diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index f29cf0f67c..d87480e1e6 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -117,14 +117,16 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList connect(ui.animationSpeedCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); + connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(toogleSmoothScaleUi(int))); connect(ui.windowThumbnails, SIGNAL(activated(int)), this, SLOT(changed())); connect(ui.disableChecks, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.unredirectFullscreen , SIGNAL(toggled(bool)), this, SLOT(changed())); + connect(ui.glScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); + connect(ui.xrScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); + connect(ui.glMode, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); - connect(ui.glTextureFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); connect(ui.glDirect, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.glVSync, SIGNAL(toggled(bool)), this, SLOT(changed())); - connect(ui.xrenderSmoothScale, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.compositingStateButton, SIGNAL(clicked(bool)), kwinInterface, SLOT(toggleCompositing())); connect(kwinInterface, SIGNAL(compositingToggled(bool)), this, SLOT(setupCompositingState(bool))); @@ -415,6 +417,13 @@ void KWinCompositingConfig::setupCompositingState( bool active, bool enabled ) ui.compositingStateButton->setEnabled( enabled ); } +void KWinCompositingConfig::toogleSmoothScaleUi( int compositingType ) +{ + ui.glScaleFilter->setVisible( compositingType == OPENGL_INDEX ); + ui.xrScaleFilter->setVisible( compositingType == XRENDER_INDEX ); + ui.scaleMethodLabel->setBuddy( compositingType == XRENDER_INDEX ? ui.xrScaleFilter : ui.glScaleFilter ); +} + bool KWinCompositingConfig::effectEnabled( const QString& effect, const KConfigGroup& cfg ) const { KService::List services = KServiceTypeTrader::self()->query( @@ -446,13 +455,15 @@ void KWinCompositingConfig::loadAdvancedTab() ui.disableChecks->setChecked( config.readEntry( "DisableChecks", false )); ui.unredirectFullscreen->setChecked( config.readEntry( "UnredirectFullscreen", true )); + ui.xrScaleFilter->setCurrentIndex((int)config.readEntry("XRenderSmoothScale", false)); + ui.glScaleFilter->setCurrentIndex(config.readEntry("GLTextureFilter", 2)); + QString glMode = config.readEntry("GLMode", "TFP"); ui.glMode->setCurrentIndex((glMode == "TFP") ? 0 : ((glMode == "SHM") ? 1 : 2)); - ui.glTextureFilter->setCurrentIndex(config.readEntry("GLTextureFilter", 1)); ui.glDirect->setChecked(config.readEntry("GLDirect", mDefaultPrefs.enableDirectRendering())); ui.glVSync->setChecked(config.readEntry("GLVSync", mDefaultPrefs.enableVSync())); - ui.xrenderSmoothScale->setChecked(config.readEntry("XRenderSmoothScale", false)); + toogleSmoothScaleUi( ui.compositingType->currentIndex() ); } void KWinCompositingConfig::load() @@ -603,7 +614,8 @@ bool KWinCompositingConfig::saveAdvancedTab() advancedChanged = true; } else if( config.readEntry("HiddenPreviews", 5) != hps[ ui.windowThumbnails->currentIndex() ] - || config.readEntry("XRenderSmoothScale", false ) != ui.xrenderSmoothScale->isChecked() ) + || (int)config.readEntry("XRenderSmoothScale", false ) != ui.xrScaleFilter->currentIndex() + || config.readEntry("GLTextureFilter", 2 ) != ui.glScaleFilter->currentIndex()) advancedChanged = true; config.writeEntry("Backend", (ui.compositingType->currentIndex() == OPENGL_INDEX) ? "OpenGL" : "XRender"); @@ -611,12 +623,13 @@ bool KWinCompositingConfig::saveAdvancedTab() config.writeEntry("DisableChecks", ui.disableChecks->isChecked()); config.writeEntry( "UnredirectFullscreen", ui.unredirectFullscreen->isChecked() ); + config.writeEntry("XRenderSmoothScale", ui.xrScaleFilter->currentIndex() == 1); + config.writeEntry("GLTextureFilter", ui.glScaleFilter->currentIndex()); + config.writeEntry("GLMode", glModes[ui.glMode->currentIndex()]); - config.writeEntry("GLTextureFilter", ui.glTextureFilter->currentIndex()); config.writeEntry("GLDirect", ui.glDirect->isChecked()); config.writeEntry("GLVSync", ui.glVSync->isChecked()); - config.writeEntry("XRenderSmoothScale", ui.xrenderSmoothScale->isChecked()); return advancedChanged; } @@ -756,11 +769,11 @@ void KWinCompositingConfig::defaults() ui.windowThumbnails->setCurrentIndex( 1 ); ui.disableChecks->setChecked( false ); ui.unredirectFullscreen->setChecked( true ); + ui.xrScaleFilter->setCurrentIndex( 0 ); + ui.glScaleFilter->setCurrentIndex( 2 ); ui.glMode->setCurrentIndex( 0 ); - ui.glTextureFilter->setCurrentIndex( 1 ); ui.glDirect->setChecked( mDefaultPrefs.enableDirectRendering() ); ui.glVSync->setChecked( mDefaultPrefs.enableVSync() ); - ui.xrenderSmoothScale->setChecked( false ); } QString KWinCompositingConfig::quickHelp() const diff --git a/kcmkwin/kwincompositing/main.h b/kcmkwin/kwincompositing/main.h index 7536fb20ec..b48499b8fc 100644 --- a/kcmkwin/kwincompositing/main.h +++ b/kcmkwin/kwincompositing/main.h @@ -75,6 +75,9 @@ class KWinCompositingConfig : public KCModule void configChanged(bool reinitCompositing); void initEffectSelector(); void setupCompositingState( bool active, bool enabled = true ); + + private slots: + void toogleSmoothScaleUi( int compositingType ); private: bool effectEnabled( const QString& effect, const KConfigGroup& cfg ) const; diff --git a/kcmkwin/kwincompositing/main.ui b/kcmkwin/kwincompositing/main.ui index 91267e0458..5bb71f5dd5 100644 --- a/kcmkwin/kwincompositing/main.ui +++ b/kcmkwin/kwincompositing/main.ui @@ -6,8 +6,8 @@ 0 0 - 728 - 554 + 595 + 483 @@ -125,19 +125,6 @@ - - - - Effect for desktop switching: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - desktopSwitchingCombo - - - @@ -320,112 +307,227 @@ Advanced - - - - - - 0 - 0 - + + + + + + + + 1 + 0 + + + + Compositing type: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + compositingType + + + + + + + + 3 + 0 + + + + + OpenGL + + + + + XRender + + + + + + + + Disable functionality checks + + + + + + + + + General Options - - Compositing type: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - compositingType + + true + + + + + + 1 + 0 + + + + Keep window thumbnails: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + windowThumbnails + + + + + + + + 3 + 0 + + + + + Always (Breaks minimization) + + + + + Only for Shown Windows + + + + + Never + + + + + + + + + 1 + 0 + + + + Scale method: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + xrScaleFilter + + + + + + + 0 + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Segoe'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Crisp:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">XRenderSetPictureFilter(&quot;fast&quot;)</span> - Pretty fast on all GPUs but looks bricky</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Smooth:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">XRenderSetPictureFilter(&quot;good&quot;) </span>- linear blending.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Fast enough on newer nvidia GPUs and maybe others but also can be <span style=" text-decoration: underline;">very</span> slow, you'll have to try.</p></body></html> + + + 0 + + + + Crisp + + + + + Smooth (slower) + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Segoe'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Crisp:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">GL_NEAREST</span> - (very) fast on all GPUs but looks bricky</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Smooth:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-style:italic;">GL_LINEAR</span> - fast on most GPUs but a little blurry</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Accurate:</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Lanczos filter, requires shader support (glsl or arb).</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Might be slow on weaker GPUs and even cause various troubles with broken drivers. (From overbrightning to segfaults)</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Fall back to &quot;Smooth&quot; if you've problems</p></body></html> + + + 1 + + + + Crisp + + + + + Smooth + + + + + Accurate + + + + + + + + + + Suspend desktop effects for fullscreen windows + + + + - - - - - 1 - 0 - - - - - OpenGL - - - - - XRender - - - - - - - - - 0 - 0 - - - - Keep window thumbnails: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - windowThumbnails - - - - - - - - 1 - 0 - - - - - Always (Breaks minimization) - - - - - Only for Shown Windows - - - - - Never - - - - - - - - Enabling this option allows compositing to be activated even if some of the internal checks fail. Doing so may make the whole desktop unusable and its use is not recommened. Use only if KWin refuses to activate compositing on a system that should be capable of compositing. - - - - Disable functionality checks - - - - + OpenGL Options - + + true + + - 0 + 1 0 @@ -444,7 +546,7 @@ - 1 + 3 0 @@ -465,51 +567,7 @@ - - - - - 0 - 0 - - - - Texture filter: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - glTextureFilter - - - - - - - - 1 - 0 - - - - - Nearest (fastest) - - - - - Bilinear - - - - - Trilinear (best quality) - - - - - + Enable direct rendering @@ -519,7 +577,7 @@ - + Use VSync @@ -532,45 +590,19 @@ - - - - XRender Options - - - - - - Smooth scaling (slower) - - - - - - - - + + Qt::Vertical 20 - 0 + 40 - - - - Improves performance of fullscreen applications like games and video players. This option can cause flickering when another window is opened above the fullscreen window. - - - Suspend desktop effects for fullscreen windows - - - diff --git a/lanczosfilter.cpp b/lanczosfilter.cpp index ac665aa732..9cc3215cad 100644 --- a/lanczosfilter.cpp +++ b/lanczosfilter.cpp @@ -40,7 +40,7 @@ LanczosFilter::LanczosFilter( QObject* parent ) #ifdef KWIN_HAVE_OPENGL_COMPOSITING , m_offscreenTex( 0 ) , m_offscreenTarget( 0 ) - , m_shader( new LanczosShader( this ) ) + , m_shader( 0 ) #endif , m_inited( false) { @@ -60,8 +60,13 @@ void LanczosFilter::init() return; m_inited = true; #ifdef KWIN_HAVE_OPENGL_COMPOSITING - // check the blacklist + KSharedConfigPtr config = KSharedConfig::openConfig( "kwinrc" ); + + if ( config->group( "Compositing" ).readEntry( "GLTextureFilter", 2 ) != 2 ) + return; // disabled by config + + // check the blacklist KConfigGroup blacklist = config->group( "Blacklist" ).group( "Lanczos" ); if( effects->checkDriverBlacklist( blacklist ) ) { @@ -69,6 +74,7 @@ void LanczosFilter::init() return; } + m_shader = new LanczosShader( this ); if( !m_shader->init() ) { delete m_shader; diff --git a/options.cpp b/options.cpp index e4edd4ea44..4ec5e9316e 100644 --- a/options.cpp +++ b/options.cpp @@ -265,7 +265,7 @@ void Options::reloadCompositingSettings() glMode = GLFallback; glDirect = config.readEntry("GLDirect", prefs.enableDirectRendering() ); glVSync = config.readEntry("GLVSync", prefs.enableVSync() ); - glSmoothScale = qBound( -1, config.readEntry( "GLTextureFilter", -1 ), 2 ); + glSmoothScale = qBound( -1, config.readEntry( "GLTextureFilter", 2 ), 2 ); glStrictBinding = config.readEntry( "GLStrictBinding", prefs.strictBinding()); xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false ); diff --git a/scene_opengl.cpp b/scene_opengl.cpp index 3a2d574df7..dc0a2ed084 100644 --- a/scene_opengl.cpp +++ b/scene_opengl.cpp @@ -1427,18 +1427,7 @@ void SceneOpenGL::Window::performPaint( int mask, QRegion region, WindowPaintDat else filter = ImageFilterFast; if( filter == ImageFilterGood ) - { - // avoid unneeded mipmap generation by only using trilinear - // filtering when it actually makes a difference, that is with - // minification or changed vertices - if( options->glSmoothScale == 2 - && ( data.quads.smoothNeeded() || data.xScale < 1 || data.yScale < 1 )) - { - texture.setFilter( GL_LINEAR_MIPMAP_LINEAR ); - } - else - texture.setFilter( GL_LINEAR ); - } + texture.setFilter( GL_LINEAR ); else texture.setFilter( GL_NEAREST ); // do required transformations @@ -1604,18 +1593,7 @@ void SceneOpenGL::Window::paintDecoration( const QPixmap* decoration, TextureTyp else return; if( filter == ImageFilterGood ) - { - // avoid unneeded mipmap generation by only using trilinear - // filtering when it actually makes a difference, that is with - // minification or changed vertices - if( options->glSmoothScale == 2 - && ( data.quads.smoothNeeded() || data.xScale < 1 || data.yScale < 1 )) - { - decorationTexture->setFilter( GL_LINEAR_MIPMAP_LINEAR ); - } - else - decorationTexture->setFilter( GL_LINEAR ); - } + decorationTexture->setFilter( GL_LINEAR ); else decorationTexture->setFilter( GL_NEAREST ); decorationTexture->setWrapMode( GL_CLAMP_TO_EDGE );