panfrost: Reserve an extra page for spilling
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 25 Feb 2020 20:36:11 +0000 (15:36 -0500)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Thu, 27 Feb 2020 15:32:11 +0000 (16:32 +0100)
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 <alyssa.rosenzweig@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3950>

src/panfrost/encoder/pan_scratch.c

index ccb2fd7fac3d086802289c96d27036e3fc60fd41..04a9bb7d1f6430b4ed2ac436c143d0895b339094 100644 (file)
@@ -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;
 }