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
This commit is contained in:
Luboš Luňák 2008-10-15 13:41:53 +00:00
parent fc3eb0d25c
commit 5a7557fc6f
3 changed files with 33 additions and 0 deletions

View file

@ -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";

View file

@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <QStringList>
#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; }

View file

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