panfrost: Add util_draw_indirect() debug path
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 3 Jun 2021 18:09:18 +0000 (14:09 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 10 Jun 2021 18:06:10 +0000 (18:06 +0000)
Useful for finding problems with the GPU indirect path.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11123>

src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_screen.c
src/panfrost/lib/pan_util.h

index de4113b..4d5d940 100644 (file)
@@ -44,6 +44,7 @@
 #include "util/format/u_format.h"
 #include "util/u_prim.h"
 #include "util/u_prim_restart.h"
+#include "util/u_draw.h"
 #include "indices/u_primconvert.h"
 #include "tgsi/tgsi_parse.h"
 #include "tgsi/tgsi_from_mesa.h"
@@ -739,6 +740,13 @@ panfrost_draw_vbo(struct pipe_context *pipe,
         if (!panfrost_render_condition_check(ctx))
                 return;
 
+        /* Emulate indirect draws when debugging */
+        if (dev->debug & PAN_DBG_NOINDIRECT && indirect && indirect->buffer) {
+                assert(num_draws == 1);
+                util_draw_indirect(pipe, info, indirect);
+                return;
+        }
+
         /* Do some common setup */
         struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
 
index c49a7c1..ad09654 100644 (file)
@@ -69,6 +69,7 @@ static const struct debug_named_value panfrost_debug_options[] = {
         {"nocrc",     PAN_DBG_NO_CRC,   "Disable transaction elimination"},
         {"msaa16",    PAN_DBG_MSAA16,   "Enable MSAA 8x and 16x support"},
         {"panblit",   PAN_DBG_PANBLIT,  "Use pan_blitter instead of u_blitter"},
+        {"noindirect", PAN_DBG_NOINDIRECT, "Emulate indirect draws on the CPU"},
         DEBUG_NAMED_VALUE_END
 };
 
index f720e7c..37d44d8 100644 (file)
@@ -40,5 +40,6 @@
 #define PAN_DBG_NO_AFBC         0x0200
 #define PAN_DBG_MSAA16          0x0400
 #define PAN_DBG_PANBLIT         0x0800
+#define PAN_DBG_NOINDIRECT      0x1000
 
 #endif /* PAN_UTIL_H */