panfrost: Handle AFBC Tiled
authorAlyssa Rosenzweig <alyssa@collabora.com>
Thu, 7 Apr 2022 21:04:58 +0000 (17:04 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 26 May 2022 15:56:32 +0000 (15:56 +0000)
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16697>

src/panfrost/lib/pan_cs.c
src/panfrost/lib/pan_texture.c

index e3f2be5..4353980 100644 (file)
@@ -42,9 +42,13 @@ mod_to_block_fmt(uint64_t mod)
                 return MALI_BLOCK_FORMAT_TILED_U_INTERLEAVED;
         default:
 #if PAN_ARCH >= 5
-                if (drm_is_afbc(mod))
+                if (drm_is_afbc(mod) && !(mod & AFBC_FORMAT_MOD_TILED))
                         return MALI_BLOCK_FORMAT_AFBC;
 #endif
+#if PAN_ARCH >= 7
+                if (drm_is_afbc(mod) && (mod & AFBC_FORMAT_MOD_TILED))
+                        return MALI_BLOCK_FORMAT_AFBC_TILED;
+#endif
 
                 unreachable("Unsupported modifer");
         }
index 37c7eef..91c29b5 100644 (file)
@@ -86,6 +86,10 @@ panfrost_compression_tag(const struct util_format_description *desc,
 #endif
 
 #if PAN_ARCH >= 7
+                /* Tiled headers */
+                if (modifier & AFBC_FORMAT_MOD_TILED)
+                        flags |= MALI_AFBC_SURFACE_FLAG_TILED_HEADER;
+
                 /* Used to make sure AFBC headers don't point outside the AFBC
                  * body. HW is using the AFBC surface stride to do this check,
                  * which doesn't work for 3D textures because the surface