From 2b535ac61b92cdf5f1e5adca3f2a4a43e7384e1a Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Sat, 2 May 2020 22:24:25 +0200 Subject: [PATCH] etnaviv: Disable seamless cube map on GC880 The GC880 on iMX6DL indicates in it's minorFeatures2 register that it does support SEAMLESS_CUBE_MAP, however when the TE.SAMPLER_CONFIG1 VIVS_TE_SAMPLER_CONFIG1_SEAMLESS_CUBE_MAP bit is set on GC880 on iMX6DL, the result is corrupted image. In particular, the following ~112 dEQPs are affected and fail: dEQP-GLES2.functional.texture.filtering.cube.* This only happens on MX6DL GC880, MX6Q GC2000 and STM32MP1 GC400(GCnano) do not report the minorFeatures2 SEAMLESS_CUBE_MAP bit and ignore the TE_SAMPLER_CONFIG1 VIVS_TE_SAMPLER_CONFIG1_SEAMLESS_CUBE_MAP bit (note that ss->seamless_cube_map is unconditionally set by mesa at times even PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE returns 0), so there is no visible problem and there are no failing dEQP tests on the GC2000 and GCnano. This might imply that the minorFeatures2 SEAMLESS_CUBE_MAP has some different meaning on GC880 or the SEAMLESS_CUBE_MAP behaves differently on the GC880. This patch does not set the SEAMLESS_CUBE_MAP bit on hardware which does not indicate support for seamless cube map and on GC880, which results in reduction in failed dEQPs: 635 to 186 on GC880, 274 to 270 on GC2000 and no change on GC400(GCnano). Fixes: 8dd26fa2f06 ("etnaviv: support GL_ARB_seamless_cubemap_per_texture") Reviewed-by: Christian Gmeiner Signed-off-by: Marek Vasut Part-of: --- src/gallium/drivers/etnaviv/etnaviv_internal.h | 2 ++ src/gallium/drivers/etnaviv/etnaviv_screen.c | 5 ++++- src/gallium/drivers/etnaviv/etnaviv_texture_state.c | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/gallium/drivers/etnaviv/etnaviv_internal.h b/src/gallium/drivers/etnaviv/etnaviv_internal.h index fabd43199ee..dc5f3f2b902 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_internal.h +++ b/src/gallium/drivers/etnaviv/etnaviv_internal.h @@ -91,6 +91,8 @@ struct etna_specs { unsigned use_blt : 1; /* can use any kind of wrapping mode on npot textures */ unsigned npot_tex_any_wrap : 1; + /* supports seamless cube map */ + unsigned seamless_cube_map : 1; /* number of bits per TS tile */ unsigned bits_per_tile; /* clear value for TS (dependent on bits_per_tile) */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index 338b643c7be..9fbacd3c49b 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -220,7 +220,7 @@ etna_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_MAX_TEXEL_OFFSET: return 7; case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE: - return VIV_FEATURE(screen, chipMinorFeatures2, SEAMLESS_CUBE_MAP); + return screen->specs.seamless_cube_map; /* Timer queries. */ case PIPE_CAP_OCCLUSION_QUERY: @@ -763,6 +763,9 @@ etna_get_specs(struct etna_screen *screen) VIV_FEATURE(screen, chipMinorFeatures4, HALTI2); screen->specs.v4_compression = VIV_FEATURE(screen, chipMinorFeatures6, V4_COMPRESSION); + screen->specs.seamless_cube_map = + (screen->model != 0x880) && /* Seamless cubemap is broken on GC880? */ + VIV_FEATURE(screen, chipMinorFeatures2, SEAMLESS_CUBE_MAP); if (screen->specs.halti >= 5) { /* GC7000 - this core must load shaders from memory. */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c index c66bfcee9a8..4c11b114ac0 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_texture_state.c +++ b/src/gallium/drivers/etnaviv/etnaviv_texture_state.c @@ -86,6 +86,8 @@ etna_create_sampler_state_state(struct pipe_context *pipe, const struct pipe_sampler_state *ss) { struct etna_sampler_state *cs = CALLOC_STRUCT(etna_sampler_state); + struct etna_context *ctx = etna_context(pipe); + struct etna_screen *screen = ctx->screen; const bool ansio = ss->max_anisotropy > 1; if (!cs) @@ -105,8 +107,8 @@ etna_create_sampler_state_state(struct pipe_context *pipe, cs->TE_SAMPLER_CONFIG0 |= VIVS_TE_SAMPLER_CONFIG0_ROUND_UV; } - cs->TE_SAMPLER_CONFIG1 = - COND(ss->seamless_cube_map, VIVS_TE_SAMPLER_CONFIG1_SEAMLESS_CUBE_MAP); + cs->TE_SAMPLER_CONFIG1 = screen->specs.seamless_cube_map ? + COND(ss->seamless_cube_map, VIVS_TE_SAMPLER_CONFIG1_SEAMLESS_CUBE_MAP) : 0; cs->TE_SAMPLER_LOD_CONFIG = COND(ss->lod_bias != 0.0, VIVS_TE_SAMPLER_LOD_CONFIG_BIAS_ENABLE) | -- 2.30.2