From c2babfccb5a9c665f4de0b66691b5f0dc359fe8b Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Wed, 29 May 2013 10:16:33 -0400 Subject: [PATCH] freedreno: add debug option to disable scissor optimization Useful for testing and debugging. Signed-off-by: Rob Clark --- .../drivers/freedreno/freedreno_gmem.c | 26 ++++++++++++------- .../drivers/freedreno/freedreno_screen.c | 1 + .../drivers/freedreno/freedreno_util.h | 9 ++++--- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 12633bd5f38..197d1d9bf1e 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -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); diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c index 52d51c22966..36ef8b0bc53 100644 --- a/src/gallium/drivers/freedreno/freedreno_screen.c +++ b/src/gallium/drivers/freedreno/freedreno_screen.c @@ -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 }; diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index f18f0fee989..b49cdfc6440 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -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, ...) \ -- 2.30.2