Mesa (master): pan/bi: Expose FAU slots

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 13 13:48:19 UTC 2020


Module: Mesa
Branch: master
Commit: f0e3de7e91aa2ad9558ba8e30247e4b0ac569521
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f0e3de7e91aa2ad9558ba8e30247e4b0ac569521

Author: Boris Brezillon <boris.brezillon at collabora.com>
Date:   Thu Nov 12 16:18:13 2020 +0100

pan/bi: Expose FAU slots

Instead of adding a BIR_INDEX_ per FAU index, let's group some of those
together.

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

---

 src/panfrost/bifrost/bi_pack.c  |  9 +++++++++
 src/panfrost/bifrost/bi_print.c | 19 ++++++++++++++++++-
 src/panfrost/bifrost/compiler.h | 16 +++++++++++++++-
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index 2122dc373fc..204affa06f5 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -179,6 +179,15 @@ bi_assign_fau_idx_single(bi_registers *regs,
 
                         regs->fau_idx = 8 | rt;
                         assigned = true;
+                } else if (ins->src[s] & BIR_INDEX_FAU) {
+                        unsigned index = ins->src[s] & BIR_FAU_TYPE_MASK;
+                        bool hi = !!(ins->src[s] & BIR_FAU_HI);
+
+                        assert(!assigned || regs->fau_idx == index);
+                        regs->fau_idx = index;
+                        ins->src[s] = BIR_INDEX_PASS |
+                                      (hi ? BIFROST_SRC_FAU_HI : BIFROST_SRC_FAU_LO);
+                        assigned = true;
                 } else if (s & BIR_INDEX_UNIFORM) {
                         unreachable("Push uniforms not implemented yet");
                 }
diff --git a/src/panfrost/bifrost/bi_print.c b/src/panfrost/bifrost/bi_print.c
index 224dbc26df4..a97366bbba6 100644
--- a/src/panfrost/bifrost/bi_print.c
+++ b/src/panfrost/bifrost/bi_print.c
@@ -99,6 +99,18 @@ bi_print_dest_index(FILE *fp, bi_instruction *ins, unsigned index)
         return true;
 }
 
+static const char *
+bir_fau_name(unsigned fau_idx)
+{
+        const char *names[] = {
+                "zero", "lane-id", "wrap-id", "core-id",
+                "fb-extent", "atest-param", "sample-pos"
+        };
+
+        assert(fau_idx < ARRAY_SIZE(names));
+        return names[fau_idx];
+}
+
 static void
 bi_print_index(FILE *fp, bi_instruction *ins, unsigned index, unsigned s)
 {
@@ -114,6 +126,9 @@ bi_print_index(FILE *fp, bi_instruction *ins, unsigned index, unsigned s)
         else if (index & BIR_INDEX_BLEND)
                 fprintf(fp, "blend_descriptor_%u.%c", ins->blend_location,
                         (index & ~BIR_INDEX_BLEND) == BIFROST_SRC_FAU_HI ? 'y' : 'x');
+        else if (index & BIR_INDEX_FAU)
+                fprintf(fp, "%s.%c", bir_fau_name(index & BIR_FAU_TYPE_MASK),
+                        (index & BIR_FAU_HI) ? 'y' : 'x');
         else
                 fprintf(fp, "#err");
 }
@@ -327,7 +342,9 @@ bi_print_instruction(bi_instruction *ins, FILE *fp)
         bi_foreach_src(ins, s) {
                 bi_print_src(fp, ins, s);
 
-                if (ins->src[s] && !(ins->src[s] & (BIR_INDEX_CONSTANT | BIR_INDEX_ZERO))) {
+                if (ins->src[s] &&
+                    !(ins->src[s] &
+                      (BIR_INDEX_CONSTANT | BIR_INDEX_ZERO | BIR_INDEX_FAU))) {
                         pan_print_alu_type(ins->src_types[s], fp);
                         bi_print_swizzle(ins, s, fp);
                 }
diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h
index ff2486a2964..d51294cf2b9 100644
--- a/src/panfrost/bifrost/compiler.h
+++ b/src/panfrost/bifrost/compiler.h
@@ -536,12 +536,26 @@ bi_remove_instruction(bi_instruction *ins)
 #define BIR_INDEX_ZERO     (1 << 28)
 #define BIR_INDEX_PASS     (1 << 27)
 #define BIR_INDEX_BLEND    (1 << 26)
+#define BIR_INDEX_FAU      (1 << 25)
+
+enum bir_fau {
+        BIR_FAU_ZERO = 0,
+        BIR_FAU_LANE_ID = 1,
+        BIR_FAU_WRAP_ID = 2,
+        BIR_FAU_CORE_ID = 3,
+        BIR_FAU_FB_EXTENT = 4,
+        BIR_FAU_ATEST_PARAM = 5,
+        BIR_FAU_SAMPLE_POS_ARRAY = 6,
+        BIR_FAU_TYPE_MASK = 15,
+        BIR_FAU_HI = (1 << 8),
+};
 
 /* Keep me synced please so we can check src & BIR_SPECIAL */
 
 #define BIR_SPECIAL        (BIR_INDEX_REGISTER | BIR_INDEX_UNIFORM | \
                             BIR_INDEX_CONSTANT | BIR_INDEX_ZERO | \
-                            BIR_INDEX_PASS | BIR_INDEX_BLEND)
+                            BIR_INDEX_PASS | BIR_INDEX_BLEND | \
+                            BIR_INDEX_FAU)
 
 static inline unsigned
 bi_max_temp(bi_context *ctx)



More information about the mesa-commit mailing list