render: add wlr_egl_create_from_drm_fd function

This function relies on the extension EGL_WL_bind_wayland_display being
present. If not, the creation of `wlr_egl` will fallback on using GBM
This commit is contained in:
Simon Zeni 2021-01-20 21:14:04 -05:00
parent 84dea55b20
commit 074e36deb6
4 changed files with 173 additions and 49 deletions

15
include/render/egl.h Normal file
View file

@ -0,0 +1,15 @@
#ifndef RENDER_EGL_H
#define RENDER_EGL_H
#include <wlr/render/egl.h>
/**
* Creates and EGL context from a given drm fd. This function uses the
* following extensions:
* - EXT_device_enumeration to get the list of available EGLDeviceEXT
* - EXT_device_drm to get the name of the EGLDeviceEXT
* - EXT_platform_device to create an EGLDisplay from an EGLDeviceEXT
*/
struct wlr_egl *wlr_egl_create_from_drm_fd(int drm_fd);
#endif

View file

@ -51,6 +51,9 @@ struct wlr_egl {
// Device extensions
bool device_drm_ext;
// Client extensions
bool device_query_ext;
} exts;
struct {
@ -65,6 +68,7 @@ struct wlr_egl {
PFNEGLDEBUGMESSAGECONTROLKHRPROC eglDebugMessageControlKHR;
PFNEGLQUERYDISPLAYATTRIBEXTPROC eglQueryDisplayAttribEXT;
PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT;
PFNEGLQUERYDEVICESEXTPROC eglQueryDevicesEXT;
} procs;
struct wl_display *wl_display;