[Mesa-dev] [PATCH 3/6] i965/sync: Fold brw_fence_has_completed() into caller

Chad Versace chadversary at chromium.org
Wed Sep 28 06:51:21 UTC 2016


The function is tiny and called exactly once. There's no need for it.
---
 src/mesa/drivers/dri/i965/intel_syncobj.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_syncobj.c b/src/mesa/drivers/dri/i965/intel_syncobj.c
index ba8d3d0..ed699b2 100644
--- a/src/mesa/drivers/dri/i965/intel_syncobj.c
+++ b/src/mesa/drivers/dri/i965/intel_syncobj.c
@@ -84,24 +84,6 @@ brw_fence_insert(struct brw_context *brw, struct brw_fence *fence)
 }
 
 static bool
-brw_fence_has_completed_locked(struct brw_fence *fence)
-{
-   return !drm_intel_bo_busy(fence->batch_bo);
-}
-
-static bool
-brw_fence_has_completed(struct brw_fence *fence)
-{
-   bool ret;
-
-   mtx_lock(&fence->mutex);
-   ret = brw_fence_has_completed_locked(fence);
-   mtx_unlock(&fence->mutex);
-
-   return ret;
-}
-
-static bool
 brw_fence_client_wait_locked(struct brw_context *brw, struct brw_fence *fence,
                              uint64_t timeout)
 {
@@ -202,9 +184,14 @@ static void
 intel_gl_check_sync(struct gl_context *ctx, struct gl_sync_object *s)
 {
    struct intel_gl_sync_object *sync = (struct intel_gl_sync_object *)s;
+   struct brw_fence *fence = &sync->fence;
 
-   if (brw_fence_has_completed(&sync->fence))
+   mtx_lock(&fence->mutex);
+
+   if (!drm_intel_bo_busy(fence->batch_bo))
       s->StatusFlag = 1;
+
+   mtx_unlock(&fence->mutex);
 }
 
 void
-- 
2.10.0



More information about the mesa-dev mailing list