Mesa (master): freedreno/a6xx: disable LRZ when color channels are masked

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 20 19:20:20 UTC 2020


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

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu Aug 20 11:14:36 2020 -0700

freedreno/a6xx: disable LRZ when color channels are masked

>From the PoV of early-z tests, having masked color channels is basically
like blend, ie. we do actually care about the fragments (or at least
parts of them) from previous draws.

Signed-off-by: Rob Clark <robdclark at chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6409>

---

 src/gallium/drivers/freedreno/a6xx/fd6_blend.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_blend.c b/src/gallium/drivers/freedreno/a6xx/fd6_blend.c
index d69d3f0f59d..fe63be97fd5 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_blend.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_blend.c
@@ -166,7 +166,20 @@ fd6_blend_state_create(struct pipe_context *pctx,
 		const struct pipe_rt_blend_state *rt = &cso->rt[i];
 
 		so->reads_dest |= rt->blend_enable;
-		if (rt->blend_enable) {
+
+		/* From the PoV of LRZ, having masked color channels is
+		 * the same as having blend enabled, in that the draw will
+		 * care about the fragments from an earlier draw.
+		 *
+		 * NOTE we actually don't care about masked color channels
+		 * that don't actually exist in the render target, but we
+		 * don't know the render target format here to determine
+		 * that.  It is probably not worth worrying about, but if
+		 * we find a game/benchmark that goes out of it's way to
+		 * mask off non-existent channels, we should fixup the
+		 * pipe_blend_state to give us more info.
+		 */
+		if (rt->blend_enable || (rt->colormask != 0xf)) {
 			so->reads_dest = true;
 		}
 	}



More information about the mesa-commit mailing list