panfrost: Fix BI_BLEND packing
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 10 Apr 2020 03:04:41 +0000 (23:04 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Fri, 10 Apr 2020 14:53:57 +0000 (16:53 +0200)
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4505>

src/panfrost/bifrost/bi_pack.c
src/panfrost/bifrost/bi_schedule.c
src/panfrost/bifrost/bi_tables.c
src/panfrost/bifrost/bifrost_compile.c

index 61d3b4f1ee2623da32f063537cc7f728c980d8fb..3a37452a949f155ec89bc9d840461d12bfb08f32 100644 (file)
@@ -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:
index 2885aeefe3a4cf70859572063ab0883532ca87c6..e309890cd6495f33663f46d614348c1faee12b75 100644 (file)
@@ -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;
index c94d1572a3f0207dc20b6acb922b7e00ebbbb10e..7e9c90327f1477270e4eb91a8f6a05c04875202d 100644 (file)
@@ -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,
index a43068e35d61225c344210ddc8f228f9fe0d7fbf..42abe567ee744a7b844382069b2c7cbe123d2e78 100644 (file)
@@ -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,