panfrost: Use packed TLS on Valhall
authorAlyssa Rosenzweig <alyssa@collabora.com>
Tue, 3 May 2022 20:34:52 +0000 (16:34 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 4 May 2022 12:48:27 +0000 (12:48 +0000)
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 <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16314>

src/panfrost/lib/pan_cs.c

index 880bb18..ab05585 100644 (file)
@@ -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) {