gallium/u_threaded: add an option for unsychronized create_fence_fd
authorMarek Olšák <marek.olsak@amd.com>
Wed, 21 Sep 2022 20:12:25 +0000 (16:12 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 23 Sep 2022 03:47:50 +0000 (03:47 +0000)
And enable it for radeonsi. This may be needed by Android.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18731>

src/gallium/auxiliary/util/u_threaded_context.c
src/gallium/auxiliary/util/u_threaded_context.h
src/gallium/drivers/freedreno/freedreno_context.c
src/gallium/drivers/radeonsi/si_pipe.c

index fdd1997..7731dd7 100644 (file)
@@ -2961,7 +2961,9 @@ tc_create_fence_fd(struct pipe_context *_pipe,
    struct threaded_context *tc = threaded_context(_pipe);
    struct pipe_context *pipe = tc->pipe;
 
-   tc_sync(tc);
+   if (!tc->options.unsynchronized_create_fence_fd)
+      tc_sync(tc);
+
    pipe->create_fence_fd(pipe, fence, fd, type);
 }
 
index 597a5b2..337ab95 100644 (file)
@@ -465,6 +465,9 @@ struct threaded_context_options {
     * safe to call without synchronizing with driver thread.
     */
    bool unsynchronized_get_device_reset_status;
+
+   /* If true, create_fence_fd doesn't access the context in the driver. */
+   bool unsynchronized_create_fence_fd;
 };
 
 struct threaded_context {
index 1330b09..7b9aeb5 100644 (file)
@@ -701,6 +701,7 @@ fd_context_init_tc(struct pipe_context *pctx, unsigned flags)
          .create_fence = fd_fence_create_unflushed,
          .is_resource_busy = fd_resource_busy,
          .unsynchronized_get_device_reset_status = true,
+         .unsynchronized_create_fence_fd = true,
       },
       &ctx->tc);
 
index 6a1c069..999c0a3 100644 (file)
@@ -915,6 +915,7 @@ static struct pipe_context *si_pipe_create_context(struct pipe_screen *screen, v
                                        si_create_fence : NULL,
                                  .is_resource_busy = si_is_resource_busy,
                                  .driver_calls_flush_notify = true,
+                                 .unsynchronized_create_fence_fd = true,
                               },
                               &((struct si_context *)ctx)->tc);