[Mesa-dev] [PATCH 09/13] i965/sync: Stop cacheing fence's signal status

Chad Versace chad.versace at intel.com
Sat Jul 9 00:00:59 UTC 2016


Cacheing the signal status complicates the code for questionable
performance benefit. I added the cacheing long ago, and I now think it
was the wrong decision.
---
 src/mesa/drivers/dri/i965/intel_syncobj.c | 28 +++-------------------------
 1 file changed, 3 insertions(+), 25 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_syncobj.c b/src/mesa/drivers/dri/i965/intel_syncobj.c
index c44c4be..8a18016 100644
--- a/src/mesa/drivers/dri/i965/intel_syncobj.c
+++ b/src/mesa/drivers/dri/i965/intel_syncobj.c
@@ -47,8 +47,6 @@
 struct brw_fence {
    /** The fence waits for completion of this batch. */
    drm_intel_bo *batch_bo;
-
-   bool signalled;
 };
 
 struct intel_gl_sync_object {
@@ -67,7 +65,6 @@ static void
 brw_fence_insert(struct brw_context *brw, struct brw_fence *fence)
 {
    assert(!fence->batch_bo);
-   assert(!fence->signalled);
 
    brw_emit_mi_flush(brw);
    fence->batch_bo = brw->batch.bo;
@@ -78,17 +75,8 @@ brw_fence_insert(struct brw_context *brw, struct brw_fence *fence)
 static bool
 brw_fence_has_completed(struct brw_fence *fence)
 {
-   if (fence->signalled)
-      return true;
-
-   if (fence->batch_bo && !drm_intel_bo_busy(fence->batch_bo)) {
-      drm_intel_bo_unreference(fence->batch_bo);
-      fence->batch_bo = NULL;
-      fence->signalled = true;
-      return true;
-   }
-
-   return false;
+   assert(fence->batch_bo);
+   return !drm_intel_bo_busy(fence->batch_bo);
 }
 
 /**
@@ -99,9 +87,6 @@ static bool
 brw_fence_client_wait(struct brw_context *brw, struct brw_fence *fence,
                       uint64_t timeout)
 {
-   if (fence->signalled)
-      return true;
-
    assert(fence->batch_bo);
 
    /* DRM_IOCTL_I915_GEM_WAIT uses a signed 64 bit timeout and returns
@@ -112,14 +97,7 @@ brw_fence_client_wait(struct brw_context *brw, struct brw_fence *fence,
    if (timeout > INT64_MAX)
       timeout = INT64_MAX;
 
-   if (drm_intel_gem_bo_wait(fence->batch_bo, timeout) != 0)
-      return false;
-
-   fence->signalled = true;
-   drm_intel_bo_unreference(fence->batch_bo);
-   fence->batch_bo = NULL;
-
-   return true;
+   return drm_intel_gem_bo_wait(fence->batch_bo, timeout) == 0;
 }
 
 static void
-- 
2.9.0.rc2



More information about the mesa-dev mailing list