From 314eb97dcb9e1c90d1404e3d8a06b812592d083f Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Mon, 9 Aug 2021 08:27:59 +0200 Subject: [PATCH] broadcom/compiler: Flags are per-thread state in V3D 4.2+ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This means they survive a thread switch, so we can remove redundant flag setups across thread switches. Reviewed-by: Alejandro PiƱeiro Part-of: --- src/broadcom/compiler/vir_opt_redundant_flags.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/broadcom/compiler/vir_opt_redundant_flags.c b/src/broadcom/compiler/vir_opt_redundant_flags.c index 8749f3cd647..4609ef9c361 100644 --- a/src/broadcom/compiler/vir_opt_redundant_flags.c +++ b/src/broadcom/compiler/vir_opt_redundant_flags.c @@ -107,9 +107,14 @@ vir_opt_redundant_flags_block(struct v3d_compile *c, struct qblock *block) continue; } - /* Flags aren't preserved across a thrsw. */ - if (inst->qpu.sig.thrsw) - last_flags = NULL; + /* Flags aren't preserved across a thrsw. + * + * In V3D 4.2+ flags are preserved across thread switches. + */ + if (c->devinfo->ver < 42) { + if (inst->qpu.sig.thrsw) + last_flags = NULL; + } if (inst->qpu.flags.apf != V3D_QPU_PF_NONE || inst->qpu.flags.mpf != V3D_QPU_PF_NONE) {