summaryrefslogtreecommitdiffstats
path: root/src/amd/vulkan/winsys
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-02-15 01:17:02 +0000
committerDave Airlie <[email protected]>2017-09-12 05:37:15 +1000
commit310fca375c13c52fbcb11cab148ca1bf0ddd2f69 (patch)
treee4716263f9c23f5c682e8938ab64b5fc13235fdb /src/amd/vulkan/winsys
parent6eade342eb223313242c1c2a7615b6bd75036087 (diff)
radv: add debug flags to zero vram allocations.
We are seeing apps that sometimes rely on Windows behaviour, add a flag to rule out vram zeroing. Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Samuel Pitoiset <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd/vulkan/winsys')
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c3
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c1
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h1
3 files changed, 5 insertions, 0 deletions
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index 1c56c559072..c8b67a095b7 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -331,6 +331,9 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
if (flags & RADEON_FLAG_GTT_WC)
request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;
+ /* 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;
r = amdgpu_bo_alloc(ws->dev, &request, &buf_handle);
if (r) {
fprintf(stderr, "amdgpu: Failed to allocate a buffer:\n");
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
index a6dedfa5a17..36606defb77 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
@@ -106,6 +106,7 @@ radv_amdgpu_winsys_create(int fd, uint64_t debug_flags, uint64_t perftest_flags)
if (debug_flags & RADV_DEBUG_NO_IBS)
ws->use_ib_bos = false;
+ ws->zero_all_vram_allocs = debug_flags & RADV_DEBUG_ZERO_VRAM;
ws->batchchain = !(perftest_flags & RADV_PERFTEST_NO_BATCHCHAIN);
LIST_INITHEAD(&ws->global_bo_list);
pthread_mutex_init(&ws->global_bo_list_lock, NULL);
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
index f84f62cb224..66c93475e5e 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
@@ -45,6 +45,7 @@ struct radv_amdgpu_winsys {
bool debug_all_bos;
bool batchchain;
bool use_ib_bos;
+ bool zero_all_vram_allocs;
unsigned num_buffers;
pthread_mutex_t global_bo_list_lock;