Mesa (main): venus: fix device group enumeration with unsupported devices
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 31 21:04:14 UTC 2021
Module: Mesa
Branch: main
Commit: 86cb30baaf23a60de73c252b3bdd1455bd026dda
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=86cb30baaf23a60de73c252b3bdd1455bd026dda
Author: Chia-I Wu <olvaffe at gmail.com>
Date: Sat Aug 28 21:42:32 2021 -0700
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 at gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei at chromium.org>
Reviewed-by: Ryan Neph <ryanneph at google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12637>
---
src/virtio/vulkan/vn_physical_device.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/virtio/vulkan/vn_physical_device.c b/src/virtio/vulkan/vn_physical_device.c
index 14b40f2dfff..4ca5f3896b0 100644
--- a/src/virtio/vulkan/vn_physical_device.c
+++ b/src/virtio/vulkan/vn_physical_device.c
@@ -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;
More information about the mesa-commit
mailing list