[vlc-devel] [PATCH 1/3] window: add has_shared_egl info flag

Alexandre Janniaux ajanni at videolabs.io
Thu Sep 26 11:04:39 CEST 2019


UI integration of the video might need shared display, for instance with
wayland. When the display connection is shared, calling eglTerminate
will destroy every other context. The `has_shared_egl` flag prevents
this by notifying the possible EGL clients of the window that they
should not terminate the EGLDisplay themselves.
---
 include/vlc_vout_window.h | 15 +++++++++++++++
 src/video_output/window.c |  1 +
 2 files changed, 16 insertions(+)

diff --git a/include/vlc_vout_window.h b/include/vlc_vout_window.h
index 9116fa65614..10cdc410e51 100644
--- a/include/vlc_vout_window.h
+++ b/include/vlc_vout_window.h
@@ -381,6 +381,21 @@ typedef struct vout_window_t {
     struct {
         bool has_double_click; /**< Whether double click events are sent,
                                     or need to be emulated */
+        /**
+         * Define whether EGL is used elsewhere within the same display.
+         *
+         * When this flag is set to `true`, the underlying opengl providers
+         * won't terminate EGLDisplay, so the other clients are expected to
+         * terminate the EGLDisplay after all VLC OpenGL providers linked to
+         * this EGLDisplay have been closed.
+         *
+         * \remark {
+         *   The main reason for this flags is to allow embedding a video into
+         *   a client UI which would be using EGL, whenever the window display
+         *   needs to be the same between both the UI and the video.
+         *   In particular, it would happen with Wayland and a QML client. }
+         * */
+        bool has_shared_egl;
     } info;

     /* Private place holder for the vout_window_t module (optional)
diff --git a/src/video_output/window.c b/src/video_output/window.c
index 16ebf9ef5a2..363f5f21854 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -67,6 +67,7 @@ vout_window_t *vout_window_New(vlc_object_t *obj, const char *module,

     memset(&window->handle, 0, sizeof(window->handle));
     window->info.has_double_click = false;
+    window->info.has_shared_egl = false;
     window->sys = NULL;
     assert(owner != NULL);
     window->owner = *owner;
--
2.23.0


More information about the vlc-devel mailing list