Mesa (main): pan/bi: Specialize BLEND emit for Valhall

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 14:34:59 UTC 2022


Module: Mesa
Branch: main
Commit: 9091b6261bbfbd8d3b64868691fd071146e9a6e0
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9091b6261bbfbd8d3b64868691fd071146e9a6e0

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Jul 29 17:39:14 2021 -0400

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 <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15793>

---

 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),



More information about the mesa-commit mailing list