[Intel-gfx] [PATCH] Manage fences in user-mode bufmgr_fake to clean buffers

Keith Packard keithp at keithp.com
Thu Oct 9 23:35:10 CEST 2008


From 7f4e78cd8cfde56a992bdf58ee1c5fcef54281dc Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp at keithp.com>
Date: Thu, 9 Oct 2008 14:30:56 -0700
Subject: [PATCH] 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 at keithp.com>
---
 libdrm/intel/intel_bufmgr_fake.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libdrm/intel/intel_bufmgr_fake.c b/libdrm/intel/intel_bufmgr_fake.c
index 22273c5..4e05a9e 100644
--- a/libdrm/intel/intel_bufmgr_fake.c
+++ b/libdrm/intel/intel_bufmgr_fake.c
@@ -253,8 +253,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) {
+      bufmgr_fake->last_fence = bufmgr_fake->fence_emit(bufmgr_fake->fence_priv);
+      return bufmgr_fake->last_fence;
+   }
 
    ie.irq_seq = &seq;
    ret = drmCommandWriteRead(bufmgr_fake->fd, DRM_I915_IRQ_EMIT,
@@ -279,6 +281,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;
    }
 
-- 
1.5.6.5


-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20081009/498d5679/attachment.sig>


More information about the Intel-gfx mailing list