diff options
author | Alan Hourihane <alanh@tungstengraphics.com> | 2008-02-27 17:30:21 +0000 |
---|---|---|
committer | Alan Hourihane <alanh@tungstengraphics.com> | 2008-02-27 17:30:21 +0000 |
commit | 8689f7e348671f65e4b8c425ea4674fa33fc2900 (patch) | |
tree | 55e6d0af861c23466263508d6935b05e305c4d9d /hw/xfree86/dri/dri.c | |
parent | 06a58f2d5363e13069315beac8934cca1aab54db (diff) | |
parent | 41aea6194bd29ab34cc166b3fd90eee64299ddf8 (diff) |
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into glucose-2
Conflicts:
hw/xfree86/Makefile.am
hw/xfree86/dri/dri.c
hw/xfree86/dri/dristruct.h
hw/xgl/glx/xglx.c
hw/xgl/xglscreen.c
render/picture.c
Diffstat (limited to 'hw/xfree86/dri/dri.c')
-rw-r--r-- | hw/xfree86/dri/dri.c | 62 |
1 files changed, 17 insertions, 45 deletions
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index ce75af5bb..9ec48c9b3 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -78,9 +78,9 @@ extern Bool noPanoramiXExtension; #endif static int DRIEntPrivIndex = -1; -static int DRIScreenPrivIndex = -1; -static int DRIWindowPrivIndex = -1; -static int DRIPixmapPrivIndex = -1; +static DevPrivateKey DRIScreenPrivKey = &DRIScreenPrivKey; +static DevPrivateKey DRIWindowPrivKey = &DRIWindowPrivKey; +static DevPrivateKey DRIPixmapPrivKey = &DRIPixmapPrivKey; static unsigned long DRIGeneration = 0; static unsigned int DRIDrawableValidationStamp = 0; @@ -343,20 +343,18 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIEntPriv = DRI_ENT_PRIV(pScrn); - if (DRIGeneration != serverGeneration) { - if ((DRIScreenPrivIndex = AllocateScreenPrivateIndex()) < 0) - return FALSE; + DRIScreenPrivKey = &DRIScreenPrivKey; + if (DRIGeneration != serverGeneration) DRIGeneration = serverGeneration; - } pDRIPriv = (DRIScreenPrivPtr) xcalloc(1, sizeof(DRIScreenPrivRec)); if (!pDRIPriv) { - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - DRIScreenPrivIndex = -1; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); + DRIScreenPrivKey = NULL; return FALSE; } - pScreen->devPrivates[DRIScreenPrivIndex].ptr = (pointer) pDRIPriv; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, pDRIPriv); pDRIPriv->drmFD = pDRIEntPriv->drmFD; pDRIPriv->directRenderingSupport = TRUE; pDRIPriv->pDriverInfo = pDRIInfo; @@ -381,7 +379,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) &pDRIPriv->hSAREA) < 0) { pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); drmClose(pDRIPriv->drmFD); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmAddMap failed\n"); @@ -398,7 +396,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0) { pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); drmClose(pDRIPriv->drmFD); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] drmMap failed\n"); @@ -428,7 +426,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) &pDRIPriv->pDriverInfo->hFrameBuffer) < 0) { pDRIPriv->directRenderingSupport = FALSE; - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); drmUnmap(pDRIPriv->pSAREA, pDRIPriv->pDriverInfo->SAREASize); drmClose(pDRIPriv->drmFD); DRIDrvMsg(pScreen->myNum, X_INFO, @@ -744,8 +742,8 @@ DRICloseScreen(ScreenPtr pScreen) } xfree(pDRIPriv); - pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; - DRIScreenPrivIndex = -1; + dixSetPrivate(&pScreen->devPrivates, DRIScreenPrivKey, NULL); + DRIScreenPrivKey = NULL; } } @@ -772,38 +770,13 @@ drmServerInfo DRIDRMServerInfo = { Bool DRIExtensionInit(void) { - int i; - ScreenPtr pScreen; - - if (DRIScreenPrivIndex < 0 || DRIGeneration != serverGeneration) { + if (!DRIScreenPrivKey || DRIGeneration != serverGeneration) { return FALSE; } - /* Allocate a window private index with a zero sized private area for - * each window, then should a window become a DRI window, we'll hang - * a DRIWindowPrivateRec off of this private index. - */ - if ((DRIWindowPrivIndex = AllocateWindowPrivateIndex()) < 0) - return FALSE; - /* Allocate a pixmap private index with a zero sized private area for - * each pixmap, then should a pixmap become a DRI pixmap, we'll hang - * a DRIPixmapPrivateRec off of this private index. - */ - if ((DRIPixmapPrivIndex = AllocatePixmapPrivateIndex()) < 0) - return FALSE; - DRIDrawablePrivResType = CreateNewResourceType(DRIDrawablePrivDelete); DRIContextPrivResType = CreateNewResourceType(DRIContextPrivDelete); - for (i = 0; i < screenInfo.numScreens; i++) - { - pScreen = screenInfo.screens[i]; - if (!AllocateWindowPrivate(pScreen, DRIWindowPrivIndex, 0)) - return FALSE; - if (!AllocatePixmapPrivate(pScreen, DRIPixmapPrivIndex, 0)) - return FALSE; - } - RegisterBlockAndWakeupHandlers(DRIBlockHandler, DRIWakeupHandler, NULL); return TRUE; @@ -1278,9 +1251,8 @@ DRICreateDrawable(ScreenPtr pScreen, ClientPtr client, DrawablePtr pDrawable, pDRIDrawablePriv->nrects = REGION_NUM_RECTS(&pWin->clipList); /* save private off of preallocated index */ - pWin->devPrivates[DRIWindowPrivIndex].ptr = - (pointer)pDRIDrawablePriv; - + dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, + pDRIDrawablePriv); pDRIPriv->nrWindows++; if (pDRIDrawablePriv->nrects) @@ -1377,7 +1349,7 @@ DRIDrawablePrivDestroy(WindowPtr pWin) drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable); xfree(pDRIDrawablePriv); - pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL; + dixSetPrivate(&pWin->devPrivates, DRIWindowPrivKey, NULL); } static Bool |