radv: only expose host visible memory types for images with host-transfer

Because the memory must be mapped on the CPU.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35974>
This commit is contained in:
Samuel Pitoiset
2025-07-03 12:37:46 +02:00
committed by Marge Bot
parent a75bd251df
commit d85b7b6c62
3 changed files with 10 additions and 0 deletions
+5
View File
@@ -1425,6 +1425,11 @@ radv_GetImageMemoryRequirements2(VkDevice _device, const VkImageMemoryRequiremen
pMemoryRequirements->memoryRequirements.memoryTypeBits =
((1u << pdev->memory_properties.memoryTypeCount) - 1u) & ~pdev->memory_types_32bit;
if (image->vk.usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT) {
/* Only expose host visible memory types for images that need to be mapped on the CPU. */
pMemoryRequirements->memoryRequirements.memoryTypeBits &= pdev->memory_types_host_visible;
}
pMemoryRequirements->memoryRequirements.size = size;
pMemoryRequirements->memoryRequirements.alignment = alignment;
+2
View File
@@ -490,6 +490,8 @@ radv_physical_device_init_mem_types(struct radv_physical_device *pdev)
for (unsigned i = 0; i < type_count; ++i) {
if (pdev->memory_flags[i] & RADEON_FLAG_32BIT)
pdev->memory_types_32bit |= BITFIELD_BIT(i);
if (pdev->memory_flags[i] & RADEON_FLAG_CPU_ACCESS)
pdev->memory_types_host_visible |= BITFIELD_BIT(i);
}
}
+3
View File
@@ -145,6 +145,9 @@ struct radv_physical_device {
/* Bitmask of memory types that use the 32-bit address space. */
uint32_t memory_types_32bit;
/* Bitmask of memory types that are host-visible. */
uint32_t memory_types_host_visible;
#ifndef _WIN32
int available_nodes;
drmPciBusInfo bus_info;