Mesa (master): anv: improve error message when failing to open device path

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Sep 16 20:04:35 UTC 2020


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

Author: Mike Blumenkrantz <michael.blumenkrantz at gmail.com>
Date:   Fri Sep 11 09:00:53 2020 -0400

anv: improve error message when failing to open device path

Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6747>

---

 src/intel/vulkan/anv_device.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 7cf8667420f..5cef070bb3e 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -322,8 +322,14 @@ anv_physical_device_try_create(struct anv_instance *instance,
    brw_process_intel_debug_variable();
 
    fd = open(path, O_RDWR | O_CLOEXEC);
-   if (fd < 0)
-      return vk_error(VK_ERROR_INCOMPATIBLE_DRIVER);
+   if (fd < 0) {
+      if (errno == ENOMEM) {
+         return vk_errorfi(instance, NULL, VK_ERROR_OUT_OF_HOST_MEMORY,
+                        "Unable to open device %s: out of memory", path);
+      }
+      return vk_errorfi(instance, NULL, VK_ERROR_INCOMPATIBLE_DRIVER,
+                        "Unable to open device %s: %m", path);
+   }
 
    struct gen_device_info devinfo;
    if (!gen_get_device_info_from_fd(fd, &devinfo)) {



More information about the mesa-commit mailing list