summaryrefslogtreecommitdiffstats
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
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]>
-rw-r--r--src/amd/vulkan/radv_debug.h1
-rw-r--r--src/amd/vulkan/radv_device.c1
-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
5 files changed, 7 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h
index 18ef7e7e0a8..e45c987e6a3 100644
--- a/src/amd/vulkan/radv_debug.h
+++ b/src/amd/vulkan/radv_debug.h
@@ -39,6 +39,7 @@ enum {
RADV_DEBUG_NO_IBS = 0x200,
RADV_DEBUG_DUMP_SPIRV = 0x400,
RADV_DEBUG_VM_FAULTS = 0x800,
+ RADV_DEBUG_ZERO_VRAM = 0x1000,
};
enum {
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index a68278ff439..6b96a3da4a3 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -412,6 +412,7 @@ static const struct debug_control radv_debug_options[] = {
{"noibs", RADV_DEBUG_NO_IBS},
{"spirv", RADV_DEBUG_DUMP_SPIRV},
{"vmfaults", RADV_DEBUG_VM_FAULTS},
+ {"zerovram", RADV_DEBUG_ZERO_VRAM},
{NULL, 0}
};
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;