egl: simplify _eglAddDRMDevice()

We only create EGLDevice's for render-capable devices, so it's better
to document that in the code and simplify this function.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25504>
This commit is contained in:
Leandro Ribeiro 2023-08-10 09:52:53 -03:00 committed by Marge Bot
parent f0861645bb
commit 950825cb36

View file

@ -112,9 +112,16 @@ _eglAddDRMDevice(drmDevicePtr device)
{
_EGLDevice *dev;
if ((device->available_nodes &
(1 << DRM_NODE_PRIMARY | 1 << DRM_NODE_RENDER)) == 0)
return -1;
assert(device->available_nodes & ((1 << DRM_NODE_RENDER)));
/* TODO: uncomment this assert, which is a sanity check.
*
* assert(device->available_nodes & ((1 << DRM_NODE_PRIMARY)));
*
* DRM shim does not expose a primary node, so the CI would fail if we had
* this assert. DRM shim is being used to run shader-db. We need to
* investigate what should be done (probably fixing DRM shim).
*/
dev = _eglGlobal.DeviceList;
@ -135,16 +142,11 @@ _eglAddDRMDevice(drmDevicePtr device)
return -1;
dev = dev->Next;
dev->extensions = "EGL_EXT_device_drm";
dev->extensions = "EGL_EXT_device_drm EGL_EXT_device_drm_render_node";
dev->EXT_device_drm = EGL_TRUE;
dev->EXT_device_drm_render_node = EGL_TRUE;
dev->device = device;
/* TODO: EGL_EXT_device_drm_render_node support for kmsro + renderonly */
if (device->available_nodes & (1 << DRM_NODE_RENDER)) {
dev->extensions = "EGL_EXT_device_drm EGL_EXT_device_drm_render_node";
dev->EXT_device_drm_render_node = EGL_TRUE;
}
return 0;
}
#endif