ail: clarify metadata buffer calculation

there's a very good reason that the calculation is what it is.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30981>
This commit is contained in:
Alyssa Rosenzweig
2024-08-22 14:41:48 -04:00
committed by Marge Bot
parent b0a8e623f9
commit 9f1e2e5053

View File

@@ -229,10 +229,15 @@ ail_initialize_compression(struct ail_layout *layout)
layout->level_offsets_compressed_B[l] = compbuf_B;
/* The compression buffer seems to have 8 bytes per 16 x 16 sample block. */
unsigned cmpw_el = DIV_ROUND_UP(util_next_power_of_two(width_sa), 16);
unsigned cmph_el = DIV_ROUND_UP(util_next_power_of_two(height_sa), 16);
compbuf_B += ALIGN_POT(cmpw_el * cmph_el * 8, AIL_CACHELINE);
/* The metadata buffer contains 8 bytes per 16x16 compression tile.
* Addressing is fully twiddled, so both width and height are padded to
* powers-of-two.
*/
unsigned w_tl = DIV_ROUND_UP(util_next_power_of_two(width_sa), 16);
unsigned h_tl = DIV_ROUND_UP(util_next_power_of_two(height_sa), 16);
unsigned B_per_tl_2 = 8;
compbuf_B += ALIGN_POT(w_tl * h_tl * B_per_tl_2, AIL_CACHELINE);
width_sa = DIV_ROUND_UP(width_sa, 2);
height_sa = DIV_ROUND_UP(height_sa, 2);