aboutsummaryrefslogtreecommitdiff
path: root/libdrm/intel
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-10-09 14:30:56 -0700
committerKeith Packard <keithp@keithp.com>2008-10-09 18:25:58 -0700
commit94c88c151cecae48ce1f4f01acddfaaad4b437f3 (patch)
treeeff25f07c323167af6e216e7304f56735c291619 /libdrm/intel
parent3169d9639bd002b43e4064cea32e0d262076c1e0 (diff)
Manage fences in user-mode bufmgr_fake to clean buffers
When using bufmgr_fake without DRM, the X server idles the ring whenever it wants to wait for something to complete (brutal, but effective). In this case, bufmgr_fake must treat the pending fence as having passed. However, it wasn't recording the fences as it emitted them, nor cleaning buffers as they passed. Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'libdrm/intel')
-rw-r--r--libdrm/intel/intel_bufmgr_fake.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/libdrm/intel/intel_bufmgr_fake.c b/libdrm/intel/intel_bufmgr_fake.c
index c8f643db..1be4698b 100644
--- a/libdrm/intel/intel_bufmgr_fake.c
+++ b/libdrm/intel/intel_bufmgr_fake.c
@@ -256,8 +256,10 @@ _fence_emit_internal(dri_bufmgr_fake *bufmgr_fake)
struct drm_i915_irq_emit ie;
int ret, seq = 1;
- if (bufmgr_fake->fence_emit != NULL)
- return bufmgr_fake->fence_emit(bufmgr_fake->fence_priv);
+ if (bufmgr_fake->fence_emit != NULL) {
+ seq = bufmgr_fake->fence_emit(bufmgr_fake->fence_priv);
+ return seq;
+ }
ie.irq_seq = &seq;
ret = drmCommandWriteRead(bufmgr_fake->fd, DRM_I915_IRQ_EMIT,
@@ -268,8 +270,7 @@ _fence_emit_internal(dri_bufmgr_fake *bufmgr_fake)
}
DBG("emit 0x%08x\n", seq);
- bufmgr_fake->last_fence = seq;
- return bufmgr_fake->last_fence;
+ return seq;
}
static void
@@ -282,6 +283,7 @@ _fence_wait_internal(dri_bufmgr_fake *bufmgr_fake, int seq)
if (bufmgr_fake->fence_wait != NULL) {
bufmgr_fake->fence_wait(seq, bufmgr_fake->fence_priv);
+ clear_fenced(bufmgr_fake, seq);
return;
}
@@ -571,6 +573,7 @@ static int clear_fenced(dri_bufmgr_fake *bufmgr_fake,
struct block *block, *tmp;
int ret = 0;
+ bufmgr_fake->last_fence = fence_cookie;
DRMLISTFOREACHSAFE(block, tmp, &bufmgr_fake->fenced) {
assert(block->fenced);