egl: only take render nodes into account when listing DRM devices
authorSimon Ser <contact@emersion.fr>
Thu, 25 Mar 2021 17:42:06 +0000 (18:42 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 26 Mar 2021 10:32:31 +0000 (10:32 +0000)
We don't want to expose an EGL device for a display-only DRM devices
(like VKMS). For these DRM devices we have a separate software-rendering
device (the first in the list, always present).

There is a similar check in _eglAddDRMDevice, however it will be
removed in a future commit to allow split render/display devices
to be properly added. We can't figure out whether we're on a split
render/display system before loading the driver.

Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 5743a36b2b32 ("egl: Don't add hardware device if there is no render node v2.")
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9697>

src/egl/main/egldevice.c

index 4aa1a77..79048d8 100644 (file)
@@ -274,6 +274,9 @@ _eglRefreshDeviceList(void)
 
    num_devs = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
    for (int i = 0; i < num_devs; i++) {
+      if (!(devices[i]->available_nodes & (1 << DRM_NODE_RENDER)))
+         continue;
+
       ret = _eglAddDRMDevice(devices[i], NULL);
 
       /* Device is not added - error or already present */