radv: dump the list of enabled options when a hang occured
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Mon, 11 Sep 2017 20:28:42 +0000 (22:28 +0200)
committerSamuel Pitoiset <samuel.pitoiset@gmail.com>
Thu, 14 Sep 2017 08:37:57 +0000 (10:37 +0200)
Useful to know which debug/perftest options were enabled when
a hang report is generated.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/vulkan/radv_debug.c
src/amd/vulkan/radv_device.c
src/amd/vulkan/radv_private.h

index ec43366de7d75c271478a5174d310887e3413879..662e29694f594ad2ffc6ab9d90cc37126bab18bd 100644 (file)
@@ -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) {
index 8de1bb3b0c1af948d9351eead2a9b8fd30589a5d..c112453e395d668e88d3d3db0a92ea691685343c 100644 (file)
@@ -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,
index 76149afb0751067912848952539f53afe00d305f..e5092a8923b01381efb97c09ad1da686078a6ce6 100644 (file)
@@ -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.
  *