summaryrefslogtreecommitdiff
path: root/libdrm/intel
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-10-13 13:41:10 -0700
committerEric Anholt <eric@anholt.net>2008-10-13 13:41:10 -0700
commit3e03d781f7c41a88d5d5f895be9c443bf3592ef0 (patch)
treea92ebc68808bcaa215ef5e2e9c1110dafc0ead30 /libdrm/intel
parentc6109df93bc062d3ec2ff2808babe826532d11b3 (diff)
intel: Avoid pthread mutex recursion in bufmgr_fake.
Bug #18035. Fixes deadlock in glean texCube testcase.
Diffstat (limited to 'libdrm/intel')
-rw-r--r--libdrm/intel/intel_bufmgr_fake.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/libdrm/intel/intel_bufmgr_fake.c b/libdrm/intel/intel_bufmgr_fake.c
index 1be4698b..cfe9a731 100644
--- a/libdrm/intel/intel_bufmgr_fake.c
+++ b/libdrm/intel/intel_bufmgr_fake.c
@@ -717,20 +717,25 @@ dri_bufmgr_fake_wait_idle(dri_bufmgr_fake *bufmgr_fake)
* the necessary flushing.
*/
static void
-dri_fake_bo_wait_rendering(dri_bo *bo)
+dri_fake_bo_wait_rendering_locked(dri_bo *bo)
{
dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
- pthread_mutex_lock(&bufmgr_fake->lock);
-
- if (bo_fake->block == NULL || !bo_fake->block->fenced) {
- pthread_mutex_unlock(&bufmgr_fake->lock);
+ if (bo_fake->block == NULL || !bo_fake->block->fenced)
return;
- }
_fence_wait_internal(bufmgr_fake, bo_fake->block->fence);
+}
+
+static void
+dri_fake_bo_wait_rendering(dri_bo *bo)
+{
+ dri_bufmgr_fake *bufmgr_fake = (dri_bufmgr_fake *)bo->bufmgr;
+ dri_bo_fake *bo_fake = (dri_bo_fake *)bo;
+ pthread_mutex_lock(&bufmgr_fake->lock);
+ dri_fake_bo_wait_rendering_locked(bo);
pthread_mutex_unlock(&bufmgr_fake->lock);
}
@@ -972,7 +977,7 @@ dri_fake_bo_map_locked(dri_bo *bo, int write_enable)
if (!(bo_fake->flags & BM_NO_FENCE_SUBDATA) &&
bo_fake->block->fenced) {
- dri_fake_bo_wait_rendering(bo);
+ dri_fake_bo_wait_rendering_locked(bo);
}
bo->virtual = bo_fake->block->virtual;
@@ -987,7 +992,7 @@ dri_fake_bo_map_locked(dri_bo *bo, int write_enable)
if ((bo_fake->card_dirty == 1) && bo_fake->block) {
if (bo_fake->block->fenced)
- dri_fake_bo_wait_rendering(bo);
+ dri_fake_bo_wait_rendering_locked(bo);
memcpy(bo_fake->backing_store, bo_fake->block->virtual, bo_fake->block->bo->size);
bo_fake->card_dirty = 0;