summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Velikov <emil.l.velikov@gmail.com>2021-10-02 21:49:47 +0100
committerDudemanguy <random342@airmail.cc>2021-10-16 20:33:53 +0000
commite869d519baf4b71b33e522f97b4638979fe0d4db (patch)
tree256483ddf5f6abde1f7345c917fbef91540b21ea
parent20e9c66fa935807ca5d11eedf82fbfd3db807c04 (diff)
downloadmpv-e869d519baf4b71b33e522f97b4638979fe0d4db.tar.bz2
mpv-e869d519baf4b71b33e522f97b4638979fe0d4db.tar.xz
vo_gpu: context_glx: remove legacy create_context_x11_old()
The old/legacy code-path isn't really needed for mpv use-cases. In particular: All Mesa drivers (even GL 2.1 ones like lima/vc4) work fine with the "non-legacy" path. From proprietary/binary drivers - the vendor either does not support desktop GL or the drivers/HW is not actively supported. Looking at the Nvidia HW - anything GeForce 7 and older is GL 2.1 and lacks decent video acceleration. The latest official drivers are from 2017. All newer Nvidia HW is GL 3.3+ thus must have GLX_ARB_create_context as in the non-legacy path, while also good acceleration albeit via VDPAU in some cases. With the old path gone, provide meaningful error message in the very unlikely case that GLX_ARB_create_context is missing. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
-rw-r--r--video/out/opengl/context_glx.c52
1 files changed, 9 insertions, 43 deletions
diff --git a/video/out/opengl/context_glx.c b/video/out/opengl/context_glx.c
index 529991fac2..e4e23c7b86 100644
--- a/video/out/opengl/context_glx.c
+++ b/video/out/opengl/context_glx.c
@@ -69,41 +69,6 @@ static void glx_uninit(struct ra_ctx *ctx)
vo_x11_uninit(ctx->vo);
}
-static bool create_context_x11_old(struct ra_ctx *ctx, GL *gl)
-{
- struct priv *p = ctx->priv;
- Display *display = ctx->vo->x11->display;
- struct vo *vo = ctx->vo;
-
- if (p->context)
- return true;
-
- if (!p->vinfo) {
- MP_FATAL(vo, "Can't create a legacy GLX context without X visual\n");
- return false;
- }
-
- GLXContext new_context = glXCreateContext(display, p->vinfo, NULL, True);
- if (!new_context) {
- MP_FATAL(vo, "Could not create GLX context!\n");
- return false;
- }
-
- if (!glXMakeCurrent(display, ctx->vo->x11->window, new_context)) {
- MP_FATAL(vo, "Could not set GLX context!\n");
- glXDestroyContext(display, new_context);
- return false;
- }
-
- const char *glxstr = glXQueryExtensionsString(display, ctx->vo->x11->screen);
-
- mpgl_load_functions(gl, (void *)glXGetProcAddressARB, glxstr, vo->log);
-
- p->context = new_context;
-
- return true;
-}
-
typedef GLXContext (*glXCreateContextAttribsARBProc)
(Display*, GLXFBConfig, GLXContext, Bool, const int*);
@@ -122,9 +87,14 @@ static bool create_context_x11_gl3(struct ra_ctx *ctx, GL *gl, int gl_version,
const char *glxstr =
glXQueryExtensionsString(vo->x11->display, vo->x11->screen);
- bool have_ctx_ext = glxstr && !!strstr(glxstr, "GLX_ARB_create_context");
+ if (!glxstr) {
+ MP_ERR(ctx, "GLX did not advertise any extensions\n");
+ return false;
+ }
- if (!(have_ctx_ext && glXCreateContextAttribsARB)) {
+ if (!strstr(glxstr, "GLX_ARB_create_context") ||
+ !glXCreateContextAttribsARB) {
+ MP_ERR(ctx, "GLX does not support GLX_ARB_create_context\n");
return false;
}
@@ -133,7 +103,7 @@ static bool create_context_x11_gl3(struct ra_ctx *ctx, GL *gl, int gl_version,
if (es) {
profile_mask = GLX_CONTEXT_ES2_PROFILE_BIT_EXT;
- if (!(glxstr && strstr(glxstr, "GLX_EXT_create_context_es2_profile")))
+ if (!strstr(glxstr, "GLX_EXT_create_context_es2_profile"))
return false;
}
@@ -316,11 +286,7 @@ static bool glx_init(struct ra_ctx *ctx)
int version = mpgl_min_required_gl_versions[n];
MP_VERBOSE(ctx, "Creating OpenGL %d.%d context...\n",
MPGL_VER_P(version));
- if (version >= 300) {
- success = create_context_x11_gl3(ctx, gl, version, false);
- } else {
- success = create_context_x11_old(ctx, gl);
- }
+ success = create_context_x11_gl3(ctx, gl, version, false);
if (success)
break;
}