ac/surface: honor RADEON_SURF_PREFER_xxx_ALIGNMENT on GFX12

This allows to select a better alignment to not waste memory.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33033>
This commit is contained in:
Samuel Pitoiset
2025-01-15 03:53:17 -08:00
committed by Marge Bot
parent 2774fb32e6
commit 7e6159d10c
+8 -1
View File
@@ -2780,7 +2780,14 @@ static unsigned gfx12_select_swizzle_mode(struct ac_addrlib *addrlib,
get_in.numSlices = in->numSlices;
get_in.numMipLevels = in->numMipLevels;
get_in.numSamples = in->numSamples;
get_in.maxAlign = info->has_dedicated_vram ? (256 * 1024) : (64 * 1024);
if (surf->flags & RADEON_SURF_PREFER_4K_ALIGNMENT) {
get_in.maxAlign = 4 * 1024;
} else if (surf->flags & RADEON_SURF_PREFER_64K_ALIGNMENT) {
get_in.maxAlign = 64 * 1024;
} else {
get_in.maxAlign = info->has_dedicated_vram ? (256 * 1024) : (64 * 1024);
}
if (Addr3GetPossibleSwizzleModes(addrlib->handle, &get_in, &get_out) != ADDR_OK) {
assert(!"Addr3GetPossibleSwizzleModes failed");