From 8f583df7b6f0fdcc383afbf03e20ed2f91eb4a95 Mon Sep 17 00:00:00 2001 From: Arcady Goldmints-Orlov Date: Tue, 15 Dec 2020 13:55:23 -0600 Subject: [PATCH] broadcom/compiler: Enable PER_QUAD TMU access only in uniform control flow PER_QUAD TMU lookups will partially override the predication mask on TMU writes. If some but not all lanes in a quad are predicated out, setting PER_QUAD will force them all to be enabled. This can result in TMU access to bogus addresses when in nonuniform control flow. Also, since PER_QUAD is needed to make sure derivatives work with helper invocations, and derivatives are undefined in nonuniform control flow, there is no reason to leave it enabled in this case. Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/compiler/nir_to_vir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index ac41a136b38..cf678b4432f 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -365,7 +365,7 @@ ntq_emit_tmu_general(struct v3d_compile *c, nir_intrinsic_instr *instr, num_components = tmu_writes - 1; } - uint32_t perquad = is_load + uint32_t perquad = is_load && !vir_in_nonuniform_control_flow(c) ? GENERAL_TMU_LOOKUP_PER_QUAD : GENERAL_TMU_LOOKUP_PER_PIXEL; uint32_t config = (0xffffff00 |