Module: Mesa
Branch: master
Commit: ce470af0b1bcb276c22dd04e627ab665e10619f7
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce470af0b1bcb276c22dd04e627ab665e10619f7

Author: Nicolai Hähnle <nicolai.haeh...@amd.com>
Date:   Mon Nov  6 11:56:54 2017 +0100

u_threaded_gallium: remove synchronization in fence_server_sync

The whole point of fence_server_sync is that it can be used to
avoid waiting in the application thread.

Reviewed-by: Andres Rodriguez <andre...@gmail.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/auxiliary/util/u_threaded_context.c       | 14 +++++++++++---
 src/gallium/auxiliary/util/u_threaded_context.h       |  1 +
 src/gallium/auxiliary/util/u_threaded_context_calls.h |  1 +
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_threaded_context.c 
b/src/gallium/auxiliary/util/u_threaded_context.c
index b212393a5b..d0a8ffbd11 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -1835,14 +1835,22 @@ tc_create_fence_fd(struct pipe_context *_pipe,
 }
 
 static void
+tc_call_fence_server_sync(struct pipe_context *pipe, union tc_payload *payload)
+{
+   pipe->fence_server_sync(pipe, payload->fence);
+   pipe->screen->fence_reference(pipe->screen, &payload->fence, NULL);
+}
+
+static void
 tc_fence_server_sync(struct pipe_context *_pipe,
                      struct pipe_fence_handle *fence)
 {
    struct threaded_context *tc = threaded_context(_pipe);
-   struct pipe_context *pipe = tc->pipe;
+   struct pipe_screen *screen = tc->pipe->screen;
+   union tc_payload *payload = tc_add_small_call(tc, 
TC_CALL_fence_server_sync);
 
-   tc_sync(tc);
-   pipe->fence_server_sync(pipe, fence);
+   payload->fence = NULL;
+   screen->fence_reference(screen, &payload->fence, fence);
 }
 
 static struct pipe_video_codec *
diff --git a/src/gallium/auxiliary/util/u_threaded_context.h 
b/src/gallium/auxiliary/util/u_threaded_context.h
index ea815ed5e0..b2d904569e 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.h
+++ b/src/gallium/auxiliary/util/u_threaded_context.h
@@ -309,6 +309,7 @@ union tc_payload {
    struct pipe_query *query;
    struct pipe_resource *resource;
    struct pipe_transfer *transfer;
+   struct pipe_fence_handle *fence;
    uint64_t handle;
 };
 
diff --git a/src/gallium/auxiliary/util/u_threaded_context_calls.h 
b/src/gallium/auxiliary/util/u_threaded_context_calls.h
index 0d2fd18368..675deaabd9 100644
--- a/src/gallium/auxiliary/util/u_threaded_context_calls.h
+++ b/src/gallium/auxiliary/util/u_threaded_context_calls.h
@@ -1,5 +1,6 @@
 CALL(flush)
 CALL(callback)
+CALL(fence_server_sync)
 CALL(destroy_query)
 CALL(begin_query)
 CALL(end_query)

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to