Mesa (main): panfrost: Align layouts to tiles of superblocks

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 26 16:12:43 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed May  4 10:14:41 2022 -0400

panfrost: Align layouts to tiles of superblocks

Required to satisfy the alignment constraints on tiled AFBC.

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

---

 src/panfrost/lib/pan_layout.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/panfrost/lib/pan_layout.c b/src/panfrost/lib/pan_layout.c
index db0cfa8d996..d55d7b862aa 100644
--- a/src/panfrost/lib/pan_layout.c
+++ b/src/panfrost/lib/pan_layout.c
@@ -288,11 +288,20 @@ pan_image_layout_init(struct pan_image_layout *layout,
         unsigned height = layout->height;
         unsigned depth = layout->depth;
 
+        unsigned align_w = block_size.width;
+        unsigned align_h = block_size.height;
+
+        /* For tiled AFBC, align to tiles of superblocks (this can be large) */
+        if (afbc) {
+                align_w *= pan_afbc_tile_size(layout->modifier);
+                align_h *= pan_afbc_tile_size(layout->modifier);
+        }
+
         for (unsigned l = 0; l < layout->nr_slices; ++l) {
                 struct pan_image_slice_layout *slice = &layout->slices[l];
 
-                unsigned effective_width = ALIGN_POT(util_format_get_nblocksx(layout->format, width), block_size.width);
-                unsigned effective_height = ALIGN_POT(util_format_get_nblocksy(layout->format, height), block_size.height);
+                unsigned effective_width = ALIGN_POT(util_format_get_nblocksx(layout->format, width), align_w);
+                unsigned effective_height = ALIGN_POT(util_format_get_nblocksy(layout->format, height), align_h);
 
                 /* Align levels to cache-line as a performance improvement for
                  * linear/tiled and as a requirement for AFBC */



More information about the mesa-commit mailing list