[PATCH 6/9] Eliminate MAXSCREENS-sized CursorScreenKey array.

Peter Hutterer peter.hutterer at who-t.net
Mon Sep 19 22:30:31 PDT 2011


On Sat, Sep 17, 2011 at 03:22:32AM -0500, Jamey Sharp wrote:
> Use new per-screen privates API instead.
> 
> Commit by Jamey Sharp and Josh Triplett.
> 
> Signed-off-by: Jamey Sharp <jamey at minilop.net>
> Signed-off-by: Josh Triplett <josh at joshtriplett.org>
> ---
>  dix/cursor.c                   |    2 +-
>  dix/dispatch.c                 |    2 +-
>  hw/dmx/dmxcursor.h             |    4 ++--
>  hw/xfree86/modes/xf86Cursors.c |    4 ++--
>  hw/xfree86/ramdac/xf86Cursor.c |    6 +++---
>  hw/xfree86/ramdac/xf86HWCurs.c |    4 ++--
>  hw/xnest/XNCursor.h            |    4 ++--
>  include/cursor.h               |    4 ++--
>  8 files changed, 15 insertions(+), 15 deletions(-)
> 
> diff --git a/dix/cursor.c b/dix/cursor.c
> index c191c1e..f29cb11 100644
> --- a/dix/cursor.c
> +++ b/dix/cursor.c
> @@ -72,7 +72,7 @@ typedef struct _GlyphShare {
>  
>  static GlyphSharePtr sharedGlyphs = (GlyphSharePtr)NULL;
>  
> -DevPrivateKeyRec cursorScreenDevPriv[MAXSCREENS];
> +DevScreenPrivateKeyRec cursorScreenDevPriv;
>  
>  #ifdef XFIXES
>  static CARD32	cursorSerial;
> diff --git a/dix/dispatch.c b/dix/dispatch.c
> index f8200b1..34213cf 100644
> --- a/dix/dispatch.c
> +++ b/dix/dispatch.c
> @@ -3910,7 +3910,7 @@ AddScreen(
>  	return -1;
>      }
>  
> -    dixRegisterPrivateKey(&cursorScreenDevPriv[i], PRIVATE_CURSOR, 0);
> +    dixRegisterScreenPrivateKey(&cursorScreenDevPriv, pScreen, PRIVATE_CURSOR, 0);
>  
>      return i;
>  }
> diff --git a/hw/dmx/dmxcursor.h b/hw/dmx/dmxcursor.h
> index 5242268..fc2e118 100644
> --- a/hw/dmx/dmxcursor.h
> +++ b/hw/dmx/dmxcursor.h
> @@ -64,9 +64,9 @@ extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor);
>  extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor);
>  
>  #define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) ((dmxCursorPrivPtr) \
> -    dixLookupPrivate(&(_pCursor)->devPrivates, CursorScreenKey(_pScreen)))
> +    dixLookupScreenPrivate(&(_pCursor)->devPrivates, CursorScreenKey, _pScreen))
>  
>  #define DMX_SET_CURSOR_PRIV(_pCursor, _pScreen, v) \
> -    dixSetPrivate(&(_pCursor)->devPrivates, CursorScreenKey(_pScreen), v)
> +    dixSetScreenPrivate(&(_pCursor)->devPrivates, CursorScreenKey, _pScreen, v)
>  
>  #endif /* DMXCURSOR_H */
> diff --git a/hw/xfree86/modes/xf86Cursors.c b/hw/xfree86/modes/xf86Cursors.c
> index 0667447..23c48eb 100644
> --- a/hw/xfree86/modes/xf86Cursors.c
> +++ b/hw/xfree86/modes/xf86Cursors.c
> @@ -252,7 +252,7 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
>      CursorPtr		cursor = xf86_config->cursor;
>      int			c;
>      CARD8		*bits = cursor ?
> -        dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen))
> +        dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey, screen)
>        : NULL;
>  
>      /* Save ARGB versions of these colors */
> @@ -650,7 +650,7 @@ xf86_reload_cursors (ScreenPtr screen)
>  
>      if (cursor)
>      {
> -	void *src = dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen));
> +	void *src = dixLookupScreenPrivate(&cursor->devPrivates, CursorScreenKey, screen);
>  #ifdef ARGB_CURSOR
>  	if (cursor->bits->argb && cursor_info->LoadCursorARGB)
>  	    (*cursor_info->LoadCursorARGB) (scrn, cursor);
> diff --git a/hw/xfree86/ramdac/xf86Cursor.c b/hw/xfree86/ramdac/xf86Cursor.c
> index 24c91cc..1e0f7e0 100644
> --- a/hw/xfree86/ramdac/xf86Cursor.c
> +++ b/hw/xfree86/ramdac/xf86Cursor.c
> @@ -273,7 +273,7 @@ xf86CursorRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs)
>  	&pScreen->devPrivates, xf86CursorScreenKey);
>  
>      if (pCurs->refcnt <= 1)
> -	dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), NULL);
> +	dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, NULL);
>  
>      return (*ScreenPriv->spriteFuncs->RealizeCursor)(pDev, pScreen, pCurs);
>  }
> @@ -286,8 +286,8 @@ xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
>  	&pScreen->devPrivates, xf86CursorScreenKey);
>  
>      if (pCurs->refcnt <= 1) {
> -	free(dixLookupPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen)));
> -	dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), NULL);
> +	free(dixLookupScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen));
> +	dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, NULL);
>      }
>  
>      return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pDev, pScreen, pCurs);
> diff --git a/hw/xfree86/ramdac/xf86HWCurs.c b/hw/xfree86/ramdac/xf86HWCurs.c
> index dd2b78f..f9b09fc 100644
> --- a/hw/xfree86/ramdac/xf86HWCurs.c
> +++ b/hw/xfree86/ramdac/xf86HWCurs.c
> @@ -123,7 +123,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
>  	return;
>      }
>  
> -    bits = dixLookupPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen));
> +    bits = dixLookupScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen);
>  
>      x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
>      y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
> @@ -133,7 +133,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
>  #endif
>      if (!bits) {
>  	bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs);
> -	dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), bits);
> +	dixSetScreenPrivate(&pCurs->devPrivates, CursorScreenKey, pScreen, bits);
>      }
>  
>      if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
> diff --git a/hw/xnest/XNCursor.h b/hw/xnest/XNCursor.h
> index d3b18bd..473b201 100644
> --- a/hw/xnest/XNCursor.h
> +++ b/hw/xnest/XNCursor.h
> @@ -30,10 +30,10 @@ typedef struct {
>  } xnestPrivCursor;
>  
>  #define xnestGetCursorPriv(pCursor, pScreen) ((xnestPrivCursor *) \
> -    dixLookupPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen)))
> +    dixLookupScreenPrivate(&(pCursor)->devPrivates, CursorScreenKey, pScreen))
>  
>  #define xnestSetCursorPriv(pCursor, pScreen, v) \
> -    dixSetPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen), v)
> +    dixSetScreenPrivate(&(pCursor)->devPrivates, CursorScreenKey, pScreen, v)
>  
>  #define xnestCursor(pCursor, pScreen) \
>    (xnestGetCursorPriv(pCursor, pScreen)->cursor)
> diff --git a/include/cursor.h b/include/cursor.h
> index 59978d4..394383a 100644
> --- a/include/cursor.h
> +++ b/include/cursor.h
> @@ -63,8 +63,8 @@ struct _DeviceIntRec;
>  typedef struct _Cursor *CursorPtr;
>  typedef struct _CursorMetric *CursorMetricPtr;
>  
> -extern _X_EXPORT DevPrivateKeyRec cursorScreenDevPriv[MAXSCREENS];
> -#define CursorScreenKey(pScreen) (cursorScreenDevPriv + (pScreen)->myNum)
> +extern _X_EXPORT DevScreenPrivateKeyRec cursorScreenDevPriv;
> +#define CursorScreenKey (&cursorScreenDevPriv)

i'd remove the space before '(' but otherwise
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

Cheers,
  Peter


More information about the xorg-devel mailing list