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

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;
}
......
......@@ -153,8 +153,6 @@ static int XpFreePage(pointer, XID);
static Bool XpCloseScreen(int, ScreenPtr);
static CARD32 GetAllEventMasks(XpContextPtr);
static struct _XpClient *CreateXpClient(ClientPtr);
static void InitContextPrivates(XpContextPtr);
static void ResetContextPrivates(void);
static struct _XpClient *FindClient(XpContextPtr, ClientPtr);
static struct _XpClient *AcquireClient(XpContextPtr, ClientPtr);
......@@ -233,21 +231,12 @@ static XpScreenPtr XpScreens[MAXSCREENS];
static unsigned char XpReqCode;
static int XpEventBase;
static int XpErrorBase;
static unsigned long XpGeneration = 0;
static int XpClientPrivateIndex;
/* Variables for the context private machinery.
* These must be initialized at compile time because
* main() calls InitOutput before InitExtensions, and the
* output drivers are likely to call AllocateContextPrivate.
* These variables are reset at CloseScreen time. CloseScreen
* is used because it occurs after FreeAllResources, and before
* the next InitOutput cycle.
*/
static int contextPrivateCount = 0;
static int contextPrivateLen = 0;
static unsigned *contextPrivateSizes = (unsigned *)NULL;
static unsigned totalContextSize = sizeof(XpContextRec);
static DevPrivateKey XpClientPrivateKey = &XpClientPrivateKey;
#define XP_GETPRIV(pClient) ((XpContextPtr) \
dixLookupPrivate(&(pClient)->devPrivates, XpClientPrivateKey))
#define XP_SETPRIV(pClient, p) \
dixSetPrivate(&(pClient)->devPrivates, XpClientPrivateKey, p)
/*
* There are three types of resources involved. One is the resource associated
......@@ -305,20 +294,6 @@ XpExtensionInit(INITARGS)
EventSwapVector[XpEventBase+1] = (EventSwapPtr) SwapXpAttributeEvent;
}
if(XpGeneration != serverGeneration)
{
XpClientPrivateIndex = AllocateClientPrivateIndex();
/*
* We allocate 0 length & simply stuff a pointer to the
* ContextRec in the DevUnion.
*/
if(AllocateClientPrivate(XpClientPrivateIndex, 0) != TRUE)
{
/* we can't alloc a client private, should we bail??? XXX */
}
XpGeneration = serverGeneration;
}
for(i = 0; i < MAXSCREENS; i++)
{
/*
......@@ -377,14 +352,6 @@ XpCloseScreen(int index, ScreenPtr pScreen)
}
XpScreens[index] = (XpScreenPtr)NULL;
/*
* It's wasteful to call ResetContextPrivates() at every CloseScreen,
* but it's the best we know how to do for now. We do this because we
* have to wait until after all resources have been freed (so we know
* how to free the ContextRecs), and before the next InitOutput cycle.
* See dix/main.c for the order of initialization and reset.
*/
ResetContextPrivates();
return (*CloseScreen)(index, pScreen);
}
......@@ -956,12 +923,10 @@ ProcXpCreateContext(ClientPtr client)
/*
* Allocate and add the context resource.
*/
if((pContext = (XpContextPtr) xalloc(totalContextSize)) ==
if((pContext = (XpContextPtr) xalloc(sizeof(XpContextRec))) ==
(XpContextPtr) NULL)
return BadAlloc;
InitContextPrivates(pContext);
if(AddResource(stuff->contextID, RTcontext, (pointer) pContext)
!= TRUE)
{
......@@ -975,6 +940,7 @@ ProcXpCreateContext(ClientPtr client)
pContext->state = 0;
pContext->clientSlept = (ClientPtr)NULL;
pContext->imageRes = 0;
pContext->devPrivates = NULL;
pContext->funcs.DestroyContext = 0;
pContext->funcs.StartJob = 0;
......@@ -1041,8 +1007,7 @@ ProcXpSetContext(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPrintSetContextReq);
if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) !=
(pointer)NULL)
if((pContext = XP_GETPRIV(client)) != (pointer)NULL)
{
/*
* Erase this client's knowledge of its old context, if any.
......@@ -1055,7 +1020,7 @@ ProcXpSetContext(ClientPtr client)
FreeXpClient(pPrintClient, TRUE);
}
client->devPrivates[XpClientPrivateIndex].ptr = (pointer)NULL;
XP_SETPRIV(client, NULL);
}
if(stuff->printContext == None)
return Success;
......@@ -1077,7 +1042,7 @@ ProcXpSetContext(ClientPtr client)
if((pPrintClient = AcquireClient(pContext, client)) == (XpClientPtr)NULL)
return BadAlloc;
client->devPrivates[XpClientPrivateIndex].ptr = pContext;
XP_SETPRIV(client, pContext);
XpSetFontResFunc(client);
......@@ -1090,7 +1055,7 @@ ProcXpSetContext(ClientPtr client)
XpContextPtr
XpGetPrintContext(ClientPtr client)
{
return (client->devPrivates[XpClientPrivateIndex].ptr);
return XP_GETPRIV(client);
}
static int
......@@ -1105,8 +1070,7 @@ ProcXpGetContext(ClientPtr client)
REQUEST_SIZE_MATCH(xPrintGetContextReq);
if((pContext = client->devPrivates[XpClientPrivateIndex].ptr) ==
(pointer)NULL)
if((pContext = XP_GETPRIV(client)) == (pointer)NULL)
rep.printContext = None;
else
rep.printContext = pContext->contextID;
......@@ -1249,6 +1213,7 @@ XpFreeContext(pointer data, XID id)
}
xfree(pContext->printerName);
dixFreePrivates(pContext->devPrivates);
xfree(pContext);
return Success; /* ??? */
}
......@@ -1284,11 +1249,9 @@ FreeXpClient(XpClientPtr pXpClient, Bool freeResource)
* If we're freeing the clientRec associated with the context tied
* to the client's devPrivates, then we need to clear the devPrivates.
*/
if(pXpClient->client->devPrivates[XpClientPrivateIndex].ptr ==
pXpClient->context)
if(XP_GETPRIV(pXpClient->client) == pXpClient->context)
{
pXpClient->client->devPrivates[XpClientPrivateIndex].ptr =
(pointer)NULL;
XP_SETPRIV(pXpClient->client, NULL);
}
for(pPrev = (XpClientPtr)NULL, pCurrent = pContext->clientHead;
......@@ -1372,87 +1335,6 @@ XpFreePage(pointer data, XID id)
return result;
}
/*
* ContextPrivate machinery.
* Context privates are intended for use by the drivers, allowing the
* drivers to maintain context-specific data. The driver should free
* the associated data at DestroyContext time.
*/
static void
InitContextPrivates(XpContextPtr context)
{
register char *ptr;
DevUnion *ppriv;
register unsigned *sizes;
register unsigned size;
register int i;
if (totalContextSize == sizeof(XpContextRec))
ppriv = (DevUnion *)NULL;
else
ppriv = (DevUnion *)(context + 1);
context->devPrivates = ppriv;
sizes = contextPrivateSizes;
ptr = (char *)(ppriv + contextPrivateLen);
for (i = contextPrivateLen; --i >= 0; ppriv++, sizes++)
{
if ( (size = *sizes) )
{
ppriv->ptr = (pointer)ptr;
ptr += size;
}
else
ppriv->ptr = (pointer)NULL;
}
}
static void
ResetContextPrivates(void)
{
contextPrivateCount = 0;
contextPrivateLen = 0;
xfree(contextPrivateSizes);
contextPrivateSizes = (unsigned *)NULL;
totalContextSize = sizeof(XpContextRec);
}
int
XpAllocateContextPrivateIndex(void)
{
return contextPrivateCount++;
}
Bool
XpAllocateContextPrivate(int index, unsigned amount)
{
unsigned oldamount;
if (index >= contextPrivateLen)
{
unsigned *nsizes;
nsizes = (unsigned *)xrealloc(contextPrivateSizes,
(index + 1) * sizeof(unsigned));
if (!nsizes)
return FALSE;
while (contextPrivateLen <= index)
{
nsizes[contextPrivateLen++] = 0;
totalContextSize += sizeof(DevUnion);
}
contextPrivateSizes = nsizes;
}
oldamount = contextPrivateSizes[index];
if (amount > oldamount)
{
contextPrivateSizes[index] = amount;
totalContextSize += (amount - oldamount);
}
return TRUE;
}
static XpClientPtr
AcquireClient(XpContextPtr pContext, ClientPtr client)
{
......@@ -1501,8 +1383,7 @@ ProcXpStartJob(ClientPtr client)
REQUEST_SIZE_MATCH(xPrintStartJobReq);
/* Check to see that a context has been established by this client. */
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
== (XpContextPtr)NULL)
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
return XpErrorBase+XPBadContext;
if(pContext->state != 0)
......@@ -1542,8 +1423,7 @@ ProcXpEndJob(ClientPtr client)
REQUEST_SIZE_MATCH(xPrintEndJobReq);
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
== (XpContextPtr)NULL)
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
return XpErrorBase+XPBadSequence;
if(!(pContext->state & JOB_STARTED))
......@@ -1648,8 +1528,7 @@ ProcXpStartDoc(ClientPtr client)
REQUEST_SIZE_MATCH(xPrintStartDocReq);
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
== (XpContextPtr)NULL)
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
return XpErrorBase+XPBadSequence;
if(!(pContext->state & JOB_STARTED) ||
......@@ -1684,8 +1563,7 @@ ProcXpEndDoc(ClientPtr client)
REQUEST_SIZE_MATCH(xPrintEndDocReq);
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
== (XpContextPtr)NULL)
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
return XpErrorBase+XPBadSequence;
if(!(pContext->state & DOC_RAW_STARTED) &&
......@@ -1837,8 +1715,7 @@ ProcXpStartPage(ClientPtr client)
REQUEST_SIZE_MATCH(xPrintStartPageReq);
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
== (XpContextPtr)NULL)
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
return XpErrorBase+XPBadSequence;
if(!(pContext->state & JOB_STARTED))
......@@ -1882,8 +1759,7 @@ ProcXpEndPage(ClientPtr client)
REQUEST_SIZE_MATCH(xPrintEndPageReq);
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
== (XpContextPtr)NULL)
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
return XpErrorBase+XPBadSequence;
if(!(pContext->state & PAGE_STARTED))
......@@ -1932,8 +1808,7 @@ ProcXpPutDocumentData(ClientPtr client)
REQUEST_AT_LEAST_SIZE(xPrintPutDocumentDataReq);
if((pContext = (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr)
== (XpContextPtr)NULL)
if((pContext = XP_GETPRIV(client)) == (XpContextPtr)NULL)
return XpErrorBase+XPBadSequence;
if(!(pContext->state & DOC_RAW_STARTED) &&
......@@ -2443,7 +2318,7 @@ GetAllEventMasks(XpContextPtr pContext)
XpContextPtr
XpContextOfClient(ClientPtr client)
{
return (XpContextPtr)client->devPrivates[XpClientPrivateIndex].ptr;
return XP_GETPRIV(client);
}
......
......@@ -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