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; }