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

2010-05-21 Thread Oliver McFadden
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.mcfad...@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 RESTYPECursorClientType;
   static RESTYPE CursorHideCountType;
   static RESTYPE CursorWindowType;
   static CursorPtr   CursorCurrent[MAXDEVICES];
  -static CursorPtrpInvisibleCursor = NULL;
   
   static int CursorScreenPrivateKeyIndex;
   static DevPrivateKey CursorScreenPrivateKey = CursorScreenPrivateKeyIndex;
  @@ -135,7 +134,7 @@ CursorDisplayCursor (DeviceIntPtr pDev,
   CursorPtr pCursor)
   {
   CursorScreenPtrcs = 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@lists.x.org: X.Org development
 Archives: http://lists.x.org/archives/xorg-devel
 Info: http://lists.x.org/mailman/listinfo/xorg-devel


___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


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

2010-05-21 Thread Jamey Sharp
On Thu, May 20, 2010 at 11:44 PM, Oliver McFadden
oliver.mcfad...@nokia.com wrote:
 -    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));
     }

I don't understand the intent here. I think you still want to call
DisplayCursor with NullCursor, just not RealizeCursor; and I guess
this patch introduces an extra call to RealizeCursor for the
visible-cursor case.

I thought you'd want this patch hunk instead:

diff --git a/xfixes/cursor.c b/xfixes/cursor.c
index 52bdb27..1f5f841 100644
--- a/xfixes/cursor.c
+++ b/xfixes/cursor.c
@@ -148,8 +148,7 @@ CursorDisplayCursor (DeviceIntPtr pDev,
CursorVisible = EnableCursor;

 if (cs-pCursorHideCounts != NULL || !CursorVisible) {
-ret = ((*pScreen-RealizeCursor)(pDev, pScreen, pInvisibleCursor) 
-  (*pScreen-DisplayCursor) (pDev, pScreen, pInvisibleCursor));
+ret = (*pScreen-DisplayCursor) (pDev, pScreen, NullCursor);
 } else {
ret = (*pScreen-DisplayCursor) (pDev, pScreen, pCursor);
 }

I haven't compiled that though, let alone tested it.

Jamey
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel