From 1fa674c109c05e082bf0fb43be064cbdabea3327 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 27 Sep 2015 21:20:46 +0200 Subject: vo_opengl: refactor EGL context information callback Move the ugliness from x11egl.c to common.c, so that the ugliness doesn't have to be duplicated in wayland.c. --- video/out/opengl/x11egl.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'video/out/opengl/x11egl.c') diff --git a/video/out/opengl/x11egl.c b/video/out/opengl/x11egl.c index b196b7d9f4..13901860f8 100644 --- a/video/out/opengl/x11egl.c +++ b/video/out/opengl/x11egl.c @@ -31,21 +31,11 @@ #include "common.h" struct priv { - Display *x_display; EGLDisplay egl_display; EGLContext egl_context; EGLSurface egl_surface; }; -static _Thread_local struct priv *current_context; - -static void * GLAPIENTRY get_native_display(const char *name) -{ - if (current_context && strcmp(name, "x11") == 0) - return current_context->x_display; - return NULL; -} - static void mpegl_uninit(MPGLContext *ctx) { struct priv *p = ctx->priv; @@ -55,7 +45,6 @@ static void mpegl_uninit(MPGLContext *ctx) eglDestroyContext(p->egl_display, p->egl_context); } p->egl_context = EGL_NO_CONTEXT; - current_context = NULL; vo_x11_uninit(ctx->vo); } @@ -128,8 +117,6 @@ static int mpegl_init(struct MPGLContext *ctx, int flags) if (!vo_x11_init(vo)) goto uninit; - p->x_display = vo->x11->display; - if (!eglBindAPI(es ? EGL_OPENGL_ES_API : EGL_OPENGL_API)) { mp_msg(vo->log, msgl, "Could not bind API (%s).\n", es ? "GLES" : "GL"); goto uninit; @@ -166,10 +153,10 @@ static int mpegl_init(struct MPGLContext *ctx, int flags) void *(*gpa)(const GLubyte*) = (void *(*)(const GLubyte*))eglGetProcAddress; mpgl_load_functions(ctx->gl, gpa, egl_exts, vo->log); - ctx->gl->MPGetNativeDisplay = get_native_display; - assert(!current_context); - current_context = p; + ctx->native_display_type = "x11"; + ctx->native_display = vo->x11->display; + return true; uninit: -- cgit v1.2.3