Module: Mesa
Branch: main
Commit: 6761dbf8915d16d1408ac9b3d85751d0991f542c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6761dbf8915d16d1408ac9b3d85751d0991f542c

Author: Alyssa Rosenzweig <[email protected]>
Date:   Tue May  3 16:34:52 2022 -0400

panfrost: Use packed TLS on Valhall

Packed TLS has cache-locality benefits on Valhall, compared to Bifrost's flat
TLS. Valhall does support flat TLS, but requires extra arithmetic in the shader
for correct results. At least until we get to generic pointers (and maybe even
then), we can use packed TLS. So just use packed TLS always for proper spilling.

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

---

 src/panfrost/lib/pan_cs.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/panfrost/lib/pan_cs.c b/src/panfrost/lib/pan_cs.c
index 880bb1878a8..ab05585abee 100644
--- a/src/panfrost/lib/pan_cs.c
+++ b/src/panfrost/lib/pan_cs.c
@@ -484,7 +484,19 @@ GENX(pan_emit_tls)(const struct pan_tls_info *info,
                                 panfrost_get_stack_shift(info->tls.size);
 
                         cfg.tls_size = shift;
+#if PAN_ARCH >= 9
+                        /* For now, always use packed TLS addressing. This is
+                         * better for the cache and requires no fix up code in
+                         * the shader. We may need to revisit this someday for
+                         * OpenCL generic pointer support.
+                         */
+                        cfg.tls_address_mode = MALI_ADDRESS_MODE_PACKED;
+
+                        assert((info->tls.ptr & 4095) == 0);
+                        cfg.tls_base_pointer = info->tls.ptr >> 8;
+#else
                         cfg.tls_base_pointer = info->tls.ptr;
+#endif
                 }
 
                 if (info->wls.size) {

Reply via email to