pan/bi: Add bi_pack_sync
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 6 Jan 2021 18:39:28 +0000 (13:39 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 Jan 2021 16:55:44 +0000 (16:55 +0000)
The type/sync byte, also known as the tag.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>

src/panfrost/bifrost/bi_pack.c

index 0747ba4..fb0328f 100644 (file)
@@ -668,6 +668,36 @@ bi_pack_tuple_bits(enum bi_clause_subword idx,
         return (lo | hi) & ((1ULL << nbits) - 1);
 }
 
+static inline uint16_t
+bi_pack_lu(enum bi_clause_subword word,
+                struct bi_packed_tuple *tuples,
+                ASSERTED unsigned tuple_count)
+{
+        return (word >= BI_CLAUSE_SUBWORD_UPPER_0) ?
+                bi_pack_upper(word, tuples, tuple_count) :
+                bi_pack_literal(word);
+}
+
+static uint8_t
+bi_pack_sync(enum bi_clause_subword t1,
+                enum bi_clause_subword t2,
+                enum bi_clause_subword t3,
+                struct bi_packed_tuple *tuples,
+                ASSERTED unsigned tuple_count,
+                bool z)
+{
+        uint8_t sync =
+                (bi_pack_lu(t3, tuples, tuple_count) << 0) |
+                (bi_pack_lu(t2, tuples, tuple_count) << 3);
+
+        if (t1 == BI_CLAUSE_SUBWORD_Z)
+                sync |= z << 6;
+        else
+                sync |= bi_pack_literal(t1) << 6;
+
+        return sync;
+}
+
 static void
 bi_pack_clause(bi_context *ctx, bi_clause *clause,
                 bi_clause *next_1, bi_clause *next_2,