panfrost: Reload depth/stencil when they are read

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7922>
This commit is contained in:
Boris Brezillon 2020-11-27 20:51:18 +01:00 committed by Marge Bot
parent 94009cbebc
commit e15fd6c36e
3 changed files with 15 additions and 6 deletions

View file

@ -604,6 +604,12 @@ panfrost_emit_frag_shader_meta(struct panfrost_batch *batch)
else
batch->draws |= PIPE_CLEAR_COLOR0;
if (ctx->depth_stencil->base.depth.enabled)
batch->read |= PIPE_CLEAR_DEPTH;
if (ctx->depth_stencil->base.stencil[0].enabled)
batch->read |= PIPE_CLEAR_STENCIL;
return xfer.gpu;
}

View file

@ -893,17 +893,17 @@ panfrost_batch_draw_wallpaper(struct panfrost_batch *batch)
/* Assume combined. If either depth or stencil is written, they will
* both be written so we need to be careful for reloading */
unsigned draws = batch->draws;
unsigned reload = batch->draws | batch->read;
if (draws & PIPE_CLEAR_DEPTHSTENCIL)
draws |= PIPE_CLEAR_DEPTHSTENCIL;
if (reload & PIPE_CLEAR_DEPTHSTENCIL)
reload |= PIPE_CLEAR_DEPTHSTENCIL;
/* Mask of buffers which need reload since they are not cleared and
* they are drawn. (If they are cleared, reload is useless; if they are
* not drawn and also not cleared, we can generally omit the attachment
* at the framebuffer descriptor level */
* not drawn or read and also not cleared, we can generally omit the
* attachment at the framebuffer descriptor level */
unsigned reload = ~batch->clear & draws;
reload &= ~batch->clear;
for (unsigned i = 0; i < batch->key.nr_cbufs; ++i) {
if (reload & (PIPE_CLEAR_COLOR0 << i))

View file

@ -64,6 +64,9 @@ struct panfrost_batch {
/* Buffers drawn */
unsigned draws;
/* Buffers read */
unsigned read;
/* Packed clear values, indexed by both render target as well as word.
* Essentially, a single pixel is packed, with some padding to bring it
* up to a 32-bit interval; that pixel is then duplicated over to fill