From 2ee3bef252237d8c94b873e3378e0bedd69cf59a Mon Sep 17 00:00:00 2001 From: "Eric R. Smith" Date: Thu, 6 Mar 2025 20:44:04 -0400 Subject: [PATCH] panfrost: consider xfb shader when calculating thread local storage size Register spilling can cause us to require thread local storage (tls). However, we were not adjusting the tls stack size space to account for the tls needed for the extra xfb shader when transform feedback is needed. We noticed this when testing register allocation in the OpenGL CTS (for testing we had forced spilling where none happened before). Cc: mesa-stable Reviewed-by: Boris Brezillon Part-of: --- src/gallium/drivers/panfrost/pan_job.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 03bc6bf8d99..9437f562fc4 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -789,11 +789,12 @@ panfrost_batch_adjust_stack_size(struct panfrost_batch *batch) for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i) { struct panfrost_compiled_shader *ss = ctx->prog[i]; + struct panfrost_compiled_shader *xfb_ss = + ctx->uncompiled[i] ? ctx->uncompiled[i]->xfb : NULL; - if (!ss) - continue; - - batch->stack_size = MAX2(batch->stack_size, ss->info.tls_size); + batch->stack_size = MAX3(batch->stack_size, + ss ? ss->info.tls_size : 0, + xfb_ss ? xfb_ss->info.tls_size : 0); } }