pan/bi: Move bi_flip_ports out of port assignment
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 5 May 2020 18:34:58 +0000 (14:34 -0400)
committerMarge Bot <eric+marge@anholt.net>
Fri, 29 May 2020 20:34:55 +0000 (20:34 +0000)
It's more of a packing fixup than anything scheduler-y, and port
assignment will soon be the domain of the scheduler.

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

src/panfrost/bifrost/bi_pack.c

index 9c49ffceb2760ba87b1c84fb1138de43a700537a..0cc56584303064a1e57da33526965ef787d4d2ac 100644 (file)
@@ -267,14 +267,6 @@ bi_assign_ports(bi_bundle *now, bi_bundle *prev)
                 now->regs.write_fma = true;
         }
 
-        /* Finally, ensure port 1 > port 0 for the 63-x trick to function */
-
-        if (now->regs.enabled[0] && now->regs.enabled[1] && now->regs.port[1] < now->regs.port[0]) {
-                unsigned temp = now->regs.port[0];
-                now->regs.port[0] = now->regs.port[1];
-                now->regs.port[1] = temp;
-        }
-
         return now->regs;
 }
 
@@ -1676,6 +1668,20 @@ struct bi_packed_bundle {
         uint64_t hi;
 };
 
+/* We must ensure port 1 > port 0 for the 63-x trick to function, so we fix
+ * this up at pack time. (Scheduling doesn't care.) */
+
+static void
+bi_flip_ports(bi_registers *regs)
+{
+        if (regs->enabled[0] && regs->enabled[1] && regs->port[1] < regs->port[0]) {
+                unsigned temp = regs->port[0];
+                regs->port[0] = regs->port[1];
+                regs->port[1] = temp;
+        }
+
+}
+
 static struct bi_packed_bundle
 bi_pack_bundle(bi_clause *clause, bi_bundle bundle, bi_bundle prev, bool first_bundle, gl_shader_stage stage)
 {
@@ -1683,6 +1689,8 @@ bi_pack_bundle(bi_clause *clause, bi_bundle bundle, bi_bundle prev, bool first_b
         bi_assign_uniform_constant(clause, &bundle.regs, bundle);
         bundle.regs.first_instruction = first_bundle;
 
+        bi_flip_ports(&bundle.regs);
+
         uint64_t reg = bi_pack_registers(bundle.regs);
         uint64_t fma = bi_pack_fma(clause, bundle, &bundle.regs);
         uint64_t add = bi_pack_add(clause, bundle, &bundle.regs, stage);