Merge remote branch 'jamey/for-keith'

This commit is contained in:
Keith Packard 2010-09-23 15:30:37 -07:00
commit 98197d931b
8 changed files with 85 additions and 115 deletions

View File

@ -237,28 +237,35 @@ dixRegisterPrivateKey(DevPrivateKey key, DevPrivateType type, unsigned size)
return TRUE; return TRUE;
} }
/* Bool
* Allocate a new private key. dixRegisterScreenPrivateKey(DevScreenPrivateKey screenKey, ScreenPtr pScreen, DevPrivateType type, unsigned size)
*
* This manages the storage of the key object itself, freeing it when the
* privates system is restarted at server reset time. All other keys
* are expected to be statically allocated as the privates must be
* reset after all objects have been freed
*/
DevPrivateKey
dixCreatePrivateKey(DevPrivateType type, unsigned size)
{ {
DevPrivateKey key; DevPrivateKey key;
if (!dixRegisterPrivateKey(&screenKey->screenKey, PRIVATE_SCREEN, 0))
return FALSE;
key = dixGetPrivate(&pScreen->devPrivates, &screenKey->screenKey);
if (key != NULL) {
assert(key->size == size);
assert(key->type == type);
return TRUE;
}
key = calloc(sizeof (DevPrivateKeyRec), 1); key = calloc(sizeof (DevPrivateKeyRec), 1);
if (!key) if (!key)
return NULL; return FALSE;
if (!dixRegisterPrivateKey(key, type, size)) { if (!dixRegisterPrivateKey(key, type, size)) {
free(key); free(key);
return NULL; return FALSE;
} }
key->allocated = TRUE; key->allocated = TRUE;
return key; dixSetPrivate(&pScreen->devPrivates, &screenKey->screenKey, key);
return TRUE;
}
DevPrivateKey
_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen)
{
return dixGetPrivate(&pScreen->devPrivates, &key->screenKey);
} }
/* /*

View File

@ -4854,16 +4854,16 @@ If the function is called more than once on the same key, all calls must use
the same value for <type>size</type> or the server will abort.</para> the same value for <type>size</type> or the server will abort.</para>
<para> <para>
To request private space and have the server manage the key, use To request per-screen private space in an object, use
<blockquote><programlisting> <blockquote><programlisting>
DevPrivateKey dixCreatePrivateKey(DevPrivateType type, unsigned size); Bool dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen, DevPrivateType type, unsigned size);
</programlisting></blockquote> </programlisting></blockquote>
The <parameter>type</parameter> and <parameter>size</parameter> arguments are The <parameter>type</parameter> and <parameter>size</parameter> arguments are
the same as those to <function>dixRegisterPrivateKey</function> but this the same as those to <function>dixRegisterPrivateKey</function> but this
function allocates a <type>DevPrivateKeyRec</type> and returns a pointer to it function ensures the given <parameter>key</parameter> exists on objects of
instead of requiring the caller to pass a pointer to an existing structure. the specified type with distinct storage for the given
The server will free it automatically when the privates system is restarted <parameter>pScreen</parameter>. The key is usable on ScreenPrivate variants
at server reset time.</para> that are otherwise equivalent to the following Private functions.</para>
<para> <para>
To attach a piece of private data to an object, use: To attach a piece of private data to an object, use:

View File

@ -227,11 +227,7 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
CursorPtr cursor = xf86_config->cursor; CursorPtr cursor = xf86_config->cursor;
int c; int c;
CARD8 *bits = cursor ? CARD8 *bits = cursor ?
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen)) dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen))
#else
cursor->devPriv[screen->myNum]
#endif
: NULL; : NULL;
/* Save ARGB versions of these colors */ /* Save ARGB versions of these colors */
@ -630,11 +626,7 @@ xf86_reload_cursors (ScreenPtr screen)
if (cursor) if (cursor)
{ {
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
void *src = dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen)); void *src = dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen));
#else
void *src = cursor->devPriv[screen->myNum];
#endif
#ifdef ARGB_CURSOR #ifdef ARGB_CURSOR
if (cursor->bits->argb && cursor_info->LoadCursorARGB) if (cursor->bits->argb && cursor_info->LoadCursorARGB)
(*cursor_info->LoadCursorARGB) (scrn, cursor); (*cursor_info->LoadCursorARGB) (scrn, cursor);

