2018-07-13 08:40:56 -04:00
|
|
|
/*
|
|
|
|
|
* This an unstable interface of wlroots. No guarantees are made regarding the
|
|
|
|
|
* future consistency of this API.
|
|
|
|
|
*/
|
|
|
|
|
#ifndef WLR_USE_UNSTABLE
|
|
|
|
|
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-02-12 21:29:23 +01:00
|
|
|
#ifndef WLR_RENDER_EGL_H
|
|
|
|
|
#define WLR_RENDER_EGL_H
|
2017-05-03 17:04:41 +12:00
|
|
|
|
2019-10-16 15:16:53 +02:00
|
|
|
#ifndef MESA_EGL_NO_X11_HEADERS
|
2018-11-09 20:31:11 +01:00
|
|
|
#define MESA_EGL_NO_X11_HEADERS
|
|
|
|
|
#endif
|
2019-10-16 15:16:53 +02:00
|
|
|
#ifndef EGL_NO_X11
|
|
|
|
|
#define EGL_NO_X11
|
|
|
|
|
#endif
|
2020-11-02 10:51:52 +01:00
|
|
|
#ifndef EGL_NO_PLATFORM_SPECIFIC_TYPES
|
|
|
|
|
#define EGL_NO_PLATFORM_SPECIFIC_TYPES
|
|
|
|
|
#endif
|
2018-11-09 20:31:11 +01:00
|
|
|
|
2020-05-11 08:58:30 +02:00
|
|
|
#include <wlr/config.h>
|
|
|
|
|
|
2017-05-03 17:04:41 +12:00
|
|
|
#include <EGL/egl.h>
|
2017-08-09 21:25:34 +02:00
|
|
|
#include <EGL/eglext.h>
|
2018-02-12 21:29:23 +01:00
|
|
|
#include <stdbool.h>
|
2019-04-01 19:17:23 +03:00
|
|
|
#include <wlr/render/drm_format_set.h>
|
2017-05-03 17:04:41 +12:00
|
|
|
|
2021-09-21 09:36:44 -04:00
|
|
|
struct wlr_egl_context {
|
|
|
|
|
EGLDisplay display;
|
|
|
|
|
EGLContext context;
|
|
|
|
|
EGLSurface draw_surface;
|
|
|
|
|
EGLSurface read_surface;
|
|
|
|
|
};
|
|
|
|
|
|
2020-05-19 11:54:59 +02:00
|
|
|
/**
|
2021-01-09 12:13:35 +01:00
|
|
|
* Make the EGL context current.
|
2020-05-19 11:54:59 +02:00
|
|
|
*
|
|
|
|
|
* Callers are expected to clear the current context when they are done by
|
|
|
|
|
* calling wlr_egl_unset_current.
|
|
|
|
|
*/
|
2021-09-21 10:00:17 -04:00
|
|
|
bool wlr_egl_context_set_current(struct wlr_egl_context *ctx);
|
2018-01-21 00:06:35 +01:00
|
|
|
|
2021-09-21 10:00:17 -04:00
|
|
|
/**
|
|
|
|
|
* Clear the EGL context
|
|
|
|
|
*/
|
|
|
|
|
bool wlr_egl_context_unset_current(struct wlr_egl_context *ctx);
|
2020-05-19 11:54:59 +02:00
|
|
|
|
2021-09-21 10:00:17 -04:00
|
|
|
bool wlr_egl_context_is_current(struct wlr_egl_context *ctx);
|
2018-04-01 16:07:50 -04:00
|
|
|
|
2021-09-21 09:36:44 -04:00
|
|
|
/**
|
|
|
|
|
* Save the current EGL context to the structure provided in the argument.
|
|
|
|
|
*
|
|
|
|
|
* This includes display, context, draw surface and read surface.
|
|
|
|
|
*/
|
|
|
|
|
void wlr_egl_context_save(struct wlr_egl_context *context);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Restore EGL context that was previously saved using wlr_egl_context_save().
|
|
|
|
|
*/
|
|
|
|
|
bool wlr_egl_context_restore(struct wlr_egl_context *context);
|
|
|
|
|
|
2017-05-03 17:04:41 +12:00
|
|
|
#endif
|