From bda2bb31b13d540ff0730fbc3e9ef5f21fdb9181 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 21 Nov 2019 08:45:27 -0500 Subject: [PATCH] pan/midgard: Enable LOD lowering only on buggy chips T720 and earlier need this workaround, so check the quirk before lowering. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso --- src/panfrost/midgard/midgard_compile.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index cf7d15a0f9f..91cba1c1d54 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -485,7 +485,7 @@ midgard_nir_lower_fdot2(nir_shader *shader) /* Flushes undefined values to zero */ static void -optimise_nir(nir_shader *nir) +optimise_nir(nir_shader *nir, unsigned quirks) { bool progress; unsigned lower_flrp = @@ -504,6 +504,11 @@ optimise_nir(nir_shader *nir) NIR_PASS(progress, nir, nir_lower_tex, &lower_tex_options); + /* T720 is broken. */ + + if (quirks & MIDGARD_BROKEN_LOD) + NIR_PASS_V(nir, midgard_nir_lod_errata); + do { progress = false; @@ -2481,7 +2486,7 @@ midgard_compile_shader_nir(nir_shader *nir, midgard_program *program, bool is_bl /* Optimisation passes */ - optimise_nir(nir); + optimise_nir(nir, ctx->quirks); if (midgard_debug & MIDGARD_DBG_SHADERS) { nir_print_shader(nir, stdout); -- 2.30.2