Mesa (main): freedreno: Skip staging blits from uninitialized resources.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 17 23:04:41 UTC 2021


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

Author: Emma Anholt <emma at anholt.net>
Date:   Thu Jun 17 13:24:45 2021 -0700

freedreno: Skip staging blits from uninitialized resources.

When storing depth- or stencil-only texture data that has been packed into
a depth/stencil texture, the tex store gets PIPE_MAP_READ added onto it
since the other channel will get ORed into the incoming data, but
sometimes we know that the other component is undefined because the whole
texture is either fresh or just invalidated.

Cleans up a confusing extra blit in a dEQP case I've been debugging, and
should be less work for dEQP CI.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11452>

---

 src/gallium/drivers/freedreno/freedreno_resource.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c
index 913355a392e..6b27cead2e3 100644
--- a/src/gallium/drivers/freedreno/freedreno_resource.c
+++ b/src/gallium/drivers/freedreno/freedreno_resource.c
@@ -797,6 +797,13 @@ resource_transfer_map(struct pipe_context *pctx, struct pipe_resource *prsc,
 
    tc_assert_driver_thread(ctx->tc);
 
+   /* Strip the read flag if the buffer has been invalidated (or is freshly
+    * created). Avoids extra staging blits of undefined data on glTexSubImage of
+    * a fresh DEPTH_COMPONENT or STENCIL_INDEX texture being stored as z24s8.
+    */
+   if (!rsc->valid)
+      usage &= ~PIPE_MAP_READ;
+
    /* we always need a staging texture for tiled buffers:
     *
     * TODO we might sometimes want to *also* shadow the resource to avoid



More information about the mesa-commit mailing list