Mesa (staging/22.1): pan/bi: Fix mov and pack_32_2x16

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 23 18:09:43 UTC 2022


Module: Mesa
Branch: staging/22.1
Commit: 4bbf53621632fbb518ea987157c6a6ca65f4ce89
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4bbf53621632fbb518ea987157c6a6ca65f4ce89

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed May 18 12:44:38 2022 -0400

pan/bi: Fix mov and pack_32_2x16

Move can take in a vector and write a scalar, depending on the swizzle. We need
to handle this case. Split out mov and pack_32_2x16 so we can specify correct
behaviour for both. Also drop unused 1-bit boolean stuff which obscured the fix.

Fixes: 76cea8e27b3 ("panfrost: Fix pack_32_2x16 implementation")
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16585>
(cherry picked from commit 9924e6f291496e1c53a1691bc371c99b0f49964b)

---

 .pick_status.json                      |  2 +-
 src/panfrost/bifrost/bifrost_compile.c | 24 ++++++++++++++++++------
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index cc71d609b95..ed93b817160 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -571,7 +571,7 @@
         "description": "pan/bi: Fix mov and pack_32_2x16",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "76cea8e27b3bb16cf752962ca53da42ab4bf51e4"
     },
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index 338fad3f016..19e76a41f38 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -2027,10 +2027,7 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
                 return;
 
 
-        case nir_op_mov:
-        case nir_op_pack_32_2x16: {
-                unsigned src_comps = nir_src_num_components(instr->src[0].src);
-
+        case nir_op_mov: {
                 bi_index idx = bi_src_index(&instr->src[0].src);
                 bi_index unoffset_srcs[4] = { idx, idx, idx, idx };
 
@@ -2041,8 +2038,23 @@ bi_emit_alu(bi_builder *b, nir_alu_instr *instr)
                         comps > 3 ? instr->src[0].swizzle[3] : 0,
                 };
 
-                if (src_sz == 1) src_sz = 16;
-                bi_make_vec_to(b, dst, unoffset_srcs, channels, src_comps, src_sz);
+                bi_make_vec_to(b, dst, unoffset_srcs, channels, comps, src_sz);
+                return;
+        }
+
+        case nir_op_pack_32_2x16: {
+                assert(nir_src_num_components(instr->src[0].src) == 2);
+                assert(comps == 1);
+
+                bi_index idx = bi_src_index(&instr->src[0].src);
+                bi_index unoffset_srcs[4] = { idx, idx, idx, idx };
+
+                unsigned channels[2] = {
+                        instr->src[0].swizzle[0],
+                        instr->src[0].swizzle[1]
+                };
+
+                bi_make_vec_to(b, dst, unoffset_srcs, channels, 2, 16);
                 return;
         }
 



More information about the mesa-commit mailing list