panfrost: Fix stack shift calculation
Fixes flickering in Neverwinter Nights.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3789
Fixes: e6152091ca9 ("panfrost: Use canonical characterization of tls_size")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7613>
(cherry picked from commit 12dec2004ed0b50b0cb0ad7cc635f2a706be9891)
diff --git a/.pick_status.json b/.pick_status.json
index 2396e4e..a17016f 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1030,7 +1030,7 @@
"description": "panfrost: Fix stack shift calculation",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "e6152091ca99c3d8491ac48baa1f301da6f4a4c3"
},
diff --git a/src/panfrost/lib/pan_scratch.c b/src/panfrost/lib/pan_scratch.c
index c632440..2742acb 100644
--- a/src/panfrost/lib/pan_scratch.c
+++ b/src/panfrost/lib/pan_scratch.c
@@ -67,7 +67,7 @@
panfrost_get_stack_shift(unsigned stack_size)
{
if (stack_size)
- return util_logbase2(DIV_ROUND_UP(stack_size, 16));
+ return util_logbase2_ceil(DIV_ROUND_UP(stack_size, 16));
else
return 0;
}