diff --git a/src/gallium/drivers/etnaviv/etnaviv_screen.c b/src/gallium/drivers/etnaviv/etnaviv_screen.c index e9d40594b1c..e2b9d928306 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_screen.c +++ b/src/gallium/drivers/etnaviv/etnaviv_screen.c @@ -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; } diff --git a/src/gallium/drivers/etnaviv/etnaviv_shader.c b/src/gallium/drivers/etnaviv/etnaviv_shader.c index 712ebc6ae83..ed7fb5fc5e6 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_shader.c +++ b/src/gallium/drivers/etnaviv/etnaviv_shader.c @@ -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. */