From d88b546e6538489c4bf8cc0180c048e5658386b8 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Mon, 28 Nov 2022 17:29:17 +0900 Subject: [PATCH] ail: Introduce layer_alignment flag The hardware uses this flag to determine whether layer strides are implicitly aligned to the page size or not. Signed-off-by: Asahi Lina Part-of: --- src/asahi/layout/layout.c | 3 +++ src/asahi/layout/layout.h | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/src/asahi/layout/layout.c b/src/asahi/layout/layout.c index dcc5bc749b8..834fbd43451 100644 --- a/src/asahi/layout/layout.c +++ b/src/asahi/layout/layout.c @@ -168,6 +168,9 @@ ail_initialize_twiddled(struct ail_layout *layout) */ if ((layout->levels != 1 && layout->depth_px != 1 && offset_B > AIL_PAGESIZE) || layout->tiling != AIL_TILING_TWIDDLED_COMPRESSED) + layout->page_aligned_layers = true; + + if (layout->page_aligned_layers) layout->layer_stride_B = ALIGN_POT(offset_B, AIL_PAGESIZE); else layout->layer_stride_B = offset_B; diff --git a/src/asahi/layout/layout.h b/src/asahi/layout/layout.h index 24cab6687c2..c35dbab1051 100644 --- a/src/asahi/layout/layout.h +++ b/src/asahi/layout/layout.h @@ -99,6 +99,12 @@ struct ail_layout { */ uint32_t layer_stride_B; + /** + * Whether the layer stride is aligned to the page size or not. The hardware + * needs this flag to compute the implicit layer stride. + */ + bool page_aligned_layers; + /** * Offsets of mip levels within a layer. */