Module: Mesa
Branch: master
Commit: e5cd5e9cec9112a71007b88220178afadb6c0133
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e5cd5e9cec9112a71007b88220178afadb6c0133

Author: Italo Nicola <[email protected]>
Date:   Mon Oct 26 13:46:52 2020 +0000

pan/mdg: fix LOCAL_STORAGE wls_instances packing

Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7315>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c 
b/src/gallium/drivers/panfrost/pan_cmdstream.c
index 83234bdee90..6345d8d7ec7 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -953,12 +953,12 @@ panfrost_emit_shared_memory(struct panfrost_batch *batch,
         unsigned single_size = util_next_power_of_two(MAX2(ss->shared_size,
                                                            128));
 
-        unsigned log2_instances =
-                util_logbase2_ceil(info->grid[0]) +
-                util_logbase2_ceil(info->grid[1]) +
-                util_logbase2_ceil(info->grid[2]);
+        unsigned instances =
+                util_next_power_of_two(info->grid[0]) *
+                util_next_power_of_two(info->grid[1]) *
+                util_next_power_of_two(info->grid[2]);
 
-        unsigned shared_size = single_size * (1 << log2_instances) * 
dev->core_count;
+        unsigned shared_size = single_size * instances * dev->core_count;
         struct panfrost_bo *bo = panfrost_batch_get_shared_memory(batch,
                                                                   shared_size,
                                                                   1);
@@ -969,7 +969,7 @@ panfrost_emit_shared_memory(struct panfrost_batch *batch,
 
         pan_pack(t.cpu, LOCAL_STORAGE, ls) {
                 ls.wls_base_pointer = bo->ptr.gpu;
-                ls.wls_instances = log2_instances;
+                ls.wls_instances = instances;
                 ls.wls_size_scale = util_logbase2(single_size) + 1;
         };
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to