Commit 4017d319 authored by Eamon Walsh's avatar Eamon Walsh Committed by Eamon Walsh

devPrivates rework: since API is already broken, switch everything

over to new system.

Need to update documentation and address some remaining vestiges of
old system such as CursorRec structure, fb "offman" structure, and
FontRec privates.
parent 85547073
......@@ -48,5 +48,5 @@ int DPMSGet(int *plevel)
int DPMSSet(ClientPtr client, int level)
{
return Success;
}
......@@ -110,8 +110,8 @@ static void PanoramiXResetProc(ExtensionEntry*);
int (* SavedProcVector[256]) (ClientPtr client) = { NULL, };
static int PanoramiXGCIndex = -1;
static int PanoramiXScreenIndex = -1;
static DevPrivateKey PanoramiXGCKey = &PanoramiXGCKey;
static DevPrivateKey PanoramiXScreenKey = &PanoramiXScreenKey;
typedef struct {
DDXPointRec clipOrg;
......@@ -140,8 +140,8 @@ static GCFuncs XineramaGCFuncs = {
};
#define Xinerama_GC_FUNC_PROLOGUE(pGC)\
PanoramiXGCPtr pGCPriv = \
(PanoramiXGCPtr) (pGC)->devPrivates[PanoramiXGCIndex].ptr;\
PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr) \
dixLookupPrivate(&(pGC)->devPrivates, PanoramiXGCKey); \
(pGC)->funcs = pGCPriv->wrapFuncs;
#define Xinerama_GC_FUNC_EPILOGUE(pGC)\
......@@ -152,8 +152,8 @@ static GCFuncs XineramaGCFuncs = {
static Bool
XineramaCloseScreen (int i, ScreenPtr pScreen)
{
PanoramiXScreenPtr pScreenPriv =
(PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
pScreen->CreateGC = pScreenPriv->CreateGC;
......@@ -171,14 +171,14 @@ static Bool
XineramaCreateGC(GCPtr pGC)
{
ScreenPtr pScreen = pGC->pScreen;
PanoramiXScreenPtr pScreenPriv =
(PanoramiXScreenPtr) pScreen->devPrivates[PanoramiXScreenIndex].ptr;
PanoramiXScreenPtr pScreenPriv = (PanoramiXScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, PanoramiXScreenKey);
Bool ret;
pScreen->CreateGC = pScreenPriv->CreateGC;
if((ret = (*pScreen->CreateGC)(pGC))) {
PanoramiXGCPtr pGCPriv =
(PanoramiXGCPtr) pGC->devPrivates[PanoramiXGCIndex].ptr;
PanoramiXGCPtr pGCPriv = (PanoramiXGCPtr)
dixLookupPrivate(&pGC->devPrivates, PanoramiXGCKey);
pGCPriv->wrapFuncs = pGC->funcs;
pGC->funcs = &XineramaGCFuncs;
......@@ -284,8 +284,8 @@ XineramaCopyGC (
unsigned long mask,
GCPtr pGCDst
){
PanoramiXGCPtr pSrcPriv =
(PanoramiXGCPtr) pGCSrc->devPrivates[PanoramiXGCIndex].ptr;
PanoramiXGCPtr pSrcPriv = (PanoramiXGCPtr)
dixLookupPrivate(&pGCSrc->devPrivates, PanoramiXGCKey);
Xinerama_GC_FUNC_PROLOGUE (pGCDst);
if(mask & GCTileStipXOrigin)
......@@ -484,20 +484,17 @@ void PanoramiXExtensionInit(int argc, char *argv[])
xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
BREAK_IF(!panoramiXdataPtr);
BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0);
BREAK_IF((PanoramiXScreenIndex = AllocateScreenPrivateIndex()) < 0);
if (!dixRequestPrivate(PanoramiXGCKey, sizeof(PanoramiXGCRec))) {
noPanoramiXExtension = TRUE;
return;
}
for (i = 0; i < PanoramiXNumScreens; i++) {
pScreen = screenInfo.screens[i];
if(!AllocateGCPrivate(pScreen, PanoramiXGCIndex,
sizeof(PanoramiXGCRec))) {
noPanoramiXExtension = TRUE;
return;
}
pScreenPriv = xalloc(sizeof(PanoramiXScreenRec));
pScreen->devPrivates[PanoramiXScreenIndex].ptr =
(pointer)pScreenPriv;
dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey,
pScreenPriv);
if(!pScreenPriv) {
noPanoramiXExtension = TRUE;
return;
......
......@@ -234,10 +234,12 @@ MakeScreenPrivate (
ScreenPtr /* pScreen */
);
static int ScreenPrivateIndex;
static DevPrivateKey ScreenPrivateKey = &ScreenPrivateKey;
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr)(s)->devPrivates[ScreenPrivateIndex].ptr)
#define SetScreenPrivate(s,v) ((s)->devPrivates[ScreenPrivateIndex].ptr = (pointer) v);
#define GetScreenPrivate(s) ((ScreenSaverScreenPrivatePtr) \
dixLookupPrivate(&(s)->devPrivates, ScreenPrivateKey))
#define SetScreenPrivate(s,v) \
dixSetPrivate(&(s)->devPrivates, ScreenPrivateKey, v);
#define SetupScreen(s) ScreenSaverScreenPrivatePtr pPriv = (s ? GetScreenPrivate(s) : NULL)
#define New(t) ((t *) xalloc (sizeof (t)))
......@@ -260,14 +262,13 @@ ScreenSaverExtensionInit(INITARGS)
AttrType = CreateNewResourceType(ScreenSaverFreeAttr);
EventType = CreateNewResourceType(ScreenSaverFreeEvents);
SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend);
ScreenPrivateIndex = AllocateScreenPrivateIndex ();
for (i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
SetScreenPrivate (pScreen, NULL);
}
if (AttrType && EventType && SuspendType && ScreenPrivateIndex != -1 &&
if (AttrType && EventType && SuspendType &&
(extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
ProcScreenSaverDispatch, SProcScreenSaverDispatch,
ScreenSaverResetProc, StandardMinorOpcode)))
......
......@@ -119,7 +119,7 @@ static int pixmapFormat;
static int shmPixFormat[MAXSCREENS];
static ShmFuncsPtr shmFuncs[MAXSCREENS];
static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS];
static int shmPixmapPrivate;
static DevPrivateKey shmPixmapPrivate = &shmPixmapPrivate;
static ShmFuncs miFuncs = {NULL, miShmPutImage};
static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
......@@ -229,20 +229,11 @@ ShmExtensionInit(INITARGS)
if (!pixmapFormat)
pixmapFormat = ZPixmap;
if (sharedPixmaps)
{
for (i = 0; i < screenInfo.numScreens; i++)
{
destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap;
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
}
shmPixmapPrivate = AllocatePixmapPrivateIndex();
for (i = 0; i < screenInfo.numScreens; i++)
{
if (!AllocatePixmapPrivate(screenInfo.screens[i],
shmPixmapPrivate, 0))
return;
}
}
}
ShmSegType = CreateNewResourceType(ShmDetachSegment);
if (ShmSegType &&
......@@ -295,7 +286,8 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
if (pPixmap->refcnt == 1)
{
ShmDescPtr shmdesc;
shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr;
shmdesc = (ShmDescPtr)dixLookupPrivate(&pPixmap->devPrivates,
shmPixmapPrivate);
if (shmdesc)
ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
}
......@@ -762,7 +754,7 @@ CreatePmap:
shmdesc->addr + stuff->offset);
if (pMap) {
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = newPix->info[j].id;
......@@ -1076,7 +1068,7 @@ CreatePmap:
shmdesc->addr + stuff->offset);
if (pMap)
{
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
pMap->drawable.id = stuff->pid;
......
......@@ -76,11 +76,11 @@ DeviceIntPtr xeviemouse = NULL;
Mask xevieMask = 0;
int xevieEventSent = 0;
int xevieKBEventSent = 0;
static unsigned int xevieServerGeneration;
static int xevieDevicePrivateIndex;
static DevPrivateKey xevieDevicePrivateKey = &xevieDevicePrivateKey;
static Bool xevieModifiersOn = FALSE;
#define XEVIEINFO(dev) ((xevieDeviceInfoPtr)dev->devPrivates[xevieDevicePrivateIndex].ptr)
#define XEVIEINFO(dev) ((xevieDeviceInfoPtr) \
dixLookupPrivate(&(dev)->devPrivates, xevieDevicePrivateKey))
Mask xevieFilters[128] =
{
......@@ -134,12 +134,6 @@ XevieExtensionInit (void)
{
ExtensionEntry* extEntry;
if (serverGeneration != xevieServerGeneration) {
if ((xevieDevicePrivateIndex = AllocateDevicePrivateIndex()) == -1)
return;
xevieServerGeneration = serverGeneration;
}
if (!AddCallback(&ServerGrabCallback,XevieServerGrabStateCallback,NULL))
return;
......@@ -618,14 +612,11 @@ XevieAdd(DeviceIntPtr device, void* data)
{
xevieDeviceInfoPtr xeviep;
if (!AllocateDevicePrivate(device, xevieDevicePrivateIndex))
return FALSE;
xeviep = xalloc (sizeof (xevieDeviceInfoRec));
if (!xeviep)
return FALSE;
device->devPrivates[xevieDevicePrivateIndex].ptr = xeviep;
dixSetPrivate(&device->devPrivates, xevieDevicePrivateKey, xeviep);
XevieUnwrapAdd(device, data);
return TRUE;
......@@ -642,7 +633,7 @@ XevieRemove(DeviceIntPtr device,pointer data)
UNWRAP_UNWRAPPROC(device,xeviep->unwrapProc);
xfree(xeviep);
device->devPrivates[xevieDevicePrivateIndex].ptr = NULL;
dixSetPrivate(&device->devPrivates, xevieDevicePrivateKey, NULL);
return TRUE;
}
......
This diff is collapsed.
......@@ -388,8 +388,8 @@ ProcXvQueryAdaptors(ClientPtr client)
return rc;
pScreen = pWin->drawable.pScreen;
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
XvGetScreenKey());
if (!pxvs)
{
rep.type = X_Reply;
......@@ -2099,7 +2099,8 @@ XineramaXvPutStill(ClientPtr client)
void XineramifyXv(void)
{
ScreenPtr pScreen, screen0 = screenInfo.screens[0];
XvScreenPtr xvsp0 = (XvScreenPtr)screen0->devPrivates[XvScreenIndex].ptr;
XvScreenPtr xvsp0 = (XvScreenPtr)dixLookupPrivate(&screen0->devPrivates,
XvGetScreenKey());
XvAdaptorPtr refAdapt, pAdapt;
XvAttributePtr pAttr;
XvScreenPtr xvsp;
......@@ -2132,8 +2133,8 @@ void XineramifyXv(void)
for(j = 1; j < PanoramiXNumScreens; j++) {
pScreen = screenInfo.screens[j];
xvsp = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
xvsp = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
XvGetScreenKey());
/* Do not try to go on if xv is not supported on this screen */
if (xvsp==NULL) continue ;
......
......@@ -55,7 +55,6 @@ SOFTWARE.
#include "scrnintstr.h"
#include <X11/extensions/Xvproto.h>
extern int XvScreenIndex;
extern unsigned long XvExtensionGeneration;
extern unsigned long XvScreenGeneration;
extern unsigned long XvResourceGeneration;
......@@ -224,10 +223,8 @@ typedef struct {
DevUnion devPriv;
} XvScreenRec, *XvScreenPtr;
#define SCREEN_PROLOGUE(pScreen, field)\
((pScreen)->field = \
((XvScreenPtr) \
(pScreen)->devPrivates[XvScreenIndex].ptr)->field)
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = ((XvScreenPtr) \
dixLookupPrivate(&(pScreen)->devPrivates, XvScreenKey))->field)
#define SCREEN_EPILOGUE(pScreen, field, wrapper)\
((pScreen)->field = wrapper)
......@@ -242,7 +239,7 @@ extern int SProcXvDispatch(ClientPtr);
extern void XvExtensionInit(void);
extern int XvScreenInit(ScreenPtr);
extern int XvGetScreenIndex(void);
extern DevPrivateKey XvGetScreenKey(void);
extern unsigned long XvGetRTPort(void);
extern int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
extern int XvdiVideoStopped(XvPortPtr, int);
......
......@@ -105,7 +105,7 @@ SOFTWARE.
#include "xvdisp.h"
#endif
int XvScreenIndex = -1;
static DevPrivateKey XvScreenKey = &XvScreenKey;
unsigned long XvExtensionGeneration = 0;
unsigned long XvScreenGeneration = 0;
unsigned long XvResourceGeneration = 0;
......@@ -166,12 +166,6 @@ XvExtensionInit(void)
ErrorF("XvExtensionInit: Unable to allocate resource types\n");
return;
}
XvScreenIndex = AllocateScreenPrivateIndex ();
if (XvScreenIndex < 0)
{
ErrorF("XvExtensionInit: Unable to allocate screen private index\n");
return;
}
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif
......@@ -265,19 +259,13 @@ XvScreenInit(ScreenPtr pScreen)
ErrorF("XvScreenInit: Unable to allocate resource types\n");
return BadAlloc;
}
XvScreenIndex = AllocateScreenPrivateIndex ();
if (XvScreenIndex < 0)
{
ErrorF("XvScreenInit: Unable to allocate screen private index\n");
return BadAlloc;
}
#ifdef PANORAMIX
XineramaRegisterConnectionBlockCallback(XineramifyXv);
#endif
XvScreenGeneration = serverGeneration;
}
if (pScreen->devPrivates[XvScreenIndex].ptr)
if (dixLookupPrivate(&pScreen->devPrivates, XvScreenKey))
{
ErrorF("XvScreenInit: screen devPrivates ptr non-NULL before init\n");
}
......@@ -291,7 +279,7 @@ XvScreenInit(ScreenPtr pScreen)
return BadAlloc;
}
pScreen->devPrivates[XvScreenIndex].ptr = (pointer)pxvs;
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, pxvs);
pxvs->DestroyPixmap = pScreen->DestroyPixmap;
......@@ -313,7 +301,7 @@ XvCloseScreen(
XvScreenPtr pxvs;
pxvs = (XvScreenPtr) pScreen->devPrivates[XvScreenIndex].ptr;
pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
pScreen->DestroyPixmap = pxvs->DestroyPixmap;
pScreen->DestroyWindow = pxvs->DestroyWindow;
......@@ -323,7 +311,7 @@ XvCloseScreen(
xfree(pxvs);
pScreen->devPrivates[XvScreenIndex].ptr = (pointer)NULL;
dixSetPrivate(&pScreen->devPrivates, XvScreenKey, NULL);
return (*pScreen->CloseScreen)(ii, pScreen);
......@@ -334,10 +322,10 @@ XvResetProc(ExtensionEntry* extEntry)
{
}
_X_EXPORT int
XvGetScreenIndex(void)
_X_EXPORT DevPrivateKey
XvGetScreenKey(void)
{
return XvScreenIndex;
return XvScreenKey;
}
_X_EXPORT unsigned long
......@@ -361,7 +349,7 @@ XvDestroyPixmap(PixmapPtr pPix)
SCREEN_PROLOGUE(pScreen, DestroyPixmap);
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
/* CHECK TO SEE IF THIS PORT IS IN USE */
......@@ -413,7 +401,7 @@ XvDestroyWindow(WindowPtr pWin)
SCREEN_PROLOGUE(pScreen, DestroyWindow);
pxvs = (XvScreenPtr)pScreen->devPrivates[XvScreenIndex].ptr;
pxvs = (XvScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XvScreenKey);
/* CHECK TO SEE IF THIS PORT IS IN USE */
......
......@@ -39,7 +39,7 @@
#define DR_CLIENT_DRIVER_NAME_SIZE 48
#define DR_BUSID_SIZE 48
int XvMCScreenIndex = -1;
static DevPrivateKey XvMCScreenKey = NULL;
unsigned long XvMCGeneration = 0;
......@@ -63,7 +63,7 @@ typedef struct {
} XvMCScreenRec, *XvMCScreenPtr;
#define XVMC_GET_PRIVATE(pScreen) \
(XvMCScreenPtr)((pScreen)->devPrivates[XvMCScreenIndex].ptr)
(XvMCScreenPtr)(dixLookupPrivate(&(pScreen)->devPrivates, XvMCScreenKey))
static int
......@@ -153,7 +153,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
return _XvBadPort;
}
if(XvMCScreenIndex >= 0) { /* any adaptors at all */
if(XvMCScreenKey) { /* any adaptors at all */
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
if((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
for(i = 0; i < pScreenPriv->num_adaptors; i++) {
......@@ -211,7 +211,7 @@ ProcXvMCCreateContext(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
if(XvMCScreenIndex < 0) /* no XvMC adaptors */
if(XvMCScreenKey == NULL) /* no XvMC adaptors */
return BadMatch;
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */
......@@ -494,7 +494,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
if(XvMCScreenIndex < 0) /* No XvMC adaptors */
if(XvMCScreenKey == NULL) /* No XvMC adaptors */
return BadMatch;
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
......@@ -679,7 +679,7 @@ XvMCExtensionInit(void)
{
ExtensionEntry *extEntry;
if(XvMCScreenIndex < 0) /* nobody supports it */
if(XvMCScreenKey == NULL) /* nobody supports it */
return;
if(!(XvMCRTContext = CreateNewResourceType(XvMCDestroyContextRes)))
......@@ -720,17 +720,12 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
{
XvMCScreenPtr pScreenPriv;
if(XvMCGeneration != serverGeneration) {
if((XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0)
return BadAlloc;
XvMCGeneration = serverGeneration;
}
XvMCScreenKey = &XvMCScreenKey;
if(!(pScreenPriv = (XvMCScreenPtr)xalloc(sizeof(XvMCScreenRec))))
return BadAlloc;
pScreen->devPrivates[XvMCScreenIndex].ptr = (pointer)pScreenPriv;
dixSetPrivate(&pScreen->devPrivates, XvMCScreenKey, pScreenPriv);
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = XvMCCloseScreen;
......@@ -754,7 +749,7 @@ XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
XvMCAdaptorPtr adaptor = NULL;
int i;
if(XvMCScreenIndex < 0) return NULL;
if(XvMCScreenKey == NULL) return NULL;
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen)))
return NULL;
......
......@@ -60,7 +60,6 @@ SOFTWARE.
#include "mfb.h"
extern int afbInverseAlu[];
extern int afbScreenPrivateIndex;
/* warning: PixelType definition duplicated in maskbits.h */
#ifndef PixelType
#define PixelType CARD32
......@@ -736,14 +735,15 @@ typedef struct {
} afbPrivGC;
typedef afbPrivGC *afbPrivGCPtr;
extern int afbGCPrivateIndex; /* index into GC private array */
extern int afbWindowPrivateIndex; /* index into Window private array */
extern DevPrivateKey afbScreenPrivateKey;
extern DevPrivateKey afbGCPrivateKey;
extern DevPrivateKey afbWindowPrivateKey;
#ifdef PIXMAP_PER_WINDOW
extern int frameWindowPrivateIndex; /* index into Window private array */
extern DevPrivateKey frameWindowPrivateKey;
#endif
#define afbGetGCPrivate(pGC) \
((afbPrivGC *)((pGC)->devPrivates[afbGCPrivateIndex].ptr))
((afbPrivGC *)dixLookupPrivate(&(pGC)->devPrivates, afbGCPrivateKey))
/* private field of window */
typedef struct {
......@@ -759,7 +759,7 @@ typedef struct {
#define afbGetTypedWidth(pDrawable,wtype)( \
(((pDrawable)->type == DRAWABLE_WINDOW) ? \
(int)(((PixmapPtr)((pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr))->devKind) : \
(int)(((PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey)->devKind) : \
(int)(((PixmapPtr)pDrawable)->devKind)) / sizeof (wtype))
#define afbGetByteWidth(pDrawable) afbGetTypedWidth(pDrawable, unsigned char)
......@@ -769,7 +769,7 @@ typedef struct {
#define afbGetTypedWidthAndPointer(pDrawable, width, pointer, wtype, ptype) {\
PixmapPtr _pPix; \
if ((pDrawable)->type == DRAWABLE_WINDOW) \
_pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
_pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \
else \
_pPix = (PixmapPtr)(pDrawable); \
(pointer) = (ptype *) _pPix->devPrivate.ptr; \
......@@ -779,7 +779,7 @@ typedef struct {
#define afbGetPixelWidthSizeDepthAndPointer(pDrawable, width, size, dep, pointer) {\
PixmapPtr _pPix; \
if ((pDrawable)->type == DRAWABLE_WINDOW) \
_pPix = (PixmapPtr)(pDrawable)->pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
_pPix = (PixmapPtr)dixLookupPrivate(&(pDrawable)->pScreen->devPrivates, afbScreenPrivateKey); \
else \
_pPix = (PixmapPtr)(pDrawable); \
(pointer) = (PixelType *)_pPix->devPrivate.ptr; \
......@@ -795,7 +795,7 @@ typedef struct {
afbGetTypedWidthAndPointer(pDrawable, width, pointer, PixelType, PixelType)
#define afbGetWindowTypedWidthAndPointer(pWin, width, pointer, wtype, ptype) {\
PixmapPtr _pPix = (PixmapPtr)(pWin)->drawable.pScreen->devPrivates[afbScreenPrivateIndex].ptr; \
PixmapPtr _pPix = (PixmapPtr)dixLookupPrivate(&(pWin)->drawable.pScreen->devPrivates, afbScreenPrivateKey); \
(pointer) = (ptype *) _pPix->devPrivate.ptr; \
(width) = ((int) _pPix->devKind) / sizeof (wtype); \
}
......
......@@ -321,7 +321,8 @@ afbPolyFillArcSolid(register DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parc
RegionPtr cclip;
unsigned char *rrops;
priv = (afbPrivGC *) pGC->devPrivates[afbGCPrivateIndex].ptr;
priv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
afbGCPrivateKey);
rrops = priv->rrops;
cclip = pGC->pCompositeClip;
for (arc = parcs, i = narcs; --i >= 0; arc++) {
......
......@@ -93,7 +93,8 @@ afbPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *pre
unsigned char *rrops;
unsigned char *rropsOS;
priv = (afbPrivGC *)pGC->devPrivates[afbGCPrivateIndex].ptr;
priv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
afbGCPrivateKey);
prgnClip = pGC->pCompositeClip;
rrops = priv->rrops;
rropsOS = priv->rropOS;
......
......@@ -123,7 +123,8 @@ afbSolidFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
afbGetPixelWidthSizeDepthAndPointer(pDrawable, nlwidth, sizeDst, depthDst,
pBase);
rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
afbGCPrivateKey))->rrops;
while (n--) {
addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
......@@ -238,8 +239,8 @@ afbStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
tileHeight = pStipple->drawable.height;
psrc = (PixelType *)(pStipple->devPrivate.ptr);
rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
afbGCPrivateKey))->rrops;
while (n--) {
src = psrc[ppt->y % tileHeight];
addrlBase = afbScanline(pBase, ppt->x, ppt->y, nlwidth);
......@@ -484,8 +485,8 @@ afbOpaqueStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
tileHeight = pTile->drawable.height;
psrc = (PixelType *)(pTile->devPrivate.ptr);
rop = pGC->alu;
rropsOS = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rropOS;
rropsOS = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
afbGCPrivateKey))->rropOS;
switch(rop) {
case GXcopy:
while (n--) {
......@@ -793,8 +794,8 @@ afbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
tileWidth = pTile->drawable.width;
tileHeight = pTile->drawable.height;
rrops = ((afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr))->rrops;
rrops = ((afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
afbGCPrivateKey))->rrops;
/* this replaces rotating the stipple. Instead, we just adjust the offset
* at which we start grabbing bits from the stipple.
* Ensure that ppt->x - xSrc >= 0 and ppt->y - ySrc >= 0,
......
......@@ -154,7 +154,8 @@ afbCreateGC(pGC)
/* afb wants to translate before scan convesion */
pGC->miTranslate = 1;
pPriv = (afbPrivGC *)(pGC->devPrivates[afbGCPrivateIndex].ptr);
pPriv = (afbPrivGC *)dixLookupPrivate(&pGC->devPrivates,
afbGCPrivateKey);
afbReduceRop(pGC->alu, pGC->fgPixel, pGC->planemask, pGC->depth,
pPriv->rrops);
afbReduceOpaqueStipple(pGC->fgPixel, pGC->bgPixel, pGC->planemask,
......@@ -295,8 +296,8 @@ afbValidateGC(pGC, changes, pDrawable)
(oldOrg.y != pGC->lastWinOrg.y);
devPriv = ((afbPrivGCPtr)(pGC->devPrivates[afbGCPrivateIndex].ptr));
devPriv = (afbPrivGCPtr)dixLookupPrivate(&pGC->devPrivates,
afbGCPrivateKey);
/*
if the client clip is different or moved OR
......
......@@ -145,8 +145,8 @@ afbImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
register int nFirst;