ail: add ail_bytes_to_pages helper

this happens a bunch with sparse

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33682>
This commit is contained in:
Alyssa Rosenzweig 2025-01-22 15:13:16 -05:00 committed by Marge Bot
parent 56cd20ddea
commit 78ca483940

View file

@ -520,6 +520,13 @@ ail_drm_modifier_to_tiling(uint64_t modifier)
#define AIL_FOLIO_SIZE_EL (AIL_PAGES_PER_FOLIO * 2)
#define AIL_FOLIO_SIZE_B (AIL_FOLIO_SIZE_EL * AIL_SPARSE_ELSIZE_B)
static inline unsigned
ail_bytes_to_pages(unsigned x_B)
{
assert((x_B % AIL_PAGESIZE) == 0);
return x_B / AIL_PAGESIZE;
}
/*
* Map a logical page of the image (i.e. page = logical address / page_size) to
* a word-index into the sparse table.