panfrost: Add pan_afbc_tile_size helper
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 4 May 2022 13:59:35 +0000 (09:59 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 26 May 2022 15:56:32 +0000 (15:56 +0000)
To unify calculations with linear and tiled AFBC formats.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16697>

src/panfrost/lib/pan_layout.c

index b78a904..b16a00d 100644 (file)
@@ -131,6 +131,16 @@ panfrost_block_size(uint64_t modifier, enum pipe_format format)
 }
 
 /*
+ * Determine the tile size used by AFBC. This tiles superblocks themselves.
+ * Current GPUs support either 8x8 tiling or no tiling (1x1)
+ */
+static inline unsigned
+pan_afbc_tile_size(uint64_t modifier)
+{
+        return (modifier & AFBC_FORMAT_MOD_TILED) ? 8 : 1;
+}
+
+/*
  * Determine the number of bytes between header rows for an AFBC image. For an
  * image with linear headers, this is simply the number of header blocks
  * (=superblocks) per row  times the numbers of bytes per header block.