freedreno/a5xx: fallback to slow-clear for z32

We probably *could* do this with blit path, but I think it would involve
clobbering settings from batch->gmem (see emit_zs()).

Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
Rob Clark 2017-05-15 12:36:24 -04:00
parent cb16d91034
commit 9235ab6550
4 changed files with 37 additions and 12 deletions

View File

@ -123,7 +123,7 @@ fd2_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
}
static void
static bool
fd2_clear(struct fd_context *ctx, unsigned buffers,
const union pipe_color_union *color, double depth, unsigned stencil)
{
@ -291,6 +291,8 @@ fd2_clear(struct fd_context *ctx, unsigned buffers,
ctx->dirty_shader[PIPE_SHADER_VERTEX] |= FD_DIRTY_SHADER_PROG;
ctx->dirty_shader[PIPE_SHADER_FRAGMENT] |= FD_DIRTY_SHADER_PROG | FD_DIRTY_SHADER_CONST;
return true;
}
void

View File

@ -162,7 +162,19 @@ fd5_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
return true;
}
static void
static bool is_z32(enum pipe_format format)
{
switch (format) {
case PIPE_FORMAT_Z32_FLOAT_S8X24_UINT:
case PIPE_FORMAT_Z32_UNORM:
case PIPE_FORMAT_Z32_FLOAT:
return true;
default:
return false;
}
}
static bool
fd5_clear(struct fd_context *ctx, unsigned buffers,
const union pipe_color_union *color, double depth, unsigned stencil)
{
@ -170,6 +182,10 @@ fd5_clear(struct fd_context *ctx, unsigned buffers,
struct pipe_framebuffer_state *pfb = &ctx->batch->framebuffer;
struct pipe_scissor_state *scissor = fd_context_get_scissor(ctx);
if ((buffers & (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL)) &&
is_z32(pfb->zsbuf->format))
return false;
/* TODO handle scissor.. or fallback to slow-clear? */
ctx->batch->max_scissor.minx = MIN2(ctx->batch->max_scissor.minx, scissor->minx);
@ -272,6 +288,8 @@ fd5_clear(struct fd_context *ctx, unsigned buffers,
/* disable fast clear to not interfere w/ gmem->mem, etc.. */
OUT_PKT4(ring, REG_A5XX_RB_CLEAR_CNTL, 1);
OUT_RING(ring, 0x00000000); /* RB_CLEAR_CNTL */
return true;
}
void

View File

@ -297,7 +297,7 @@ struct fd_context {
/* draw: */
bool (*draw_vbo)(struct fd_context *ctx, const struct pipe_draw_info *info,
unsigned index_offset);
void (*clear)(struct fd_context *ctx, unsigned buffers,
bool (*clear)(struct fd_context *ctx, unsigned buffers,
const union pipe_color_union *color, double depth, unsigned stencil);
/* compute: */

View File

@ -384,17 +384,22 @@ fd_clear(struct pipe_context *pctx, unsigned buffers,
/* if per-gen backend doesn't implement ctx->clear() generic
* blitter clear:
*/
if (!ctx->clear) {
fd_blitter_clear(pctx, buffers, color, depth, stencil);
return;
bool fallback = true;
if (ctx->clear) {
fd_batch_set_stage(batch, FD_STAGE_CLEAR);
if (ctx->clear(ctx, buffers, color, depth, stencil)) {
if (fd_mesa_debug & FD_DBG_DCLEAR)
fd_context_all_dirty(ctx);
fallback = false;
}
}
fd_batch_set_stage(batch, FD_STAGE_CLEAR);
ctx->clear(ctx, buffers, color, depth, stencil);
if (fd_mesa_debug & FD_DBG_DCLEAR)
fd_context_all_dirty(ctx);
if (fallback) {
fd_blitter_clear(pctx, buffers, color, depth, stencil);
}
}
static void