EGLBoolean MESA_device_software;
EGLBoolean EXT_device_drm;
+ EGLBoolean EXT_device_drm_render_node;
#ifdef HAVE_LIBDRM
drmDevicePtr device;
}
_EGLDevice _eglSoftwareDevice = {
- .extensions = "EGL_MESA_device_software",
+ /* TODO: EGL_EXT_device_drm support for KMS + llvmpipe */
+ .extensions = "EGL_MESA_device_software EGL_EXT_device_drm_render_node",
.MESA_device_software = EGL_TRUE,
+ .EXT_device_drm_render_node = EGL_TRUE,
};
#ifdef HAVE_LIBDRM
dev->EXT_device_drm = 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;
+ }
+
if (out_dev)
*out_dev = dev;
return dev->MESA_device_software;
case _EGL_DEVICE_DRM:
return dev->EXT_device_drm;
+ case _EGL_DEVICE_DRM_RENDER_NODE:
+ return dev->EXT_device_drm_render_node;
default:
assert(0);
return EGL_FALSE;
switch (name) {
case EGL_EXTENSIONS:
return dev->extensions;
-#ifdef HAVE_LIBDRM
case EGL_DRM_DEVICE_FILE_EXT:
- if (_eglDeviceSupports(dev, _EGL_DEVICE_DRM))
- return dev->device->nodes[DRM_NODE_PRIMARY];
+ if (!_eglDeviceSupports(dev, _EGL_DEVICE_DRM))
+ break;
+#ifdef HAVE_LIBDRM
+ return dev->device->nodes[DRM_NODE_PRIMARY];
+#else
+ /* This should never happen: we don't yet support EGL_DEVICE_DRM for the
+ * software device, and physical devices are only exposed when libdrm is
+ * available. */
+ assert(0);
+ break;
#endif
- FALLTHROUGH;
- default:
- _eglError(EGL_BAD_PARAMETER, "eglQueryDeviceStringEXT");
+ case EGL_DRM_RENDER_NODE_FILE_EXT:
+ if (!_eglDeviceSupports(dev, _EGL_DEVICE_DRM_RENDER_NODE))
+ break;
+#ifdef HAVE_LIBDRM
+ return dev->device ? dev->device->nodes[DRM_NODE_RENDER] : NULL;
+#else
+ /* Physical devices are only exposed when libdrm is available. */
+ assert(_eglDeviceSupports(dev, _EGL_DEVICE_SOFTWARE));
return NULL;
- };
+#endif
+ }
+ _eglError(EGL_BAD_PARAMETER, "eglQueryDeviceStringEXT");
+ return NULL;
}
/* Do a fresh lookup for devices.