[vlc-devel] [PATCH 2/3] egl: allow window provider to prevent eglTerminate in vlc_gl_t
Alexandre Janniaux
ajanni at videolabs.io
Thu Sep 26 11:04:40 CEST 2019
If a window provider is using EGL with the same display, the EGL state
should be terminated from there instead of from the vlc_gl_t provider.
This implement the handling of vout_window::info::has_shared_egl
semantic.
---
modules/video_output/opengl/egl.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
index 53d770365ad..cfb88fcb315 100644
--- a/modules/video_output/opengl/egl.c
+++ b/modules/video_output/opengl/egl.c
@@ -179,13 +179,22 @@ static void Close(vlc_gl_t *gl)
{
vlc_gl_sys_t *sys = gl->sys;
+
+ /* Window providers can prevent the EGL implementation from destroying
+ * the associated EGL display. */
+ bool prevent_terminate = gl->surface->info.has_shared_egl;
+
if (sys->display != EGL_NO_DISPLAY)
{
if (sys->context != EGL_NO_CONTEXT)
eglDestroyContext(sys->display, sys->context);
if (sys->surface != EGL_NO_SURFACE)
eglDestroySurface(sys->display, sys->surface);
- eglTerminate(sys->display);
+
+ /* Kill the egl state only if we own it. */
+ if (!prevent_terminate)
+ eglTerminate(sys->display);
+ eglReleaseThread();
}
#ifdef USE_PLATFORM_X11
if (sys->x11 != NULL)
--
2.23.0
More information about the vlc-devel
mailing list