Useful to know which debug/perftest options were enabled when
a hang report is generated.

Signed-off-by: Samuel Pitoiset <[email protected]>
---
 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(+)

diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c
index 106c6e4f64..812e868c10 100644
--- a/src/amd/vulkan/radv_debug.c
+++ b/src/amd/vulkan/radv_debug.c
@@ -553,6 +553,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)
 {
@@ -585,6 +609,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 5101bd7cb2..58e6815124 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 31991a314c..191a81f77a 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.
  *
-- 
2.14.1

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to