From 40fd1f9da448b65bbd6491199e9f66cef7fdbe32 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 25 Feb 2020 15:36:11 -0500 Subject: [PATCH] panfrost: Reserve an extra page for spilling I'm not sure what this is for, but the blob does it and I'd rather not poke farther than needed into hardware-internal details. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Tomeu Vizoso Part-of: --- src/panfrost/encoder/pan_scratch.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/panfrost/encoder/pan_scratch.c b/src/panfrost/encoder/pan_scratch.c index ccb2fd7fac3..04a9bb7d1f6 100644 --- a/src/panfrost/encoder/pan_scratch.c +++ b/src/panfrost/encoder/pan_scratch.c @@ -86,7 +86,8 @@ panfrost_get_stack_shift(unsigned stack_size) return util_logbase2_ceil(MAX2(stack_size, 256)) - 4; } -/* Computes the aligned stack size given the shift and thread count */ +/* Computes the aligned stack size given the shift and thread count. The blob + * reserves an extra page, and since this is hardware-internal, we do too. */ unsigned panfrost_get_total_stack_size( @@ -94,6 +95,8 @@ panfrost_get_total_stack_size( unsigned threads_per_core, unsigned core_count) { - unsigned stack_size = 1 << (stack_shift + 4); - return stack_size * threads_per_core * core_count; + unsigned size_per_thread = MAX2(1 << (stack_shift + 4), 32); + unsigned size = size_per_thread * threads_per_core * core_count; + + return size + 4096; } -- 2.30.2