etnaviv: allow larger shaders with unified instruction memory

When the core supports unified instruction memory, don't clamp individual
shader sizes to 256 instructions. Allow shaders to make full use of the
state instruction memory, as long as both VS and FS fit into the memory
region.

Allows to run the shaders from glmark2 terrain from state instruction
memory, so we don't need to use icache mode on GC3000 and makes the app
work on GC2000, which doesn't have icache but unified instruction memory.

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/33229>
This commit is contained in:
Lucas Stach
2025-01-26 17:06:56 +01:00
committed by Marge Bot
parent bc83e0b90f
commit 3800ecc029
2 changed files with 10 additions and 4 deletions
+3 -3
View File
@@ -878,19 +878,19 @@ etna_get_specs(struct etna_screen *screen)
* same.
*/
screen->specs.ps_offset = 0x8000;
screen->specs.max_instructions = 256; /* maximum number instructions for non-icache use */
/* maximum number instructions for non-icache use */
screen->specs.max_instructions = instruction_count;
screen->specs.has_icache = true;
} else {
if (instruction_count > 256) {
/* unified instruction states */
screen->specs.vs_offset = 0xC000;
screen->specs.ps_offset = 0xC000;
screen->specs.max_instructions = 256;
} else {
screen->specs.vs_offset = 0x4000;
screen->specs.ps_offset = 0x6000;
screen->specs.max_instructions = instruction_count;
}
screen->specs.max_instructions = instruction_count;
screen->specs.has_icache = false;
}
+7 -1
View File
@@ -284,7 +284,13 @@ etna_link_shaders(struct etna_context *ctx, struct compiled_shader_state *cs,
cs->ps_inst_mem_size = fs->code_size;
cs->PS_INST_MEM = fs->code;
if (vs->needs_icache || fs->needs_icache) {
if (vs->needs_icache || fs->needs_icache ||
(ctx->screen->specs.has_unified_instmem &&
((cs->vs_inst_mem_size + cs->ps_inst_mem_size) / 4 >
ctx->screen->specs.max_instructions))) {
if (!ctx->screen->specs.has_icache)
return false;
/* If either of the shaders needs ICACHE, we use it for both. It is
* either switched on or off for the entire shader processor.
*/