[Mesa-dev] [PATCH] egl: Don't add hardware device if there is no render node v2.

Mathias.Froehlich at gmx.net Mathias.Froehlich at gmx.net
Mon Jun 17 10:36:50 UTC 2019


From: Mathias Fröhlich <Mathias.Froehlich at gmx.net>


Emil,

that one probably matches your original intent then.

please review
Thanks

Mathias


Do not offer a hardware drm backed egl device if no render node
is available. The current implementation will fail on this
egl device. On top it issues a warning that is actually missleading.
There are finally more error paths that can fail on the way to a
hardware backed egl device. Fixing all of them would kind of require
opening the drm device and see if there is a usable driver associated
with the device. The taken approach avoids a full probe and fixes at
least this kind of problem on kvm virtualization hosts I observe here.

Signed-off-by: Mathias Fröhlich <Mathias.Froehlich at web.de>
---
 src/egl/main/egldevice.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/egl/main/egldevice.c b/src/egl/main/egldevice.c
index 76b8960fa5b..99d8a6c1886 100644
--- a/src/egl/main/egldevice.c
+++ b/src/egl/main/egldevice.c
@@ -108,9 +108,9 @@ static int
 _eglAddDRMDevice(drmDevicePtr device, _EGLDevice **out_dev)
 {
    _EGLDevice *dev;
+   const int wanted_nodes = 1 << DRM_NODE_RENDER | 1 << DRM_NODE_PRIMARY;

-   if ((device->available_nodes & (1 << DRM_NODE_PRIMARY |
-                                   1 << DRM_NODE_RENDER)) == 0)
+   if ((device->available_nodes & wanted_nodes) != wanted_nodes)
       return -1;

    dev = _eglGlobal.DeviceList;
--
2.21.0



More information about the mesa-dev mailing list