The separate stencil buffer was not also getting marked as valid if
written by a draw/clear, resulting in gmem2mem getting skipped. Move
this into fd_batch_resource_used() which also handles the separate
stencil case.
Also fix restore_buffers typo.
Fixes: 4ab6ab80365 freedreno: avoid mem2gmem for invalidated buffers
Signed-off-by: Rob Clark <robdclark@gmail.com>
DBG("%p: %s %p", batch, write ? "write" : "read", rsc);
+ if (write)
+ rsc->valid = true;
+
/* note, invalidate write batch, to avoid further writes to rsc
* resulting in a write-after-read hazard.
*/
{
if (!prsc)
return;
- fd_resource(prsc)->valid = true;
fd_batch_resource_used(batch, fd_resource(prsc), true);
}
if (fd_stencil_enabled(ctx)) {
if (fd_resource(pfb->zsbuf->texture)->valid)
- restore_buffers |= FD_BUFFER_DEPTH;
+ restore_buffers |= FD_BUFFER_STENCIL;
buffers |= FD_BUFFER_STENCIL;
resource_written(batch, pfb->zsbuf->texture);
batch->gmem_reason |= FD_GMEM_STENCIL_ENABLED;