[Mesa-dev] [PATCH 1/2] gallium/ddebug: make 'noflush' also affect 'always' mode

Nicolai Hähnle nhaehnle at gmail.com
Mon Jan 25 09:00:31 PST 2016


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

This changes the default behavior of 'always' mode to be consistent with
hang detection mode.

I have used this to more easily compare dumped command streams using diff.
---
 src/gallium/drivers/ddebug/dd_draw.c   |  3 +++
 src/gallium/drivers/ddebug/dd_screen.c | 12 +++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/ddebug/dd_draw.c b/src/gallium/drivers/ddebug/dd_draw.c
index 0d7ee9a..de484ab 100644
--- a/src/gallium/drivers/ddebug/dd_draw.c
+++ b/src/gallium/drivers/ddebug/dd_draw.c
@@ -602,6 +602,7 @@ static void
 dd_after_draw(struct dd_context *dctx, struct dd_call *call)
 {
    struct dd_screen *dscreen = dd_screen(dctx->base.screen);
+   struct pipe_context *pipe = dctx->pipe;
 
    if (dctx->num_draw_calls >= dscreen->skip_count) {
       switch (dscreen->mode) {
@@ -615,6 +616,8 @@ dd_after_draw(struct dd_context *dctx, struct dd_call *call)
          }
          break;
       case DD_DUMP_ALL_CALLS:
+         if (!dscreen->no_flush)
+            pipe->flush(pipe, NULL, 0);
          dd_dump_call(dctx, call, 0);
          break;
       default:
diff --git a/src/gallium/drivers/ddebug/dd_screen.c b/src/gallium/drivers/ddebug/dd_screen.c
index 2716845..ab87d25 100644
--- a/src/gallium/drivers/ddebug/dd_screen.c
+++ b/src/gallium/drivers/ddebug/dd_screen.c
@@ -270,7 +270,7 @@ ddebug_screen_create(struct pipe_screen *screen)
 {
    struct dd_screen *dscreen;
    const char *option = debug_get_option("GALLIUM_DDEBUG", NULL);
-   bool dump_always = option && !strcmp(option, "always");
+   bool dump_always = option && !strncmp(option, "always", 6);
    bool no_flush = option && strstr(option, "noflush");
    bool help = option && !strcmp(option, "help");
    unsigned timeout = 0;
@@ -280,15 +280,17 @@ ddebug_screen_create(struct pipe_screen *screen)
       puts("");
       puts("Usage:");
       puts("");
-      puts("  GALLIUM_DDEBUG=always");
-      puts("    Dump context and driver information after every draw call into");
+      puts("  GALLIUM_DDEBUG=\"always [noflush]\"");
+      puts("    Flush and dump context and driver information after every draw call into");
       puts("    $HOME/"DD_DIR"/.");
       puts("");
-      puts("  GALLIUM_DDEBUG=[timeout in ms] noflush");
+      puts("  GALLIUM_DDEBUG=\"[timeout in ms] [noflush]\"");
       puts("    Flush and detect a device hang after every draw call based on the given");
       puts("    fence timeout and dump context and driver information into");
       puts("    $HOME/"DD_DIR"/ when a hang is detected.");
-      puts("    If 'noflush' is specified, only detect hangs in pipe->flush.");
+      puts("");
+      puts("  If 'noflush' is specified, do not flush on every draw call. In hang");
+      puts("  detection mode, this only detect hangs in pipe->flush.");
       puts("");
       puts("  GALLIUM_DDEBUG_SKIP=[count]");
       puts("    Skip flush and hang detection for the given initial number of draw calls.");
-- 
2.5.0



More information about the mesa-dev mailing list