From 6929333b0f550109e48fe71acc0a33217b02440f Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Mon, 3 Nov 2025 19:00:00 +0100 Subject: [PATCH] ac/surface: ban 256KB swizzle modes for non-MSAA images on GFX11+ This seems to hurt more than it helps and AMD drivers also disable 256 KB for non-MSAA. While we are at it, remove an useless check about GFX12 APUs because they don't exist. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14237 Signed-off-by: Samuel Pitoiset Part-of: --- src/amd/common/ac_surface.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c index 4ecc085fa0e..dd90e04f59c 100644 --- a/src/amd/common/ac_surface.c +++ b/src/amd/common/ac_surface.c @@ -1966,8 +1966,12 @@ static int gfx9_get_preferred_swizzle_mode(struct ac_addrlib *addrlib, const str sin.forbiddenBlock.macroThick64KB = 1; } - if (surf->flags & (RADEON_SURF_PREFER_64K_ALIGNMENT | RADEON_SURF_PREFER_4K_ALIGNMENT)) { - if (info->gfx_level >= GFX11) { + if (info->gfx_level >= GFX11) { + /* Ban 256KB for non-MSAA images because it seems to hurt more than it + * helps. Also ban when 4K or 64K are explicitly preferred. + */ + if (in->numSamples == 1 || + surf->flags & (RADEON_SURF_PREFER_64K_ALIGNMENT | RADEON_SURF_PREFER_4K_ALIGNMENT)) { sin.forbiddenBlock.gfx11.thin256KB = 1; sin.forbiddenBlock.gfx11.thick256KB = 1; } @@ -3029,7 +3033,10 @@ static unsigned gfx12_select_swizzle_mode(struct ac_addrlib *addrlib, } else if (flags & RADEON_SURF_PREFER_64K_ALIGNMENT) { get_in.maxAlign = 64 * 1024; } else { - get_in.maxAlign = info->has_dedicated_vram ? (256 * 1024) : (64 * 1024); + /* Ban 256KB for non-MSAA images because it seems to hurt more than it + * helps. Also ban on APUs because it's unsupported. + */ + get_in.maxAlign = in->numSamples == 1 || !info->has_dedicated_vram ? (64 * 1024) : (256 * 1024); } if (Addr3GetPossibleSwizzleModes(addrlib->handle, &get_in, &get_out) != ADDR_OK) {