Mesa (master): freedreno: Add an early out for preparing to read a resource.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 12 21:38:57 UTC 2020


Module: Mesa
Branch: master
Commit: d393837332a07f53b9622ca55149e63947e0f937
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d393837332a07f53b9622ca55149e63947e0f937

Author: Eric Anholt <eric at anholt.net>
Date:   Mon May 11 13:46:33 2020 -0700

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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4996>

---

 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);
 



More information about the mesa-commit mailing list