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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15123>
This commit is contained in:
Alyssa Rosenzweig 2022-02-12 14:15:17 -05:00 committed by Marge Bot
parent 5b1a00c565
commit 099d61c95d
2 changed files with 8 additions and 6 deletions

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

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