summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2013-03-05 17:49:43 -0500
committerRob Clark <robdclark@gmail.com>2013-03-19 10:49:30 -0400
commitafc1b7c21f795c1bf18f1edc376624011e2dfd7c (patch)
treee5186b47a50face17d633ec8124133d03ce3f631
parent90862c8507c4eb6c8b815e4d07bcf46352e38682 (diff)
freedreno: clear fixes
Some fixes for clearing only depth or only stencil. Signed-off-by: Rob Clark <robdclark@gmail.com>
-rw-r--r--src/gallium/drivers/freedreno/freedreno_clear.c19
-rw-r--r--src/gallium/drivers/freedreno/freedreno_gmem.c2
2 files changed, 16 insertions, 5 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_clear.c b/src/gallium/drivers/freedreno/freedreno_clear.c
index 04d85ad919..545e8ad312 100644
--- a/src/gallium/drivers/freedreno/freedreno_clear.c
+++ b/src/gallium/drivers/freedreno/freedreno_clear.c
@@ -105,16 +105,27 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
OUT_PKT3(ring, CP_SET_CONSTANT, 2);
OUT_RING(ring, CP_REG(REG_RB_COPY_CONTROL));
reg = 0;
- if (buffers & PIPE_CLEAR_DEPTH) {
- reg |= RB_COPY_CONTROL_CLEAR_MASK(0xf) |
- RB_COPY_CONTROL_DEPTH_CLEAR_ENABLE;
+ if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) {
+ reg |= RB_COPY_CONTROL_DEPTH_CLEAR_ENABLE;
+ switch (fd_pipe2depth(fb->zsbuf->format)) {
+ case DEPTHX_24_8:
+ if (buffers & PIPE_CLEAR_DEPTH)
+ reg |= RB_COPY_CONTROL_CLEAR_MASK(0xe);
+ if (buffers & PIPE_CLEAR_STENCIL)
+ reg |= RB_COPY_CONTROL_CLEAR_MASK(0x1);
+ break;
+ case DEPTHX_16:
+ if (buffers & PIPE_CLEAR_DEPTH)
+ reg |= RB_COPY_CONTROL_CLEAR_MASK(0xf);
+ break;
+ }
}
OUT_RING(ring, reg);
OUT_PKT3(ring, CP_SET_CONSTANT, 2);
OUT_RING(ring, CP_REG(REG_RB_DEPTH_CLEAR));
reg = 0;
- if (fb->zsbuf) {
+ if (buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) {
switch (fd_pipe2depth(fb->zsbuf->format)) {
case DEPTHX_24_8:
reg = (((uint32_t)(0xffffff * depth)) << 8) |
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c
index dae60c6d5d..52b637629f 100644
--- a/src/gallium/drivers/freedreno/freedreno_gmem.c
+++ b/src/gallium/drivers/freedreno/freedreno_gmem.c
@@ -322,7 +322,7 @@ emit_mem2gmem(struct fd_context *ctx, struct fd_ringbuffer *ring,
if (ctx->restore & (FD_BUFFER_DEPTH | FD_BUFFER_STENCIL))
emit_mem2gmem_surf(ring, 0, bin_w * bin_h, pfb->zsbuf);
- if (ctx->resolve & FD_BUFFER_COLOR)
+ if (ctx->restore & FD_BUFFER_COLOR)
emit_mem2gmem_surf(ring, 1, 0, pfb->cbufs[0]);
/* TODO blob driver seems to toss in a CACHE_FLUSH after each DRAW_INDX.. */