[Mesa-dev] [PATCH 2/2] gallium/u_threaded: rename IGNORE_VALID_RANGE -> NO_INFER_UNSYNCHRONIZED

Marek Olšák maraeo at gmail.com
Fri Aug 25 13:41:32 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/auxiliary/util/u_threaded_context.c | 4 ++--
 src/gallium/auxiliary/util/u_threaded_context.h | 4 ++--
 src/gallium/drivers/radeon/r600_buffer_common.c | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_threaded_context.c b/src/gallium/auxiliary/util/u_threaded_context.c
index 8e3cc34..043d4e6 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.c
+++ b/src/gallium/auxiliary/util/u_threaded_context.c
@@ -1293,21 +1293,21 @@ tc_improve_map_buffer_flags(struct threaded_context *tc,
        * result in an incorrect behavior with the threaded context.
        */
       return usage;
    }
 
    /* Handle CPU reads trivially. */
    if (usage & PIPE_TRANSFER_READ) {
       /* Drivers aren't allowed to do buffer invalidations. */
       return (usage & ~PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) |
              TC_TRANSFER_MAP_NO_INVALIDATE |
-             TC_TRANSFER_MAP_IGNORE_VALID_RANGE;
+             TC_TRANSFER_MAP_NO_INFER_UNSYNCHRONIZED;
    }
 
    /* See if the buffer range being mapped has never been initialized,
     * in which case it can be mapped unsynchronized. */
    if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED) &&
        !tres->is_shared &&
        !util_ranges_intersect(&tres->valid_buffer_range, offset, offset + size))
       usage |= PIPE_TRANSFER_UNSYNCHRONIZED;
 
    if (!(usage & PIPE_TRANSFER_UNSYNCHRONIZED)) {
@@ -1338,21 +1338,21 @@ tc_improve_map_buffer_flags(struct threaded_context *tc,
 
    /* Unsychronized buffer mappings don't have to synchronize the thread. */
    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 |
           TC_TRANSFER_MAP_NO_INVALIDATE |
-          TC_TRANSFER_MAP_IGNORE_VALID_RANGE;
+          TC_TRANSFER_MAP_NO_INFER_UNSYNCHRONIZED;
 }
 
 static void *
 tc_transfer_map(struct pipe_context *_pipe,
                 struct pipe_resource *resource, unsigned level,
                 unsigned usage, const struct pipe_box *box,
                 struct pipe_transfer **transfer)
 {
    struct threaded_context *tc = threaded_context(_pipe);
    struct threaded_resource *tres = threaded_resource(resource);
diff --git a/src/gallium/auxiliary/util/u_threaded_context.h b/src/gallium/auxiliary/util/u_threaded_context.h
index 0742fae..8977b03 100644
--- a/src/gallium/auxiliary/util/u_threaded_context.h
+++ b/src/gallium/auxiliary/util/u_threaded_context.h
@@ -87,21 +87,21 @@
  *
  * 1) If transfer_map has PIPE_TRANSFER_UNSYNCHRONIZED, the call is made
  *    in the non-driver thread without flushing the queue. The driver will
  *    receive TC_TRANSFER_MAP_THREADED_UNSYNC in addition to PIPE_TRANSFER_-
  *    UNSYNCHRONIZED to indicate this.
  *    Note that transfer_unmap is always enqueued and called from the driver
  *    thread.
  *
  * 2) The driver isn't allowed to infer unsychronized mappings by tracking
  *    the valid buffer range. The threaded context always sends TC_TRANSFER_-
- *    MAP_IGNORE_VALID_RANGE to indicate this. Ignoring the flag will lead
+ *    MAP_NO_INFER_UNSYNCHRONIZED to indicate this. Ignoring the flag will lead
  *    to failures.
  *    The threaded context does its own detection of unsynchronized mappings.
  *
  * 3) The driver isn't allowed to do buffer invalidations by itself under any
  *    circumstances. This is necessary for unsychronized maps to map the latest
  *    version of the buffer. (because invalidations can be queued, while
  *    unsychronized maps are not queued and they should return the latest
  *    storage after invalidation). The threaded context always sends
  *    TC_TRANSFER_MAP_NO_INVALIDATE into transfer_map and buffer_subdata to
  *    indicate this. Ignoring the flag will lead to failures.
@@ -159,21 +159,21 @@
 #define U_THREADED_CONTEXT_H
 
 #include "pipe/p_context.h"
 #include "pipe/p_state.h"
 #include "util/u_queue.h"
 #include "util/u_range.h"
 #include "util/slab.h"
 
 /* These are transfer flags sent to drivers. */
 /* Never infer whether it's safe to use unsychronized mappings: */
-#define TC_TRANSFER_MAP_IGNORE_VALID_RANGE   (1u << 29)
+#define TC_TRANSFER_MAP_NO_INFER_UNSYNCHRONIZED (1u << 29)
 /* Don't invalidate buffers: */
 #define TC_TRANSFER_MAP_NO_INVALIDATE        (1u << 30)
 /* transfer_map is called from a non-driver thread: */
 #define TC_TRANSFER_MAP_THREADED_UNSYNC      (1u << 31)
 
 /* Size of the queue = number of batch slots in memory.
  * - 1 batch is always idle and records new commands
  * - 1 batch is being executed
  * so the queue size is TC_MAX_BATCHES - 2 = number of waiting batches.
  *
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c
index dd1c209..076faa9 100644
--- a/src/gallium/drivers/radeon/r600_buffer_common.c
+++ b/src/gallium/drivers/radeon/r600_buffer_common.c
@@ -376,21 +376,21 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
 	 *        page will be used.
 	 *
 	 * So don't ever use staging buffers.
 	 */
 	if (rbuffer->b.is_user_ptr)
 		usage |= PIPE_TRANSFER_PERSISTENT;
 
 	/* See if the buffer range being mapped has never been initialized,
 	 * in which case it can be mapped unsynchronized. */
 	if (!(usage & (PIPE_TRANSFER_UNSYNCHRONIZED |
-		       TC_TRANSFER_MAP_IGNORE_VALID_RANGE)) &&
+		       TC_TRANSFER_MAP_NO_INFER_UNSYNCHRONIZED)) &&
 	    usage & PIPE_TRANSFER_WRITE &&
 	    !rbuffer->b.is_shared &&
 	    !util_ranges_intersect(&rbuffer->valid_buffer_range, box->x, box->x + box->width)) {
 		usage |= PIPE_TRANSFER_UNSYNCHRONIZED;
 	}
 
 	/* If discarding the entire range, discard the whole resource instead. */
 	if (usage & PIPE_TRANSFER_DISCARD_RANGE &&
 	    box->x == 0 && box->width == resource->width0) {
 		usage |= PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE;
-- 
2.7.4



More information about the mesa-dev mailing list