OSDN Git Service

gallium/radeon: if we can't discard a whole resource, discard the range instead
authorMarek Olšák <marek.olsak@amd.com>
Thu, 25 Feb 2016 22:42:59 +0000 (23:42 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 9 Mar 2016 14:02:26 +0000 (15:02 +0100)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeon/r600_buffer_common.c

index fb3a80e..70c8eb2 100644 (file)
@@ -312,13 +312,17 @@ static void *r600_buffer_transfer_map(struct pipe_context *ctx,
                if (r600_invalidate_buffer(rctx, rbuffer)) {
                        /* At this point, the buffer is always idle. */
                        usage |= PIPE_TRANSFER_UNSYNCHRONIZED;
+               } else {
+                       /* Fall back to a temporary buffer. */
+                       usage |= PIPE_TRANSFER_DISCARD_RANGE;
                }
        }
-       else if ((usage & PIPE_TRANSFER_DISCARD_RANGE) &&
-                !(usage & (PIPE_TRANSFER_UNSYNCHRONIZED |
-                           PIPE_TRANSFER_PERSISTENT)) &&
-                !(rscreen->debug_flags & DBG_NO_DISCARD_RANGE) &&
-                r600_can_dma_copy_buffer(rctx, box->x, 0, box->width)) {
+
+       if ((usage & PIPE_TRANSFER_DISCARD_RANGE) &&
+           !(usage & (PIPE_TRANSFER_UNSYNCHRONIZED |
+                      PIPE_TRANSFER_PERSISTENT)) &&
+           !(rscreen->debug_flags & DBG_NO_DISCARD_RANGE) &&
+           r600_can_dma_copy_buffer(rctx, box->x, 0, box->width)) {
                assert(usage & PIPE_TRANSFER_WRITE);
 
                /* Check if mapping this buffer would cause waiting for the GPU. */