freedreno/a6xx: LRZ for MSAA

We don't need to fall off the LRZ path when we fall back to clearing
depth with a u_blitter draw, since u_blitter uses zsa state to achieve
the depth/stencil clear and this is entirely compabile with LRZ.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20975>
This commit is contained in:
Rob Clark 2022-12-05 08:53:28 -08:00 committed by Marge Bot
parent 5eb85ef756
commit 951d963565

View file

@ -502,10 +502,6 @@ fd6_clear(struct fd_context *ctx, unsigned buffers,
const bool has_depth = pfb->zsbuf;
unsigned color_buffers = buffers >> 2;
/* we need to do multisample clear on 3d pipe, so fallback to u_blitter: */
if (pfb->samples > 1)
return false;
/* If we're clearing after draws, fallback to 3D pipe clears. We could
* use blitter clears in the draw batch but then we'd have to patch up the
* gmem offsets. This doesn't seem like a useful thing to optimize for
@ -513,6 +509,19 @@ fd6_clear(struct fd_context *ctx, unsigned buffers,
if (ctx->batch->num_draws > 0)
return false;
if (has_depth && (buffers & PIPE_CLEAR_DEPTH)) {
struct fd_resource *zsbuf = fd_resource(pfb->zsbuf->texture);
if (zsbuf->lrz && !is_z32(pfb->zsbuf->format)) {
zsbuf->lrz_valid = true;
zsbuf->lrz_direction = FD_LRZ_UNKNOWN;
fd6_clear_lrz(ctx->batch, zsbuf, depth);
}
}
/* we need to do multisample clear on 3d pipe, so fallback to u_blitter: */
if (pfb->samples > 1)
return false;
u_foreach_bit (i, color_buffers)
ctx->batch->clear_color[i] = *color;
if (buffers & PIPE_CLEAR_DEPTH)
@ -522,15 +531,6 @@ fd6_clear(struct fd_context *ctx, unsigned buffers,
ctx->batch->fast_cleared |= buffers;
if (has_depth && (buffers & PIPE_CLEAR_DEPTH)) {
struct fd_resource *zsbuf = fd_resource(pfb->zsbuf->texture);
if (zsbuf->lrz && !is_z32(pfb->zsbuf->format)) {
zsbuf->lrz_valid = true;
zsbuf->lrz_direction = FD_LRZ_UNKNOWN;
fd6_clear_lrz(ctx->batch, zsbuf, depth);
}
}
return true;
}