panfrost: Use txl instead of tex in the blitter
authorAlyssa Rosenzweig <alyssa@collabora.com>
Sat, 12 Feb 2022 19:15:17 +0000 (14:15 -0500)
committerMarge Bot <emma+marge@anholt.net>
Wed, 23 Feb 2022 12:56:30 +0000 (12:56 +0000)
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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>

src/panfrost/lib/pan_blitter.c
src/panfrost/midgard/midgard_compile.c

index 37b41f3..60b9fd3 100644 (file)
@@ -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);
index d2badbc..6f2204b 100644 (file)
@@ -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);