From 6ac085966bb9f3e7f37977dc55ed689f4acffa5f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 5 May 2021 20:32:45 -0400 Subject: [PATCH] gallium/u_threaded: always map idle buffers unsynchronized Reviewed-By: Mike Blumenkrantz Reviewed-by: Rob Clark Part-of: --- src/gallium/auxiliary/util/u_threaded_context.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index eb2e512..8f3bd71 100644 --- a/src/gallium/auxiliary/util/u_threaded_context.c +++ b/src/gallium/auxiliary/util/u_threaded_context.c @@ -1937,11 +1937,12 @@ tc_improve_map_buffer_flags(struct threaded_context *tc, return usage & ~PIPE_MAP_DISCARD_WHOLE_RESOURCE; } - /* See if the buffer range being mapped has never been initialized, - * in which case it can be mapped unsynchronized. */ + /* See if the buffer range being mapped has never been initialized or + * the buffer is idle, in which case it can be mapped unsynchronized. */ if (!(usage & PIPE_MAP_UNSYNCHRONIZED) && - !tres->is_shared && - !util_ranges_intersect(&tres->valid_buffer_range, offset, offset + size)) + ((!tres->is_shared && + !util_ranges_intersect(&tres->valid_buffer_range, offset, offset + size)) || + !tc_is_buffer_busy(tc, tres, usage))) usage |= PIPE_MAP_UNSYNCHRONIZED; if (!(usage & PIPE_MAP_UNSYNCHRONIZED)) { -- 2.7.4