radv: set RADEON_SURF_NO_TEXTURE flag in radv_get_surface_flags()

In vkCreateImage() if block comrpessed format and VK_IMAGE_TILING_LINEAR is
used, then the app crashes in vega gpu.

This is because addrlib does not support BC + linear as from function
ValidateSwModeParams(). From Marek Olšák the addrlib behaviour is correct.

In pal driver, flags.texture is not set in DetermineSurfaceFlags() function
if BC + linear. pal driver does it because it is expected that the
BC + linear image is only used as transfer resource.

This patch sets RADEON_SURF_NO_TEXTURE flag if usage is not
VK_IMAGE_USAGE_SAMPLED_BIT and and VK_IMAGE_USAGE_STORAGE_BIT.
flags.texture flag is not set if RADEON_SURF_NO_TEXTURE and this fixes
the crash.

v1: set NO_TEXTURE if not SAMPLED or STORAGE (Marek Olšák)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21422>
This commit is contained in:
Yogesh Mohan Marimuthu 2023-02-21 15:56:35 +05:30 committed by Marge Bot
parent de0885cdb8
commit 2b04d6cada

View file

@ -656,6 +656,8 @@ radv_get_surface_flags(struct radv_device *device, struct radv_image *image, uns
/* Disable DCC for VRS rate images because the hw can't handle compression. */
if (pCreateInfo->usage & VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR)
flags |= RADEON_SURF_VRS_RATE | RADEON_SURF_DISABLE_DCC;
if (!(pCreateInfo->usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT)))
flags |= RADEON_SURF_NO_TEXTURE;
return flags;
}