turnip: Do better TU_DEBUG=startup logging of drmGetDevices2() failure.
authorEric Anholt <eric@anholt.net>
Wed, 17 Jun 2020 18:25:17 +0000 (11:25 -0700)
committerMarge Bot <eric+marge@anholt.net>
Fri, 26 Jun 2020 19:34:17 +0000 (19:34 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2769>

src/freedreno/vulkan/tu_device.c

index 43ed5f6e4a8c8dc7e7092957e7b94f8c2dbaeaf1..dd046f39eefede1aeb79dc059fc98da2f1d35bdf 100644 (file)
@@ -501,8 +501,12 @@ tu_enumerate_devices(struct tu_instance *instance)
 
    max_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
 
-   if (instance->debug_flags & TU_DEBUG_STARTUP)
-      tu_logi("Found %d drm nodes", max_devices);
+   if (instance->debug_flags & TU_DEBUG_STARTUP) {
+      if (max_devices < 0)
+         tu_logi("drmGetDevices2 returned error: %s\n", strerror(max_devices));
+      else
+         tu_logi("Found %d drm nodes", max_devices);
+   }
 
    if (max_devices < 1)
       return vk_error(instance, VK_ERROR_INCOMPATIBLE_DRIVER);