From d393837332a07f53b9622ca55149e63947e0f937 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 11 May 2020 13:46:33 -0700 Subject: [PATCH] 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: --- src/gallium/drivers/freedreno/freedreno_batch.c | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- 2.30.2