pan/midgard: Enable LOD lowering only on buggy chips
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Thu, 21 Nov 2019 13:45:27 +0000 (08:45 -0500)
committerTomeu Vizoso <tomeu.vizoso@collabora.co.uk>
Fri, 22 Nov 2019 05:07:19 +0000 (05:07 +0000)
T720 and earlier need this workaround, so check the quirk before
lowering.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
src/panfrost/midgard/midgard_compile.c

index cf7d15a0f9f591205cac4b9d312e8f2ddd511431..91cba1c1d541233e3f2beae925355164351092d1 100644 (file)
@@ -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);