radv: rework how shaders are dumped when generating a hang report

Use a flag for the active stages instead.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Samuel Pitoiset
2018-05-24 13:09:12 +02:00
parent 8c406f0b4d
commit 6f0530ecfe

View File

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