[Mesa-dev] [PATCH 1/4] ddebug: write out final driver log messages with GALLIUM_DDEBUG=always

Nicolai Hähnle nhaehnle at gmail.com
Mon Sep 11 15:06:31 UTC 2017


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

If the last operation happens to be a non-draw, such as a
transfer_map that triggers a decompress blit, there may be
interesting messages left in the driver log.
---
 src/gallium/drivers/ddebug/dd_context.c | 13 ++++++++++++-
 src/gallium/drivers/ddebug/dd_draw.c    |  2 +-
 src/gallium/drivers/ddebug/dd_pipe.h    |  2 ++
 3 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/ddebug/dd_context.c b/src/gallium/drivers/ddebug/dd_context.c
index fc44a4bd1b9..2abbff933f6 100644
--- a/src/gallium/drivers/ddebug/dd_context.c
+++ b/src/gallium/drivers/ddebug/dd_context.c
@@ -577,22 +577,33 @@ dd_context_destroy(struct pipe_context *_pipe)
       thrd_join(dctx->thread, NULL);
       mtx_destroy(&dctx->mutex);
       assert(!dctx->records);
    }
 
    if (dctx->fence) {
       pipe->transfer_unmap(pipe, dctx->fence_transfer);
       pipe_resource_reference(&dctx->fence, NULL);
    }
 
-   if (pipe->set_log_context)
+   if (pipe->set_log_context) {
       pipe->set_log_context(pipe, NULL);
+
+      if (dd_screen(dctx->base.screen)->mode == DD_DUMP_ALL_CALLS) {
+         FILE *f = dd_get_file_stream(dd_screen(dctx->base.screen), 0);
+         if (f) {
+            fprintf(f, "Remainder of driver log:\n\n");
+         }
+
+         u_log_new_page_print(&dctx->log, f);
+         fclose(f);
+      }
+   }
    u_log_context_destroy(&dctx->log);
 
    pipe->destroy(pipe);
    FREE(dctx);
 }
 
 
 /********************************************************************
  * transfer
  */
diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c
index 4bf13bd7e46..aec9332d903 100644
--- a/src/gallium/drivers/ddebug/dd_draw.c
+++ b/src/gallium/drivers/ddebug/dd_draw.c
@@ -32,21 +32,21 @@
 #include "util/u_framebuffer.h"
 #include "util/u_helpers.h"
 #include "util/u_inlines.h"
 #include "util/u_memory.h"
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_scan.h"
 #include "os/os_time.h"
 #include <inttypes.h>
 
 
-static FILE *
+FILE *
 dd_get_file_stream(struct dd_screen *dscreen, unsigned apitrace_call_number)
 {
    struct pipe_screen *screen = dscreen->screen;
    char cmd_line[4096];
 
    FILE *f = dd_get_debug_file(dscreen->verbose);
    if (!f)
       return NULL;
 
    if (os_get_command_line(cmd_line, sizeof(cmd_line)))
diff --git a/src/gallium/drivers/ddebug/dd_pipe.h b/src/gallium/drivers/ddebug/dd_pipe.h
index 70b9ae8ae82..252dbffac86 100644
--- a/src/gallium/drivers/ddebug/dd_pipe.h
+++ b/src/gallium/drivers/ddebug/dd_pipe.h
@@ -267,20 +267,22 @@ struct dd_context
 
 
 struct pipe_context *
 dd_context_create(struct dd_screen *dscreen, struct pipe_context *pipe);
 
 void
 dd_init_draw_functions(struct dd_context *dctx);
 int
 dd_thread_pipelined_hang_detect(void *input);
 
+FILE *
+dd_get_file_stream(struct dd_screen *dscreen, unsigned apitrace_call_number);
 
 static inline struct dd_context *
 dd_context(struct pipe_context *pipe)
 {
    return (struct dd_context *)pipe;
 }
 
 static inline struct dd_screen *
 dd_screen(struct pipe_screen *screen)
 {
-- 
2.11.0



More information about the mesa-dev mailing list