View File

@ -636,7 +636,6 @@ DDCModeFromDetailedTiming(int scrnIndex, struct detailed_timings *timing,
return Mode; return Mode;
} }
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
static DisplayModePtr static DisplayModePtr
DDCModesFromCVT(int scrnIndex, struct cvt_timings *t) DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
{ {
@ -665,7 +664,6 @@ DDCModesFromCVT(int scrnIndex, struct cvt_timings *t)
return modes; return modes;
} }
#endif
static const struct { static const struct {
short w; short w;
@ -1021,12 +1019,10 @@ static void handle_detailed_modes(struct detailed_monitor_section *det_mon,
p->quirks, p->timing_level,p->rb); p->quirks, p->timing_level,p->rb);
p->Modes = xf86ModesAdd(p->Modes, Mode); p->Modes = xf86ModesAdd(p->Modes, Mode);
break; break;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
case DS_CVT: case DS_CVT:
Mode = DDCModesFromCVT(p->DDC->scrnIndex, det_mon->section.cvt); Mode = DDCModesFromCVT(p->DDC->scrnIndex, det_mon->section.cvt);
p->Modes = xf86ModesAdd(p->Modes, Mode); p->Modes = xf86ModesAdd(p->Modes, Mode);
break; break;
#endif
case DS_EST_III: case DS_EST_III:
Mode = DDCModesFromEstIII(det_mon->section.est_iii); Mode = DDCModesFromEstIII(det_mon->section.est_iii);
p->Modes = xf86ModesAdd(p->Modes, Mode); p->Modes = xf86ModesAdd(p->Modes, Mode);

View File

@ -38,14 +38,6 @@
extern XF86ConfigPtr xf86configptr; extern XF86ConfigPtr xf86configptr;
/*
* This is the version number where we epoched. These files get copied
* into drivers that want to use this setup infrastructure on pre-1.3
* servers, so when that happens they need to define these symbols
* themselves. However, _in_ the server, we basically always define them now.
*/
#if XORG_VERSION_CURRENT <= XORG_VERSION_NUMERIC(7,2,99,2,0)
/** /**
* Calculates the horizontal sync rate of a mode. * Calculates the horizontal sync rate of a mode.
*/ */
@ -326,7 +318,6 @@ xf86PrintModeline(int scrnIndex,DisplayModePtr mode)
mode->VTotal, flags, xf86ModeHSync(mode)); mode->VTotal, flags, xf86ModeHSync(mode));
free(flags); free(flags);
} }
#endif /* XORG_VERSION_CURRENT <= 7.2.99.2 */
/** /**
* Marks as bad any modes with unsupported flags. * Marks as bad any modes with unsupported flags.
@ -503,12 +494,7 @@ xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
for (mode = modeList; mode != NULL; mode = mode->next) { for (mode = modeList; mode != NULL; mode = mode->next) {
if (xf86ModeBandwidth(mode, depth) > bandwidth) if (xf86ModeBandwidth(mode, depth) > bandwidth)
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
mode->status = MODE_BANDWIDTH; mode->status = MODE_BANDWIDTH;
#else
/* MODE_BANDWIDTH didn't exist in xserver 1.2 */
mode->status = MODE_BAD;
#endif
} }
} }

View File

