diff options
author | gareth <gareth> | 2001-01-29 12:22:44 +0000 |
---|---|---|
committer | gareth <gareth> | 2001-01-29 12:22:44 +0000 |
commit | d85e796e88e1dafc46394788df79321384f96cd5 (patch) | |
tree | b889a20584f3854bd5635e82f4602564c1be3a7c /xc/programs/Xserver/GL | |
parent | eaba6647143d4dd460524db16850fd68d440cbfa (diff) |
Remove #if 0'd-out call to DRILock.tdfx-3-0-1-branch
Diffstat (limited to 'xc/programs/Xserver/GL')
-rw-r--r-- | xc/programs/Xserver/GL/dri/dri.c | 147 |
1 files changed, 71 insertions, 76 deletions
diff --git a/xc/programs/Xserver/GL/dri/dri.c b/xc/programs/Xserver/GL/dri/dri.c index 01a8ab2c0..0f62df601 100644 --- a/xc/programs/Xserver/GL/dri/dri.c +++ b/xc/programs/Xserver/GL/dri/dri.c @@ -165,7 +165,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) 0, pDRIPriv->pDriverInfo->SAREASize, DRM_SHM, - DRM_CONTAINS_LOCK, + DRM_CONTAINS_LOCK, &pDRIPriv->hSAREA) < 0) { pDRIPriv->directRenderingSupport = FALSE; @@ -179,7 +179,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) "[drm] added %d byte SAREA at 0x%08lx\n", pDRIPriv->pDriverInfo->SAREASize, pDRIPriv->hSAREA); - if (drmMap( pDRIPriv->drmFD, + if (drmMap( pDRIPriv->drmFD, pDRIPriv->hSAREA, pDRIPriv->pDriverInfo->SAREASize, (drmAddressPtr)(&pDRIPriv->pSAREA)) < 0) @@ -194,12 +194,12 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) memset(pDRIPriv->pSAREA, 0, pDRIPriv->pDriverInfo->SAREASize); DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] mapped SAREA 0x%08lx to %p\n", pDRIPriv->hSAREA, pDRIPriv->pSAREA); - - if (drmAddMap( pDRIPriv->drmFD, + + if (drmAddMap( pDRIPriv->drmFD, (drmHandle)pDRIPriv->pDriverInfo->frameBufferPhysicalAddress, pDRIPriv->pDriverInfo->frameBufferSize, - DRM_FRAME_BUFFER, - 0, + DRM_FRAME_BUFFER, + 0, &pDRIPriv->hFrameBuffer) < 0) { pDRIPriv->directRenderingSupport = FALSE; @@ -234,7 +234,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) /* validate max drawable table entry set by driver */ if ((pDRIPriv->pDriverInfo->maxDrawableTableEntry <= 0) || (pDRIPriv->pDriverInfo->maxDrawableTableEntry > SAREA_MAX_DRAWABLES)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "Invalid max drawable table size set by driver: %d\n", pDRIPriv->pDriverInfo->maxDrawableTableEntry); } @@ -246,11 +246,6 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfoPtr pDRIInfo, int *pDRMFD) pDRIPriv->pSAREA->drawableTable[i].flags = 0; } -#if 0 - /* Grab the hardware lock */ - DRILock(pScreen, 0); -#endif - return TRUE; } @@ -271,7 +266,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, &pDRIPriv->myContext, flags))) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to create server context\n"); return FALSE; } @@ -294,12 +289,12 @@ DRIFinishScreenInit(ScreenPtr pScreen) /* Server will handle 3D swaps, and hide 2D swaps from kernel. * Register server context as a preserved context. */ - + /* allocate memory for hidden context store */ pDRIPriv->hiddenContextStore = (void *)xcalloc(1, pDRIInfo->contextSize); if (!pDRIPriv->hiddenContextStore) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to allocate hidden context\n"); DRIDestroyContextPriv(pDRIContextPriv); return FALSE; @@ -309,17 +304,17 @@ DRIFinishScreenInit(ScreenPtr pScreen) pDRIPriv->partial3DContextStore = (void *)xcalloc(1, pDRIInfo->contextSize); if (!pDRIPriv->partial3DContextStore) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] failed to allocate partial 3D context\n"); xfree(pDRIPriv->hiddenContextStore); DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } - + /* save initial context store */ if (pDRIInfo->SwapContext) { (*pDRIInfo->SwapContext)( - pScreen, + pScreen, DRI_NO_SYNC, DRI_2D_CONTEXT, pDRIPriv->hiddenContextStore, @@ -333,7 +328,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) * setup signal handler for receiving swap requests from kernel */ if (!drmInstallSIGIOHandler(pDRIPriv->drmFD, DRISwapContext)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to setup DRM signal handler\n"); if (pDRIPriv->hiddenContextStore) xfree(pDRIPriv->hiddenContextStore); @@ -342,7 +337,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) DRIDestroyContextPriv(pDRIContextPriv); return FALSE; } else { - DRIDrvMsg(pScreen->myNum, X_INFO, + DRIDrvMsg(pScreen->myNum, X_INFO, "[drm] installed DRM signal handler\n"); } @@ -382,7 +377,7 @@ DRIFinishScreenInit(ScreenPtr pScreen) pDRIPriv->wrap.AdjustFrame = pScrn->AdjustFrame; pScrn->AdjustFrame = pDRIInfo->wrap.AdjustFrame; } - + DRIDrvMsg(pScreen->myNum, X_INFO, "[DRI] installation complete\n"); return TRUE; @@ -405,13 +400,13 @@ DRICloseScreen(ScreenPtr pScreen) if (pDRIPriv->pDriverInfo->driverSwapMethod != DRI_KERNEL_SWAP) { if (!drmRemoveSIGIOHandler(pDRIPriv->drmFD)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to remove DRM signal handler\n"); } } if (!DRIDestroyContextPriv(pDRIPriv->myContextPriv)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "failed to destroy server context\n"); } @@ -445,7 +440,7 @@ DRICloseScreen(ScreenPtr pScreen) pDRIPriv->hSAREA, pDRIPriv->pSAREA); } - + drmClose(pDRIPriv->drmFD); xfree(pDRIPriv); pScreen->devPrivates[DRIScreenPrivIndex].ptr = NULL; @@ -462,7 +457,7 @@ DRIExtensionInit(void) return FALSE; } - /* Allocate a window private index with a zero sized private area for + /* 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. */ @@ -555,7 +550,7 @@ DRIGetClientDriverName(ScreenPtr pScreen, /* DRICreateContextPriv and DRICreateContextPrivFromHandle are helper functions that layer on drmCreateContext and drmAddContextTag. - + DRICreateContextPriv always creates a kernel drmContext and then calls DRICreateContextPrivFromHandle to create a DRIContextPriv structure for DRI tracking. For the SIGIO handler, the drmContext is associated with @@ -596,7 +591,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen, pDRIContextPriv->pContextStore = (void *)(pDRIContextPriv + 1); drmAddContextTag(pDRIPriv->drmFD, hHWContext, pDRIContextPriv); - + pDRIContextPriv->hwContext = hHWContext; pDRIContextPriv->pScreen = pScreen; pDRIContextPriv->flags = flags; @@ -606,7 +601,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen, if (drmSetContextFlags(pDRIPriv->drmFD, hHWContext, DRM_CONTEXT_2DONLY)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to set 2D context flag\n"); DRIDestroyContextPriv(pDRIContextPriv); return NULL; @@ -616,7 +611,7 @@ DRICreateContextPrivFromHandle(ScreenPtr pScreen, if (drmSetContextFlags(pDRIPriv->drmFD, hHWContext, DRM_CONTEXT_PRESERVED)) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[drm] failed to set preserved flag\n"); DRIDestroyContextPriv(pDRIContextPriv); return NULL; @@ -631,7 +626,7 @@ DRIDestroyContextPriv(DRIContextPrivPtr pDRIContextPriv) DRIScreenPrivPtr pDRIPriv; if (!pDRIContextPriv) return TRUE; - + pDRIPriv = DRI_SCREEN_PRIV(pDRIContextPriv->pScreen); if (!(pDRIContextPriv->flags & DRI_CONTEXT_RESERVED)) { @@ -675,14 +670,14 @@ DRICreateContext(ScreenPtr pScreen, VisualPtr visual, /* No matching GLX visual found */ return FALSE; } - + if (!(pDRIContextPriv = DRICreateContextPriv(pScreen, pHWContext, 0))) { return FALSE; } contextStore=DRIGetContextStore(pDRIContextPriv); if (pDRIPriv->pDriverInfo->CreateContext) { - if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual, + if (!((*pDRIPriv->pDriverInfo->CreateContext)(pScreen, visual, *pHWContext, *pVisualConfigPriv, (DRIContextType)(long)contextStore))) { DRIDestroyContextPriv(pDRIContextPriv); @@ -726,9 +721,9 @@ DRIContextPrivDelete(pointer pResource, XID id) * in the case of transition from private to shared backbuffers. It's * not necessary for correctness, because DRIClipNotify gets called in * time to prevent any conflict, but the transition from - * shared->private is sometimes missed if we don't do this. + * shared->private is sometimes missed if we don't do this. */ -static void +static void DRIClipNotifyAllDrawables(ScreenPtr pScreen) { int i; @@ -736,11 +731,11 @@ DRIClipNotifyAllDrawables(ScreenPtr pScreen) for( i=0; i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; - } + } } -static void +static void DRITransitionToSharedBuffers(ScreenPtr pScreen) { /* ErrorF("DRITransitionToSharedBuffers\n"); */ @@ -748,7 +743,7 @@ DRITransitionToSharedBuffers(ScreenPtr pScreen) } -static void +static void DRITransitionToPrivateBuffers(ScreenPtr pScreen) { /* ErrorF("DRITransitionToPrivateBuffers\n"); */ @@ -813,7 +808,7 @@ DRICreateDrawable(ScreenPtr pScreen, Drawable id, pDRIDrawablePriv->drawableIndex = -1; /* save private off of preallocated index */ - pWin->devPrivates[DRIWindowPrivIndex].ptr = + pWin->devPrivates[DRIWindowPrivIndex].ptr = (pointer)pDRIDrawablePriv; switch (++pDRIPriv->nrWindows) { @@ -852,7 +847,7 @@ DRIDestroyDrawable(ScreenPtr pScreen, Drawable id, DrawablePtr pDrawable) pDRIDrawablePriv->refCount--; if (pDRIDrawablePriv->refCount <= 0) { /* This calls back DRIDrawablePrivDelete which frees private area */ - FreeResourceByType(id, DRIDrawablePrivResType, FALSE); + FreeResourceByType(id, DRIDrawablePrivResType, FALSE); } } else { /* pixmap (or for GLX 1.3, a PBuffer) */ @@ -880,7 +875,7 @@ DRIDrawablePrivDelete(pointer pResource, XID id) pDRIPriv->DRIDrawables[pDRIDrawablePriv->drawableIndex] = NULL; } - if (drmDestroyDrawable(pDRIPriv->drmFD, + if (drmDestroyDrawable(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable)) { return FALSE; } @@ -942,7 +937,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen, if (!(pDRIPriv->DRIDrawables[i])) { pDRIPriv->DRIDrawables[i] = pDrawable; pDRIDrawablePriv->drawableIndex = i; - pDRIPriv->pSAREA->drawableTable[i].stamp = + pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; break; } @@ -955,10 +950,10 @@ DRIGetDrawableInfo(ScreenPtr pScreen, int oldestIndex = 0; i = pDRIPriv->pDriverInfo->maxDrawableTableEntry; while (i--) { - if (pDRIPriv->pSAREA->drawableTable[i].stamp < + if (pDRIPriv->pSAREA->drawableTable[i].stamp < oldestStamp) { oldestIndex = i; - oldestStamp = + oldestStamp = pDRIPriv->pSAREA->drawableTable[i].stamp; } } @@ -973,15 +968,15 @@ DRIGetDrawableInfo(ScreenPtr pScreen, pDRIPriv->DRIDrawables[oldestIndex] = pDrawable; /* validate SAREA entry */ - pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = + pDRIPriv->pSAREA->drawableTable[oldestIndex].stamp = DRIDrawableValidationStamp++; /* check for stamp wrap around */ if (oldestStamp > DRIDrawableValidationStamp) { /* walk SAREA table and invalidate all drawables */ - for( i=0; - i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; + for( i=0; + i < pDRIPriv->pDriverInfo->maxDrawableTableEntry; i++) { pDRIPriv->pSAREA->drawableTable[i].stamp = DRIDrawableValidationStamp++; @@ -997,10 +992,10 @@ DRIGetDrawableInfo(ScreenPtr pScreen, pDRIDrawablePriv->drawableIndex); /* reinit drawable ID if window is visible */ - if ((pWin->viewable) && + if ((pWin->viewable) && (pDRIPriv->pDriverInfo->bufferRequests != DRI_NO_WINDOWS)) { - (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, + (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, &pWin->clipList, pDRIDrawablePriv->drawableIndex); } } @@ -1028,7 +1023,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen, *numClipRects = 1; *pClipRects = &pDRIPriv->fullscreen_rect; } - + *backX = *X; *backY = *Y; @@ -1178,7 +1173,7 @@ DRIDoWakeupHandler(int screenNum, pointer wakeupData, } } -void +void DRIDoBlockHandler(int screenNum, pointer blockData, pointer pTimeout, pointer pReadmask) { @@ -1197,7 +1192,7 @@ DRIDoBlockHandler(int screenNum, pointer blockData, DRIUnlock(pScreen); } -void +void DRISwapContext(int drmFD, void *oldctx, void *newctx) { DRIContextPrivPtr oldContext = (DRIContextPrivPtr)oldctx; @@ -1240,7 +1235,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) #endif if (!pDRIPriv->pDriverInfo->SwapContext) { - DRIDrvMsg(pScreen->myNum, X_ERROR, + DRIDrvMsg(pScreen->myNum, X_ERROR, "[DRI] DDX driver missing context swap call back\n"); return; } @@ -1256,7 +1251,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) oldContextType = DRI_NO_CONTEXT; } newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && + if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } @@ -1270,8 +1265,8 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) /* optimize 2D context swaps */ if (newContext->flags & DRI_CONTEXT_2DONLY) { - /* go from 3D context to 2D context and only save 2D - * subset of 3D state + /* go from 3D context to 2D context and only save 2D + * subset of 3D state */ oldContextStore = DRIGetContextStore(oldContext); oldContextType = DRI_2D_CONTEXT; @@ -1282,8 +1277,8 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) } else if (oldContext->flags & DRI_CONTEXT_2DONLY) { if (pDRIPriv->lastPartial3DContext == newContext) { - /* go from 2D context back to previous 3D context and - * only restore 2D subset of previous 3D state + /* go from 2D context back to previous 3D context and + * only restore 2D subset of previous 3D state */ oldContextStore = DRIGetContextStore(oldContext); oldContextType = DRI_2D_CONTEXT; @@ -1296,7 +1291,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) /* call DDX driver to do partial restore */ oldContextStore = DRIGetContextStore(oldContext); - newContextStore = + newContextStore = DRIGetContextStore(pDRIPriv->lastPartial3DContext); (*pDRIPriv->pDriverInfo->SwapContext)(pScreen, DRI_2D_SYNC, @@ -1310,7 +1305,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) oldContext->valid3D = TRUE; oldContextType = DRI_3D_CONTEXT; newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && + if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } @@ -1326,7 +1321,7 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) oldContext->valid3D = TRUE; oldContextType = DRI_3D_CONTEXT; newContextStore = DRIGetContextStore(newContext); - if ((newContext->valid3D) && + if ((newContext->valid3D) && (newContext->hwContext != pDRIPriv->myContext)) { newContextType = DRI_3D_CONTEXT; } @@ -1346,33 +1341,33 @@ DRISwapContext(int drmFD, void *oldctx, void *newctx) newContextStore); } -void* +void* DRIGetContextStore(DRIContextPrivPtr context) { return((void *)context->pContextStore); } -void +void DRIPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) { ScreenPtr pScreen = pWin->drawable.pScreen; DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); - /* NOT_DONE: HACK until we have newly transitioned 3D->2D - * windows computed + /* NOT_DONE: HACK until we have newly transitioned 3D->2D + * windows computed */ if(what == PW_BACKGROUND) { if ((pDRIPriv->pDriverInfo->bufferRequests == DRI_3D_WINDOWS_ONLY) && (pDRIDrawablePriv)) { - (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn, + (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn, pDRIDrawablePriv->drawableIndex); } else if (pDRIPriv->pDriverInfo->bufferRequests == DRI_ALL_WINDOWS) { if (pDRIDrawablePriv) { - (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn, + (*pDRIPriv->pDriverInfo->InitBuffers)(pWin, prgn, pDRIDrawablePriv->drawableIndex); } else { @@ -1414,7 +1409,7 @@ DRIPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) } } -void +void DRICopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1611,7 +1606,7 @@ DRIClipNotify(WindowPtr pWin, int dx, int dy) } } -CARD32 +CARD32 DRIGetDrawableIndex(WindowPtr pWin) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1629,7 +1624,7 @@ DRIGetDrawableIndex(WindowPtr pWin) return index; } -unsigned int +unsigned int DRIGetDrawableStamp(ScreenPtr pScreen, CARD32 drawable_index) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); @@ -1641,7 +1636,7 @@ void DRIPrintDrawableLock(ScreenPtr pScreen, char *msg) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - + ErrorF("%s: %d\n", msg, pDRIPriv->pSAREA->drawable_lock.lock); } @@ -1649,7 +1644,7 @@ void DRILock(ScreenPtr pScreen, int flags) { DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen); - + if (!lockRefCount) DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags); lockRefCount++; @@ -1688,10 +1683,10 @@ DRIGetContext(ScreenPtr pScreen) return 0; return pDRIPriv->myContext; } - + /* This lets get at the unwrapped functions so that they can correctly * call the lowerlevel functions, and choose whether they will be - * called at every level of recursion (eg in validatetree). + * called at every level of recursion (eg in validatetree). */ DRIWrappedFuncsRec * DRIGetWrappedFuncs(ScreenPtr pScreen) @@ -1778,7 +1773,7 @@ DRIOpenFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable) ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; WindowPtr pWin = (WindowPtr)pDrawable; XF86DRIClipRectPtr pClipRects = (void *)REGION_RECTS(&pWin->clipList); - + _DRIAdjustFrame(pScrn, pDRIPriv, pScrn->frameX0, pScrn->frameY0); if (pDrawable->type != DRAWABLE_WINDOW) return FALSE; @@ -1807,7 +1802,7 @@ DRIOpenFullScreen(ScreenPtr pScreen, DrawablePtr pDrawable) pScrn->vtSema = FALSE; pDRIPriv->fullscreen = pDrawable; DRIClipNotify(pWin, 0, 0); - + if (pDRIPriv->pDriverInfo->OpenFullScreen) pDRIPriv->pDriverInfo->OpenFullScreen(pScreen); @@ -1838,7 +1833,7 @@ _DRICloseFullScreen(pointer pResource, XID id) pScrn->EnableDisableFBAccess(pScreen->myNum, TRUE); pWin->eventMask = mask; pWin->optional = optional; - + xf86EnableVTSwitch(TRUE); pDRIPriv->pSAREA->frame.fullscreen = 0; return TRUE; |