freedreno: add debug option to force emulated indirect
authorRob Clark <robdclark@gmail.com>
Wed, 29 Nov 2017 20:06:39 +0000 (15:06 -0500)
committerRob Clark <robdclark@gmail.com>
Sun, 3 Dec 2017 19:17:41 +0000 (14:17 -0500)
Useful mostly for debugging indirect draw.

Signed-off-by: Rob Clark <robdclark@gmail.com>
src/gallium/drivers/freedreno/freedreno_draw.c
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/freedreno/freedreno_util.h

index 60a1180f24d5b17dc02a4348c0b628788d7f057e..fc24776e4a9f54a59be7f2a4a1e8badb1c3120a2 100644 (file)
@@ -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))
index aea56a180af13710667e05088bce1f580bb7367b..35433da4b9f9b17b44888db02b24d7be97326e00 100644 (file)
@@ -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
 };
 
index 14fcf1d6725e79eb9f0b65a600e95dab63d8e78d..b6f4771390eaa38868723982771fea3a8faf4356 100644 (file)
@@ -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;