freedreno: Early-out from the resource write path when we're the writer.

No need to do the other checks in this case, because then we know that
we've done the UBWC clears and recursed on stencil and added deps on read
batches.

Done as a separate patch to reduce behavior changes in my upcoming move of
the batch cache to the context.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8729>
This commit is contained in:
Eric Anholt 2021-01-25 14:54:25 -08:00
parent d1a0eba241
commit f179594cf9
1 changed files with 11 additions and 5 deletions

View File

@ -451,15 +451,21 @@ fd_batch_resource_write(struct fd_batch *batch, struct fd_resource *rsc)
{
fd_screen_assert_locked(batch->ctx->screen);
DBG("%p: write %p", batch, rsc);
/* Must do this before the early out, so we unset a previous resource
* invalidate (which may have left the write_batch state in place).
*/
rsc->valid = true;
if (rsc->write_batch == batch)
return;
fd_batch_write_prep(batch, rsc);
if (rsc->stencil)
fd_batch_resource_write(batch, rsc->stencil);
DBG("%p: write %p", batch, rsc);
rsc->valid = true;
/* note, invalidate write batch, to avoid further writes to rsc
* resulting in a write-after-read hazard.
*/
@ -468,7 +474,7 @@ fd_batch_resource_write(struct fd_batch *batch, struct fd_resource *rsc)
struct fd_batch_cache *cache = &batch->ctx->screen->batch_cache;
struct fd_batch *dep;
if (rsc->write_batch && rsc->write_batch != batch)
if (rsc->write_batch)
flush_write_batch(rsc);
foreach_batch(dep, cache, rsc->batch_mask) {