diff options
author | Eric Anholt <[email protected]> | 2019-04-17 14:44:44 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2019-04-18 13:24:55 -0700 |
commit | 12f6c34806cbb1d9e65ee3d070c753b4b47a6e64 (patch) | |
tree | 46b75b67e96671578474dc5f9bb7f5f1ccc2e646 /src/broadcom/compiler | |
parent | 1ce143ca19950d52a1b5eec418a5c90843049304 (diff) |
v3d: Fix atomic cmpxchg in shaders on hardware.
In what might be my first case of finding a divergence between hardware
and simpenrose for v3d 4.x, it seems that despite what the spec claims,
you actually need specific values in the TYPE field for atomic ops.
Fixes dEQP-GLES31.functional.*.compswap.*
Diffstat (limited to 'src/broadcom/compiler')
-rw-r--r-- | src/broadcom/compiler/nir_to_vir.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/broadcom/compiler/nir_to_vir.c b/src/broadcom/compiler/nir_to_vir.c index 9a4705a3de6..30fd4002ef9 100644 --- a/src/broadcom/compiler/nir_to_vir.c +++ b/src/broadcom/compiler/nir_to_vir.c @@ -266,14 +266,24 @@ ntq_emit_tmu_general(struct v3d_compile *c, nir_intrinsic_instr *instr, 1 : 0])); } + /* The spec says that for atomics, the TYPE field is ignored, but that + * doesn't seem to be the case for CMPXCHG. Just use the number of + * tmud writes we did to decide the type (or choose "32bit" for atomic + * reads, which has been fine). + */ + int num_components; + if (tmu_op == GENERAL_TMU_WRITE_OP_ATOMIC_CMPXCHG) + num_components = 2; + else + num_components = instr->num_components; + uint32_t config = (0xffffff00 | tmu_op | GENERAL_TMU_LOOKUP_PER_PIXEL); - if (instr->num_components == 1) { + if (num_components == 1) { config |= GENERAL_TMU_LOOKUP_TYPE_32BIT_UI; } else { - config |= (GENERAL_TMU_LOOKUP_TYPE_VEC2 + - instr->num_components - 2); + config |= GENERAL_TMU_LOOKUP_TYPE_VEC2 + num_components - 2; } if (vir_in_nonuniform_control_flow(c)) { |