radv/winsys: make IBs read-only for the GPU
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 5 Dec 2017 13:28:46 +0000 (14:28 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 8 Jan 2018 20:24:45 +0000 (21:24 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c

index 4578a9b54849837b1c5d7b9d9b19728a701ade44..0ee56f91447cabef6207a41ba2f1be473382ac45 100644 (file)
@@ -200,9 +200,10 @@ radv_amdgpu_cs_create(struct radeon_winsys *ws,
 
        if (cs->ws->use_ib_bos) {
                cs->ib_buffer = ws->buffer_create(ws, ib_size, 0,
-                                               RADEON_DOMAIN_GTT,
-                                               RADEON_FLAG_CPU_ACCESS|
-                                                 RADEON_FLAG_NO_INTERPROCESS_SHARING);
+                                                 RADEON_DOMAIN_GTT,
+                                                 RADEON_FLAG_CPU_ACCESS |
+                                                 RADEON_FLAG_NO_INTERPROCESS_SHARING |
+                                                 RADEON_FLAG_READ_ONLY);
                if (!cs->ib_buffer) {
                        free(cs);
                        return NULL;
@@ -287,8 +288,9 @@ static void radv_amdgpu_cs_grow(struct radeon_winsys_cs *_cs, size_t min_size)
 
        cs->ib_buffer = cs->ws->base.buffer_create(&cs->ws->base, ib_size, 0,
                                                   RADEON_DOMAIN_GTT,
-                                                  RADEON_FLAG_CPU_ACCESS|
-                                                  RADEON_FLAG_NO_INTERPROCESS_SHARING);
+                                                  RADEON_FLAG_CPU_ACCESS |
+                                                  RADEON_FLAG_NO_INTERPROCESS_SHARING |
+                                                  RADEON_FLAG_READ_ONLY);
 
        if (!cs->ib_buffer) {
                cs->base.cdw = 0;
@@ -877,7 +879,10 @@ static int radv_amdgpu_winsys_cs_submit_sysmem(struct radeon_winsys_ctx *_ctx,
                }
                assert(cnt);
 
-               bo = ws->buffer_create(ws, 4 * size, 4096, RADEON_DOMAIN_GTT, RADEON_FLAG_CPU_ACCESS|RADEON_FLAG_NO_INTERPROCESS_SHARING);
+               bo = ws->buffer_create(ws, 4 * size, 4096, RADEON_DOMAIN_GTT,
+                                      RADEON_FLAG_CPU_ACCESS |
+                                      RADEON_FLAG_NO_INTERPROCESS_SHARING |
+                                      RADEON_FLAG_READ_ONLY);
                ptr = ws->buffer_map(bo);
 
                if (preamble_cs) {