egl: error out if we can't find an EGLDevice in _eglFindDevice()
authorLeandro Ribeiro <leandro.ribeiro@collabora.com>
Mon, 4 Sep 2023 16:34:27 +0000 (13:34 -0300)
committerMarge Bot <emma+marge@anholt.net>
Tue, 17 Oct 2023 20:31:13 +0000 (20:31 +0000)
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 <leandro.ribeiro@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24825>

src/egl/main/egldevice.c

index d4cc3d9..f8b7e94 100644 (file)
@@ -153,6 +153,9 @@ _eglAddDRMDevice(drmDevicePtr device)
 
 /* 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.
  */
 _EGLDevice *
@@ -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");