radeonsi: skip an unnecessary mutex lock for L2 prefetches
authorMarek Olšák <marek.olsak@amd.com>
Tue, 17 Jan 2017 19:10:15 +0000 (20:10 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 18 Jan 2017 18:51:31 +0000 (19:51 +0100)
the mutex lock is inside util_range_add.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_cp_dma.c

index 06e4899a887f8072c2d92f6adf7603eaa5c2035b..582e5995164034b5ac7f6e4b47fbb7dcdf9c8c48 100644 (file)
@@ -315,11 +315,13 @@ void si_copy_buffer(struct si_context *sctx,
        if (!size)
                return;
 
-       /* Mark the buffer range of destination as valid (initialized),
-        * so that transfer_map knows it should wait for the GPU when mapping
-        * that range. */
-       util_range_add(&r600_resource(dst)->valid_buffer_range, dst_offset,
-                      dst_offset + size);
+       if (dst != src || dst_offset != src_offset) {
+               /* Mark the buffer range of destination as valid (initialized),
+                * so that transfer_map knows it should wait for the GPU when mapping
+                * that range. */
+               util_range_add(&r600_resource(dst)->valid_buffer_range, dst_offset,
+                              dst_offset + size);
+       }
 
        dst_offset += r600_resource(dst)->gpu_address;
        src_offset += r600_resource(src)->gpu_address;