From f45ceb818261859e623b45653b55347566c2b8f2 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Fri, 11 Jun 2021 18:48:09 -0400 Subject: pan/mdg: Insert moves before writeout when needed Otherwise we end up accessing overwritten registers. Fixes dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_enable_buffer_enable Signed-off-by: Alyssa Rosenzweig Cc: mesa-stable Part-of: --- .../panfrost/ci/deqp-panfrost-t860-fails.txt | 17 --------- src/panfrost/midgard/midgard_schedule.c | 42 +++++++++++++++++++++- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/gallium/drivers/panfrost/ci/deqp-panfrost-t860-fails.txt b/src/gallium/drivers/panfrost/ci/deqp-panfrost-t860-fails.txt index bf7ba24b34f..20ff4c22a83 100644 --- a/src/gallium/drivers/panfrost/ci/deqp-panfrost-t860-fails.txt +++ b/src/gallium/drivers/panfrost/ci/deqp-panfrost-t860-fails.txt @@ -12,29 +12,12 @@ dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_x,Fa dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_dst_y,Fail dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_x,Fail dEQP-GLES3.functional.fbo.blit.rect.nearest_consistency_min_reverse_src_y,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_blend_eq_buffer_blend_eq,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_blend_eq_buffer_separate_blend_eq,Fail dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_blend_func_buffer_blend_func,Fail dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_blend_func_buffer_separate_blend_func,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_color_mask_buffer_color_mask,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_disable_buffer_disable,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_disable_buffer_enable,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_enable_buffer_disable,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_enable_buffer_enable,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_separate_blend_eq_buffer_blend_eq,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_separate_blend_eq_buffer_separate_blend_eq,Fail dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_separate_blend_func_buffer_blend_func,Fail dEQP-GLES31.functional.draw_buffers_indexed.overwrite_common.common_separate_blend_func_buffer_separate_blend_func,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_blend_eq_buffer_blend_eq,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_blend_eq_buffer_separate_blend_eq,Fail dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_blend_func_buffer_blend_func,Fail dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_blend_func_buffer_separate_blend_func,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_disable_buffer_disable,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_disable_buffer_enable,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_enable_buffer_disable,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_enable_buffer_enable,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_separate_blend_eq_buffer_blend_eq,Fail -dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_separate_blend_eq_buffer_separate_blend_eq,Fail dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_separate_blend_func_buffer_blend_func,Fail dEQP-GLES31.functional.draw_buffers_indexed.overwrite_indexed.common_separate_blend_func_buffer_separate_blend_func,Fail dEQP-GLES31.functional.draw_buffers_indexed.random.max_implementation_draw_buffers.0,Fail diff --git a/src/panfrost/midgard/midgard_schedule.c b/src/panfrost/midgard/midgard_schedule.c index f987b7f17fd..a371f6eef05 100644 --- a/src/panfrost/midgard/midgard_schedule.c +++ b/src/panfrost/midgard/midgard_schedule.c @@ -1527,6 +1527,40 @@ mir_lower_ldst(compiler_context *ctx) } } +/* Insert moves to ensure we can register allocate blend writeout */ +static void +mir_lower_blend_input(compiler_context *ctx) +{ + mir_foreach_block(ctx, _blk) { + midgard_block *blk = (midgard_block *) _blk; + + if (list_is_empty(&blk->base.instructions)) + continue; + + midgard_instruction *I = mir_last_in_block(blk); + + if (!I || I->type != TAG_ALU_4 || !I->writeout) + continue; + + mir_foreach_src(I, s) { + unsigned src = I->src[s]; + + if (src >= ctx->temp_count) + continue; + + if (!_blk->live_out[src]) + continue; + + unsigned temp = make_compiler_temp(ctx); + midgard_instruction mov = v_mov(src, temp); + mov.mask = 0xF; + mov.dest_type = nir_type_uint32; + mir_insert_instruction_before(ctx, I, mov); + I->src[s] = mov.dest; + } + } +} + void midgard_schedule_program(compiler_context *ctx) { @@ -1536,6 +1570,13 @@ midgard_schedule_program(compiler_context *ctx) /* Must be lowered right before scheduling */ mir_squeeze_index(ctx); mir_lower_special_reads(ctx); + + if (ctx->stage == MESA_SHADER_FRAGMENT) { + mir_invalidate_liveness(ctx); + mir_compute_liveness(ctx); + mir_lower_blend_input(ctx); + } + mir_squeeze_index(ctx); /* Lowering can introduce some dead moves */ @@ -1545,5 +1586,4 @@ midgard_schedule_program(compiler_context *ctx) midgard_opt_dead_move_eliminate(ctx, block); schedule_block(ctx, block); } - } -- cgit v1.2.3