vc4: Add a debug flag for waiting for sync on submit.
authorEric Anholt <eric@anholt.net>
Tue, 2 Dec 2014 21:18:56 +0000 (13:18 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 5 Dec 2014 18:43:14 +0000 (10:43 -0800)
This is nice when you're tracking down which command list is hanging the
GPU.

src/gallium/drivers/vc4/vc4_context.c
src/gallium/drivers/vc4/vc4_screen.c
src/gallium/drivers/vc4/vc4_screen.h

index bb30c0e8ca785c11edd48daacfc99abc62e1323e..b26c07127a98050add5db1841da519d4b873eb2c 100644 (file)
@@ -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);
index abd44eee3a8341dc2a076bb13e165c13abe2db06..18451bd71a77d87e802785a38eca71231f8ea1a2 100644 (file)
@@ -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 }
 };
 
index ba07490fc9462456b72dc8c76c5dd50939573c5f..3819bda3c63c88ccc6146c9f4b63b645b0fbdfc8 100644 (file)
@@ -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