freedreno: add debug option to disable scissor optimization
authorRob Clark <robclark@freedesktop.org>
Wed, 29 May 2013 14:16:33 +0000 (10:16 -0400)
committerRob Clark <robclark@freedesktop.org>
Sat, 24 Aug 2013 17:11:50 +0000 (13:11 -0400)
Useful for testing and debugging.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/freedreno_gmem.c
src/gallium/drivers/freedreno/freedreno_screen.c
src/gallium/drivers/freedreno/freedreno_util.h

index 12633bd5f389c2b40bde9af474c823eece7309b4..197d1d9bf1ea33426693a42dee5b93666b179b1d 100644 (file)
@@ -71,7 +71,8 @@ calculate_tiles(struct fd_context *ctx)
 {
        struct fd_gmem_stateobj *gmem = &ctx->gmem;
        struct pipe_scissor_state *scissor = &ctx->max_scissor;
-       uint32_t cpp = util_format_get_blocksize(ctx->framebuffer.cbufs[0]->format);
+       struct pipe_framebuffer_state *pfb = &ctx->framebuffer;
+       uint32_t cpp = util_format_get_blocksize(pfb->cbufs[0]->format);
        uint32_t gmem_size = ctx->screen->gmemsize_bytes;
        uint32_t minx, miny, width, height;
        uint32_t nbins_x = 1, nbins_y = 1;
@@ -84,10 +85,17 @@ calculate_tiles(struct fd_context *ctx)
                return;
        }
 
-       minx = scissor->minx & ~31; /* round down to multiple of 32 */
-       miny = scissor->miny & ~31;
-       width = scissor->maxx - minx;
-       height = scissor->maxy - miny;
+       if (fd_mesa_debug & FD_DBG_DSCIS) {
+               minx = 0;
+               miny = 0;
+               width = pfb->width;
+               height = pfb->height;
+       } else {
+               minx = scissor->minx & ~31; /* round down to multiple of 32 */
+               miny = scissor->miny & ~31;
+               width = scissor->maxx - minx;
+               height = scissor->maxy - miny;
+       }
 
 // TODO we probably could optimize this a bit if we know that
 // Z or stencil is not enabled for any of the draw calls..
@@ -132,9 +140,7 @@ static void
 render_tiles(struct fd_context *ctx)
 {
        struct fd_gmem_stateobj *gmem = &ctx->gmem;
-       uint32_t i, yoff = 0;
-
-       yoff= gmem->miny;
+       uint32_t i, yoff = gmem->miny;
 
        ctx->emit_tile_init(ctx);
 
@@ -143,13 +149,13 @@ render_tiles(struct fd_context *ctx)
                uint32_t bh = gmem->bin_h;
 
                /* clip bin height: */
-               bh = MIN2(bh, gmem->height - yoff);
+               bh = MIN2(bh, gmem->miny + gmem->height - yoff);
 
                for (j = 0; j < gmem->nbins_x; j++) {
                        uint32_t bw = gmem->bin_w;
 
                        /* clip bin width: */
-                       bw = MIN2(bw, gmem->width - xoff);
+                       bw = MIN2(bw, gmem->minx + gmem->width - xoff);
 
                        DBG("bin_h=%d, yoff=%d, bin_w=%d, xoff=%d",
                                        bh, yoff, bw, xoff);
index 52d51c22966bd51ba53bd82b4380051ffccec7a1..36ef8b0bc53155257c14391f59fd221663def2bc 100644 (file)
@@ -60,6 +60,7 @@ static const struct debug_named_value debug_options[] = {
                {"disasm",    FD_DBG_DISASM, "Dump TGSI and adreno shader disassembly"},
                {"dclear",    FD_DBG_DCLEAR, "Mark all state dirty after clear"},
                {"dgmem",     FD_DBG_DGMEM,  "Mark all state dirty after GMEM tile pass"},
+               {"dscis",     FD_DBG_DSCIS,  "Disable scissor optimization"},
                DEBUG_NAMED_VALUE_END
 };
 
index f18f0fee989ad0fc4e9e9778bb30159c1f3e4506..b49cdfc6440fbf796c9c887138599c7b0640da5f 100644 (file)
@@ -47,10 +47,11 @@ enum adreno_pa_su_sc_draw fd_polygon_mode(unsigned mode);
 enum adreno_stencil_op fd_stencil_op(unsigned op);
 
 
-#define FD_DBG_MSGS   0x1
-#define FD_DBG_DISASM 0x2
-#define FD_DBG_DCLEAR 0x4
-#define FD_DBG_DGMEM  0x8
+#define FD_DBG_MSGS     0x01
+#define FD_DBG_DISASM   0x02
+#define FD_DBG_DCLEAR   0x04
+#define FD_DBG_DGMEM    0x08
+#define FD_DBG_DSCIS    0x10
 extern int fd_mesa_debug;
 
 #define DBG(fmt, ...) \