From 10de9b091a59e4831bb3fbfc46eb1d3c7558c9d8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 13 May 2015 23:40:52 +0200 Subject: vo_opengl: change user options for requesting GLES Instead of having separate backends, make use of GLES a flag. This reduces the number of backends and the resulting annoyances. Also, nobody cares about using GLES, so there's no backward compatibility either. --- DOCS/man/vo.rst | 11 +++++++---- video/out/gl_common.c | 3 --- video/out/gl_common.h | 2 -- video/out/gl_x11.c | 10 +--------- video/out/gl_x11egl.c | 24 ++---------------------- video/out/vo.h | 1 + video/out/vo_opengl.c | 5 +++++ 7 files changed, 16 insertions(+), 40 deletions(-) diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst index 874e064145..915ef960b1 100644 --- a/DOCS/man/vo.rst +++ b/DOCS/man/vo.rst @@ -573,12 +573,15 @@ Available video output drivers are: Cocoa/OS X win Win32/WGL - x11, x11es - X11/GLX (the ``es`` variant forces GLES) + x11 + X11/GLX wayland Wayland/EGL - x11egl, x11egles - X11/EGL (the ``es`` variant forces GLES) + x11egl + X11/EGL + + ``es`` + Force or prefer GLES2/3 over desktop OpenGL, if supported. ``fbo-format=`` Selects the internal format of textures used for FBOs. The format can diff --git a/video/out/gl_common.c b/video/out/gl_common.c index 9ea67a64a0..012e5d3912 100644 --- a/video/out/gl_common.c +++ b/video/out/gl_common.c @@ -544,13 +544,10 @@ static const struct backend backends[] = { #endif #if HAVE_GL_X11 {"x11", mpgl_set_backend_x11}, - {"x11es", mpgl_set_backend_x11es}, #endif #if HAVE_EGL_X11 {"x11egl", mpgl_set_backend_x11egl}, - {"x11egles", mpgl_set_backend_x11egles}, #endif - {0} }; int mpgl_find_backend(const char *name) diff --git a/video/out/gl_common.h b/video/out/gl_common.h index deee69c15c..7d037cd518 100644 --- a/video/out/gl_common.h +++ b/video/out/gl_common.h @@ -128,9 +128,7 @@ int mpgl_validate_backend_opt(struct mp_log *log, const struct m_option *opt, void mpgl_set_backend_cocoa(MPGLContext *ctx); void mpgl_set_backend_w32(MPGLContext *ctx); void mpgl_set_backend_x11(MPGLContext *ctx); -void mpgl_set_backend_x11es(MPGLContext *ctx); void mpgl_set_backend_x11egl(MPGLContext *ctx); -void mpgl_set_backend_x11egles(MPGLContext *ctx); void mpgl_set_backend_wayland(MPGLContext *ctx); void mpgl_set_backend_rpi(MPGLContext *ctx); diff --git a/video/out/gl_x11.c b/video/out/gl_x11.c index 8fb4e59ac8..8310cfe7de 100644 --- a/video/out/gl_x11.c +++ b/video/out/gl_x11.c @@ -33,7 +33,6 @@ struct glx_context { XVisualInfo *vinfo; GLXContext context; GLXFBConfig fbc; - bool force_es; }; static bool create_context_x11_old(struct MPGLContext *ctx) @@ -252,7 +251,7 @@ static bool config_window_x11(struct MPGLContext *ctx, int flags) int gl_version = ctx->requested_gl_version; bool success = false; - if (!glx_ctx->force_es) { + if (!(flags & VOFLAG_GLES)) { success = create_context_x11_gl3(ctx, flags, gl_version, false); if (!success) success = create_context_x11_old(ctx); @@ -295,10 +294,3 @@ void mpgl_set_backend_x11(MPGLContext *ctx) ctx->vo_uninit = vo_x11_uninit; ctx->vo_control = vo_x11_control; } - -void mpgl_set_backend_x11es(MPGLContext *ctx) -{ - mpgl_set_backend_x11(ctx); - struct glx_context *glx_ctx = ctx->priv; - glx_ctx->force_es = true; -} diff --git a/video/out/gl_x11egl.c b/video/out/gl_x11egl.c index 1f6f328251..bfb88c3110 100644 --- a/video/out/gl_x11egl.c +++ b/video/out/gl_x11egl.c @@ -93,10 +93,11 @@ static bool create_context_egl(MPGLContext *ctx, EGLConfig config, return true; } -static bool config_window_x11_egl_(struct MPGLContext *ctx, int flags, bool es) +static bool config_window_x11_egl(struct MPGLContext *ctx, int flags) { struct priv *p = ctx->priv; struct vo *vo = ctx->vo; + bool es = flags & VOFLAG_GLES; if (p->egl_context) { vo_x11_config_vo_window(vo, NULL, flags, "gl"); @@ -140,16 +141,6 @@ static bool config_window_x11_egl_(struct MPGLContext *ctx, int flags, bool es) return true; } -static bool config_window_x11_egl(struct MPGLContext *ctx, int flags) -{ - return config_window_x11_egl_(ctx, flags, false); -} - -static bool config_window_x11_egles(struct MPGLContext *ctx, int flags) -{ - return config_window_x11_egl_(ctx, flags, true); -} - static void releaseGlContext_egl(MPGLContext *ctx) { struct priv *p = ctx->priv; @@ -177,14 +168,3 @@ void mpgl_set_backend_x11egl(MPGLContext *ctx) ctx->vo_uninit = vo_x11_uninit; ctx->vo_control = vo_x11_control; } - -void mpgl_set_backend_x11egles(MPGLContext *ctx) -{ - ctx->priv = talloc_zero(ctx, struct priv); - ctx->config_window = config_window_x11_egles; - ctx->releaseGlContext = releaseGlContext_egl; - ctx->swapGlBuffers = swapGlBuffers_egl; - ctx->vo_init = vo_x11_init; - ctx->vo_uninit = vo_x11_uninit; - ctx->vo_control = vo_x11_control; -} diff --git a/video/out/vo.h b/video/out/vo.h index c2aee9aedd..167c08a69c 100644 --- a/video/out/vo.h +++ b/video/out/vo.h @@ -131,6 +131,7 @@ struct voctrl_get_equalizer_args { #define VO_NOTIMPL -3 #define VOFLAG_HIDDEN 0x10 //< Use to create a hidden window +#define VOFLAG_GLES 0x20 // Hint to prefer GLES2 if possible #define VOFLAG_GL_DEBUG 0x40 // Hint to request debug OpenGL context #define VOFLAG_ALPHA 0x80 // Hint to request alpha framebuffer diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index 1ca251a78f..115c0fcebe 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -75,6 +75,7 @@ struct gl_priv { int dwm_flush; char *backend; + int es; bool frame_started; @@ -415,6 +416,9 @@ static int preinit(struct vo *vo) if (p->use_gl_debug) vo_flags |= VOFLAG_GL_DEBUG; + if (p->es) + vo_flags |= VOFLAG_GLES; + if (p->allow_sw) vo->probing = false; @@ -467,6 +471,7 @@ static const struct m_option options[] = { OPT_FLAG("debug", use_gl_debug, 0), OPT_STRING_VALIDATE("backend", backend, 0, mpgl_validate_backend_opt), OPT_FLAG("sw", allow_sw, 0), + OPT_FLAG("es", es, 0), OPT_INTPAIR("check-pattern", opt_pattern, 0), OPT_SUBSTRUCT("", renderer_opts, gl_video_conf, 0), -- cgit v1.2.3