diff options
-rw-r--r-- | src/amd/vulkan/radv_debug.h | 1 | ||||
-rw-r--r-- | src/amd/vulkan/radv_device.c | 1 | ||||
-rw-r--r-- | src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c | 3 | ||||
-rw-r--r-- | src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 1 | ||||
-rw-r--r-- | src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h | 1 |
5 files changed, 7 insertions, 0 deletions
diff --git a/src/amd/vulkan/radv_debug.h b/src/amd/vulkan/radv_debug.h index 18ef7e7e0a..e45c987e6a 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 a68278ff43..6b96a3da4a 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 1c56c55907..c8b67a095b 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 a6dedfa5a1..36606defb7 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 f84f62cb22..66c93475e5 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; |