Mesa (main): panfrost: Use txl instead of tex in the blitter

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 23 13:10:16 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Sat Feb 12 14:15:17 2022 -0500

panfrost: Use txl instead of tex in the blitter

We always blit from a particular level, so it's a waste to compute the LOD.
This corresponds to a simple texture instruction with implement 0 LOD, which is
the optimal texturing path on Bifrost -- it maps to TEXS_2D but does not require
helper invocations.

Functional change on Bifrost: Blit shaders no longer set .computed_lod or
shader_contains_barrier.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>

---

 src/panfrost/lib/pan_blitter.c         |  2 +-
 src/panfrost/midgard/midgard_compile.c | 12 +++++++-----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/panfrost/lib/pan_blitter.c b/src/panfrost/lib/pan_blitter.c
index 37b41f3564c..60b9fd3aa9d 100644
--- a/src/panfrost/lib/pan_blitter.c
+++ b/src/panfrost/lib/pan_blitter.c
@@ -546,7 +546,7 @@ pan_blitter_get_blit_shader(struct panfrost_device *dev,
                                 tex->src[2].src_type = nir_tex_src_lod;
                                 tex->src[2].src = nir_src_for_ssa(nir_imm_int(&b, 0));
                         } else {
-                                tex->op = nir_texop_tex;
+                                tex->op = nir_texop_txl;
 
                                 tex->src[0].src_type = nir_tex_src_coord;
                                 tex->src[0].src = nir_src_for_ssa(coord);
diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index d2badbcfd20..6f2204bb6f2 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -323,7 +323,7 @@ midgard_vectorize_filter(const nir_instr *instr, void *data)
 }
 
 static void
-optimise_nir(nir_shader *nir, unsigned quirks, bool is_blend)
+optimise_nir(nir_shader *nir, unsigned quirks, bool is_blend, bool is_blit)
 {
         bool progress;
         unsigned lower_flrp =
@@ -349,9 +349,11 @@ optimise_nir(nir_shader *nir, unsigned quirks, bool is_blend)
         NIR_PASS(progress, nir, nir_lower_tex, &lower_tex_options);
 
 
-        /* T720 is broken. */
-
-        if (quirks & MIDGARD_BROKEN_LOD)
+        /* TEX_GRAD fails to apply sampler descriptor settings on some
+         * implementations, requiring a lowering. However, blit shaders do not
+         * use the affected settings and should skip the workaround.
+         */
+        if ((quirks & MIDGARD_BROKEN_LOD) && !is_blit)
                 NIR_PASS_V(nir, midgard_nir_lod_errata);
 
         /* Midgard image ops coordinates are 16-bit instead of 32-bit */
@@ -3179,7 +3181,7 @@ midgard_compile_shader_nir(nir_shader *nir,
 
         /* Optimisation passes */
 
-        optimise_nir(nir, ctx->quirks, inputs->is_blend);
+        optimise_nir(nir, ctx->quirks, inputs->is_blend, inputs->is_blit);
 
         bool skip_internal = nir->info.internal;
         skip_internal &= !(midgard_debug & MIDGARD_DBG_INTERNAL);



More information about the mesa-commit mailing list