summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel@tungstengraphics.com>2008-04-10 19:44:17 +0200
committerKristian Høgsberg <krh@redhat.com>2008-04-14 15:18:55 -0400
commitebf6797d306b4eda044ad45fa0d4d4970386174f (patch)
tree962653379082c64a992ab9d01697c1450f25ca41
parent6772ccac5851bba030339b77ffa97dfeb1c94fba (diff)
Take the DRI2 lock before mapping a pixmap for a software fallback.intel-batchbuffer
Fixes a race condition which could cause compiz with direct rendering to fail the superioctl when the BO was already mapped.
-rw-r--r--src/i830_exa.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/i830_exa.c b/src/i830_exa.c
index e3b9db5a..2d916b43 100644
--- a/src/i830_exa.c
+++ b/src/i830_exa.c
@@ -489,6 +489,8 @@ static Bool I830EXAPrepareAccess(PixmapPtr pPix, int index)
if (!driver_priv)
return FALSE;
+ dri2Lock(pPix);
+
if (driver_priv->bo) {
mmDebug("mapping %p %d %dx%d\n", pPix, driver_priv->flags, pPix->drawable.width, pPix->drawable.height);
@@ -497,15 +499,17 @@ static Bool I830EXAPrepareAccess(PixmapPtr pPix, int index)
ret = dri_bo_map(driver_priv->bo, TRUE);
if (ret) {
FatalError("Failed to map pixmap: %s\n", strerror(-ret));
- return FALSE;
+ goto error;
}
pPix->devPrivate.ptr = driver_priv->bo->virtual;
}
- dri2Lock(pPix);
-
return TRUE;
+
+error:
+ dri2Unlock(pPix);
+ return FALSE;
}
static void I830EXAFinishAccess(PixmapPtr pPix, int index)