[vlc-commits] commit: EGL: superb hack around Mesa EGL damaged linking ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Mon Nov 8 22:39:09 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Nov  8 23:38:14 2010 +0200| [2c9223f8d6b60067be7e84209fd00fd198738781] | committer: Rémi Denis-Courmont 

EGL: superb hack around Mesa EGL damaged linking

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2c9223f8d6b60067be7e84209fd00fd198738781
---

 modules/video_output/Modules.am |    3 +++
 modules/video_output/egl.c      |   15 +++++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am
index 1d66368..1701a2e 100644
--- a/modules/video_output/Modules.am
+++ b/modules/video_output/Modules.am
@@ -91,6 +91,9 @@ libegl_plugin_la_CFLAGS = $(AM_CFLAGS) \
 	$(EGL_CFLAGS) $(GL_CFLAGS)
 libegl_plugin_la_LIBADD = $(AM_LIBADD) \
 	$(EGL_LIBS) $(GL_LIBS)
+if !HAVE_WIN32
+libegl_plugin_la_LIBADD += -ldl
+endif
 libegl_plugin_la_DEPENDENCIES =
 EXTRA_LTLIBRARIES += libegl_plugin.la
 libvlc_LTLIBRARIES += $(LTLIBegl)
diff --git a/modules/video_output/egl.c b/modules/video_output/egl.c
index 1562b12..9b800b1 100644
--- a/modules/video_output/egl.c
+++ b/modules/video_output/egl.c
@@ -48,6 +48,10 @@
 # define VLC_RENDERABLE_BIT EGL_OPENGL_BIT
 #endif
 
+#ifdef __unix__
+# include <dlfcn.h>
+#endif
+
 /* Plugin callbacks */
 static int Open (vlc_object_t *);
 static void Close (vlc_object_t *);
@@ -151,6 +155,17 @@ static int Open (vlc_object_t *obj)
     sys->gl.sys = NULL;
     sys->pool = NULL;
 
+    /* XXX Explicit hack!
+     * Mesa EGL plugins (as of version 7.8.2) are not properly linked to
+     * libEGL.so even though they import some of its symbols. This is
+     * typically not a problem. Unfortunately, LibVLC loads plugins as
+     * RTLD_LOCAL so that they do not pollute the namespace. Then the
+     * libEGL symbols are not visible to EGL plugins, and the run-time
+     * linker exits the whole process. */
+#ifdef __unix__
+    dlopen ("libEGL.so", RTLD_GLOBAL|RTLD_LAZY);
+#endif
+
     EGLint major, minor;
     if (eglInitialize (dpy, &major, &minor) != EGL_TRUE)
     {



More information about the vlc-commits mailing list