pan/bi: Fix unused port swapping
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 31 Mar 2020 17:37:12 +0000 (13:37 -0400)
committerMarge Bot <eric+marge@anholt.net>
Wed, 1 Apr 2020 02:25:05 +0000 (02:25 +0000)
Fixes INSTR_INVALID_ENC

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

src/panfrost/bifrost/bi_pack.c

index 94a62edb471c54ed77acc74c5fd1a2864c3a0e0e..293a109eb5aedd4ba5e7fe2459d7c6a65dd66cad 100644 (file)
@@ -362,6 +362,15 @@ bi_pack_registers(struct bi_registers regs)
                 }
         }
 
+        /* When port 3 isn't used, we have to set it to port 2, and vice versa,
+         * or we an INSTR_INVALID_ENC is raised. The reason is unknown. */
+
+        if (!regs.port[3])
+                regs.port[3] = regs.port[2];
+
+        if (!regs.port[2])
+                regs.port[2] = regs.port[3];
+
         s.reg3 = regs.port[3];
         s.reg2 = regs.port[2];
         s.uniform_const = regs.uniform_constant;