@ -69,21 +69,12 @@ static Bool xf86RandR12CreateScreenResources12 (ScreenPtr pScreen);
#endif #endif
static int xf86RandR12Generation; static int xf86RandR12Generation;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
static DevPrivateKeyRec xf86RandR12KeyRec; static DevPrivateKeyRec xf86RandR12KeyRec;
static DevPrivateKey xf86RandR12Key; static DevPrivateKey xf86RandR12Key;
#define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \ #define XF86RANDRINFO(p) ((XF86RandRInfoPtr) \
dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key)) dixLookupPrivate(&(p)->devPrivates, xf86RandR12Key))
#else /* XORG_VERSION_CURRENT < 7.0 */
static int xf86RandR12Index;
#define XF86RANDRINFO(p) \
((XF86RandRInfoPtr)(p)->devPrivates[xf86RandR12Index].ptr)
#endif /* XORG_VERSION_CURRENT < 7.0 */
static int static int
xf86RandR12ModeRefresh (DisplayModePtr mode) xf86RandR12ModeRefresh (DisplayModePtr mode)
@ -690,17 +681,13 @@ xf86RandR12ScreenSetSize (ScreenPtr pScreen,
Bool ret = FALSE; Bool ret = FALSE;
int c; int c;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key) { if (xf86RandR12Key) {
#endif
if (randrp->virtualX == -1 || randrp->virtualY == -1) if (randrp->virtualX == -1 || randrp->virtualY == -1)
{ {
randrp->virtualX = pScrn->virtualX; randrp->virtualX = pScrn->virtualX;
randrp->virtualY = pScrn->virtualY; randrp->virtualY = pScrn->virtualY;
} }
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
} }
#endif
if (pRoot && pScrn->vtSema) if (pRoot && pScrn->vtSema)
(*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE); (*pScrn->EnableDisableFBAccess) (pScreen->myNum, FALSE);
@ -843,10 +830,8 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
mmHeight); mmHeight);
} }
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return TRUE; return TRUE;
#endif
if (randrp->virtualX == -1 || randrp->virtualY == -1) if (randrp->virtualX == -1 || randrp->virtualY == -1)
{ {
@ -882,13 +867,9 @@ xf86RandR12Init (ScreenPtr pScreen)
if (xf86RandR12Generation != serverGeneration) if (xf86RandR12Generation != serverGeneration)
xf86RandR12Generation = serverGeneration; xf86RandR12Generation = serverGeneration;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
xf86RandR12Key = &xf86RandR12KeyRec; xf86RandR12Key = &xf86RandR12KeyRec;
if (!dixRegisterPrivateKey(&xf86RandR12KeyRec, PRIVATE_SCREEN, 0)) if (!dixRegisterPrivateKey(&xf86RandR12KeyRec, PRIVATE_SCREEN, 0))
return FALSE; return FALSE;
#else
xf86RandR12Index = AllocateScreenPrivateIndex();
#endif
randrp = malloc(sizeof (XF86RandRInfoRec)); randrp = malloc(sizeof (XF86RandRInfoRec));
if (!randrp) if (!randrp)
@ -914,11 +895,7 @@ xf86RandR12Init (ScreenPtr pScreen)
randrp->maxX = randrp->maxY = 0; randrp->maxX = randrp->maxY = 0;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp); dixSetPrivate(&pScreen->devPrivates, xf86RandR12Key, randrp);
#else
pScreen->devPrivates[xf86RandR12Index].ptr = randrp;
#endif
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
if (!xf86RandR12Init12 (pScreen)) if (!xf86RandR12Init12 (pScreen))
@ -932,10 +909,8 @@ xf86RandR12CloseScreen (ScreenPtr pScreen)
{ {
XF86RandRInfoPtr randrp; XF86RandRInfoPtr randrp;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return; return;
#endif
randrp = XF86RANDRINFO(pScreen); randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
@ -955,10 +930,8 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif #endif
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return; return;
#endif
randrp = XF86RANDRINFO(pScreen); randrp = XF86RANDRINFO(pScreen);
#if RANDR_12_INTERFACE #if RANDR_12_INTERFACE
@ -981,10 +954,8 @@ xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#endif #endif
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return; return;
#endif
randrp = XF86RANDRINFO(pScreen); randrp = XF86RANDRINFO(pScreen);
#if RANDR_13_INTERFACE #if RANDR_13_INTERFACE
@ -1599,10 +1570,8 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen)
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return TRUE; return TRUE;
#endif
for (c = 0; c < config->num_crtc; c++) for (c = 0; c < config->num_crtc; c++)
xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc); xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc);
@ -1624,13 +1593,8 @@ xf86RandR12TellChanged (ScreenPtr pScreen)
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
int c; int c;
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
if (xf86RandR12Key == NULL) if (xf86RandR12Key == NULL)
return; return;
#else
if (!XF86RANDRINFO(pScreen))
return;
#endif
xf86RandR12SetInfo12 (pScreen); xf86RandR12SetInfo12 (pScreen);
for (c = 0; c < config->num_crtc; c++) for (c = 0; c < config->num_crtc; c++)

View File

