etnaviv: allow more constants in unified uniform mode

In unified uniform mode the constant memory is dynmically partitioned
between VS and FS, which allows to use far more FS constants than
currently supported with the fixed split when VS constant usage is low.
Limit computation taken from the Vivante kernel driver.

Fixes dEQP-GLES2.functional.uniform_api.random.79 on GPUs with
unified uniform support.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32983>
This commit is contained in:
Lucas Stach
2025-01-10 22:26:37 +01:00
committed by Marge Bot
parent fdaa216c5d
commit 14ccd5d945
2 changed files with 18 additions and 2 deletions
+7 -2
View File
@@ -761,8 +761,13 @@ etna_determine_uniform_limits(struct etna_screen *screen)
* gcmCONFIGUREUNIFORMS in the Vivante kernel driver file
* drivers/mxc/gpu-viv/hal/kernel/inc/gc_hal_base.h.
*/
if (screen->info->model == chipModel_GC2000 &&
(screen->info->revision == 0x5118 || screen->info->revision == 0x5140)) {
if (screen->info->halti >= 1) {
/* with halti1 we use unified constant mode */
screen->specs.max_vs_uniforms = screen->specs.max_ps_uniforms =
MIN2(512, screen->info->gpu.num_constants - 64);
} else if (screen->info->model == chipModel_GC2000 &&
(screen->info->revision == 0x5118 ||
screen->info->revision == 0x5140)) {
screen->specs.max_vs_uniforms = 256;
screen->specs.max_ps_uniforms = 64;
} else if (screen->info->gpu.num_constants == 320) {
@@ -140,6 +140,17 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs,
link.varyings[idx].pa_attributes);
}
if (ctx->screen->specs.has_unified_uniforms) {
/* check if combined shader constants fit into unified const memory */
if ((vs->uniforms.count + fs->uniforms.count) / 4 >
ctx->screen->info->gpu.num_constants) {
DBG("Number of combined uniforms (%d) exceeds maximum %d",
(vs->uniforms.count + fs->uniforms.count) / 4,
ctx->screen->info->gpu.num_constants);
return false;
}
}
/* set last_varying_2x flag if the last varying has 1 or 2 components */
bool last_varying_2x = false;
if (link.num_varyings > 0 && link.varyings[link.num_varyings - 1].num_components <= 2)