summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2018-01-12 15:35:04 -0800
committerEric Anholt <eric@anholt.net>2018-01-12 21:58:24 -0800
commit5bc0b63799dd23c7c1d150e83770d79bdca00a62 (patch)
treec7d00d087de47c9863aa04f846dfb136e2c64fef
parent762dd52951e3c23666b5c6d7c7836555a7a13bd1 (diff)
broadcom/vc5: Use MSF to ignore discards/non-dispatched channels in loops.
Prevents potential infinite loops when a non-dispatched or discarded channel never triggers the loop break condition.
-rw-r--r--src/broadcom/compiler/nir_to_vir.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c
index bc18b19f80..68e86f3a1c 100644
--- a/src/broadcom/compiler/nir_to_vir.c
+++ b/src/broadcom/compiler/nir_to_vir.c
@@ -1780,7 +1780,11 @@ ntq_emit_loop(struct v3d_compile *c, nir_loop *loop)
vir_PF(c, c->execute, V3D_QPU_PF_PUSHZ);
- vir_BRANCH(c, V3D_QPU_BRANCH_COND_ANYA);
+ struct qinst *branch = vir_BRANCH(c, V3D_QPU_BRANCH_COND_ANYA);
+ /* Pixels that were not dispatched or have been discarded should not
+ * contribute to looping again.
+ */
+ branch->qpu.branch.msfign = V3D_QPU_MSFIGN_P;
vir_link_blocks(c->cur_block, c->loop_cont_block);
vir_link_blocks(c->cur_block, c->loop_break_block);