Mesa (master): panfrost: Fix BI_BLEND packing

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 10 15:11:42 UTC 2020


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

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Thu Apr  9 23:04:41 2020 -0400

panfrost: Fix BI_BLEND packing

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4505>

---

 src/panfrost/bifrost/bi_pack.c         | 7 ++++---
 src/panfrost/bifrost/bi_schedule.c     | 6 ++++++
 src/panfrost/bifrost/bi_tables.c       | 2 +-
 src/panfrost/bifrost/bifrost_compile.c | 8 ++++----
 4 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index 61d3b4f1ee2..3a37452a949 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -1014,16 +1014,17 @@ bi_pack_add_atest(bi_clause *clause, bi_instruction *ins, struct bi_registers *r
 }
 
 static unsigned
-bi_pack_add_blend(bi_instruction *ins, struct bi_registers *regs)
+bi_pack_add_blend(bi_clause *clause, bi_instruction *ins, struct bi_registers *regs)
 {
         struct bifrost_add_inst pack = {
-                .src0 = bi_get_src(ins, regs, 0, false),
+                .src0 = bi_get_src(ins, regs, 1, false),
                 .op = BIFROST_ADD_OP_BLEND
         };
 
         /* TODO: Pack location in uniform_const */
         assert(ins->blend_location == 0);
 
+        bi_read_data_register(clause, ins);
         RETURN_PACKED(pack);
 }
 
@@ -1065,7 +1066,7 @@ bi_pack_add(bi_clause *clause, bi_bundle bundle, struct bi_registers *regs)
         case BI_CMP:
                 return BIFROST_ADD_NOP;
         case BI_BLEND:
-                return bi_pack_add_blend(bundle.add, regs);
+                return bi_pack_add_blend(clause, bundle.add, regs);
         case BI_BITWISE:
         case BI_CONVERT:
         case BI_DISCARD:
diff --git a/src/panfrost/bifrost/bi_schedule.c b/src/panfrost/bifrost/bi_schedule.c
index 2885aeefe3a..e309890cd64 100644
--- a/src/panfrost/bifrost/bi_schedule.c
+++ b/src/panfrost/bifrost/bi_schedule.c
@@ -156,6 +156,12 @@ bi_schedule(bi_context *ctx)
                                 u->data_register_write_barrier = true;
                         }
 
+                        if (ins->type == BI_ATEST)
+                                u->dependencies |= (1 << 6);
+
+                        if (ins->type == BI_BLEND)
+                                u->dependencies |= (1 << 6) | (1 << 7);
+
                         ids = ids & 1;
                         last_id = u->scoreboard_id;
                         u->back_to_back = false;
diff --git a/src/panfrost/bifrost/bi_tables.c b/src/panfrost/bifrost/bi_tables.c
index c94d1572a3f..7e9c90327f1 100644
--- a/src/panfrost/bifrost/bi_tables.c
+++ b/src/panfrost/bifrost/bi_tables.c
@@ -31,7 +31,7 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
         [BI_ATEST] 		= BI_SCHED_HI_LATENCY | BI_SCHED_ADD,
         [BI_BRANCH] 		= BI_SCHED_HI_LATENCY | BI_SCHED_ADD,
         [BI_CMP] 		= BI_GENERIC | BI_MODS | BI_SCHED_ALL,
-        [BI_BLEND] 		= BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR,
+        [BI_BLEND] 		= BI_SCHED_HI_LATENCY | BI_SCHED_ADD | BI_VECTOR | BI_DATA_REG_SRC,
         [BI_BITWISE] 		= BI_GENERIC | BI_SCHED_ALL,
         [BI_COMBINE] 		= 0,
         [BI_CONVERT] 		= BI_SCHED_ALL | BI_SWIZZLABLE,
diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c
index a43068e35d6..42abe567ee7 100644
--- a/src/panfrost/bifrost/bifrost_compile.c
+++ b/src/panfrost/bifrost/bifrost_compile.c
@@ -147,16 +147,16 @@ bi_emit_frag_out(bi_context *ctx, nir_intrinsic_instr *instr)
                 .type = BI_BLEND,
                 .blend_location = nir_intrinsic_base(instr),
                 .src = {
+                        bir_src_index(&instr->src[0]),
                         BIR_INDEX_REGISTER | 60 /* Can this be arbitrary? */,
-                        bir_src_index(&instr->src[0])
                 },
                 .src_types = {
-                        nir_type_uint32,
                         nir_type_float32,
+                        nir_type_uint32
                 },
                 .swizzle = {
-                        { 0 },
-                        { 0, 1, 2, 3 }
+                        { 0, 1, 2, 3 },
+                        { 0 }
                 },
                 .dest = BIR_INDEX_REGISTER | 48 /* Looks like magic */,
                 .dest_type = nir_type_uint32,



More information about the mesa-commit mailing list