Bug #3284: Make the DRI lock reference count per-screen.

This commit is contained in:
Adam Jackson 2005-09-13 00:44:52 +00:00
parent 846f797f37
commit b290884719
2 changed files with 7 additions and 7 deletions

View File

@ -79,7 +79,6 @@ static int DRIScreenPrivIndex = -1;
static int DRIWindowPrivIndex = -1;
static unsigned long DRIGeneration = 0;
static unsigned int DRIDrawableValidationStamp = 0;
static int lockRefCount=0;
/* Support cleanup for fullscreen mode,
independent of the DRICreateDrawable
@ -565,7 +564,7 @@ DRICloseScreen(ScreenPtr pScreen)
/* Make sure signals get unblocked etc. */
drmUnlock(pDRIPriv->drmFD, pDRIPriv->myContext);
lockRefCount=0;
pDRIPriv->lockRefCount = 0;
DRIDrvMsg(pScreen->myNum, X_INFO,
"[drm] unmapping %d bytes of SAREA %p at %p\n",
pDRIInfo->SAREASize,
@ -1910,9 +1909,9 @@ DRILock(ScreenPtr pScreen, int flags)
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if(!pDRIPriv) return;
if (!lockRefCount)
if (!pDRIPriv->lockRefCount)
DRM_LOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext, flags);
lockRefCount++;
pDRIPriv->lockRefCount++;
}
void
@ -1921,14 +1920,14 @@ DRIUnlock(ScreenPtr pScreen)
DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
if(!pDRIPriv) return;
if (lockRefCount > 0) {
lockRefCount--;
if (pDRIPriv->lockRefCount > 0) {
pDRIPriv->lockRefCount--;
}
else {
ErrorF("DRIUnlock called when not locked\n");
return;
}
if (!lockRefCount)
if (!pDRIPriv->lockRefCount)
DRM_UNLOCK(pDRIPriv->drmFD, pDRIPriv->pSAREA, pDRIPriv->myContext);
}

View File

@ -99,6 +99,7 @@ typedef struct _DRIScreenPrivRec
Bool grabbedDRILock;
Bool drmSIGIOHandlerInstalled;
Bool wrapped;
int lockRefCount;
} DRIScreenPrivRec, *DRIScreenPrivPtr;
#endif /* DRI_STRUCT_H */