]> git.sesse.net Git - vlc/commitdiff
glx: fixed startup crash, which seems to be triggered by an x.org optimization, the...
authorDamien Fouilleul <damienf@videolan.org>
Sun, 19 Aug 2007 20:48:38 +0000 (20:48 +0000)
committerDamien Fouilleul <damienf@videolan.org>
Sun, 19 Aug 2007 20:48:38 +0000 (20:48 +0000)
modules/video_output/x11/glx.c
modules/video_output/x11/xcommon.c

index 982881eb00b2f6e8ecf0f39022300bee5949e267..2e074c5ff3be88f6abaec480de02d34fa006d165 100644 (file)
@@ -76,7 +76,6 @@ static void SwapBuffers  ( vout_thread_t * );
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  CheckGLX     ( vlc_object_t *, vlc_bool_t * );
 static int  InitGLX12    ( vout_thread_t * );
 static int  InitGLX13    ( vout_thread_t * );
 static void SwitchContext( vout_thread_t * );
@@ -136,13 +135,6 @@ extern void E_(Deactivate) ( vlc_object_t * );
 static int CreateOpenGL( vlc_object_t *p_this )
 {
     vout_thread_t *p_vout = (vout_thread_t *)p_this;
-    vlc_bool_t b_glx13;
-
-    if( CheckGLX( p_this, &b_glx13 ) != VLC_SUCCESS )
-    {
-        msg_Err( p_vout, "no GLX support" );
-        return VLC_EGENERIC;
-    }
 
     if( E_(Activate)( p_this ) != VLC_SUCCESS )
     {
@@ -152,7 +144,6 @@ static int CreateOpenGL( vlc_object_t *p_this )
     /* Set the function pointer */
     p_vout->pf_init = InitOpenGL;
     p_vout->pf_swap = SwapBuffers;
-    p_vout->p_sys->b_glx13 = b_glx13;
 
     return VLC_SUCCESS;
 }
@@ -174,59 +165,6 @@ static void DestroyOpenGL( vlc_object_t *p_this )
     E_(Deactivate)( p_this );
 }
 
-/*****************************************************************************
- * OpenDisplay: open and initialize OpenGL device
- *****************************************************************************/
-static int CheckGLX( vlc_object_t *p_this, vlc_bool_t *b_glx13 )
-{
-    Display *p_display = NULL;
-    int i_opcode, i_evt, i_err = 0;
-    int i_maj, i_min = 0;
-
-    /* Open the display */
-    p_display = XOpenDisplay( NULL );
-    if( p_display == NULL )
-    {
-        msg_Err( p_this, "cannot open display" );
-        return VLC_EGENERIC;
-    }
-
-    /* Check for GLX extension */
-    if( !XQueryExtension( p_display, "GLX", &i_opcode, &i_evt, &i_err ) )
-    {
-        msg_Err( p_this, "GLX extension not supported" );
-        XCloseDisplay( p_display );
-        return VLC_EGENERIC;
-    }
-    if( !glXQueryExtension( p_display, &i_err, &i_evt ) )
-    {
-        msg_Err( p_this, "glXQueryExtension failed" );
-        XCloseDisplay( p_display );
-        return VLC_EGENERIC;
-    }
-
-    /* Check GLX version */
-    if (!glXQueryVersion( p_display, &i_maj, &i_min ) )
-    {
-        msg_Err( p_this, "glXQueryVersion failed" );
-        XCloseDisplay( p_display );
-        return VLC_EGENERIC;
-    }
-    if( i_maj <= 0 || ((i_maj == 1) && (i_min < 3)) )
-    {
-        *b_glx13 = VLC_FALSE;
-        msg_Dbg( p_this, "using GLX 1.2 API" );
-    }
-    else
-    {
-        *b_glx13 = VLC_TRUE;
-        msg_Dbg( p_this, "using GLX 1.3 API" );
-    }
-
-    XCloseDisplay( p_display );
-    return VLC_SUCCESS;
-}
-
 /*****************************************************************************
  * InitOpenGL: initializes OpenGL provider
  *****************************************************************************/
index 094c4344343944941d2d5c27350c7f41dac3ada3..c3027b52fbb2e4892db251ffd881fbd626092e0e 100644 (file)
@@ -290,6 +290,47 @@ int E_(Activate) ( vlc_object_t *p_this )
         }
     }
     p_vout->output.i_chroma = X112VLC_FOURCC(p_vout->output.i_chroma);
+#elif defined(MODULE_NAME_IS_glx)
+    {
+        int i_opcode, i_evt, i_err = 0;
+        int i_maj, i_min = 0;
+
+        /* Check for GLX extension */
+        if( !XQueryExtension( p_vout->p_sys->p_display, "GLX",
+                              &i_opcode, &i_evt, &i_err ) )
+        {
+            msg_Err( p_this, "GLX extension not supported" );
+            XCloseDisplay( p_vout->p_sys->p_display );
+            free( p_vout->p_sys );
+            return VLC_EGENERIC;
+        }
+        if( !glXQueryExtension( p_vout->p_sys->p_display, &i_err, &i_evt ) )
+        {
+            msg_Err( p_this, "glXQueryExtension failed" );
+            XCloseDisplay( p_vout->p_sys->p_display );
+            free( p_vout->p_sys );
+            return VLC_EGENERIC;
+        }
+
+        /* Check GLX version */
+        if (!glXQueryVersion( p_vout->p_sys->p_display, &i_maj, &i_min ) )
+        {
+            msg_Err( p_this, "glXQueryVersion failed" );
+            XCloseDisplay( p_vout->p_sys->p_display );
+            free( p_vout->p_sys );
+            return VLC_EGENERIC;
+        }
+        if( i_maj <= 0 || ((i_maj == 1) && (i_min < 3)) )
+        {
+            p_vout->p_sys->b_glx13 = VLC_FALSE;
+            msg_Dbg( p_this, "using GLX 1.2 API" );
+        }
+        else
+        {
+            p_vout->p_sys->b_glx13 = VLC_TRUE;
+            msg_Dbg( p_this, "using GLX 1.3 API" );
+        }
+    }
 #endif
 
     /* Create blank cursor (for mouse cursor autohiding) */