[vlc-commits] opengl: use GL core symbols from *GetProcAddress
Thomas Guillem
git at videolan.org
Wed Dec 6 16:34:28 CET 2017
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Wed Dec 6 15:27:20 2017 +0100| [744ac6ec380ef07db7cb6f6ed07d4c9ba9708798] | committer: Thomas Guillem
opengl: use GL core symbols from *GetProcAddress
Use GetProcAddress to fetch GL core symbols instead of using symbols from the
libGL linked with the vlc gl plugin (but not for GLES2/Windows/macOS).
This fixes a crash with nvidia drivers when using EGL but can also fix some
others issues if a vendor/distrib ship more than one openGL libs.
cf. https://github.com/NVIDIA/libglvnd/issues/63
Symbols from the old libGL.so.1 were used instead of symbols from the new
libOpenGL.so (that are fetched via eglGetProcAddress()).
I guess that libGL.so.1 can't work with EGL with recent drivers.
Fixes #19093
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=744ac6ec380ef07db7cb6f6ed07d4c9ba9708798
---
modules/video_output/Makefile.am | 12 ++++++++----
modules/video_output/opengl/vout_helper.c | 4 ++++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am
index 0fbaf8b05d..1a80c5a14e 100644
--- a/modules/video_output/Makefile.am
+++ b/modules/video_output/Makefile.am
@@ -24,13 +24,13 @@ libglconv_cvpx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
if HAVE_OSX
libvout_macosx_plugin_la_SOURCES = video_output/macosx.m $(OPENGL_COMMONSOURCES)
-libvout_macosx_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCLFAGS)
+libvout_macosx_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCLFAGS) -DHAVE_GL_CORE_SYMBOLS
libvout_macosx_plugin_la_LIBADD = $(OPENGL_COMMONLIBS)
libvout_macosx_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
-Wl,-framework,OpenGL,-framework,Cocoa
libcaopengllayer_plugin_la_SOURCES = video_output/caopengllayer.m $(OPENGL_COMMONSOURCES)
-libcaopengllayer_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCLFAGS)
+libcaopengllayer_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCLFAGS) -DHAVE_GL_CORE_SYMBOLS
libcaopengllayer_plugin_la_LIBADD = $(OPENGL_COMMONLIBS)
libcaopengllayer_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)' \
-Wl,-framework,OpenGL,-framework,Cocoa,-framework,QuartzCore
@@ -68,7 +68,11 @@ vout_LTLIBRARIES += $(LTLIBgles2)
libgl_plugin_la_SOURCES = $(OPENGL_COMMONSOURCES) video_output/opengl/display.c
libgl_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS) $(OPENGL_COMMONCLFAGS)
-libgl_plugin_la_LIBADD = $(GL_LIBS) $(LIBM) $(OPENGL_COMMONLIBS)
+libgl_plugin_la_LIBADD = $(LIBM) $(OPENGL_COMMONLIBS)
+if HAVE_WIN32
+libgl_plugin_la_CFLAGS += -DHAVE_GL_CORE_SYMBOLS
+libgl_plugin_la_LIBADD += $(GL_LIBS)
+endif
libglconv_vaapi_wl_plugin_la_SOURCES = video_output/opengl/converter_vaapi.c \
video_output/opengl/converter.h \
@@ -309,7 +313,7 @@ libglwin32_plugin_la_CPPFLAGS = $(AM_CPPFLAGS) \
libglwin32_plugin_la_LIBADD = libchroma_copy.la -lopengl32 -lgdi32 $(LIBCOM) -luuid $(OPENGL_COMMONLIBS)
libwgl_plugin_la_LIBADD = -lopengl32 -lgdi32 $(OPENGL_COMMONLIBS)
-libglwin32_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCLFAGS)
+libglwin32_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCLFAGS) -DHAVE_GL_CORE_SYMBOLS
libwgl_plugin_la_CFLAGS = $(AM_CFLAGS) $(OPENGL_COMMONCLFAGS)
libglwin32_plugin_la_LDFLAGS = $(AM_LDFLAGS) -rpath '$(voutdir)'
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 9004e2c20f..02ea66d8f2 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -738,7 +738,11 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
vgl->gl = gl;
+#if defined(USE_OPENGL_ES2) || defined(HAVE_GL_CORE_SYMBOLS)
#define GET_PROC_ADDR_CORE(name) vgl->vt.name = gl##name
+#else
+#define GET_PROC_ADDR_CORE(name) GET_PROC_ADDR_EXT(name, true)
+#endif
#define GET_PROC_ADDR_EXT(name, critical) do { \
vgl->vt.name = vlc_gl_GetProcAddress(gl, "gl"#name); \
if (vgl->vt.name == NULL && critical) { \
More information about the vlc-commits
mailing list