[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-12-03 21:13:44
Message-ID: 20101203211344.4E3B8AC8A4 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1203402 by fredrik:
Remove the driver detection code from CompositingPrefs, and use
the new GLPlatform class instead.
This change also enables loose binding with the R600 drivers
when DRI2 is being used.
M +8 -132 compositingprefs.cpp
M +0 -23 compositingprefs.h
M +3 -3 options.cpp
--- trunk/KDE/kdebase/workspace/kwin/compositingprefs.cpp #1203401:1203402
@@ -21,6 +21,7 @@
#include "compositingprefs.h"
#include "kwinglobals.h"
+#include "kwinglplatform.h"
#include <kdebug.h>
#include <kxerrorhandler.h>
@@ -226,72 +227,14 @@
void CompositingPrefs::detectDriverAndVersion()
{
#ifdef KWIN_HAVE_OPENGL_COMPOSITING
- mGLVendor = QString((const char*)glGetString( GL_VENDOR ));
- mGLRenderer = QString((const char*)glGetString( GL_RENDERER ));
- mGLVersion = QString((const char*)glGetString( GL_VERSION ));
+ GLPlatform *gl = GLPlatform::instance();
+ gl->detect();
+ gl->printResults();
+
mXgl = detectXgl();
- if( mGLRenderer.startsWith( "Mesa DRI Intel" ) || mGLRenderer.startsWith( "Mesa \
DRI Mobile Intel" )) // krazy:exclude=strings
- {
- mDriver = "intel";
- QStringList words = mGLRenderer.split(' ');
- if( QRegExp( "[:digit:]+" ).exactMatch( words[ words.count() - 2 ] ))
- mVersion = Version( words[ words.count() - 2 ] );
- else
- mVersion = Version( words[ words.count() - 3 ] );
- }
- else if( mGLVendor == "NVIDIA Corporation" )
- {
- mDriver = "nvidia";
- QStringList words = mGLVersion.split(' ');
- mVersion = Version( words[ words.count() - 1 ] );
- }
- else if( mGLVendor == "ATI Technologies Inc." )
- {
- mDriver = "fglrx";
- // Ati changed the version string.
- // The GL version is either in the first or second part
- QStringList versionParts = mGLVersion.split(' ');
- if( versionParts.first().count(".") == 2 || versionParts.count() == 1 )
- mVersion = Version( versionParts.first() );
- else
- {
- // version in second part is encapsulated in ()
- mVersion = Version( versionParts[1].mid( 1, versionParts[1].length() -2 \
) );
- }
- }
- else if( mGLRenderer.startsWith( "Mesa DRI R" )) // krazy:exclude=strings
- {
- mDriver = "radeon";
- mVersion = Version( mGLRenderer.split(' ')[ 3 ] );
- // Check that the version string is changed, and try the fifth element if it \
does
- if (!mVersion.startsWith("20"))
- mVersion = Version( mGLRenderer.split(' ')[ 5 ] );
- }
- else if( mGLVendor == "nouveau" )
- {
- mDriver = "nouveau";
- // use Gallium version number as the version - second part of renderer
- mVersion = Version( mGLRenderer.split(' ')[ 1 ] );
- }
- else if( mGLRenderer == "Software Rasterizer" )
- {
- mDriver = "software";
- QStringList words = mGLVersion.split(' ');
- mVersion = Version( words[ words.count() - 1 ] );
- }
- else
- {
- mDriver = "unknown";
- }
-
- // Always output as it's VERY useful
- kWarning( 1212 ) << "GL vendor is" << mGLVendor;
- kWarning( 1212 ) << "GL renderer is" << mGLRenderer;
- kWarning( 1212 ) << "GL version is" << mGLVersion;
if( mXgl )
kWarning( 1212 ) << "Using XGL";
- kWarning( 1212 ) << "Detected driver" << mDriver << ", version" << \
mVersion.join("."); #endif
}
@@ -301,29 +244,11 @@
// Always recommend
mRecommendCompositing = true;
- // Known driver specific options
- if( mXgl )
- {
- mStrictBinding = false;
- }
- else if( mDriver == "intel" )
- {
+ GLPlatform *gl = GLPlatform::instance();
+ mStrictBinding = !gl->supports( LooseBinding );
+ if ( gl->driver() == Driver_Intel )
mEnableVSync = false;
}
- else if( mDriver == "nvidia" )
- {
- mStrictBinding = false;
- }
- //else if( mDriver == "fglrx" )
- // {
- // }
- //else if( mDriver == "radeon" )
- // {
- // }
- //else if( mDriver == "software" )
- // {
- // }
- }
bool CompositingPrefs::detectXgl()
@@ -331,54 +256,5 @@
return VendorRelease(display()) == 70000001;
}
-CompositingPrefs::Version::Version( const QString& str ) :
- QStringList()
- {
- QRegExp numrx( "(\\d+)|(\\D+)" );
- int pos = 0;
- while(( pos = numrx.indexIn( str, pos )) != -1 )
- {
- pos += numrx.matchedLength();
-
- QString part = numrx.cap();
- if( part == "." )
- continue;
-
- append( part );
- }
- }
-
-int CompositingPrefs::Version::compare( const Version& v ) const
- {
- for( int i = 0; i < qMin( count(), v.count() ); i++ )
- {
- if( at( i )[ 0 ].isDigit() )
- {
- // This part of version string is numeric - compare numbers
- int num = at( i ).toInt();
- int vnum = v.at( i ).toInt();
- if( num > vnum )
- return 1;
- else if( num < vnum )
- return -1;
- }
- else
- {
- // This part is string
- if( at( i ) > v.at( i ))
- return 1;
- else if( at( i ) < v.at( i ))
- return -1;
- }
- }
-
- if( count() > v.count() )
- return 1;
- else if( count() < v.count() )
- return -1;
- else
- return 0;
- }
-
} // namespace
--- trunk/KDE/kdebase/workspace/kwin/compositingprefs.h #1203401:1203402
@@ -37,20 +37,6 @@
CompositingPrefs();
~CompositingPrefs();
- class Version : public QStringList
- {
- public:
- Version() : QStringList() {}
- Version( const QString& str );
-
- int compare( const Version& v ) const;
-
- bool operator<( const Version& v ) const { return ( compare( v ) == -1 ); }
- bool operator<=( const Version& v ) const { return ( compare( v ) != 1 ); }
- bool operator>( const Version& v ) const { return ( compare( v ) == 1 ); }
- bool operator>=( const Version& v ) const { return ( compare( v ) != -1 ); \
}
- };
-
static bool compositingPossible();
static QString compositingNotPossibleReason();
bool recommendCompositing() const;
@@ -60,15 +46,11 @@
void detect();
- QString driver() const { return mDriver; }
- Version version() const { return mVersion; }
bool xgl() const { return mXgl; }
-
protected:
void detectDriverAndVersion();
- void parseMesaVersion( const QString &version, int *major, int *minor );
void applyDriverSpecificOptions();
static bool detectXgl();
@@ -77,11 +59,6 @@
private:
- QString mGLVendor;
- QString mGLRenderer;
- QString mGLVersion;
- QString mDriver;
- Version mVersion;
bool mXgl;
bool mRecommendCompositing;
--- trunk/KDE/kdebase/workspace/kwin/options.cpp #1203401:1203402
@@ -36,6 +36,7 @@
#include "client.h"
#include "compositingprefs.h"
+#include "lib/kwinglplatform.h"
#include <kephal/screens.h>
@@ -51,13 +52,12 @@
#ifndef KCMRULES
-static bool rrNvidia = false;
int currentRefreshRate()
{
int rate = -1;
if( options->refreshRate > 0 ) // use manually configured refresh rate
rate = options->refreshRate;
- else if ( rrNvidia )
+ else if ( GLPlatform::instance()->driver() == Driver_NVidia )
{
QProcess nvidia_settings;
nvidia_settings.start( "nvidia-settings", QStringList() << "-t" << "-q" << \
"RefreshRate", QIODevice::ReadOnly ); @@ -295,7 +295,7 @@
// Compositing settings
CompositingPrefs prefs;
prefs.detect();
- rrNvidia = prefs.driver() == "nvidia";
+
useCompositing = config.readEntry( "Enabled" , prefs.recommendCompositing());
QString compositingBackend = config.readEntry("Backend", "OpenGL");
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic