diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2007-08-28 09:28:25 -0400 |
---|---|---|
committer | Eamon Walsh <ewalsh@moss-charon.epoch.ncsc.mil> | 2007-08-28 09:28:25 -0400 |
commit | 4017d3190234e189a0bbd33193a148d4d3c7556b (patch) | |
tree | 2ab228113d410386afde50c893f137d95974b8f3 /hw/xfree86/xaa/xaaInit.c | |
parent | 85547073265ae9bc4ae3af920a6d3214fd1ca0c5 (diff) |
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.
Diffstat (limited to 'hw/xfree86/xaa/xaaInit.c')
-rw-r--r-- | hw/xfree86/xaa/xaaInit.c | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c index 93f6995aa..614ecf751 100644 --- a/hw/xfree86/xaa/xaaInit.c +++ b/hw/xfree86/xaa/xaaInit.c @@ -38,22 +38,20 @@ static int XAASetDGAMode(int index, int num, DGADevicePtr devRet); static void XAAEnableDisableFBAccess (int index, Bool enable); static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask); -static int XAAScreenIndex = -1; -static int XAAGCIndex = -1; -static int XAAPixmapIndex = -1; +static DevPrivateKey XAAScreenKey = &XAAScreenKey; +static DevPrivateKey XAAGCKey = &XAAGCKey; +static DevPrivateKey XAAPixmapKey = &XAAPixmapKey; -static unsigned long XAAGeneration = 0; - -int XAAGetScreenIndex(void) { - return XAAScreenIndex; +DevPrivateKey XAAGetScreenKey(void) { + return XAAScreenKey; } -int XAAGetGCIndex(void) { - return XAAGCIndex; +DevPrivateKey XAAGetGCKey(void) { + return XAAGCKey; } -int XAAGetPixmapIndex(void) { - return XAAPixmapIndex; +DevPrivateKey XAAGetPixmapKey(void) { + return XAAPixmapKey; } /* temp kludge */ @@ -103,25 +101,16 @@ XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec) if (!infoRec) return TRUE; - if (XAAGeneration != serverGeneration) { - if ( ((XAAScreenIndex = AllocateScreenPrivateIndex()) < 0) || - ((XAAGCIndex = AllocateGCPrivateIndex()) < 0) || - ((XAAPixmapIndex = AllocatePixmapPrivateIndex()) < 0)) - return FALSE; - - XAAGeneration = serverGeneration; - } - - if (!AllocateGCPrivate(pScreen, XAAGCIndex, sizeof(XAAGCRec))) + if (!dixRequestPrivate(XAAGCKey, sizeof(XAAGCRec))) return FALSE; - if (!AllocatePixmapPrivate(pScreen, XAAPixmapIndex, sizeof(XAAPixmapRec))) + if (!dixRequestPrivate(XAAPixmapKey, sizeof(XAAPixmapRec))) return FALSE; if (!(pScreenPriv = xalloc(sizeof(XAAScreenRec)))) return FALSE; - pScreen->devPrivates[XAAScreenIndex].ptr = (pointer)pScreenPriv; + dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv); if(!xf86FBManagerRunning(pScreen)) infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS); @@ -226,7 +215,7 @@ XAACloseScreen (int i, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); pScrn->EnterVT = pScreenPriv->EnterVT; pScrn->LeaveVT = pScreenPriv->LeaveVT; @@ -524,7 +513,7 @@ XAAEnterVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); return((*pScreenPriv->EnterVT)(index, flags)); } @@ -534,7 +523,7 @@ XAALeaveVT(int index, int flags) { ScreenPtr pScreen = screenInfo.screens[index]; XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec; if(infoRec->NeedToSync) { @@ -557,7 +546,7 @@ XAASetDGAMode(int index, int num, DGADevicePtr devRet) ScreenPtr pScreen = screenInfo.screens[index]; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); int ret; if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */ @@ -619,7 +608,7 @@ XAAEnableDisableFBAccess (int index, Bool enable) ScreenPtr pScreen = screenInfo.screens[index]; XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAAScreenPtr pScreenPriv = - (XAAScreenPtr) pScreen->devPrivates[XAAScreenIndex].ptr; + (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey); if(!enable) { if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps)) |