pan/bi: Handle asymmetric staging in bi_count_read_registers
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 28 Jul 2021 23:48:06 +0000 (19:48 -0400)
committerMarge Bot <eric+marge@anholt.net>
Thu, 29 Jul 2021 23:40:46 +0000 (23:40 +0000)
Needed for atomics.

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

src/panfrost/bifrost/bir.c

index fa45ee7..6433726 100644 (file)
@@ -86,7 +86,10 @@ bi_count_staging_registers(const bi_instr *ins)
 unsigned
 bi_count_read_registers(const bi_instr *ins, unsigned s)
 {
-        if (s == 0 && bi_opcode_props[ins->op].sr_read)
+        /* PATOM_C reads 1 but writes 2 */
+        if (s == 0 && ins->op == BI_OPCODE_PATOM_C_I32)
+                return 1;
+        else if (s == 0 && bi_opcode_props[ins->op].sr_read)
                 return bi_count_staging_registers(ins);
         else
                 return 1;