From 1760511e02607361100e605a7b10fffbaccb155b Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 3 Jun 2021 14:09:18 -0400 Subject: [PATCH] panfrost: Add util_draw_indirect() debug path Useful for finding problems with the GPU indirect path. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 8 ++++++++ src/gallium/drivers/panfrost/pan_screen.c | 1 + src/panfrost/lib/pan_util.h | 1 + 3 files changed, 10 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index de4113b5631..4d5d9408dff 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -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); diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index c49a7c14da3..ad096541a4f 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -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 }; diff --git a/src/panfrost/lib/pan_util.h b/src/panfrost/lib/pan_util.h index f720e7c801a..37d44d8b821 100644 --- a/src/panfrost/lib/pan_util.h +++ b/src/panfrost/lib/pan_util.h @@ -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 */