From 69dde49f809dd00d76ee491e1e6a6d5b7e9b2ff2 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 1 Apr 2020 18:08:32 -0400 Subject: [PATCH] pan/bi: Don't gobble zero ports In case we've reading/writing R0. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/bi_pack.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c index 8f006edebe0..8cd4dd3b916 100644 --- a/src/panfrost/bifrost/bi_pack.c +++ b/src/panfrost/bifrost/bi_pack.c @@ -363,12 +363,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. */ + * or INSTR_INVALID_ENC is raised. The reason is unknown. */ - if (!regs.port[3]) + bool has_port2 = regs.write_fma || regs.write_add; + bool has_port3 = regs.read_port3 || (regs.write_fma && regs.write_add); + + if (!has_port3) regs.port[3] = regs.port[2]; - if (!regs.port[2]) + if (!has_port2) regs.port[2] = regs.port[3]; s.reg3 = regs.port[3]; -- 2.30.2