aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/amd/vulkan/radv_radeon_winsys.h1
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c7
2 files changed, 6 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h
index 5c7b1ab5118..59c628b730f 100644
--- a/src/amd/vulkan/radv_radeon_winsys.h
+++ b/src/amd/vulkan/radv_radeon_winsys.h
@@ -61,6 +61,7 @@ enum radeon_bo_flag { /* bitfield */
RADEON_FLAG_READ_ONLY = (1 << 7),
RADEON_FLAG_32BIT = (1 << 8),
RADEON_FLAG_PREFER_LOCAL_BO = (1 << 9),
+ RADEON_FLAG_ZERO_VRAM = (1 << 10),
};
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 9e19b7b1f89..c07641d6ab8 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -382,8 +382,11 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
}
/* this won't do anything on pre 4.9 kernels */
- if (ws->zero_all_vram_allocs && (initial_domain & RADEON_DOMAIN_VRAM))
- request.flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED;
+ if (initial_domain & RADEON_DOMAIN_VRAM) {
+ if (ws->zero_all_vram_allocs || (flags & RADEON_FLAG_ZERO_VRAM))
+ request.flags |= AMDGPU_GEM_CREATE_VRAM_CLEARED;
+ }
+
r = amdgpu_bo_alloc(ws->dev, &request, &buf_handle);
if (r) {
fprintf(stderr, "amdgpu: Failed to allocate a buffer:\n");