From 2c9223f8d6b60067be7e84209fd00fd198738781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= Date: Mon, 8 Nov 2010 23:38:14 +0200 Subject: [PATCH] EGL: superb hack around Mesa EGL damaged linking --- modules/video_output/Modules.am | 3 +++ modules/video_output/egl.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/modules/video_output/Modules.am b/modules/video_output/Modules.am index 1d663685cc..1701a2e86f 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 1562b12e52..9b800b17a9 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 +#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) { -- GitLab