[Mesa-dev] [PATCH 5/6] radv: make descriptor BOs read-only for the GPU

Samuel Pitoiset samuel.pitoiset at gmail.com
Thu Jan 4 17:39:49 UTC 2018


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_descriptor_set.c | 6 ++++--
 src/amd/vulkan/radv_device.c         | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_descriptor_set.c b/src/amd/vulkan/radv_descriptor_set.c
index e815939a67..19a560a6b3 100644
--- a/src/amd/vulkan/radv_descriptor_set.c
+++ b/src/amd/vulkan/radv_descriptor_set.c
@@ -454,8 +454,10 @@ VkResult radv_CreateDescriptorPool(
 	}
 
 	if (bo_size) {
-		pool->bo = device->ws->buffer_create(device->ws, bo_size,
-							32, RADEON_DOMAIN_VRAM, RADEON_FLAG_NO_INTERPROCESS_SHARING);
+		pool->bo = device->ws->buffer_create(device->ws, bo_size, 32,
+						     RADEON_DOMAIN_VRAM,
+						     RADEON_FLAG_NO_INTERPROCESS_SHARING |
+						     RADEON_FLAG_READ_ONLY);
 		pool->mapped_ptr = (uint8_t*)device->ws->buffer_map(pool->bo);
 	}
 	pool->size = bo_size;
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index cbf8f5cf49..5f78af624b 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -1603,7 +1603,9 @@ radv_get_preamble_cs(struct radv_queue *queue,
 		                                                 size,
 		                                                 4096,
 		                                                 RADEON_DOMAIN_VRAM,
-		                                                 RADEON_FLAG_CPU_ACCESS|RADEON_FLAG_NO_INTERPROCESS_SHARING);
+		                                                 RADEON_FLAG_CPU_ACCESS |
+								 RADEON_FLAG_NO_INTERPROCESS_SHARING |
+								 RADEON_FLAG_READ_ONLY);
 		if (!descriptor_bo)
 			goto fail;
 	} else
-- 
2.15.1



More information about the mesa-dev mailing list