From 9917ccccafb4ad41cad20178b4f2d4a1a9a42d23 Mon Sep 17 00:00:00 2001 From: Alexandre Janniaux Date: Mon, 11 Apr 2022 10:45:06 +0200 Subject: [PATCH] opengl: interop_vaapi: link EGL directly Use EGL symbols from EGL library directly instead of loading through vlc_gl_GetProcAddress. In the future, we might want to use runtime loading through the egl provider capabilities but it's currently unused and loading EGL through GLX (vlc_gl_GetProcAddress) is leading to undefined results and crash. With this patch, the interop_vaapi correctly fails when running with GLX and it falls back on EGL to load the interop. Fixes #26813 --- modules/video_output/Makefile.am | 4 ++-- modules/video_output/opengl/interop_vaapi.c | 14 ++------------ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/modules/video_output/Makefile.am b/modules/video_output/Makefile.am index d4ada0394b9..925ba3bed17 100644 --- a/modules/video_output/Makefile.am +++ b/modules/video_output/Makefile.am @@ -122,8 +122,8 @@ endif libglinterop_vaapi_plugin_la_SOURCES = video_output/opengl/interop_vaapi.c \ video_output/opengl/interop.h \ hw/vaapi/vlc_vaapi.c hw/vaapi/vlc_vaapi.h -libglinterop_vaapi_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS) -libglinterop_vaapi_plugin_la_LIBADD = $(LIBVA_LIBS) $(LIBVA_EGL_LIBS) +libglinterop_vaapi_plugin_la_CFLAGS = $(AM_CFLAGS) $(GL_CFLAGS) $(EGL_CFLAGS) +libglinterop_vaapi_plugin_la_LIBADD = $(LIBVA_LIBS) $(LIBVA_EGL_LIBS) $(EGL_LIBS) libglinterop_vdpau_plugin_la_SOURCES = video_output/opengl/interop_vdpau.c \ video_output/opengl/interop.h hw/vdpau/picture.c hw/vdpau/vlc_vdpau.h diff --git a/modules/video_output/opengl/interop_vaapi.c b/modules/video_output/opengl/interop_vaapi.c index afd44fc9154..0b4324eb4f0 100644 --- a/modules/video_output/opengl/interop_vaapi.c +++ b/modules/video_output/opengl/interop_vaapi.c @@ -64,8 +64,6 @@ struct priv struct { EGLDisplay display; - EGLDisplay (*getCurrentDisplay)(); - const char *(*queryString)(EGLDisplay, EGLint); EGLImage (*createImageKHR)(EGLDisplay, EGLContext, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); void (*destroyImageKHR)(EGLDisplay, EGLImage image); @@ -476,20 +474,12 @@ Open(vlc_object_t *obj) if (vaegl_init_fourcc(priv, va_fourcc)) goto error; - priv->egl.getCurrentDisplay = vlc_gl_GetProcAddress(interop->gl, "eglGetCurrentDisplay"); - if (priv->egl.getCurrentDisplay == EGL_NO_DISPLAY) - goto error; - - priv->egl.display = priv->egl.getCurrentDisplay(); + priv->egl.display = eglGetCurrentDisplay(); if (priv->egl.display == EGL_NO_DISPLAY) goto error; - priv->egl.queryString = vlc_gl_GetProcAddress(interop->gl, "eglQueryString"); - if (priv->egl.queryString == NULL) - goto error; - /* EGL_EXT_image_dma_buf_import implies EGL_KHR_image_base */ - const char *eglexts = priv->egl.queryString(priv->egl.display, EGL_EXTENSIONS); + const char *eglexts = eglQueryString(priv->egl.display, EGL_EXTENSIONS); if (eglexts == NULL || !vlc_gl_StrHasToken(eglexts, "EGL_EXT_image_dma_buf_import")) goto error; -- GitLab