@ -65,6 +65,10 @@ typedef struct _DevPrivateKeyRec {
struct _DevPrivateKeyRec *next; struct _DevPrivateKeyRec *next;
} DevPrivateKeyRec, *DevPrivateKey; } DevPrivateKeyRec, *DevPrivateKey;
typedef struct _DevScreenPrivateKeyRec {
DevPrivateKeyRec screenKey;
} DevScreenPrivateKeyRec, *DevScreenPrivateKey;
/* /*
* Let drivers know how to initialize private keys * Let drivers know how to initialize private keys
*/ */
@ -99,17 +103,6 @@ dixPrivateKeyRegistered(DevPrivateKey key)
return key->initialized; return key->initialized;
} }
/*
* Allocate a new private key.
*
* This manages the storage of the key object itself, freeing it when the
* privates system is restarted at server reset time. All other keys
* are expected to be statically allocated as the privates must be
* reset after all objects have been freed
*/
extern _X_EXPORT DevPrivateKey
dixCreatePrivateKey(DevPrivateType type, unsigned size);
/* /*
* Get the address of the private storage. * Get the address of the private storage.
* *
@ -180,6 +173,42 @@ dixLookupPrivateAddr(PrivatePtr *privates, const DevPrivateKey key)
return (pointer *)dixGetPrivateAddr(privates, key); return (pointer *)dixGetPrivateAddr(privates, key);
} }
extern _X_EXPORT Bool
dixRegisterScreenPrivateKey(DevScreenPrivateKey key, ScreenPtr pScreen, DevPrivateType type, unsigned size);
extern _X_EXPORT DevPrivateKey
_dixGetScreenPrivateKey(const DevScreenPrivateKey key, ScreenPtr pScreen);
static inline void *
dixGetScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
{
return dixGetPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline void *
dixGetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
{
return dixGetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline void
dixSetScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen, pointer val)
{
return dixSetPrivate(privates, _dixGetScreenPrivateKey(key, pScreen), val);
}
static inline pointer
dixLookupScreenPrivate(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
{
return dixLookupPrivate(privates, _dixGetScreenPrivateKey(key, pScreen));
}
static inline pointer *
dixLookupScreenPrivateAddr(PrivatePtr *privates, const DevScreenPrivateKey key, ScreenPtr pScreen)
{
return dixLookupPrivateAddr(privates, _dixGetScreenPrivateKey(key, pScreen));
}
/* /*
* Allocates private data separately from main object. * Allocates private data separately from main object.
* *

View File

@ -56,6 +56,10 @@ in this Software without prior written authorization from The Open Group.
/* per-screen private data */ /* per-screen private data */
static DevPrivateKeyRec miDCScreenKeyRec; static DevPrivateKeyRec miDCScreenKeyRec;
#define miDCScreenKey (&miDCScreenKeyRec) #define miDCScreenKey (&miDCScreenKeyRec)
static DevScreenPrivateKeyRec miDCCursorBitsKeyRec;
#define miDCCursorBitsKey (&miDCCursorBitsKeyRec)
static DevScreenPrivateKeyRec miDCDeviceKeyRec;
#define miDCDeviceKey (&miDCDeviceKeyRec)
static Bool miDCCloseScreen(int index, ScreenPtr pScreen); static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
@ -71,8 +75,8 @@ typedef struct {
#define miGetDCDevice(dev, screen) \ #define miGetDCDevice(dev, screen) \
((DevHasCursor(dev)) ? \ ((DevHasCursor(dev)) ? \
(miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCDeviceKey(screen)) : \ (miDCBufferPtr)dixLookupScreenPrivate(&dev->devPrivates, miDCDeviceKey, screen) : \
(miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCDeviceKey(screen))) (miDCBufferPtr)dixLookupScreenPrivate(&dev->u.master->devPrivates, miDCDeviceKey, screen))
/* /*
* The core pointer buffer will point to the index of the virtual core pointer * The core pointer buffer will point to the index of the virtual core pointer
@ -80,13 +84,9 @@ typedef struct {
*/ */
typedef struct { typedef struct {
CloseScreenProcPtr CloseScreen; CloseScreenProcPtr CloseScreen;
DevPrivateKey device_key;
DevPrivateKey cursor_bits_key;
} miDCScreenRec, *miDCScreenPtr; } miDCScreenRec, *miDCScreenPtr;
#define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey))) #define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey)))
#define miDCDeviceKey(s) (miGetDCScreen(s)->device_key)
#define miDCCursorBitsKey(s) (miGetDCScreen(s)->cursor_bits_key)
/* per-cursor per-screen private data */ /* per-cursor per-screen private data */
typedef struct { typedef struct {
@ -102,19 +102,15 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
{ {
miDCScreenPtr pScreenPriv; miDCScreenPtr pScreenPriv;
if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0)) if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0) ||
!dixRegisterScreenPrivateKey(&miDCCursorBitsKeyRec, pScreen, PRIVATE_CURSOR_BITS, 0) ||
!dixRegisterScreenPrivateKey(&miDCDeviceKeyRec, pScreen, PRIVATE_DEVICE, 0))
return FALSE; return FALSE;
pScreenPriv = malloc(sizeof (miDCScreenRec)); pScreenPriv = malloc(sizeof (miDCScreenRec));
if (!pScreenPriv) if (!pScreenPriv)
return FALSE; return FALSE;
pScreenPriv->cursor_bits_key = dixCreatePrivateKey(PRIVATE_CURSOR_BITS, 0);
pScreenPriv->device_key = dixCreatePrivateKey(PRIVATE_DEVICE, 0);
if (!pScreenPriv->cursor_bits_key || !pScreenPriv->device_key) {
free(pScreenPriv);
return FALSE;
}
pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miDCCloseScreen; pScreen->CloseScreen = miDCCloseScreen;
@ -144,7 +140,7 @@ Bool
miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
{ {
if (pCursor->bits->refcnt <= 1) if (pCursor->bits->refcnt <= 1)
dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), NULL); dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, NULL);
return TRUE; return TRUE;
} }
@ -243,7 +239,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
free((pointer) pPriv); free((pointer) pPriv);
return NULL; return NULL;
} }
dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), pPriv); dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, pPriv);
return pPriv; return pPriv;
} }
pPriv->pPicture = 0; pPriv->pPicture = 0;
@ -261,7 +257,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
free((pointer) pPriv); free((pointer) pPriv);
return NULL; return NULL;
} }
dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), pPriv); dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, pPriv);
/* create the two sets of bits, clipping as appropriate */ /* create the two sets of bits, clipping as appropriate */
@ -305,8 +301,8 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
{ {
miDCCursorPtr pPriv; miDCCursorPtr pPriv;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates, pPriv = (miDCCursorPtr)dixLookupScreenPrivate(&pCursor->bits->devPrivates,
miDCCursorBitsKey(pScreen)); miDCCursorBitsKey, pScreen);
if (pPriv && (pCursor->bits->refcnt <= 1)) if (pPriv && (pCursor->bits->refcnt <= 1))
{ {
if (pPriv->sourceBits) if (pPriv->sourceBits)
@ -318,7 +314,7 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
FreePicture (pPriv->pPicture, 0); FreePicture (pPriv->pPicture, 0);
#endif #endif
free((pointer) pPriv); free((pointer) pPriv);
dixSetPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey(pScreen), NULL); dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, NULL);
} }
return TRUE; return TRUE;
} }
@ -406,8 +402,8 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
miDCBufferPtr pBuffer; miDCBufferPtr pBuffer;
WindowPtr pWin; WindowPtr pWin;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates, pPriv = (miDCCursorPtr)dixLookupScreenPrivate(&pCursor->bits->devPrivates,
miDCCursorBitsKey(pScreen)); miDCCursorBitsKey, pScreen);
if (!pPriv) if (!pPriv)
{ {
pPriv = miDCRealize(pScreen, pCursor); pPriv = miDCRealize(pScreen, pCursor);
@ -523,7 +519,7 @@ miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
if (!pBuffer) if (!pBuffer)
goto failure; goto failure;
dixSetPrivate(&pDev->devPrivates, miDCDeviceKey(pScreen), pBuffer); dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, pBuffer);
pWin = pScreen->root; pWin = pScreen->root;
pBuffer->pSourceGC = miDCMakeGC(pWin); pBuffer->pSourceGC = miDCMakeGC(pWin);
@ -589,7 +585,7 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave); if (pBuffer->pSave) (*pScreen->DestroyPixmap)(pBuffer->pSave);
free(pBuffer); free(pBuffer);
dixSetPrivate(&pDev->devPrivates, miDCDeviceKey(pScreen), NULL); dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, pScreen, NULL);
} }
} }
} }