freedreno: clear fixes and debugging
authorRob Clark <robclark@freedesktop.org>
Wed, 24 Apr 2013 14:50:51 +0000 (10:50 -0400)
committerRob Clark <robclark@freedesktop.org>
Thu, 25 Apr 2013 01:09:46 +0000 (21:09 -0400)
Set a few extra registers to make sure we are in proper state for
clearing.  And also add some debug options to mark all state dirty in
clear and gmem operations to aid in debugging.

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

index 149c023d6f02ac53e9cc87a2094bcc8ac4976423..2cdb7bf11207dc7e24c6fce1f8c1d9c861d89fd4 100644 (file)
@@ -67,7 +67,9 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
        if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL))
                fd_resource(fb->zsbuf->texture)->dirty = true;
 
-       DBG("depth=%f, stencil=%u", depth, stencil);
+       DBG("%x depth=%f, stencil=%u (%s/%s)", buffers, depth, stencil,
+                       util_format_name(fb->cbufs[0]->format),
+                       fb->zsbuf ? util_format_name(fb->zsbuf->format) : "none");
 
        if ((buffers & PIPE_CLEAR_COLOR) && fb->nr_cbufs)
                colr  = pack_rgba(fb->cbufs[0]->format, color->f);
@@ -118,6 +120,9 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
                        if (buffers & PIPE_CLEAR_DEPTH)
                                reg |= A2XX_RB_COPY_CONTROL_CLEAR_MASK(0xf);
                        break;
+               default:
+                       assert(1);
+                       break;
                }
        }
        OUT_RING(ring, reg);
@@ -154,6 +159,19 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
        }
        OUT_RING(ring, reg);
 
+       OUT_PKT3(ring, CP_SET_CONSTANT, 3);
+       OUT_RING(ring, CP_REG(REG_A2XX_RB_STENCILREFMASK_BF));
+       OUT_RING(ring, 0xff000000 | A2XX_RB_STENCILREFMASK_BF_STENCILWRITEMASK(0xff));
+       OUT_RING(ring, 0xff000000 | A2XX_RB_STENCILREFMASK_STENCILWRITEMASK(0xff));
+
+       OUT_PKT3(ring, CP_SET_CONSTANT, 2);
+       OUT_RING(ring, CP_REG(REG_A2XX_RB_COLORCONTROL));
+       OUT_RING(ring, A2XX_RB_COLORCONTROL_ALPHA_FUNC(FUNC_ALWAYS) |
+                       A2XX_RB_COLORCONTROL_BLEND_DISABLE |
+                       A2XX_RB_COLORCONTROL_ROP_CODE(12) |
+                       A2XX_RB_COLORCONTROL_DITHER_MODE(DITHER_DISABLE) |
+                       A2XX_RB_COLORCONTROL_DITHER_TYPE(DITHER_PIXEL));
+
        OUT_PKT3(ring, CP_SET_CONSTANT, 3);
        OUT_RING(ring, CP_REG(REG_A2XX_PA_CL_CLIP_CNTL));
        OUT_RING(ring, 0x00000000);        /* PA_CL_CLIP_CNTL */
@@ -202,6 +220,9 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
                        FD_DIRTY_PROG |
                        FD_DIRTY_CONSTBUF |
                        FD_DIRTY_BLEND;
+
+       if (fd_mesa_debug & FD_DBG_DCLEAR)
+               ctx->dirty = 0xffffffff;
 }
 
 static void
index a6925a5573121e2e1be74e3ca6cc42206392aa8b..83e5ea664b788c0b0f9af0ef3ea062d207c633fb 100644 (file)
@@ -528,4 +528,7 @@ fd_gmem_render_tiles(struct pipe_context *pctx)
                        FD_DIRTY_VERTTEX |
                        FD_DIRTY_FRAGTEX |
                        FD_DIRTY_BLEND;
+
+       if (fd_mesa_debug & FD_DBG_DGMEM)
+               ctx->dirty = 0xffffffff;
 }
index 336d0306ec91d809b1cfe3f2c9fc304763477597..b4fc20e5c59e5bbd199f6509fc2eba58ae38dfba 100644 (file)
@@ -56,6 +56,8 @@
 static const struct debug_named_value debug_options[] = {
                {"msgs",      FD_DBG_MSGS,   "Print debug messages"},
                {"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"},
                DEBUG_NAMED_VALUE_END
 };
 
index c9af47154543fc223e1ac8c0cdc202d785469ae3..f73f792857be69debaa3179981786952e23b6367 100644 (file)
@@ -50,6 +50,8 @@ uint32_t fd_tex_swiz(enum pipe_format format, unsigned swizzle_r,
 
 #define FD_DBG_MSGS   0x1
 #define FD_DBG_DISASM 0x2
+#define FD_DBG_DCLEAR 0x4
+#define FD_DBG_DGMEM  0x8
 extern int fd_mesa_debug;
 
 #define DBG(fmt, ...) \