diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c index eb2e512144d..8f3bd71c064 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)) {