summaryrefslogtreecommitdiffstats
path: root/src/broadcom
diff options
context:
space:
mode:
authorAlejandro Piñeiro <[email protected]>2020-04-21 01:09:00 +0200
committerAlejandro Piñeiro <[email protected]>2020-04-22 23:39:34 +0200
commit9967c26ae6c5afffd238a8c33b4e97457283a9ca (patch)
tree73e829f2a773aba5b8cde71ab3578e9e87e840cf /src/broadcom
parentd0b644d9f9d9673d3fe28c8c200209f553adeda1 (diff)
v3d/tex: Configuration Parameter 1 can be only skipped if P2 can be skipped too
Configuration Parameter packets 1 and 2 are pointed as optional, but it is not clearly stated if you can skip only P1 when P2 is needed. In the practice, it seems that the situation P0 - non-P1 - P2 can causes problems, and at least on the simulator, it seems that sampler info are attempted to be accessed. So let's just be conservative, and only skip P1 configuration if we can skip P2 configuration too. Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4677>
Diffstat (limited to 'src/broadcom')
-rw-r--r--src/broadcom/compiler/v3d40_tex.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/broadcom/compiler/v3d40_tex.c b/src/broadcom/compiler/v3d40_tex.c
index 1e40e63f4ea..c3f7d94344a 100644
--- a/src/broadcom/compiler/v3d40_tex.c
+++ b/src/broadcom/compiler/v3d40_tex.c
@@ -216,7 +216,14 @@ v3d40_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
bool output_type_32_bit = (c->key->tex[unit].return_size == 32 &&
!instr->is_shadow);
- if (output_type_32_bit || texture_instr_need_sampler(instr)) {
+ /*
+ * p1 is optional, but we can skip it only if p2 can be skipped too
+ */
+ bool needs_p2_config =
+ memcmp(&p2_unpacked, &p2_unpacked_default, sizeof(p2_unpacked)) != 0;
+
+ if (needs_p2_config || output_type_32_bit ||
+ texture_instr_need_sampler(instr)) {
struct V3D41_TMU_CONFIG_PARAMETER_1 p1_unpacked = {
.output_type_32_bit = output_type_32_bit,
@@ -248,7 +255,7 @@ v3d40_vir_emit_tex(struct v3d_compile *c, nir_tex_instr *instr)
vir_WRTMUC(c, QUNIFORM_TMU_CONFIG_P1, p1_packed);
}
- if (memcmp(&p2_unpacked, &p2_unpacked_default, sizeof(p2_unpacked)) != 0)
+ if (needs_p2_config)
vir_WRTMUC(c, QUNIFORM_CONSTANT, p2_packed);
if (instr->op == nir_texop_txf) {