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 <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
Dave Airlie 2017-02-15 01:17:02 +00:00
parent 6eade342eb
commit 310fca375c
5 changed files with 7 additions and 0 deletions

View file

@ -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 {

View file

@ -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}
};

View file

@ -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");

View file

@ -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);

View file

@ -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;