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

Author: Rob Clark <robdcl...@gmail.com>
Date:   Wed Nov 29 15:06:39 2017 -0500

freedreno: add debug option to force emulated indirect

Useful mostly for debugging indirect draw.

Signed-off-by: Rob Clark <robdcl...@gmail.com>

---

 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 60a1180f24..fc24776e4a 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 aea56a180a..35433da4b9 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 14fcf1d672..b6f4771390 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;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to