Mesa (master): anv: don't report error with other vendor DRM devices

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 21 19:01:56 UTC 2020


Module: Mesa
Branch: master
Commit: e618951322e4bf27991c1a31c5933bd0d0f580a1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e618951322e4bf27991c1a31c5933bd0d0f580a1

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Tue Jan 21 18:19:18 2020 +0200

anv: don't report error with other vendor DRM devices

Enumeration should just skip unsupported DRM devices.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: 34c8621c3b37 ("anv: Allow enumerating multiple physical devices")
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2386
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3481>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3481>

---

 src/intel/vulkan/anv_device.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 50b0a01debf..5599f35304e 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -817,13 +817,13 @@ anv_enumerate_physical_devices(struct anv_instance *instance)
 
    /* TODO: Check for more devices ? */
    drmDevicePtr devices[8];
-   VkResult result = VK_ERROR_INCOMPATIBLE_DRIVER;
    int max_devices;
 
    max_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
    if (max_devices < 1)
-      return VK_ERROR_INCOMPATIBLE_DRIVER;
+      return VK_SUCCESS;
 
+   VkResult result = VK_SUCCESS;
    for (unsigned i = 0; i < (unsigned)max_devices; i++) {
       if (devices[i]->available_nodes & 1 << DRM_NODE_RENDER &&
           devices[i]->bustype == DRM_BUS_PCI &&
@@ -832,8 +832,15 @@ anv_enumerate_physical_devices(struct anv_instance *instance)
          struct anv_physical_device *pdevice;
          result = anv_physical_device_try_create(instance, devices[i],
                                                  &pdevice);
-         if (result != VK_SUCCESS)
+         /* Incompatible DRM device, skip. */
+         if (result == VK_ERROR_INCOMPATIBLE_DRIVER) {
+            result = VK_SUCCESS;
             continue;
+         }
+
+         /* Error creating the physical device, report the error. */
+         if (result != VK_SUCCESS)
+            break;
 
          list_addtail(&pdevice->link, &instance->physical_devices);
       }
@@ -841,7 +848,7 @@ anv_enumerate_physical_devices(struct anv_instance *instance)
    drmFreeDevices(devices, max_devices);
 
    /* If we successfully enumerated any devices, call it success */
-   return !list_is_empty(&instance->physical_devices) ? VK_SUCCESS : result;
+   return result;
 }
 
 VkResult anv_EnumeratePhysicalDevices(



More information about the mesa-commit mailing list