gallium/u_threaded_context: always flush asynchronously if requested
This can reduce overhead depending on whether st/mesa uses the ASYNC flag
and the app flushes often.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6952>
diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 09be4a6..9d22fde 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -2055,19 +2055,7 @@
struct threaded_context *tc = threaded_context(_pipe);
struct pipe_context *pipe = tc->pipe;
struct pipe_screen *screen = pipe->screen;
- bool async = flags & PIPE_FLUSH_DEFERRED;
-
- if (flags & PIPE_FLUSH_ASYNC) {
- struct tc_batch *last = &tc->batch_slots[tc->last];
-
- /* Prefer to do the flush in the driver thread, but avoid the inter-thread
- * communication overhead if the driver thread is currently idle and the
- * caller is going to wait for the fence immediately anyway.
- */
- if (!(util_queue_fence_is_signalled(&last->fence) &&
- (flags & PIPE_FLUSH_HINT_FINISH)))
- async = true;
- }
+ bool async = flags & (PIPE_FLUSH_DEFERRED | PIPE_FLUSH_ASYNC);
if (async && tc->create_fence) {
if (fence) {