From 49c72d84c27b698bca73978869e15cad4414ab7e Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 11 Sep 2017 22:28:42 +0200 Subject: radv: dump the list of enabled options when a hang occured Useful to know which debug/perftest options were enabled when a hang report is generated. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_debug.c | 25 +++++++++++++++++++++++++ src/amd/vulkan/radv_device.c | 14 ++++++++++++++ src/amd/vulkan/radv_private.h | 7 +++++++ 3 files changed, 46 insertions(+) (limited to 'src/amd/vulkan') diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c index ec43366de7d..662e29694f5 100644 --- a/src/amd/vulkan/radv_debug.c +++ b/src/amd/vulkan/radv_debug.c @@ -581,6 +581,30 @@ radv_dump_dmesg(FILE *f) pclose(p); } +static void +radv_dump_enabled_options(struct radv_device *device, FILE *f) +{ + uint64_t mask; + + fprintf(f, "Enabled debug options: "); + + mask = device->debug_flags; + while (mask) { + int i = u_bit_scan64(&mask); + fprintf(f, "%s, ", radv_get_debug_option_name(i)); + } + fprintf(f, "\n"); + + fprintf(f, "Enabled perftest options: "); + + mask = device->instance->perftest_flags; + while (mask) { + int i = u_bit_scan64(&mask); + fprintf(f, "%s, ", radv_get_perftest_option_name(i)); + } + fprintf(f, "\n"); +} + static bool radv_gpu_hang_occured(struct radv_queue *queue, enum ring_type ring) { @@ -613,6 +637,7 @@ radv_check_gpu_hangs(struct radv_queue *queue, struct radeon_winsys_cs *cs) graphics_pipeline = radv_get_saved_graphics_pipeline(device); compute_pipeline = radv_get_saved_compute_pipeline(device); + radv_dump_enabled_options(device, stderr); radv_dump_dmesg(stderr); if (vm_fault_occurred) { diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c index 8de1bb3b0c1..c112453e395 100644 --- a/src/amd/vulkan/radv_device.c +++ b/src/amd/vulkan/radv_device.c @@ -417,12 +417,26 @@ static const struct debug_control radv_debug_options[] = { {NULL, 0} }; +const char * +radv_get_debug_option_name(int id) +{ + assert(id < ARRAY_SIZE(radv_debug_options) - 1); + return radv_debug_options[id].string; +} + static const struct debug_control radv_perftest_options[] = { {"nobatchchain", RADV_PERFTEST_NO_BATCHCHAIN}, {"sisched", RADV_PERFTEST_SISCHED}, {NULL, 0} }; +const char * +radv_get_perftest_option_name(int id) +{ + assert(id < ARRAY_SIZE(radv_debug_options) - 1); + return radv_perftest_options[id].string; +} + VkResult radv_CreateInstance( const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 76149afb075..e5092a8923b 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -744,6 +744,13 @@ extern const struct radv_dynamic_state default_dynamic_state; void radv_dynamic_state_copy(struct radv_dynamic_state *dest, const struct radv_dynamic_state *src, uint32_t copy_mask); + +const char * +radv_get_debug_option_name(int id); + +const char * +radv_get_perftest_option_name(int id); + /** * Attachment state when recording a renderpass instance. * -- cgit v1.2.3