From e6c6495d3a850da9fc04355df40fc8ab8fa80621 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 29 Nov 2017 15:06:39 -0500 Subject: [PATCH] freedreno: add debug option to force emulated indirect Useful mostly for debugging indirect draw. Signed-off-by: Rob Clark --- src/gallium/drivers/freedreno/freedreno_draw.c | 10 ++++++++++ src/gallium/drivers/freedreno/freedreno_screen.c | 1 + src/gallium/drivers/freedreno/freedreno_util.h | 1 + 3 files changed, 12 insertions(+) diff --git a/src/gallium/drivers/freedreno/freedreno_draw.c b/src/gallium/drivers/freedreno/freedreno_draw.c index 60a1180f24d..fc24776e4a9 100644 --- a/src/gallium/drivers/freedreno/freedreno_draw.c +++ b/src/gallium/drivers/freedreno/freedreno_draw.c @@ -27,6 +27,7 @@ */ #include "pipe/p_state.h" +#include "util/u_draw.h" #include "util/u_string.h" #include "util/u_memory.h" #include "util/u_prim.h" @@ -67,6 +68,15 @@ fd_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info) struct pipe_scissor_state *scissor = fd_context_get_scissor(ctx); unsigned i, prims, buffers = 0, restore_buffers = 0; + /* for debugging problems with indirect draw, it is convenient + * to be able to emulate it, to determine if game is feeding us + * bogus data: + */ + if (info->indirect && (fd_mesa_debug & FD_DBG_NOINDR)) { + util_draw_indirect(pctx, info); + return; + } + if (!info->count_from_stream_output && !info->indirect && !info->primitive_restart && !u_trim_pipe_prim(info->mode, (unsigned*)&info->count)) diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index aea56a180af..35433da4b9f 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -79,6 +79,7 @@ static const struct debug_named_value debug_options[] = { {"bstat", FD_DBG_BSTAT, "Print batch stats at context destroy"}, {"nogrow", FD_DBG_NOGROW, "Disable \"growable\" cmdstream buffers, even if kernel supports it"}, {"lrz", FD_DBG_LRZ, "Enable experimental LRZ support (a5xx+)"}, + {"noindirect",FD_DBG_NOINDR, "Disable hw indirect draws (emulate on CPU)"}, DEBUG_NAMED_VALUE_END }; diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index 14fcf1d6725..b6f4771390e 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -80,6 +80,7 @@ enum adreno_stencil_op fd_stencil_op(unsigned op); #define FD_DBG_BSTAT 0x8000 #define FD_DBG_NOGROW 0x10000 #define FD_DBG_LRZ 0x20000 +#define FD_DBG_NOINDR 0x40000 extern int fd_mesa_debug; extern bool fd_binning_enabled; -- 2.30.2