From 5a7557fc6ff38f22f6b220296c16e1549cc2b932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 15 Oct 2008 13:41:53 +0000 Subject: [PATCH] Force OpenGL compositing to be off if OpenGL rendering is done in software (second X session with Intel). svn path=/trunk/KDE/kdebase/workspace/; revision=871752 --- compositingprefs.cpp | 28 ++++++++++++++++++++++++++++ compositingprefs.h | 2 ++ options.cpp | 3 +++ 3 files changed, 33 insertions(+) diff --git a/compositingprefs.cpp b/compositingprefs.cpp index 84bdaeca89..fe76dc8e7d 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -107,6 +107,28 @@ QString CompositingPrefs::compositingNotPossibleReason() #endif } +// This function checks selected compositing setup and returns false if it should not +// be used even if explicitly configured (unless checks are overriden). +// More checks like broken XRender setups etc. should be added here. +bool CompositingPrefs::validateSetup( CompositingType compositingType ) const + { + switch( compositingType ) + { + case NoCompositing: + return false; + case OpenGLCompositing: + if( mDriver == "software" ) + { + kDebug( 1212 ) << "Software GL renderer detected, forcing compositing off."; + return false; + } + return true; // allow + case XRenderCompositing: + return true; // xrender - always allow? + } + abort(); + } + void CompositingPrefs::detect() { if( !compositingPossible()) @@ -240,6 +262,12 @@ void CompositingPrefs::detectDriverAndVersion() mDriver = "radeon"; mVersion = Version( mGLRenderer.split(" ")[ 3 ] ); } + else if( mGLRenderer == "Software Rasterizer" ) + { + mDriver = "software"; + QStringList words = mGLVersion.split(" "); + mVersion = Version( words[ words.count() - 1 ] ); + } else { mDriver = "unknown"; diff --git a/compositingprefs.h b/compositingprefs.h index 73155a0ee9..c0722bb8a2 100644 --- a/compositingprefs.h +++ b/compositingprefs.h @@ -25,6 +25,7 @@ along with this program. If not, see . #include #include "kwinglutils.h" +#include "kwinglobals.h" namespace KWin @@ -52,6 +53,7 @@ public: static bool compositingPossible(); static QString compositingNotPossibleReason(); + bool validateSetup( CompositingType compositingType ) const; bool enableCompositing() const; bool enableVSync() const { return mEnableVSync; } bool enableDirectRendering() const { return mEnableDirectRendering; } diff --git a/options.cpp b/options.cpp index 867aee124f..c501c882e3 100644 --- a/options.cpp +++ b/options.cpp @@ -239,6 +239,9 @@ void Options::reloadCompositingSettings(const CompositingPrefs& prefs) unredirectFullscreen = config.readEntry( "UnredirectFullscreen", true ); animationSpeed = qBound( 0, config.readEntry( "AnimationSpeed", 3 ), 6 ); + + if( !disableCompositingChecks && !prefs.validateSetup( compositingMode )) + useCompositing = false; }