[MPlayer-cvslog] r38175 - in trunk/libvo: gl_common.c vo_gl_tiled.c

ib subversion at mplayerhq.hu
Thu Feb 6 17:36:07 EET 2020


Author: ib
Date: Thu Feb  6 17:36:06 2020
New Revision: 38175

Log:
Fix passing visual information to OpenGL video output driver for X11.

Enabling the GUI and starting the plain MPlayer causes a segmentation fault.

Modified:
   trunk/libvo/gl_common.c
   trunk/libvo/vo_gl_tiled.c

Modified: trunk/libvo/gl_common.c
==============================================================================
--- trunk/libvo/gl_common.c	Tue Feb  4 20:21:39 2020	(r38174)
+++ trunk/libvo/gl_common.c	Thu Feb  6 17:36:06 2020	(r38175)
@@ -2769,13 +2769,6 @@ int mpglcontext_create_window(MPGLContex
 #endif
 #ifdef CONFIG_GL_X11
   if (ctx->type == GLTYPE_X11) {
-    XVisualInfo *vinfo = NULL;
-#ifdef CONFIG_GUI
-    int value;
-
-    if (glXGetConfig(mDisplay, gl_vinfo, GLX_USE_GL, &value) == 0 && value == True)
-      vinfo = gl_vinfo;
-#else
     int default_glx_attribs[] = {
       GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1,
       GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, (flags & VOFLAG_DEPTH) ? 1 : 0, None
@@ -2784,7 +2777,21 @@ int mpglcontext_create_window(MPGLContex
       GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1,
       GLX_DOUBLEBUFFER, GLX_STEREO, None
     };
+    XVisualInfo *vinfo = NULL;
+#ifdef CONFIG_GUI
+    int value;
+
+    if (gl_vinfo && glXGetConfig(mDisplay, gl_vinfo, GLX_USE_GL, &value) == 0 && value == True)
+      vinfo = gl_vinfo;
+#endif
     if (flags & VOFLAG_STEREO) {
+#ifdef CONFIG_GUI
+      if (vinfo) {
+        if (glXGetConfig(mDisplay, vinfo, GLX_STEREO, &value) != 0 || value == False)
+          vinfo = NULL;
+      }
+      else
+#endif
       vinfo = glXChooseVisual(mDisplay, mScreen, stereo_glx_attribs);
       if (!vinfo)
         mp_msg(MSGT_VO, MSGL_ERR, "[gl] Could not find a stereo visual, "
@@ -2792,7 +2799,6 @@ int mpglcontext_create_window(MPGLContex
     }
     if (!vinfo)
       vinfo = glXChooseVisual(mDisplay, mScreen, default_glx_attribs);
-#endif
     if (!vinfo) {
       mp_msg(MSGT_VO, MSGL_ERR, "[gl] no GLX support present\n");
       return -1;

Modified: trunk/libvo/vo_gl_tiled.c
==============================================================================
--- trunk/libvo/vo_gl_tiled.c	Tue Feb  4 20:21:39 2020	(r38174)
+++ trunk/libvo/vo_gl_tiled.c	Thu Feb  6 17:36:06 2020	(r38175)
@@ -458,17 +458,20 @@ static void draw_alpha(int x0,int y0, in
 #ifdef CONFIG_GL_X11
 static int choose_glx_visual(Display *dpy, int scr, XVisualInfo *res_vi)
 {
+  XVisualInfo template, *vi_list;
+  int vi_num, i, best_i, best_weight;
+
 #ifdef CONFIG_GUI
   int value;
 
-  if (glXGetConfig(mDisplay, gl_vinfo, GLX_USE_GL, &value) == 0 && value == True) {
-    *res_vi = *gl_vinfo;
-    return 0;
-  } else
-    return -1;
-#else
-  XVisualInfo template, *vi_list;
-  int vi_num, i, best_i, best_weight;
+  if (gl_vinfo) {
+    if (glXGetConfig(mDisplay, gl_vinfo, GLX_USE_GL, &value) == 0 && value == True) {
+      *res_vi = *gl_vinfo;
+      return 0;
+    } else
+      return -1;
+  }
+#endif
 
   template.screen = scr;
   vi_list = XGetVisualInfo(dpy, VisualScreenMask, &template, &vi_num);
@@ -519,7 +522,6 @@ static int choose_glx_visual(Display *dp
   if (best_weight < 1000000) *res_vi = vi_list[best_i];
   XFree(vi_list);
   return (best_weight < 1000000) ? 0 : -1;
-#endif
 }
 
 static int config_glx(uint32_t d_width, uint32_t d_height, uint32_t flags, char *title) {


More information about the MPlayer-cvslog mailing list