From 3448b2641a475fce9220ade229570e342882f637 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 3 Dec 2019 10:37:01 -0500 Subject: [PATCH] pan/midgard: Fix liveness analysis with multiple epilogues 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 Reviewed-by: Tomeu Visoso --- src/panfrost/midgard/compiler.h | 3 +++ src/panfrost/midgard/midgard_compile.c | 1 + src/panfrost/midgard/midgard_liveness.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/panfrost/midgard/compiler.h b/src/panfrost/midgard/compiler.h index d087579f36d..45a0617a840 100644 --- a/src/panfrost/midgard/compiler.h +++ b/src/panfrost/midgard/compiler.h @@ -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 { diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index a118f34fd9a..943435c39ba 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -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); } diff --git a/src/panfrost/midgard/midgard_liveness.c b/src/panfrost/midgard/midgard_liveness.c index 08f8a07bcee..8627e01fa74 100644 --- a/src/panfrost/midgard/midgard_liveness.c +++ b/src/panfrost/midgard/midgard_liveness.c @@ -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); } -- 2.30.2