[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/kwin
From:       Fredrik Höglund <fredrik () kde ! org>
Date:       2010-02-26 20:47:01
Message-ID: 1267217221.248718.980.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1096554 by fredrik:

- Add an external helper program that initializes GLX and checks if kwin can
  use direct rendering.
- Move the LIBGL_ALWAYS_INDIRECT code to CompositingPrefs::detect(), and use
  the external helper program to determine if the variable needs to be set.


 M  +1 -0      CMakeLists.txt  
 M  +17 -0     compositingprefs.cpp  
 M  +0 -4      main.cpp  
 A             opengltest (directory)  
 A             opengltest/CMakeLists.txt  
 A             opengltest/opengltest.cpp   [License: GPL (v2+)]


--- trunk/KDE/kdebase/workspace/kwin/CMakeLists.txt #1096553:1096554
@@ -112,6 +112,7 @@
 target_link_libraries(kdeinit_kwin ${KDE4_KDEUI_LIBS} ${KDE4_PLASMA_LIBS} \
${QT_QTXML_LIBRARY} kephal kdecorations kwineffects ${X11_LIBRARIES})  
 if(OPENGL_FOUND)
+  add_subdirectory(opengltest)
   target_link_libraries(kdeinit_kwin ${OPENGL_gl_LIBRARY})
   # -ldl used by OpenGL code
   find_library(DL_LIBRARY dl)
--- trunk/KDE/kdebase/workspace/kwin/compositingprefs.cpp #1096553:1096554
@@ -26,8 +26,11 @@
 #include <kxerrorhandler.h>
 #include <klocale.h>
 #include <kdeversion.h>
+#include <kstandarddirs.h>
 
+#include <qprocess.h>
 
+
 namespace KWin
 {
 
@@ -115,6 +118,20 @@
         }
 
 #ifdef KWIN_HAVE_OPENGL_COMPOSITING
+    // HACK: This is needed for AIGLX
+    if( qstrcmp( qgetenv( "KWIN_DIRECT_GL" ), "1" ) != 0 )
+        {
+        // Start an external helper program that initializes GLX and returns
+        // 0 if we can use direct rendering, and 1 otherwise.
+        // The reason we have to use an external program is that after GLX
+        // has been initialized, it's too late to set the LIBGL_ALWAYS_INDIRECT
+        // environment variable.
+        // Direct rendering is preferred, since not all OpenGL extensions are
+        // available with indirect rendering.
+        const QString opengl_test = KStandardDirs::findExe( "kwin_opengl_test" );
+        if ( QProcess::execute( opengl_test ) != 0 )
+            setenv( "LIBGL_ALWAYS_INDIRECT", "1", true );
+        }
     if( !Extensions::glxAvailable())
         {
         kDebug( 1212 ) << "No GLX available";
--- trunk/KDE/kdebase/workspace/kwin/main.cpp #1096553:1096554
@@ -496,10 +496,6 @@
     if( KDE_signal( SIGHUP, KWin::sighandler ) == SIG_IGN )
         KDE_signal( SIGHUP, SIG_IGN );
 
-    // HACK: This is needed for AIGLX
-    if( qstrcmp( qgetenv( "KWIN_DIRECT_GL" ), "1" ) != 0 )
-        setenv( "LIBGL_ALWAYS_INDIRECT","1", true );
-
     // HACK: this is needed to work around a Qt4.4.0RC1 bug (#157659)
     setenv( "QT_SLOW_TOPLEVEL_RESIZE", "1", true );
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic