ail: move helpers to layout.h for sharing

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-09 15:25:17 -05:00
committed by Marge Bot
parent 7d27fd84d5
commit aebecb2886
2 changed files with 11 additions and 11 deletions

View File

@@ -246,6 +246,17 @@ ail_get_linear_pixel_B(const struct ail_layout *layout, ASSERTED unsigned level,
(x_px * util_format_get_blocksize(layout->format));
}
static inline uint32_t
ail_space_bits(unsigned x)
{
assert(x < 128 && "offset must be inside the tile");
return ((x & 1) << 0) | ((x & 2) << 1) | ((x & 4) << 2) | ((x & 8) << 3) |
((x & 16) << 4) | ((x & 32) << 5) | ((x & 64) << 6);
}
#define MOD_POT(x, y) (x) & ((y) - 1)
static inline unsigned
ail_effective_width_sa(unsigned width_px, unsigned sample_count_sa)
{

View File

@@ -37,22 +37,11 @@
* applying the two's complement identity, we are left with (X - mask) & mask
*/
#define MOD_POT(x, y) (x) & ((y)-1)
typedef struct {
uint64_t lo;
uint64_t hi;
} __attribute__((packed)) ail_uint128_t;
static uint32_t
ail_space_bits(unsigned x)
{
assert(x < 128 && "offset must be inside the tile");
return ((x & 1) << 0) | ((x & 2) << 1) | ((x & 4) << 2) | ((x & 8) << 3) |
((x & 16) << 4) | ((x & 32) << 5) | ((x & 64) << 6);
}
/*
* Given a power-of-two block width/height, construct the mask of "X" bits. This
* is found by restricting the full mask of alternating 0s and 1s to only cover