etnaviv: Disable trilinear filtering for shadow samplers
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

The Vivante GPUs have a hardware bug where trilinear filtering
(MIP=LINEAR) produces incorrect results when used with depth/stencil
textures that have shadow comparison enabled, leading to GPU hangs.

Work around this by forcing MIP=NEAREST for depth/stencil formats,
downgrading from trilinear to bilinear filtering as done by binary blob
too.

Fixes dEQP-GLES3.functional.texture.shadow.*.linear_mipmap_linear.*
except DEPTH32F ones on all GPUs I have access to.

Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38308>
This commit is contained in:
Christian Gmeiner 2025-11-03 23:26:05 +01:00 committed by Marge Bot
parent a21cd9d60c
commit 0c31313b6e
2 changed files with 18 additions and 0 deletions

View file

@ -326,6 +326,12 @@ etna_emit_texture_desc(struct etna_context *ctx)
if (texture_use_int_filter(&sv->base, &ss->base, true))
SAMP_CTRL0 |= VIVS_NTE_DESCRIPTOR_SAMP_CTRL0_INT_FILTER;
if (util_format_description(sv->base.format)->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
ss->base.min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
SAMP_CTRL0 &= ~VIVS_NTE_DESCRIPTOR_SAMP_CTRL0_MIP__MASK;
SAMP_CTRL0 |= VIVS_NTE_DESCRIPTOR_SAMP_CTRL0_MIP(TEXTURE_FILTER_NEAREST);
}
etna_set_state(stream, VIVS_NTE_DESCRIPTOR_TX_CTRL(x),
COND(sv->ts.enable, VIVS_NTE_DESCRIPTOR_TX_CTRL_TS_ENABLE) |
VIVS_NTE_DESCRIPTOR_TX_CTRL_TS_MODE(sv->ts.mode) |

View file

@ -356,6 +356,12 @@ etna_emit_new_texture_state(struct etna_context *ctx)
struct etna_sampler_view *sv = etna_sampler_view(ctx->sampler_view[x]);
val = (ss->config0 & sv->config0_mask) | sv->config0;
if (util_format_description(sv->base.format)->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
ss->base.min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
val &= ~VIVS_NTE_SAMPLER_CONFIG0_MIP__MASK;
val |= VIVS_NTE_SAMPLER_CONFIG0_MIP(TEXTURE_FILTER_NEAREST);
}
}
/*10000*/ EMIT_STATE(NTE_SAMPLER_CONFIG0(x), val);
@ -496,6 +502,12 @@ etna_emit_texture_state(struct etna_context *ctx)
struct etna_sampler_view *sv = etna_sampler_view(ctx->sampler_view[x]);
val = (ss->config0 & sv->config0_mask) | sv->config0;
if (util_format_description(sv->base.format)->colorspace == UTIL_FORMAT_COLORSPACE_ZS &&
ss->base.min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR) {
val &= ~VIVS_TE_SAMPLER_CONFIG0_MIP__MASK;
val |= VIVS_TE_SAMPLER_CONFIG0_MIP(TEXTURE_FILTER_NEAREST);
}
}
/*02000*/ EMIT_STATE(TE_SAMPLER_CONFIG0(x), val);