From c47bb9ca4272012cf53325a2df3047d8d2a32d2c Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 6 Feb 2014 14:33:30 +0100 Subject: gl_x11: don't require a X visual for modern GL context creation Legacy GL context creation (glXCreateContext) explicitly requires a X visual, while the modern one (glXCreateContextAttribsARB) does not for some reason. So fail only on the legacy code path if we don't find a visual. Note that vo_x11_config_vo_window() will select a default visual if a NULL visual is passed to it. --- video/out/gl_x11.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/video/out/gl_x11.c b/video/out/gl_x11.c index bada021136..c867c7e25b 100644 --- a/video/out/gl_x11.c +++ b/video/out/gl_x11.c @@ -44,6 +44,11 @@ static bool create_context_x11_old(struct MPGLContext *ctx) if (glx_ctx->context) return true; + if (!glx_ctx->vinfo) { + MP_FATAL(vo, "Can't create a legacy GLX context without X visual\n"); + return false; + } + GLXContext new_context = glXCreateContext(display, glx_ctx->vinfo, NULL, True); if (!new_context) { @@ -255,12 +260,13 @@ static bool config_window_x11(struct MPGLContext *ctx, uint32_t d_width, glx_ctx->fbc = fbc; glx_ctx->vinfo = glXGetVisualFromFBConfig(vo->x11->display, fbc); - if (!glx_ctx->vinfo) { - MP_ERR(vo, "Selected GLX FB config has no associated X visual\n"); - return false; + if (glx_ctx->vinfo) { + MP_VERBOSE(vo, "GLX chose visual with ID 0x%x\n", + (int)glx_ctx->vinfo->visualid); + } else { + MP_WARN(vo, "Selected GLX FB config has no associated X visual\n"); } - MP_VERBOSE(vo, "GLX chose visual with ID 0x%x\n", (int)glx_ctx->vinfo->visualid); glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_RED_SIZE, &ctx->depth_r); glXGetFBConfigAttrib(vo->x11->display, fbc, GLX_GREEN_SIZE, &ctx->depth_g); -- cgit v1.2.3