From: Eric Anholt Date: Mon, 11 May 2020 20:46:33 +0000 (-0700) Subject: freedreno: Add an early out for preparing to read a resource. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d393837332a07f53b9622ca55149e63947e0f937;p=mesa.git freedreno: Add an early out for preparing to read a resource. nohw drawoverhead 8 UBOs test throughput 1.06093% +/- 0.363376% (n=10). Part-of: --- diff --git a/src/gallium/drivers/freedreno/freedreno_batch.c b/src/gallium/drivers/freedreno/freedreno_batch.c index a653e0d91a8..3ee150fce75 100644 --- a/src/gallium/drivers/freedreno/freedreno_batch.c +++ b/src/gallium/drivers/freedreno/freedreno_batch.c @@ -460,6 +460,13 @@ fd_batch_resource_read(struct fd_batch *batch, struct fd_resource *rsc) { fd_screen_assert_locked(batch->ctx->screen); + /* Early out, if we hit this then we know we don't have anyone else + * writing to it (since both _write and _read flush other writers), and + * that we've already recursed for stencil. + */ + if (likely(fd_batch_references_resource(batch, rsc))) + return; + if (rsc->stencil) fd_batch_resource_read(batch, rsc->stencil);