gallium/u_threaded: disallow discard_range if map_buffer is unsynchronized
authorMarek Olšák <marek.olsak@amd.com>
Fri, 25 Aug 2017 13:34:17 +0000 (15:34 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Mon, 28 Aug 2017 19:45:32 +0000 (21:45 +0200)
The discard range codepath takes precedence, so if we get both
unsynchronized and discard_range, choose unsynchronized.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/util/u_threaded_context.c

index cbcd4056b2976dadb047af815185552dfe4fb151..8e3cc34f1041fd98abd79b82e686723da8f539ad 100644 (file)
@@ -1337,8 +1337,10 @@ tc_improve_map_buffer_flags(struct threaded_context *tc,
       usage &= ~PIPE_TRANSFER_DISCARD_RANGE;
 
    /* Unsychronized buffer mappings don't have to synchronize the thread. */
-   if (usage & PIPE_TRANSFER_UNSYNCHRONIZED)
+   if (usage & PIPE_TRANSFER_UNSYNCHRONIZED) {
+      usage &= ~PIPE_TRANSFER_DISCARD_RANGE;
       usage |= TC_TRANSFER_MAP_THREADED_UNSYNC; /* notify the driver */
+   }
 
    /* Never invalidate inside the driver and never infer "unsynchronized". */
    return usage |