[Mesa-dev] [PATCH 5/8] ddebug: dump driver state into a separate file

Nicolai Hähnle nhaehnle at gmail.com
Wed Apr 24 13:14:33 UTC 2019


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Due to asynchronous execution, it's not clear which of the draws the state
may refer to.

This also works around an issue encountered with radeonsi where dumping
the driver state itself caused a hang.
---
 src/gallium/auxiliary/driver_ddebug/dd_draw.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/src/gallium/auxiliary/driver_ddebug/dd_draw.c b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
index bda1891c49b..98e7a6bb99f 100644
--- a/src/gallium/auxiliary/driver_ddebug/dd_draw.c
+++ b/src/gallium/auxiliary/driver_ddebug/dd_draw.c
@@ -981,36 +981,43 @@ dd_report_hang(struct dd_context *dctx)
 
       FILE *f = fopen(name, "w");
       if (!f) {
          fprintf(stderr, "fopen failed\n");
       } else {
          fprintf(stderr, "%s\n", name);
 
          dd_write_header(f, dscreen->screen, record->draw_state.base.apitrace_call_number);
          dd_write_record(f, record);
 
-         if (!encountered_hang) {
-            dd_dump_driver_state(dctx, f, PIPE_DUMP_DEVICE_STATUS_REGISTERS);
-            dd_dump_dmesg(f);
-         }
-
          fclose(f);
       }
 
       if (top_not_reached)
          stop_output = true;
       encountered_hang = true;
    }
 
    if (num_later)
       fprintf(stderr, "... and %u additional draws.\n", num_later);
 
+   char name[512];
+   dd_get_debug_filename_and_mkdir(name, sizeof(name), false);
+   FILE *f = fopen(name, "w");
+   if (!f) {
+      fprintf(stderr, "fopen failed\n");
+   } else {
+      dd_write_header(f, dscreen->screen, 0);
+      dd_dump_driver_state(dctx, f, PIPE_DUMP_DEVICE_STATUS_REGISTERS);
+      dd_dump_dmesg(f);
+      fclose(f);
+   }
+
    fprintf(stderr, "\nDone.\n");
    dd_kill_process();
 }
 
 int
 dd_thread_main(void *input)
 {
    struct dd_context *dctx = (struct dd_context *)input;
    struct dd_screen *dscreen = dd_screen(dctx->base.screen);
    struct pipe_screen *screen = dscreen->screen;
-- 
2.20.1



More information about the mesa-dev mailing list