radv/winsys: add RADEON_FLAG_READ_ONLY
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Tue, 5 Dec 2017 12:57:07 +0000 (13:57 +0100)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 8 Jan 2018 20:24:43 +0000 (21:24 +0100)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_radeon_winsys.h
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c

index 45f58f063a471c9c7f08cc4b44ec3be6a9e9f724..341e40505ca4a0284397ddfe59b7bae7458b8bfc 100644 (file)
@@ -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 */
index 7cefdc8173ea69c7deb0dab3d730fb2f215d70b5..603111d2ebc03154d7526c9b84ac6f3dfb51db1f 100644 (file)
@@ -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,