anv: drop non host memory types for host-transfer on non-rebar

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24276>
This commit is contained in:
Lionel Landwerlin
2023-06-12 23:04:26 +03:00
committed by Marge Bot
parent 1c7d79374f
commit cb9537a815
3 changed files with 21 additions and 0 deletions

View File

@@ -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: {

View File

@@ -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);

View File

@@ -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).
*/