[Mesa-dev] [PATCH] i965: store reference to the context within struct brw_fence

Emil Velikov emil.l.velikov at gmail.com
Mon Sep 28 04:29:59 PDT 2015


As the spec allows for {server,client}_wait_sync to be called without
currently bound context, while our implementation requires context
pointer.

UNTESTED.

Cc: Chad Versace <chad.versace at intel.com>
Cc: Marek Olšák <marek.olsak at amd.com>
Cc: Chih-Wei Huang <cwhuang at android-x86.org>
Cc: Mauro Rossi <issor.oruam at gmail.com>
Cc: 10.6 11.0 <mesa-stable at lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---

Upon second thought I'm leaning that we should move this to the API 
specific library (i.e. libEGL) rather than keeping it here. It will give 
us remove API specific from the DRI extension, plus it'll give us better
mix'n'match (loader+dri module) compatibility.

How do you guys feel on the topic ?

-Emil


 src/mesa/drivers/dri/i965/intel_syncobj.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_syncobj.c b/src/mesa/drivers/dri/i965/intel_syncobj.c
index c44c4be..3e359a5 100644
--- a/src/mesa/drivers/dri/i965/intel_syncobj.c
+++ b/src/mesa/drivers/dri/i965/intel_syncobj.c
@@ -45,6 +45,7 @@
 #include "intel_reg.h"
 
 struct brw_fence {
+   struct brw_context *brw;
    /** The fence waits for completion of this batch. */
    drm_intel_bo *batch_bo;
 
@@ -214,6 +215,7 @@ intel_dri_create_fence(__DRIcontext *ctx)
    if (!fence)
       return NULL;
 
+   fence->brw = brw;
    brw_fence_insert(brw, fence);
 
    return fence;
@@ -232,19 +234,17 @@ static GLboolean
 intel_dri_client_wait_sync(__DRIcontext *ctx, void *driver_fence, unsigned flags,
                            uint64_t timeout)
 {
-   struct brw_context *brw = ctx->driverPrivate;
    struct brw_fence *fence = driver_fence;
 
-   return brw_fence_client_wait(brw, fence, timeout);
+   return brw_fence_client_wait(fence->brw, fence, timeout);
 }
 
 static void
 intel_dri_server_wait_sync(__DRIcontext *ctx, void *driver_fence, unsigned flags)
 {
-   struct brw_context *brw = ctx->driverPrivate;
    struct brw_fence *fence = driver_fence;
 
-   brw_fence_server_wait(brw, fence);
+   brw_fence_server_wait(fence->brw, fence);
 }
 
 const __DRI2fenceExtension intelFenceExtension = {
-- 
2.5.0



More information about the mesa-dev mailing list