From 1c8881fc605936d403d95426d813cced66d003c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Fri, 7 Nov 2025 10:41:36 +0100 Subject: [PATCH] radv: Disable sparse mapping when unsupported by VM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also disable the sparse binding queue and other related features. Using sparse on GFX6-8 can cause GPU hangs at the moment. Cc: mesa-stable Signed-off-by: Timur Kristóf Reviewed-by: Marek Olšák Reviewed-by: Samuel Pitoiset Part-of: --- src/amd/vulkan/radv_formats.c | 3 +++ src/amd/vulkan/radv_physical_device.c | 4 ++-- src/amd/vulkan/radv_physical_device.h | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/amd/vulkan/radv_formats.c b/src/amd/vulkan/radv_formats.c index df3085ab992..cf2c4232682 100644 --- a/src/amd/vulkan/radv_formats.c +++ b/src/amd/vulkan/radv_formats.c @@ -1060,6 +1060,9 @@ radv_get_image_format_properties(struct radv_physical_device *pdev, const VkPhys } if (info->flags & VK_IMAGE_CREATE_SPARSE_BINDING_BIT) { + if (!pdev->info.has_sparse_vm_mappings) + goto unsupported; + /* Sparse resources with multi-planar formats are unsupported. */ if (vk_format_get_plane_count(format) > 1) goto unsupported; diff --git a/src/amd/vulkan/radv_physical_device.c b/src/amd/vulkan/radv_physical_device.c index a465876e4c5..18994e9b73e 100644 --- a/src/amd/vulkan/radv_physical_device.c +++ b/src/amd/vulkan/radv_physical_device.c @@ -874,7 +874,7 @@ radv_physical_device_get_features(const struct radv_physical_device *pdev, struc .shaderFloat64 = true, .shaderInt64 = true, .shaderInt16 = true, - .sparseBinding = true, + .sparseBinding = pdev->info.has_sparse_vm_mappings, .sparseResidencyBuffer = pdev->info.family >= CHIP_POLARIS10, .sparseResidencyImage2D = pdev->info.family >= CHIP_POLARIS10, .sparseResidencyImage3D = pdev->info.family >= CHIP_POLARIS10, @@ -1574,7 +1574,7 @@ radv_get_physical_device_properties(struct radv_physical_device *pdev) .maxMemoryAllocationCount = UINT32_MAX, .maxSamplerAllocationCount = 64 * 1024, .bufferImageGranularity = 1, - .sparseAddressSpaceSize = pdev->info.virtual_address_max, + .sparseAddressSpaceSize = pdev->info.has_sparse_vm_mappings ? pdev->info.virtual_address_max : 0, .maxBoundDescriptorSets = MAX_SETS, .maxPerStageDescriptorSamplers = max_descriptor_set_size, .maxPerStageDescriptorUniformBuffers = max_descriptor_set_size, diff --git a/src/amd/vulkan/radv_physical_device.h b/src/amd/vulkan/radv_physical_device.h index aa081fc2484..e502aa4fee0 100644 --- a/src/amd/vulkan/radv_physical_device.h +++ b/src/amd/vulkan/radv_physical_device.h @@ -240,7 +240,8 @@ radv_dedicated_sparse_queue_enabled(const struct radv_physical_device *pdev) { /* Dedicated sparse queue requires VK_QUEUE_SUBMIT_MODE_THREADED, which is incompatible with * VK_DEVICE_TIMELINE_MODE_EMULATED. */ - return pdev->info.has_timeline_syncobj; + return pdev->info.has_timeline_syncobj && + pdev->info.has_sparse_vm_mappings; } static inline bool