diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index fdd19975b22..7731dd78ecb 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -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); } diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h index 597a5b22de2..337ab95e030 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.h +++ b/src/gallium/auxiliary/util/u_threaded_context.h @@ -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 { diff --git a/src/gallium/drivers/freedreno/freedreno_context.c b/src/gallium/drivers/freedreno/freedreno_context.c index 1330b09490e..7b9aeb5d3ec 100644 --- a/src/gallium/drivers/freedreno/freedreno_context.c +++ b/src/gallium/drivers/freedreno/freedreno_context.c @@ -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); diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c index 6a1c0698b37..999c0a3a888 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.c +++ b/src/gallium/drivers/radeonsi/si_pipe.c @@ -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);