Module: Mesa Branch: staging/21.2 Commit: 2d203fe986e51c128192ce08cf65396deedee10e URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d203fe986e51c128192ce08cf65396deedee10e
Author: Alyssa Rosenzweig <[email protected]> Date: Fri Jun 11 18:48:09 2021 -0400 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 <[email protected]> Cc: mesa-stable Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11383> (cherry picked from commit f45ceb818261859e623b45653b55347566c2b8f2) --- .pick_status.json | 2 +- .../panfrost/ci/deqp-panfrost-t860-fails.txt | 17 --------- src/panfrost/midgard/midgard_schedule.c | 42 +++++++++++++++++++++- 3 files changed, 42 insertions(+), 19 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 451018dc8a0..dd541422751 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -346,7 +346,7 @@ "description": "pan/mdg: Insert moves before writeout when needed", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, 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); } - }
