venus: fix device group enumeration with unsupported devices

instance->physical_devices includes only supported devices, not all
devices.  One example is that it does not include 1.0 devices.  We need
to fix up VkPhysicalDeviceGroupProperties to exclude unsupported
devices.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12637>
This commit is contained in:
Chia-I Wu 2021-08-28 21:42:32 -07:00 committed by Marge Bot
parent a7ebcbbd6b
commit 86cb30baaf

View file

@ -1219,22 +1219,37 @@ vn_instance_enumerate_physical_device_groups_locked(
}
/* fix VkPhysicalDeviceGroupProperties::physicalDevices to point to
* physical_devs
* physical_devs and discard unsupported ones
*/
uint32_t supported_count = 0;
for (uint32_t i = 0; i < count; i++) {
VkPhysicalDeviceGroupProperties *group = &groups[i];
uint32_t group_physical_dev_count = 0;
for (uint32_t j = 0; j < group->physicalDeviceCount; j++) {
struct vn_physical_device_base *temp_obj =
(struct vn_physical_device_base *)group->physicalDevices[j];
struct vn_physical_device *physical_dev = find_physical_device(
physical_devs, physical_dev_count, temp_obj->id);
if (!physical_dev)
continue;
group->physicalDevices[j] =
group->physicalDevices[group_physical_dev_count++] =
vn_physical_device_to_handle(physical_dev);
}
group->physicalDeviceCount = group_physical_dev_count;
if (!group->physicalDeviceCount)
continue;
if (supported_count < i)
groups[supported_count] = *group;
supported_count++;
}
count = supported_count;
assert(count);
vk_free(alloc, temp_objs);
instance->physical_device_groups = groups;