pan/midgard: Fix liveness analysis with multiple epilogues
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 3 Dec 2019 15:37:01 +0000 (10:37 -0500)
committerTomeu Vizoso <tomeu.vizoso@collabora.co.uk>
Mon, 16 Dec 2019 09:10:33 +0000 (09:10 +0000)
Epilogues are special fixed-function blocks, so they need special
handling for liveness analysis to work completely. This in turns fixes
RA issues for many shaders using MRT.

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

index d087579f36d135c5a21f0e27a867f7019182c643..45a0617a84069d25cb2b1a429d55c5f1035a8cfd 100644 (file)
@@ -198,6 +198,9 @@ typedef struct midgard_block {
          * simple bit fields, but for us, liveness is a vector idea. */
         uint16_t *live_in;
         uint16_t *live_out;
+
+        /* Indicates this is a fixed-function fragment epilogue block */
+        bool epilogue;
 } midgard_block;
 
 typedef struct midgard_bundle {
index a118f34fd9acbe562e60d50dbf544d6c75800c10..943435c39bae03f1a02c828215c427dab969a35a 100644 (file)
@@ -2217,6 +2217,7 @@ emit_fragment_epilogue(compiler_context *ctx, unsigned rt)
         }
 
         EMIT(alu_br_compact_cond, midgard_jmp_writeout_op_writeout, TAG_ALU_4, ~0, midgard_condition_always);
+        ctx->current_block->epilogue = true;
         schedule_barrier(ctx);
 }
 
index 08f8a07bcee1f97c9c3d0105f8ed9b7962746d02..8627e01fa740801c2b902038e8094058df954f3b 100644 (file)
@@ -153,7 +153,7 @@ mir_compute_liveness(compiler_context *ctx)
 
                 /* If we made progress, we need to process the predecessors */
 
-                if (progress || (blk == exit)) {
+                if (progress || (blk == exit) || blk->epilogue) {
                         mir_foreach_predecessor(blk, pred)
                                 _mesa_set_add(work_list, pred);
                 }