From 9091b6261bbfbd8d3b64868691fd071146e9a6e0 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 29 Jul 2021 17:39:14 -0400 Subject: [PATCH] pan/bi: Specialize BLEND emit for Valhall Fewer arguments compared to Bifrost; the corresponding information is encoded in a Valhall-specific blend shader prologue instead. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bifrost_compile.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index dcab16cb332..89a51faa85e 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -512,6 +512,9 @@ static void bi_emit_blend_op(bi_builder *b, bi_index rgba, nir_alu_type T, bi_index rgba2, nir_alu_type T2, unsigned rt) { + /* On Valhall, BLEND does not encode the return address */ + bool bifrost = b->shader->arch <= 8; + /* Reads 2 or 4 staging registers to cover the input */ unsigned size = nir_alu_type_get_type_size(T); unsigned size_2 = nir_alu_type_get_type_size(T2); @@ -535,18 +538,24 @@ bi_emit_blend_op(bi_builder *b, bi_index rgba, nir_alu_type T, } else if (b->shader->inputs->is_blend) { uint64_t blend_desc = b->shader->inputs->blend.bifrost_blend_desc; + bi_index desc = bi_temp(b->shader); + bi_mov_i32_to(b, bi_word(desc, 0), bi_imm_u32(blend_desc)); + bi_mov_i32_to(b, bi_word(desc, 1), bi_imm_u32(blend_desc >> 32)); + /* Blend descriptor comes from the compile inputs */ /* Put the result in r0 */ - bi_blend_to(b, bi_register(0), rgba, + + bi_blend_to(b, bifrost ? bi_register(0) : bi_null(), rgba, bi_register(60), - bi_imm_u32(blend_desc & 0xffffffff), - bi_imm_u32(blend_desc >> 32), + bi_word(desc, 0), + bi_word(desc, 1), bi_null(), regfmt, sr_count, 0); } else { /* Blend descriptor comes from the FAU RAM. By convention, the - * return address is stored in r48 and will be used by the - * blend shader to jump back to the fragment shader after */ - bi_blend_to(b, bi_register(48), rgba, + * return address on Bifrost is stored in r48 and will be used + * by the blend shader to jump back to the fragment shader */ + + bi_blend_to(b, bifrost ? bi_register(48) : bi_null(), rgba, bi_register(60), bi_fau(BIR_FAU_BLEND_0 + rt, false), bi_fau(BIR_FAU_BLEND_0 + rt, true),