[Mesa-dev] [PATCH 1/2] radeonsi: write wave information into GPU hang reports

Marek Olšák maraeo at gmail.com
Sat Feb 4 22:44:28 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

UMR is our new debugging tool. It must have +s set for Mesa to use it
without root privileges:
  sudo chmod +s .../umr

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
 src/gallium/drivers/radeonsi/si_debug.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_debug.c b/src/gallium/drivers/radeonsi/si_debug.c
index cc3617f..e4a350f 100644
--- a/src/gallium/drivers/radeonsi/si_debug.c
+++ b/src/gallium/drivers/radeonsi/si_debug.c
@@ -461,38 +461,58 @@ static void si_dump_descriptors(struct si_context *sctx,
 	if (type == PIPE_SHADER_VERTEX) {
 		si_dump_descriptor_list(&sctx->vertex_buffers, shader_name[type],
 					" - Vertex buffer", info->num_inputs, f);
 	}
 
 	for (unsigned i = 0; i < SI_NUM_SHADER_DESCS; ++i, ++descs)
 		si_dump_descriptor_list(descs, shader_name[type], elem_name[i],
 					num_elements[i], f);
 }
 
+static void si_dump_command(const char *title, const char *command, FILE *f)
+{
+	char line[2000];
+
+	FILE *p = popen(command, "r");
+	if (!p)
+		return;
+
+	fprintf(f, COLOR_YELLOW "%s: " COLOR_RESET "\n", title);
+	while (fgets(line, sizeof(line), p))
+		fputs(line, f);
+	fprintf(f, "\n\n");
+	pclose(p);
+}
+
 static void si_dump_debug_state(struct pipe_context *ctx, FILE *f,
 				unsigned flags)
 {
 	struct si_context *sctx = (struct si_context*)ctx;
 
 	if (flags & PIPE_DUMP_DEVICE_STATUS_REGISTERS)
 		si_dump_debug_registers(sctx, f);
 
 	if (flags & PIPE_DUMP_CURRENT_STATES)
 		si_dump_framebuffer(sctx, f);
 
 	if (flags & PIPE_DUMP_CURRENT_SHADERS) {
 		si_dump_shader(sctx->screen, &sctx->vs_shader, f);
 		si_dump_shader(sctx->screen, &sctx->tcs_shader, f);
 		si_dump_shader(sctx->screen, &sctx->tes_shader, f);
 		si_dump_shader(sctx->screen, &sctx->gs_shader, f);
 		si_dump_shader(sctx->screen, &sctx->ps_shader, f);
 
+		if (flags & PIPE_DUMP_DEVICE_STATUS_REGISTERS) {
+			si_dump_command("Active waves", "umr -wa | column -t", f);
+			si_dump_command("Wave information", "umr -O bits -wa", f);
+		}
+
 		si_dump_descriptor_list(&sctx->descriptors[SI_DESCS_RW_BUFFERS],
 					"", "RW buffers", SI_NUM_RW_BUFFERS, f);
 		si_dump_descriptors(sctx, &sctx->vs_shader, f);
 		si_dump_descriptors(sctx, &sctx->tcs_shader, f);
 		si_dump_descriptors(sctx, &sctx->tes_shader, f);
 		si_dump_descriptors(sctx, &sctx->gs_shader, f);
 		si_dump_descriptors(sctx, &sctx->ps_shader, f);
 	}
 
 	if (flags & PIPE_DUMP_LAST_COMMAND_BUFFER) {
-- 
2.7.4



More information about the mesa-dev mailing list