Detect xgl and whether to use strict binding.
svn path=/trunk/KDE/kdebase/workspace/; revision=726357
This commit is contained in:
parent
6daf4d3ec8
commit
fef0d1ff29
3 changed files with 33 additions and 11 deletions
|
@ -20,11 +20,14 @@ namespace KWin
|
||||||
{
|
{
|
||||||
|
|
||||||
CompositingPrefs::CompositingPrefs()
|
CompositingPrefs::CompositingPrefs()
|
||||||
|
: mXgl( false )
|
||||||
|
, mEnableCompositing( false )
|
||||||
|
, mEnableVSync( true )
|
||||||
|
, mEnableDirectRendering( true )
|
||||||
|
, mStrictBinding( true )
|
||||||
{
|
{
|
||||||
mEnableCompositing = false;
|
|
||||||
mEnableVSync = true;
|
|
||||||
mEnableDirectRendering = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CompositingPrefs::~CompositingPrefs()
|
CompositingPrefs::~CompositingPrefs()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -163,26 +166,28 @@ void CompositingPrefs::detectDriverAndVersion()
|
||||||
mGLVendor = QString((const char*)glGetString( GL_VENDOR ));
|
mGLVendor = QString((const char*)glGetString( GL_VENDOR ));
|
||||||
mGLRenderer = QString((const char*)glGetString( GL_RENDERER ));
|
mGLRenderer = QString((const char*)glGetString( GL_RENDERER ));
|
||||||
mGLVersion = QString((const char*)glGetString( GL_VERSION ));
|
mGLVersion = QString((const char*)glGetString( GL_VERSION ));
|
||||||
|
mXgl = detectXgl();
|
||||||
kDebug() << "GL vendor is" << mGLVendor;
|
kDebug() << "GL vendor is" << mGLVendor;
|
||||||
kDebug() << "GL renderer is" << mGLRenderer;
|
kDebug() << "GL renderer is" << mGLRenderer;
|
||||||
kDebug() << "GL version is" << mGLVersion;
|
kDebug() << "GL version is" << mGLVersion;
|
||||||
|
kDebug() << "XGL:" << ( mXgl ? "yes" : "no" );
|
||||||
|
|
||||||
if( mGLRenderer.contains( "Intel" ))
|
if( mGLRenderer.contains( "Intel" ))
|
||||||
{
|
{
|
||||||
mDriver = "intel";
|
mDriver = "intel";
|
||||||
QStringList words = mGLRenderer.split(" ");
|
QStringList words = mGLRenderer.split(" ");
|
||||||
mVersion = Version( words[ words.count() - 2 ] );
|
mVersion = Version( words[ words.count() - 2 ] );
|
||||||
}
|
}
|
||||||
else if( mGLVendor.contains( "NVIDIA" ))
|
else if( mGLVendor.contains( "NVIDIA" ))
|
||||||
{
|
{
|
||||||
mDriver = "nvidia";
|
mDriver = "nvidia";
|
||||||
QStringList words = mGLVersion.split(" ");
|
QStringList words = mGLVersion.split(" ");
|
||||||
mVersion = Version( words[ words.count() - 1 ] );
|
mVersion = Version( words[ words.count() - 1 ] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mDriver = "unknown";
|
mDriver = "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
kDebug() << "Detected driver" << mDriver << ", version" << mVersion.join(".");
|
kDebug() << "Detected driver" << mDriver << ", version" << mVersion.join(".");
|
||||||
#endif
|
#endif
|
||||||
|
@ -190,7 +195,13 @@ void CompositingPrefs::detectDriverAndVersion()
|
||||||
|
|
||||||
void CompositingPrefs::applyDriverSpecificOptions()
|
void CompositingPrefs::applyDriverSpecificOptions()
|
||||||
{
|
{
|
||||||
if( mDriver == "intel")
|
if( mXgl )
|
||||||
|
{
|
||||||
|
kDebug() << "xgl, enabling";
|
||||||
|
mEnableCompositing = true;
|
||||||
|
mStrictBinding = false;
|
||||||
|
}
|
||||||
|
else if( mDriver == "intel")
|
||||||
{
|
{
|
||||||
kDebug() << "intel driver, disabling vsync, enabling direct";
|
kDebug() << "intel driver, disabling vsync, enabling direct";
|
||||||
mEnableVSync = false;
|
mEnableVSync = false;
|
||||||
|
@ -205,6 +216,7 @@ void CompositingPrefs::applyDriverSpecificOptions()
|
||||||
{
|
{
|
||||||
kDebug() << "nvidia driver, disabling vsync";
|
kDebug() << "nvidia driver, disabling vsync";
|
||||||
mEnableVSync = false;
|
mEnableVSync = false;
|
||||||
|
mStrictBinding = false;
|
||||||
if( mVersion >= Version( "96.39" ))
|
if( mVersion >= Version( "96.39" ))
|
||||||
{
|
{
|
||||||
kDebug() << "nvidia >= 96.39, enabling compositing";
|
kDebug() << "nvidia >= 96.39, enabling compositing";
|
||||||
|
@ -214,6 +226,11 @@ void CompositingPrefs::applyDriverSpecificOptions()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool CompositingPrefs::detectXgl()
|
||||||
|
{ // Xgl apparently uses only this specific X version
|
||||||
|
return VendorRelease(display()) == 70000001;
|
||||||
|
}
|
||||||
|
|
||||||
CompositingPrefs::Version::Version( const QString& str ) :
|
CompositingPrefs::Version::Version( const QString& str ) :
|
||||||
QStringList()
|
QStringList()
|
||||||
{
|
{
|
||||||
|
|
|
@ -44,17 +44,20 @@ public:
|
||||||
bool enableCompositing() const { return mEnableCompositing; }
|
bool enableCompositing() const { return mEnableCompositing; }
|
||||||
bool enableVSync() const { return mEnableVSync; }
|
bool enableVSync() const { return mEnableVSync; }
|
||||||
bool enableDirectRendering() const { return mEnableDirectRendering; }
|
bool enableDirectRendering() const { return mEnableDirectRendering; }
|
||||||
|
bool strictBinding() const { return mStrictBinding; }
|
||||||
|
|
||||||
void detect();
|
void detect();
|
||||||
|
|
||||||
QString driver() const { return mDriver; }
|
QString driver() const { return mDriver; }
|
||||||
Version version() const { return mVersion; }
|
Version version() const { return mVersion; }
|
||||||
|
bool xgl() const { return mXgl; }
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void detectDriverAndVersion();
|
void detectDriverAndVersion();
|
||||||
void applyDriverSpecificOptions();
|
void applyDriverSpecificOptions();
|
||||||
|
static bool detectXgl();
|
||||||
|
|
||||||
bool createGLXContext();
|
bool createGLXContext();
|
||||||
void deleteGLXContext();
|
void deleteGLXContext();
|
||||||
|
@ -66,10 +69,12 @@ private:
|
||||||
QString mGLVersion;
|
QString mGLVersion;
|
||||||
QString mDriver;
|
QString mDriver;
|
||||||
Version mVersion;
|
Version mVersion;
|
||||||
|
bool mXgl;
|
||||||
|
|
||||||
bool mEnableCompositing;
|
bool mEnableCompositing;
|
||||||
bool mEnableVSync;
|
bool mEnableVSync;
|
||||||
bool mEnableDirectRendering;
|
bool mEnableDirectRendering;
|
||||||
|
bool mStrictBinding;
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
GLXContext mGLContext;
|
GLXContext mGLContext;
|
||||||
|
|
|
@ -180,7 +180,6 @@ unsigned long Options::updateSettings()
|
||||||
|
|
||||||
config.changeGroup("Translucency");
|
config.changeGroup("Translucency");
|
||||||
refreshRate = config.readEntry( "RefreshRate", 0 );
|
refreshRate = config.readEntry( "RefreshRate", 0 );
|
||||||
glStrictBinding = config.readEntry( "GLStrictBinding", false );
|
|
||||||
const HiddenPreviews hps[] = { HiddenPreviewsNever, HiddenPreviewsKeep, HiddenPreviewUpdate, HiddenPreviewsActive };
|
const HiddenPreviews hps[] = { HiddenPreviewsNever, HiddenPreviewsKeep, HiddenPreviewUpdate, HiddenPreviewsActive };
|
||||||
hiddenPreviews = hps[ qBound( 0, config.readEntry( "HiddenPreviews", 3 ), 3 ) ];
|
hiddenPreviews = hps[ qBound( 0, config.readEntry( "HiddenPreviews", 3 ), 3 ) ];
|
||||||
|
|
||||||
|
@ -231,6 +230,7 @@ void Options::reloadCompositingSettings(const CompositingPrefs& prefs)
|
||||||
glDirect = config.readEntry("GLDirect", prefs.enableDirectRendering() );
|
glDirect = config.readEntry("GLDirect", prefs.enableDirectRendering() );
|
||||||
glVSync = config.readEntry("GLVSync", prefs.enableVSync() );
|
glVSync = config.readEntry("GLVSync", prefs.enableVSync() );
|
||||||
smoothScale = qBound( -1, config.readEntry( "GLTextureFilter", -1 ), 2 );
|
smoothScale = qBound( -1, config.readEntry( "GLTextureFilter", -1 ), 2 );
|
||||||
|
glStrictBinding = config.readEntry( "GLStrictBinding", prefs.strictBinding());
|
||||||
|
|
||||||
xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false );
|
xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue