Module: Mesa
Branch: main
Commit: 2be404f5571ada32d3b2e9cfe9b769846f27d68f
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2be404f5571ada32d3b2e9cfe9b769846f27d68f

Author: Leandro Ribeiro <[email protected]>
Date:   Mon Sep  4 13:34:27 2023 -0300

egl: error out if we can't find an EGLDevice in _eglFindDevice()

Follow up of "egl/drm: get compatible render-only device fd for kms-only
device". Now we can properly error out when we don't find the EGLDevice
in _eglFindDevice().

Signed-off-by: Leandro Ribeiro <[email protected]>
Reviewed-by: Simon Ser <[email protected]>
Reviewed-by: Daniel Stone <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24825>

---

 src/egl/main/egldevice.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/egl/main/egldevice.c b/src/egl/main/egldevice.c
index d4cc3d995d8..f8b7e94de76 100644
--- a/src/egl/main/egldevice.c
+++ b/src/egl/main/egldevice.c
@@ -152,6 +152,9 @@ _eglAddDRMDevice(drmDevicePtr device)
 #endif
 
 /* Finds a device in DeviceList, for the given fd.
+ *
+ * The fd must be of a render-capable device, as there are only render-capable
+ * devices in DeviceList.
  *
  * If a software device, the fd is ignored.
  */
@@ -186,6 +189,9 @@ _eglFindDevice(int fd, bool software)
       }
    }
 
+   /* Couldn't find an EGLDevice for the device. */
+   dev = NULL;
+
 #else
    _eglLog(_EGL_FATAL,
            "Driver bug: Built without libdrm, yet looking for HW device");

Reply via email to