[Mesa-dev] [PATCH 2/6] radv/winsys: add RADEON_FLAG_READ_ONLY

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


Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
---
 src/amd/vulkan/radv_radeon_winsys.h           | 1 +
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h
index 45f58f063a..341e40505c 100644
--- a/src/amd/vulkan/radv_radeon_winsys.h
+++ b/src/amd/vulkan/radv_radeon_winsys.h
@@ -55,6 +55,7 @@ enum radeon_bo_flag { /* bitfield */
 	RADEON_FLAG_VA_UNCACHED =   (1 << 4),
 	RADEON_FLAG_IMPLICIT_SYNC = (1 << 5),
 	RADEON_FLAG_NO_INTERPROCESS_SHARING = (1 << 6),
+	RADEON_FLAG_READ_ONLY =     (1 << 7),
 };
 
 enum radeon_bo_usage { /* bitfield */
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index 7cefdc8173..603111d2eb 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -49,12 +49,14 @@ radv_amdgpu_bo_va_op(struct radv_amdgpu_winsys *ws,
 		     uint32_t ops)
 {
 	uint64_t flags = AMDGPU_VM_PAGE_READABLE |
-			 AMDGPU_VM_PAGE_WRITEABLE |
 			 AMDGPU_VM_PAGE_EXECUTABLE;
 
 	if ((bo_flags & RADEON_FLAG_VA_UNCACHED) && ws->info.chip_class >= GFX9)
 		flags |= AMDGPU_VM_MTYPE_UC;
 
+	if (!(bo_flags & RADEON_FLAG_READ_ONLY))
+		flags |= AMDGPU_VM_PAGE_WRITEABLE;
+
 	size = ALIGN(size, getpagesize());
 
 	return amdgpu_bo_va_op_raw(ws->dev, bo, offset, size, addr,
-- 
2.15.1



More information about the mesa-dev mailing list