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>
This commit is contained in:
Marek Olšák 2020-10-03 04:12:47 -04:00 committed by Marge Bot
parent 28256d3d7b
commit 706fef711b

View file

@ -2055,19 +2055,7 @@ tc_flush(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 = 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) {