From 6f0530ecfe9cfe4349dab197397df92dd967c50c Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Thu, 24 May 2018 13:09:12 +0200 Subject: [PATCH] radv: rework how shaders are dumped when generating a hang report Use a flag for the active stages instead. Signed-off-by: Samuel Pitoiset Reviewed-by: Bas Nieuwenhuizen --- src/amd/vulkan/radv_debug.c | 41 ++++++++++++++----------------------- 1 file changed, 15 insertions(+), 26 deletions(-) diff --git a/src/amd/vulkan/radv_debug.c b/src/amd/vulkan/radv_debug.c index 72c7c39fcb8..5cdbf5bea9a 100644 --- a/src/amd/vulkan/radv_debug.c +++ b/src/amd/vulkan/radv_debug.c @@ -442,28 +442,22 @@ radv_dump_annotated_shader(struct radv_shader_variant *shader, static void radv_dump_annotated_shaders(struct radv_pipeline *pipeline, - struct radv_shader_variant *compute_shader, - FILE *f) + VkShaderStageFlagBits active_stages, FILE *f) { struct ac_wave_info waves[AC_MAX_WAVES_PER_CHIP]; unsigned num_waves = ac_get_wave_info(waves); - unsigned mask; fprintf(f, COLOR_CYAN "The number of active waves = %u" COLOR_RESET "\n\n", num_waves); /* Dump annotated active graphics shaders. */ - mask = pipeline->active_stages; - while (mask) { - int stage = u_bit_scan(&mask); + while (active_stages) { + int stage = u_bit_scan(&active_stages); radv_dump_annotated_shader(pipeline->shaders[stage], stage, waves, num_waves, f); } - radv_dump_annotated_shader(compute_shader, MESA_SHADER_COMPUTE, waves, - num_waves, f); - /* Print waves executing shaders that are not currently bound. */ unsigned i; bool found = false; @@ -521,47 +515,42 @@ radv_dump_shader(struct radv_pipeline *pipeline, static void radv_dump_shaders(struct radv_pipeline *pipeline, - struct radv_shader_variant *compute_shader, FILE *f) + VkShaderStageFlagBits active_stages, FILE *f) { - unsigned mask; - /* Dump active graphics shaders. */ - mask = pipeline->active_stages; - while (mask) { - int stage = u_bit_scan(&mask); + while (active_stages) { + int stage = u_bit_scan(&active_stages); radv_dump_shader(pipeline, pipeline->shaders[stage], stage, f); } - - radv_dump_shader(pipeline, compute_shader, MESA_SHADER_COMPUTE, f); } static void radv_dump_graphics_state(struct radv_pipeline *graphics_pipeline, struct radv_pipeline *compute_pipeline, FILE *f) { - struct radv_shader_variant *compute_shader = - compute_pipeline ? compute_pipeline->shaders[MESA_SHADER_COMPUTE] : NULL; + VkShaderStageFlagBits active_stages; if (!graphics_pipeline) return; - radv_dump_shaders(graphics_pipeline, compute_shader, f); - radv_dump_annotated_shaders(graphics_pipeline, compute_shader, f); + active_stages = graphics_pipeline->active_stages; + + radv_dump_shaders(graphics_pipeline, active_stages, f); + radv_dump_annotated_shaders(graphics_pipeline, active_stages, f); radv_dump_descriptors(graphics_pipeline, f); } static void radv_dump_compute_state(struct radv_pipeline *compute_pipeline, FILE *f) { + VkShaderStageFlagBits active_stages = VK_SHADER_STAGE_COMPUTE_BIT; + if (!compute_pipeline) return; - radv_dump_shaders(compute_pipeline, - compute_pipeline->shaders[MESA_SHADER_COMPUTE], f); - radv_dump_annotated_shaders(compute_pipeline, - compute_pipeline->shaders[MESA_SHADER_COMPUTE], - f); + radv_dump_shaders(compute_pipeline, active_stages, f); + radv_dump_annotated_shaders(compute_pipeline, active_stages, f); radv_dump_descriptors(compute_pipeline, f); } -- 2.30.2