[Mesa-dev] [PATCH 1/5] st/dri: use stapi flush instead of pipe flush when creating fences

Nicolai Hähnle nhaehnle at gmail.com
Sun Oct 22 19:18:08 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

There may be pending operations (e.g. vertices) that need to be flushed
by the state tracker.

Found by inspection.
---
 src/gallium/state_trackers/dri/dri_helpers.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_helpers.c b/src/gallium/state_trackers/dri/dri_helpers.c
index 06309d8f0ce..a9213eca19a 100644
--- a/src/gallium/state_trackers/dri/dri_helpers.c
+++ b/src/gallium/state_trackers/dri/dri_helpers.c
@@ -83,47 +83,48 @@ static unsigned dri2_fence_get_caps(__DRIscreen *_screen)
 
    if (screen->get_param(screen, PIPE_CAP_NATIVE_FENCE_FD))
       caps |= __DRI_FENCE_CAP_NATIVE_FD;
 
    return caps;
 }
 
 static void *
 dri2_create_fence(__DRIcontext *_ctx)
 {
-   struct pipe_context *ctx = dri_context(_ctx)->st->pipe;
+   struct st_context_iface *stapi = dri_context(_ctx)->st;
    struct dri2_fence *fence = CALLOC_STRUCT(dri2_fence);
 
    if (!fence)
       return NULL;
 
-   ctx->flush(ctx, &fence->pipe_fence, 0);
+   stapi->flush(stapi, 0, &fence->pipe_fence);
 
    if (!fence->pipe_fence) {
       FREE(fence);
       return NULL;
    }
 
    fence->driscreen = dri_screen(_ctx->driScreenPriv);
    return fence;
 }
 
 static void *
 dri2_create_fence_fd(__DRIcontext *_ctx, int fd)
 {
-   struct pipe_context *ctx = dri_context(_ctx)->st->pipe;
+   struct st_context_iface *stapi = dri_context(_ctx)->st;
+   struct pipe_context *ctx = stapi->pipe;
    struct dri2_fence *fence = CALLOC_STRUCT(dri2_fence);
 
    if (fd == -1) {
       /* exporting driver created fence, flush: */
-      ctx->flush(ctx, &fence->pipe_fence,
-                 PIPE_FLUSH_DEFERRED | PIPE_FLUSH_FENCE_FD);
+      stapi->flush(stapi, PIPE_FLUSH_DEFERRED | PIPE_FLUSH_FENCE_FD,
+                   &fence->pipe_fence);
    } else {
       /* importing a foreign fence fd: */
       ctx->create_fence_fd(ctx, &fence->pipe_fence, fd);
    }
    if (!fence->pipe_fence) {
       FREE(fence);
       return NULL;
    }
 
    fence->driscreen = dri_screen(_ctx->driScreenPriv);
-- 
2.11.0



More information about the mesa-dev mailing list