summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xTOOLS/old-configure1
-rw-r--r--video/out/opengl/common.c17
-rw-r--r--video/out/opengl/common.h11
-rw-r--r--video/out/opengl/header_fixes.h19
-rw-r--r--video/out/opengl/x11egl.c4
-rw-r--r--wscript5
6 files changed, 56 insertions, 1 deletions
diff --git a/TOOLS/old-configure b/TOOLS/old-configure
index cdb65b0d7d..ac9f1e773d 100755
--- a/TOOLS/old-configure
+++ b/TOOLS/old-configure
@@ -690,6 +690,7 @@ fi
check_yes_no $_gl GL
check_yes_no $_gl_x11 GL_X11
check_yes_no $_gl_x11_egl EGL_X11
+check_yes_no $_gl_x11_egl EGL
check_yes_no $_gl_wayland GL_WAYLAND
echores "$_gl"
diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c
index 2b6d3949ef..8eafc09d25 100644
--- a/video/out/opengl/common.c
+++ b/video/out/opengl/common.c
@@ -72,6 +72,7 @@ static bool check_ext(GL *gl, const char *name)
#define FN_OFFS(name) offsetof(GL, name)
#define DEF_FN(name) {FN_OFFS(name), "gl" # name}
+#define DEF_FN_EGL(name) {FN_OFFS(name), "egl" # name}
#define DEF_FN_NAME(name, str) {FN_OFFS(name), str}
struct gl_function {
@@ -278,6 +279,22 @@ static const struct gl_functions gl_functions[] = {
.extension = "GL_APPLE_rgb_422",
.provides = MPGL_CAP_APPLE_RGB_422,
},
+ // EGL extensions for vaapi EGL interop
+ {
+ .extension = "EGL_KHR_image_base",
+ .functions = (const struct gl_function[]) {
+ DEF_FN_EGL(CreateImageKHR),
+ DEF_FN_EGL(DestroyImageKHR),
+ {0}
+ },
+ },
+ {
+ .extension = "GL_OES_EGL_image",
+ .functions = (const struct gl_function[]) {
+ DEF_FN(EGLImageTargetTexture2DOES),
+ {0}
+ },
+ },
{
.ver_core = 430,
.extension = "GL_ARB_debug_output",
diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h
index 0e3566d689..675447db54 100644
--- a/video/out/opengl/common.h
+++ b/video/out/opengl/common.h
@@ -46,6 +46,11 @@
#include <GL/glext.h>
#endif
+#if HAVE_EGL
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+#endif
+
#define MP_GET_GL_WORKAROUNDS
#include "header_fixes.h"
@@ -268,6 +273,12 @@ struct GL {
GLint (GLAPIENTRY *GetVideoSync)(GLuint *);
GLint (GLAPIENTRY *WaitVideoSync)(GLint, GLint, unsigned int *);
+ EGLImageKHR (EGLAPIENTRY *CreateImageKHR)(EGLDisplay, EGLContext,
+ EGLenum, EGLClientBuffer,
+ const EGLint *);
+ EGLBoolean (EGLAPIENTRY *DestroyImageKHR)(EGLDisplay, EGLImageKHR);
+ void (EGLAPIENTRY *EGLImageTargetTexture2DOES)(GLenum, GLeglImageOES);
+
void (GLAPIENTRY *DebugMessageCallback)(MP_GLDEBUGPROC callback,
const void *userParam);
diff --git a/video/out/opengl/header_fixes.h b/video/out/opengl/header_fixes.h
index 6a5ce6ad09..4975528325 100644
--- a/video/out/opengl/header_fixes.h
+++ b/video/out/opengl/header_fixes.h
@@ -60,6 +60,25 @@
#define GLvdpauSurfaceNV GLintptr
#endif
+typedef void *MP_voidptr;
+
+#ifndef GL_OES_EGL_image
+#define GLeglImageOES MP_voidptr
+#endif
+#ifndef EGL_KHR_image
+#define EGLImageKHR MP_voidptr
+#endif
+
+#if !HAVE_EGL
+#define EGLBoolean unsigned int
+#define EGLenum unsigned int
+#define EGLint int
+#define EGLContext MP_voidptr
+#define EGLDisplay MP_voidptr
+#define EGLClientBuffer MP_voidptr
+#define EGLAPIENTRY GLAPIENTRY
+#endif
+
#ifndef GL_DEBUG_SEVERITY_HIGH
#define GL_DEBUG_SEVERITY_HIGH 0x9146
#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
diff --git a/video/out/opengl/x11egl.c b/video/out/opengl/x11egl.c
index fba40603fc..53cd5ae677 100644
--- a/video/out/opengl/x11egl.c
+++ b/video/out/opengl/x11egl.c
@@ -134,8 +134,10 @@ static bool config_window_x11_egl(struct MPGLContext *ctx, int flags)
return false;
}
+ const char *egl_exts = eglQueryString(p->egl_display, EGL_EXTENSIONS);
+
void *(*gpa)(const GLubyte*) = (void *(*)(const GLubyte*))eglGetProcAddress;
- mpgl_load_functions(ctx->gl, gpa, NULL, vo->log);
+ mpgl_load_functions(ctx->gl, gpa, egl_exts, vo->log);
return true;
}
diff --git a/wscript b/wscript
index a9b026d9de..f23cf43500 100644
--- a/wscript
+++ b/wscript
@@ -609,6 +609,11 @@ video_output_features = [
'groups': [ 'gl' ],
'func': check_pkg_config('egl', 'gl'),
} , {
+ 'name': 'egl',
+ 'desc': 'EGL',
+ 'deps': [ 'egl-x11' ],
+ 'func': check_true,
+ } , {
'name': '--gl-wayland',
'desc': 'OpenGL Wayland Backend',
'deps': [ 'wayland' ],