From 11b598fe33a29f1f6c41faf6b1dfbdd94af6d19b Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Tue, 2 Jun 2020 21:49:44 +0000 Subject: render: egl: Add utility functions for saving/restoring context --- include/wlr/render/egl.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'include/wlr') diff --git a/include/wlr/render/egl.h b/include/wlr/render/egl.h index 98435d91..d46d95af 100644 --- a/include/wlr/render/egl.h +++ b/include/wlr/render/egl.h @@ -30,6 +30,13 @@ #include #include +struct wlr_egl_context { + EGLDisplay display; + EGLContext context; + EGLSurface draw_surface; + EGLSurface read_surface; +}; + struct wlr_egl { EGLenum platform; EGLDisplay display; @@ -137,6 +144,18 @@ bool wlr_egl_unset_current(struct wlr_egl *egl); bool wlr_egl_is_current(struct wlr_egl *egl); +/** + * Save the current EGL context to the structure provided in the argument. + * + * This includes display, context, draw surface and read surface. + */ +void wlr_egl_save_context(struct wlr_egl_context *context); + +/** + * Restore EGL context that was previously saved using wlr_egl_save_current(). + */ +bool wlr_egl_restore_context(struct wlr_egl_context *context); + bool wlr_egl_swap_buffers(struct wlr_egl *egl, EGLSurface surface, pixman_region32_t *damage); -- cgit v1.2.3