Mesa (master): vc4: Add a debug flag for waiting for sync on submit.

Eric Anholt anholt at kemper.freedesktop.org
Fri Dec 5 19:19:20 UTC 2014


Module: Mesa
Branch: master
Commit: 34cf86bdc48e1b350437fe831fedd4632f4e06c2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=34cf86bdc48e1b350437fe831fedd4632f4e06c2

Author: Eric Anholt <eric at anholt.net>
Date:   Tue Dec  2 13:18:56 2014 -0800

vc4: Add a debug flag for waiting for sync on submit.

This is nice when you're tracking down which command list is hanging the
GPU.

---

 src/gallium/drivers/vc4/vc4_context.c |    8 ++++++++
 src/gallium/drivers/vc4/vc4_screen.c  |    2 ++
 src/gallium/drivers/vc4/vc4_screen.h  |    1 +
 3 files changed, 11 insertions(+)

diff --git a/src/gallium/drivers/vc4/vc4_context.c b/src/gallium/drivers/vc4/vc4_context.c
index bb30c0e..b26c071 100644
--- a/src/gallium/drivers/vc4/vc4_context.c
+++ b/src/gallium/drivers/vc4/vc4_context.c
@@ -324,6 +324,14 @@ vc4_flush(struct pipe_context *pctx)
 
         vc4->last_emit_seqno = submit.seqno;
 
+        if (vc4_debug & VC4_DEBUG_ALWAYS_SYNC) {
+                if (!vc4_wait_seqno(vc4->screen, vc4->last_emit_seqno,
+                                    PIPE_TIMEOUT_INFINITE)) {
+                        fprintf(stderr, "Wait failed.\n");
+                        abort();
+                }
+        }
+
         vc4_reset_cl(&vc4->bcl);
         vc4_reset_cl(&vc4->rcl);
         vc4_reset_cl(&vc4->shader_rec);
diff --git a/src/gallium/drivers/vc4/vc4_screen.c b/src/gallium/drivers/vc4/vc4_screen.c
index abd44ee..18451bd 100644
--- a/src/gallium/drivers/vc4/vc4_screen.c
+++ b/src/gallium/drivers/vc4/vc4_screen.c
@@ -52,6 +52,8 @@ static const struct debug_named_value debug_options[] = {
           "Skip actual hardware execution of commands" },
         { "always_flush", VC4_DEBUG_ALWAYS_FLUSH,
           "Flush after each draw call" },
+        { "always_sync", VC4_DEBUG_ALWAYS_SYNC,
+          "Wait for finish after each flush" },
         { NULL }
 };
 
diff --git a/src/gallium/drivers/vc4/vc4_screen.h b/src/gallium/drivers/vc4/vc4_screen.h
index ba07490..3819bda 100644
--- a/src/gallium/drivers/vc4/vc4_screen.h
+++ b/src/gallium/drivers/vc4/vc4_screen.h
@@ -37,6 +37,7 @@ struct vc4_bo;
 #define VC4_DEBUG_PERF      0x0020
 #define VC4_DEBUG_NORAST    0x0040
 #define VC4_DEBUG_ALWAYS_FLUSH 0x0080
+#define VC4_DEBUG_ALWAYS_SYNC  0x0100
 
 #define VC4_MAX_MIP_LEVELS 12
 #define VC4_MAX_TEXTURE_SAMPLERS 16




More information about the mesa-commit mailing list