<html><head></head><body><div class="gmail_quote">Le 21 juin 2017 10:19:05 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">I forgot to fix the TODO (ugly way to get the X11 Display via EGL) in<br />converter_vaapi.c before pushing it.<br /><br />I think, there are 3 ways to fix this issues:<br /><br /> - What I do in this patch: get the same X11 display that is created by x11_egl.<br /><br /> - Just do an other XOpenDisplay(wnd->display.x11) from converter_vaapi.c. I<br />   guess this will safely use the same dpy instance created by x11_egl, no ?<br /><br /> - have x11_egl saving the X11 dpy in the wmd->display struct<br />---<br /> include/vlc_opengl.h                          |  6 ++++++<br /> modules/video_output/opengl/converter_vaapi.c | 13 +++----------<br /> modules/video_output/opengl/egl.c             | 11 +++++++++++<br /> 3 files changed, 20 insertions(+), 10 deletions(-)<br /><br />diff --git a/include/vlc_opengl.h b/include/vlc_opengl.h<br />index 6642f78554..d536d271d7 100644<br />--- a/include/vlc_opengl.h<br />+++ b/include/vlc_opengl.h<br />@@ -50,6 +50,7 @@ struct vlc_gl_t<br />     void (*resize)(vlc_gl_t *, unsigned, unsigned);<br />     void (*swap)(vlc_gl_t *);<br />     void*(*getProcAddress)(vlc_gl_t *, const char *);<br />+    void*(*getNativeDpy)(vlc_gl_t *);<br /> };<br /> <br /> enum {<br />@@ -86,6 +87,11 @@ static inline void *vlc_gl_GetProcAddress(vlc_gl_t *gl, const char *name)<br />     return (gl->getProcAddress != NULL) ? gl->getProcAddress(gl, name) : NULL;<br /> }<br /> <br />+static inline void *vlc_gl_GetNativeDpy(vlc_gl_t *gl)<br />+{<br />+    return gl->getNativeDpy != NULL ? gl->getNativeDpy(gl) : NULL;<br />+}<br />+<br /> VLC_API vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *,<br />                                         const struct vout_window_cfg_t *,<br />                                         struct vout_window_t **) VLC_USED;<br />diff --git a/modules/video_output/opengl/converter_vaapi.c b/modules/video_output/opengl/converter_vaapi.c<br />index 7c9f9947b6..4096f072dd 100644<br />--- a/modules/video_output/opengl/converter_vaapi.c<br />+++ b/modules/video_output/opengl/converter_vaapi.c<br />@@ -38,14 +38,6 @@<br /> <br /> #ifdef HAVE_VA_X11<br /> # include <va/va_x11.h><br />-/* TODO ugly way to get the X11 Display via EGL. */<br />-struct vlc_gl_sys_t<br />-{<br />-    EGLDisplay display;<br />-    EGLSurface surface;<br />-    EGLContext context;<br />-    Display *x11;<br />-};<br /> #endif<br /> <br /> struct priv<br />@@ -315,8 +307,9 @@ opengl_tex_converter_vaapi_init(video_format_t *fmt, opengl_tex_converter_t *tc)<br /> #ifdef HAVE_VA_X11<br />         case VOUT_WINDOW_TYPE_XID:<br />         {<br />-            struct vlc_gl_sys_t *glsys = tc->gl->sys;<br />-            fshader = tc_vaegl_init(fmt, tc, priv, vaGetDisplay(glsys->x11));<br />+            void *x11_dpy = vlc_gl_GetNativeDpy(tc->gl);<br />+            if (x11_dpy != NULL)<br />+                fshader = tc_vaegl_init(fmt, tc, priv, vaGetDisplay(x11_dpy));<br />             break;<br />         }<br /> #endif<br />diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c<br />index 22cf3545c9..ccb4891640 100644<br />--- a/modules/video_output/opengl/egl.c<br />+++ b/modules/video_output/opengl/egl.c<br />@@ -103,6 +103,14 @@ static void *GetSymbol(vlc_gl_t *gl, const char *procname)<br />     return (void *)eglGetProcAddress (procname);<br /> }<br /> <br />+#if defined (USE_PLATFORM_X11)<br />+static void *GetNativeDpy(vlc_gl_t *gl)<br />+{<br />+    vlc_gl_sys_t *sys = gl->sys;<br />+    return sys->x11;<br />+}<br />+#endif<br />+<br /> static bool CheckToken(const char *haystack, const char *needle)<br /> {<br />     size_t len = strlen(needle);<br />@@ -371,6 +379,9 @@ static int Open (vlc_object_t *obj, const struct gl_api *api)<br />     gl->resize = Resize;<br />     gl->swap = SwapBuffers;<br />     gl->getProcAddress = GetSymbol;<br />+#if defined (USE_PLATFORM_X11)<br />+    gl->getNativeDpy = GetNativeDpy;<br />+#endif<br />     return VLC_SUCCESS;<br /> <br /> error:</pre></blockquote></div><br clear="all">GL does not know what backend it runs on (GLX, EGL/X11, EGL/Wayland, maybe EGL/GBM soon) so it does not know the type of the native display pointer (if that even means anything). So I don't really see how that would work.<br>
-- <br>
Rémi Denis-Courmont<br>
Typed on an inconvenient virtual keyboard</body></html>