From f85b7aa5d409ffcc7e0ae013f43068a698d3517e Mon Sep 17 00:00:00 2001 From: Icecream95 Date: Thu, 29 Apr 2021 11:27:28 +1200 Subject: [PATCH] pan/mdg: Fix calculation of available work registers Make the rmu variable signed; otherwise the MAX2 has no effect and work_count can end up being larger than 16. Fixes INSTR_OPERAND_FAULTs in SuperTuxKart. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4707 Fixes: c6ed8bf77cb ("panfrost: Fix uniform_count on Midgard") Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/midgard/midgard_ra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panfrost/midgard/midgard_ra.c b/src/panfrost/midgard/midgard_ra.c index fc893ba0132..0b5f885dc1d 100644 --- a/src/panfrost/midgard/midgard_ra.c +++ b/src/panfrost/midgard/midgard_ra.c @@ -394,7 +394,7 @@ allocate_registers(compiler_context *ctx, bool *spilled) /* The number of vec4 work registers available depends on the number of * register-mapped uniforms and the shader stage. By ABI we limit blend * shaders to 8 registers, should be lower XXX */ - unsigned rmu = ctx->info->push.count / 4; + int rmu = ctx->info->push.count / 4; int work_count = ctx->inputs->is_blend ? 8 : 16 - MAX2(rmu - 8, 0); /* No register allocation to do with no SSA */