[PATCH] mi: removed the invisible cursor and never realize this cursor.

Oliver McFadden oliver.mcfadden at nokia.com
Fri May 21 03:45:56 PDT 2010


Uggh, it appears this patch is ineffective compared to the previous
version. Turning on sprite debugging shows the Save/Restore functions
are still called.

[   162.260] SetCursor restore 2                                                
[   162.264] SaveUnderCursor 2                                                  
[   162.265] RestoreCursor 2                                                    
[   162.297] SetCursor restore 2                                                
[   162.304] SaveUnderCursor 2                                                  
[   162.304] RestoreCursor 2                                                    

I will check into it again.

On Fri, 2010-05-21 at 10:19 +0200, Mcfadden Oliver (Nokia-D/Helsinki)
wrote:
> On Fri, 2010-05-21 at 08:44 +0200, Mcfadden Oliver (Nokia-D/Helsinki)
> wrote:
> > Previously we used an "invisible" cursor, however, this would still
> > cause damage events and thus unnecessary redrawing. Now we never realize
> > the cursor when it hasn't been defined (via XDefineCursor) or has been
> > hidden (via XFixesHideCursor.)
> > 
> > Improves performance when using software cursor sprites, primarily on
> > devices where you do not want a visible cursor (touchscreen tablets,
> > embedded devices, etc.)
> > 
> > Signed-off-by: Oliver McFadden <oliver.mcfadden at nokia.com>
> > ---
> > v2 of [PATCH] mi: removed the invisible cursor sprite; use NullCursor instead.
> > 
> >  xfixes/cursor.c |   46 ++++------------------------------------------
> >  1 files changed, 4 insertions(+), 42 deletions(-)
> > 
> > diff --git a/xfixes/cursor.c b/xfixes/cursor.c
> > index 52bdb27..a52f3a0 100644
> > --- a/xfixes/cursor.c
> > +++ b/xfixes/cursor.c
> > @@ -58,7 +58,6 @@ static RESTYPE		CursorClientType;
> >  static RESTYPE		CursorHideCountType;
> >  static RESTYPE		CursorWindowType;
> >  static CursorPtr	CursorCurrent[MAXDEVICES];
> > -static CursorPtr        pInvisibleCursor = NULL;
> >  
> >  static int CursorScreenPrivateKeyIndex;
> >  static DevPrivateKey CursorScreenPrivateKey = &CursorScreenPrivateKeyIndex;
> > @@ -135,7 +134,7 @@ CursorDisplayCursor (DeviceIntPtr pDev,
> >  		     CursorPtr pCursor)
> >  {
> >      CursorScreenPtr	cs = GetCursorScreen(pScreen);
> > -    Bool		ret;
> > +    Bool		ret = TRUE;
> >      DisplayCursorProcPtr backupProc;
> >  
> >      Unwrap (cs, pScreen, DisplayCursor, backupProc);
> > @@ -147,11 +146,9 @@ CursorDisplayCursor (DeviceIntPtr pDev,
> >      if (ConnectionInfo)
> >  	CursorVisible = EnableCursor;
> >  
> > -    if (cs->pCursorHideCounts != NULL || !CursorVisible) {
> > -        ret = ((*pScreen->RealizeCursor)(pDev, pScreen, pInvisibleCursor) &&
> > -	       (*pScreen->DisplayCursor) (pDev, pScreen, pInvisibleCursor));
> > -    } else {
> > -	ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
> > +    if (!cs->pCursorHideCounts && CursorVisible) {
> > +        ret = ((*pScreen->RealizeCursor)(pDev, pScreen, pCursor) &&
> > +	       (*pScreen->DisplayCursor) (pDev, pScreen, pCursor));
> >      }
> >  
> >      if (pCursor != CursorCurrent[pDev->id])
> > @@ -1031,37 +1028,6 @@ CursorFreeWindow (pointer data, XID id)
> >      return 1;
> >  }
> >  
> > -static CursorPtr
> > -createInvisibleCursor (void)
> > -{
> > -    CursorPtr pCursor;
> > -    unsigned char *psrcbits, *pmaskbits;
> > -    CursorMetricRec cm;
> > -
> > -    psrcbits = (unsigned char *) calloc(4, 1);
> > -    pmaskbits = (unsigned char *) calloc(4, 1);
> > -    if (psrcbits == NULL || pmaskbits == NULL) {
> > -	return NULL;
> > -    }
> > -
> > -    cm.width = 1;
> > -    cm.height = 1;
> > -    cm.xhot = 0;
> > -    cm.yhot = 0;
> > -
> > -    if (AllocARGBCursor(psrcbits, pmaskbits,
> > -			NULL, &cm,
> > -			0, 0, 0,
> > -			0, 0, 0,
> > -			&pCursor, serverClient, (XID)0) != Success)
> > -	return NullCursor;
> > -
> > -    if (!AddResource(FakeClientID(0), RT_CURSOR, (pointer) pCursor))
> > -	return NullCursor;
> > -
> > -    return pCursor;
> > -}
> > -
> >  Bool
> >  XFixesCursorInit (void)
> >  {
> > @@ -1090,10 +1056,6 @@ XFixesCursorInit (void)
> >      CursorWindowType = CreateNewResourceType(CursorFreeWindow,
> >  					     "XFixesCursorWindow");
> >  
> > -    pInvisibleCursor = createInvisibleCursor();
> > -    if (pInvisibleCursor == NULL)
> > -	return BadAlloc;
> > -
> >      return CursorClientType && CursorHideCountType && CursorWindowType;
> >  }
> >  
> 
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel




More information about the xorg-devel mailing list