diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 418ea2ac6a6..55958816b65 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -2124,6 +2124,19 @@ anv_image_get_memory_requirements(struct anv_device *device, memory_types |= device->physical->memory.compressed_mem_types; } + if (image->vk.usage & VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT) { + /* Remove non host visible heaps from the types for host transfers on + * non ReBAR devices + */ + if (device->physical->has_small_bar) { + for (uint32_t i = 0; i < device->physical->memory.type_count; i++) { + if (!(device->physical->memory.types[i].propertyFlags & + VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) + memory_types &= ~BITFIELD_BIT(i); + } + } + } + vk_foreach_struct(ext, pMemoryRequirements->pNext) { switch (ext->sType) { case VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS: { diff --git a/src/intel/vulkan/anv_physical_device.c b/src/intel/vulkan/anv_physical_device.c index fda76609d98..15418770b69 100644 --- a/src/intel/vulkan/anv_physical_device.c +++ b/src/intel/vulkan/anv_physical_device.c @@ -2538,6 +2538,9 @@ anv_physical_device_try_create(struct vk_instance *vk_instance, device->local_minor = 0; } + device->has_small_bar = anv_physical_device_has_vram(device) && + device->vram_non_mappable.size != 0; + get_device_extensions(device, &device->vk.supported_extensions); get_features(device, &device->vk.supported_features); get_properties(device, &device->vk.properties); diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h index 15a3c4065b9..b8cd681d4c2 100644 --- a/src/intel/vulkan/anv_private.h +++ b/src/intel/vulkan/anv_private.h @@ -1046,6 +1046,11 @@ struct anv_physical_device { /** Whether KMD has the ability to create VM objects */ bool has_vm_control; + /** Whether the device is not able map all the device local memory on the + * host + */ + bool has_small_bar; + /** True if we have the means to do sparse binding (e.g., a Kernel driver * a vm_bind ioctl). */