ac/surface: fix missing NULL check in gfx12_select_swizle_mode()

Add null check for surf pointer.
Fixes segfault issue during start of gdm on gfx12.

Signed-off-by: Saroj Kumar <saroj.kumar@amd.com>

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33199>
This commit is contained in:
Saroj Kumar
2025-01-24 16:51:02 +05:30
committed by Marge Bot
parent 1f9d96ec78
commit 433004dcff
+2 -2
View File
@@ -2781,9 +2781,9 @@ static unsigned gfx12_select_swizzle_mode(struct ac_addrlib *addrlib,
get_in.numMipLevels = in->numMipLevels;
get_in.numSamples = in->numSamples;
if (surf->flags & RADEON_SURF_PREFER_4K_ALIGNMENT) {
if (surf && surf->flags & RADEON_SURF_PREFER_4K_ALIGNMENT) {
get_in.maxAlign = 4 * 1024;
} else if (surf->flags & RADEON_SURF_PREFER_64K_ALIGNMENT) {
} else if (surf && surf->flags & RADEON_SURF_PREFER_64K_ALIGNMENT) {
get_in.maxAlign = 64 * 1024;
} else {
get_in.maxAlign = info->has_dedicated_vram ? (256 * 1024) : (64 * 1024);