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/hwdec_vaegl.c45
-rw-r--r--video/out/opengl/rpi.h3
-rw-r--r--wscript5
7 files changed, 35 insertions, 66 deletions
diff --git a/TOOLS/old-configure b/TOOLS/old-configure
index 41c9b1c9bd..92aca58bde 100755
--- a/TOOLS/old-configure
+++ b/TOOLS/old-configure
@@ -690,7 +690,6 @@ 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 43d9375155..640a357b12 100644
--- a/video/out/opengl/common.c
+++ b/video/out/opengl/common.c
@@ -72,7 +72,6 @@ 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 {
@@ -279,22 +278,6 @@ 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 675447db54..0e3566d689 100644
--- a/video/out/opengl/common.h
+++ b/video/out/opengl/common.h
@@ -46,11 +46,6 @@
#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"
@@ -273,12 +268,6 @@ 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 4975528325..6a5ce6ad09 100644
--- a/video/out/opengl/header_fixes.h
+++ b/video/out/opengl/header_fixes.h
@@ -60,25 +60,6 @@
#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/hwdec_vaegl.c b/video/out/opengl/hwdec_vaegl.c
index 74f6c0d6f8..cbdcbb8755 100644
--- a/video/out/opengl/hwdec_vaegl.c
+++ b/video/out/opengl/hwdec_vaegl.c
@@ -22,6 +22,7 @@
#include <assert.h>
#include <EGL/egl.h>
+#include <EGL/eglext.h>
#include <va/va_drmcommon.h>
@@ -42,6 +43,12 @@ struct priv {
VAImage current_image;
bool buffer_acquired;
struct mp_image *current_ref;
+
+ EGLImageKHR (EGLAPIENTRY *CreateImageKHR)(EGLDisplay, EGLContext,
+ EGLenum, EGLClientBuffer,
+ const EGLint *);
+ EGLBoolean (EGLAPIENTRY *DestroyImageKHR)(EGLDisplay, EGLImageKHR);
+ void (EGLAPIENTRY *EGLImageTargetTexture2DOES)(GLenum, GLeglImageOES);
};
static bool test_format(struct gl_hwdec *hw);
@@ -53,7 +60,7 @@ static void unref_image(struct gl_hwdec *hw)
for (int n = 0; n < 4; n++) {
if (p->images[n])
- hw->gl->DestroyImageKHR(eglGetCurrentDisplay(), p->images[n]);
+ p->DestroyImageKHR(eglGetCurrentDisplay(), p->images[n]);
p->images[n] = 0;
}
@@ -121,26 +128,38 @@ static int create(struct gl_hwdec *hw)
{
GL *gl = hw->gl;
+ struct priv *p = talloc_zero(hw, struct priv);
+ hw->priv = p;
+ p->current_image.buf = p->current_image.image_id = VA_INVALID_ID;
+ p->log = hw->log;
+
if (hw->hwctx)
return -1;
if (!eglGetCurrentDisplay())
return -1;
- Display *x11disp =
+ p->xdisplay =
hw->gl->MPGetNativeDisplay ? hw->gl->MPGetNativeDisplay("x11") : NULL;
- if (!x11disp)
+ if (!p->xdisplay)
return -1;
- if (!gl->CreateImageKHR || !gl->EGLImageTargetTexture2DOES ||
- !strstr(gl->extensions, "EXT_image_dma_buf_import") ||
+ if (!strstr(gl->extensions, "EXT_image_dma_buf_import") ||
+ !strstr(gl->extensions, "EGL_KHR_image_base") ||
+ !strstr(gl->extensions, "GL_OES_EGL_image") ||
!(gl->mpgl_caps & MPGL_CAP_TEX_RG))
return -1;
- struct priv *p = talloc_zero(hw, struct priv);
- hw->priv = p;
- p->current_image.buf = p->current_image.image_id = VA_INVALID_ID;
- p->log = hw->log;
- p->xdisplay = x11disp;
- p->display = vaGetDisplay(x11disp);
+ // EGL_KHR_image_base
+ p->CreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR");
+ p->DestroyImageKHR = (void *)eglGetProcAddress("eglDestroyImageKHR");
+ // GL_OES_EGL_image
+ p->EGLImageTargetTexture2DOES =
+ (void *)eglGetProcAddress("glEGLImageTargetTexture2DOES");
+
+ if (!p->CreateImageKHR || !p->DestroyImageKHR ||
+ !p->EGLImageTargetTexture2DOES)
+ return -1;
+
+ p->display = vaGetDisplay(p->xdisplay);
if (!p->display)
return -1;
@@ -262,13 +281,13 @@ static int map_image(struct gl_hwdec *hw, struct mp_image *hw_image,
ADD_ATTRIB(EGL_DMA_BUF_PLANE0_OFFSET_EXT, va_image->offsets[n]);
ADD_ATTRIB(EGL_DMA_BUF_PLANE0_PITCH_EXT, va_image->pitches[n]);
- p->images[n] = hw->gl->CreateImageKHR(eglGetCurrentDisplay(),
+ p->images[n] = p->CreateImageKHR(eglGetCurrentDisplay(),
EGL_NO_CONTEXT, EGL_LINUX_DMA_BUF_EXT, NULL, attribs);
if (!p->images[n])
goto err;
gl->BindTexture(GL_TEXTURE_2D, p->gl_textures[n]);
- gl->EGLImageTargetTexture2DOES(GL_TEXTURE_2D, p->images[n]);
+ p->EGLImageTargetTexture2DOES(GL_TEXTURE_2D, p->images[n]);
out_textures[n] = p->gl_textures[n];
}
diff --git a/video/out/opengl/rpi.h b/video/out/opengl/rpi.h
index 5ce893e9e3..c2c6dd0dc4 100644
--- a/video/out/opengl/rpi.h
+++ b/video/out/opengl/rpi.h
@@ -1,5 +1,8 @@
#include <bcm_host.h>
+#include <EGL/egl.h>
+#include <EGL/eglext.h>
+
#include "common.h"
struct mp_egl_rpi {
diff --git a/wscript b/wscript
index 3acda833b8..3e6c7278a0 100644
--- a/wscript
+++ b/wscript
@@ -703,11 +703,6 @@ video_output_features = [
'desc': 'OpenGL video outputs',
'deps_any': [ 'gl-cocoa', 'gl-x11', 'gl-win32', 'gl-wayland', 'rpi' ],
'func': check_true
- } , {
- 'name': 'egl',
- 'desc': 'EGL',
- 'deps_any': [ 'egl-x11', 'rpi' , 'gl-wayland' ],
- 'func': check_true,
}
]