gallium: wire up server_wait_sync
authorRob Clark <robclark@freedesktop.org>
Fri, 1 Apr 2016 19:47:44 +0000 (15:47 -0400)
committerRob Clark <robdclark@gmail.com>
Fri, 2 Dec 2016 01:16:31 +0000 (20:16 -0500)
This will be needed for explicit synchronization with devices outside
the gpu, ie. EGL_ANDROID_native_fence_sync.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/gallium/include/pipe/p_context.h
src/gallium/state_trackers/dri/dri2.c

index b97aad5e3132ae476facec46c3a17bc06500b3af..ee8a5113caa1cb3508910058c1aaec101c9e0f13 100644 (file)
@@ -474,6 +474,12 @@ struct pipe_context {
                  struct pipe_fence_handle **fence,
                  unsigned flags);
 
+   /**
+    * Insert commands to have GPU wait for fence to be signaled.
+    */
+   void (*fence_server_sync)(struct pipe_context *pipe,
+                             struct pipe_fence_handle *fence);
+
    /**
     * Create a view on a texture to be used by a shader stage.
     */
index 9ec069b306384a005ccd7a9a00c6fe427f836d61..1a44bcb771e5afa9bc34dfef1587d41b3c437045 100644 (file)
@@ -1548,7 +1548,11 @@ dri2_client_wait_sync(__DRIcontext *_ctx, void *_fence, unsigned flags,
 static void
 dri2_server_wait_sync(__DRIcontext *_ctx, void *_fence, unsigned flags)
 {
-   /* AFAIK, no driver currently supports parallel context execution. */
+   struct pipe_context *ctx = dri_context(_ctx)->st->pipe;
+   struct dri2_fence *fence = (struct dri2_fence*)_fence;
+
+   if (ctx->fence_server_sync)
+      ctx->fence_server_sync(ctx, fence->pipe_fence);
 }
 
 static __DRI2fenceExtension dri2FenceExtension = {