kick trilinear filtering if favor of the lanczos filter (now default, unless blacklisted)

make the scale method configurable and align the UI for GL and Xrender

CCBUG: 243181


svn path=/trunk/KDE/kdebase/workspace/; revision=1195698
This commit is contained in:
Thomas Lübking 2010-11-11 19:53:19 +00:00
parent 24a0e94397
commit 029f93127f
6 changed files with 253 additions and 221 deletions

View file

@ -117,14 +117,16 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
connect(ui.animationSpeedCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(changed())); 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(changed()));
connect(ui.compositingType, SIGNAL(currentIndexChanged(int)), this, SLOT(toogleSmoothScaleUi(int)));
connect(ui.windowThumbnails, SIGNAL(activated(int)), this, SLOT(changed())); connect(ui.windowThumbnails, SIGNAL(activated(int)), this, SLOT(changed()));
connect(ui.disableChecks, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.disableChecks, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.unredirectFullscreen , 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.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.glDirect, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.glVSync, 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(ui.compositingStateButton, SIGNAL(clicked(bool)), kwinInterface, SLOT(toggleCompositing()));
connect(kwinInterface, SIGNAL(compositingToggled(bool)), this, SLOT(setupCompositingState(bool))); connect(kwinInterface, SIGNAL(compositingToggled(bool)), this, SLOT(setupCompositingState(bool)));
@ -415,6 +417,13 @@ void KWinCompositingConfig::setupCompositingState( bool active, bool enabled )
ui.compositingStateButton->setEnabled( 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 bool KWinCompositingConfig::effectEnabled( const QString& effect, const KConfigGroup& cfg ) const
{ {
KService::List services = KServiceTypeTrader::self()->query( KService::List services = KServiceTypeTrader::self()->query(
@ -446,13 +455,15 @@ void KWinCompositingConfig::loadAdvancedTab()
ui.disableChecks->setChecked( config.readEntry( "DisableChecks", false )); ui.disableChecks->setChecked( config.readEntry( "DisableChecks", false ));
ui.unredirectFullscreen->setChecked( config.readEntry( "UnredirectFullscreen", true )); 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"); QString glMode = config.readEntry("GLMode", "TFP");
ui.glMode->setCurrentIndex((glMode == "TFP") ? 0 : ((glMode == "SHM") ? 1 : 2)); 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.glDirect->setChecked(config.readEntry("GLDirect", mDefaultPrefs.enableDirectRendering()));
ui.glVSync->setChecked(config.readEntry("GLVSync", mDefaultPrefs.enableVSync())); ui.glVSync->setChecked(config.readEntry("GLVSync", mDefaultPrefs.enableVSync()));
ui.xrenderSmoothScale->setChecked(config.readEntry("XRenderSmoothScale", false)); toogleSmoothScaleUi( ui.compositingType->currentIndex() );
} }
void KWinCompositingConfig::load() void KWinCompositingConfig::load()
@ -603,7 +614,8 @@ bool KWinCompositingConfig::saveAdvancedTab()
advancedChanged = true; advancedChanged = true;
} }
else if( config.readEntry("HiddenPreviews", 5) != hps[ ui.windowThumbnails->currentIndex() ] 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; advancedChanged = true;
config.writeEntry("Backend", (ui.compositingType->currentIndex() == OPENGL_INDEX) ? "OpenGL" : "XRender"); 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("DisableChecks", ui.disableChecks->isChecked());
config.writeEntry( "UnredirectFullscreen", ui.unredirectFullscreen->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("GLMode", glModes[ui.glMode->currentIndex()]);
config.writeEntry("GLTextureFilter", ui.glTextureFilter->currentIndex());
config.writeEntry("GLDirect", ui.glDirect->isChecked()); config.writeEntry("GLDirect", ui.glDirect->isChecked());
config.writeEntry("GLVSync", ui.glVSync->isChecked()); config.writeEntry("GLVSync", ui.glVSync->isChecked());
config.writeEntry("XRenderSmoothScale", ui.xrenderSmoothScale->isChecked());
return advancedChanged; return advancedChanged;
} }
@ -756,11 +769,11 @@ void KWinCompositingConfig::defaults()
ui.windowThumbnails->setCurrentIndex( 1 ); ui.windowThumbnails->setCurrentIndex( 1 );
ui.disableChecks->setChecked( false ); ui.disableChecks->setChecked( false );
ui.unredirectFullscreen->setChecked( true ); ui.unredirectFullscreen->setChecked( true );
ui.xrScaleFilter->setCurrentIndex( 0 );
ui.glScaleFilter->setCurrentIndex( 2 );
ui.glMode->setCurrentIndex( 0 ); ui.glMode->setCurrentIndex( 0 );
ui.glTextureFilter->setCurrentIndex( 1 );
ui.glDirect->setChecked( mDefaultPrefs.enableDirectRendering() ); ui.glDirect->setChecked( mDefaultPrefs.enableDirectRendering() );
ui.glVSync->setChecked( mDefaultPrefs.enableVSync() ); ui.glVSync->setChecked( mDefaultPrefs.enableVSync() );
ui.xrenderSmoothScale->setChecked( false );
} }
QString KWinCompositingConfig::quickHelp() const QString KWinCompositingConfig::quickHelp() const

View file

@ -75,6 +75,9 @@ class KWinCompositingConfig : public KCModule
void configChanged(bool reinitCompositing); void configChanged(bool reinitCompositing);
void initEffectSelector(); void initEffectSelector();
void setupCompositingState( bool active, bool enabled = true ); void setupCompositingState( bool active, bool enabled = true );
private slots:
void toogleSmoothScaleUi( int compositingType );
private: private:
bool effectEnabled( const QString& effect, const KConfigGroup& cfg ) const; bool effectEnabled( const QString& effect, const KConfigGroup& cfg ) const;

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>728</width> <width>595</width>
<height>554</height> <height>483</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
@ -125,19 +125,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Effect for desktop switching:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>desktopSwitchingCombo</cstring>
</property>
</widget>
</item>
<item row="5" column="1"> <item row="5" column="1">
<widget class="KComboBox" name="desktopSwitchingCombo"> <widget class="KComboBox" name="desktopSwitchingCombo">
<property name="sizePolicy"> <property name="sizePolicy">
@ -320,112 +307,227 @@
<attribute name="title"> <attribute name="title">
<string>Advanced</string> <string>Advanced</string>
</attribute> </attribute>
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item row="0" column="0"> <item>
<widget class="QLabel" name="label_7"> <layout class="QGridLayout" name="gridLayout_5">
<property name="sizePolicy"> <item row="0" column="0">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <widget class="QLabel" name="label_7">
<horstretch>0</horstretch> <property name="sizePolicy">
<verstretch>0</verstretch> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
</sizepolicy> <horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Compositing type:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>compositingType</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="compositingType">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>OpenGL</string>
</property>
</item>
<item>
<property name="text">
<string>XRender</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="disableChecks">
<property name="text">
<string>Disable functionality checks</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
<string>General Options</string>
</property> </property>
<property name="text"> <property name="flat">
<string>Compositing type:</string> <bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>compositingType</cstring>
</property> </property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Keep window thumbnails:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>windowThumbnails</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="windowThumbnails">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>3</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Always (Breaks minimization)</string>
</property>
</item>
<item>
<property name="text">
<string>Only for Shown Windows</string>
</property>
</item>
<item>
<property name="text">
<string>Never</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="scaleMethodLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Scale method:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>xrScaleFilter</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QComboBox" name="xrScaleFilter">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Segoe'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crisp:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;XRenderSetPictureFilter(&amp;quot;fast&amp;quot;)&lt;/span&gt; - Pretty fast on all GPUs but looks bricky&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Smooth:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;XRenderSetPictureFilter(&amp;quot;good&amp;quot;) &lt;/span&gt;- linear blending.&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Fast enough on newer nvidia GPUs and maybe others but also can be &lt;span style=&quot; text-decoration: underline;&quot;&gt;very&lt;/span&gt; slow, you'll have to try.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<item>
<property name="text">
<string>Crisp</string>
</property>
</item>
<item>
<property name="text">
<string>Smooth (slower)</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="glScaleFilter">
<property name="toolTip">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Segoe'; font-size:8pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Crisp:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;GL_NEAREST&lt;/span&gt; - (very) fast on all GPUs but looks bricky&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Smooth:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-style:italic;&quot;&gt;GL_LINEAR&lt;/span&gt; - fast on most GPUs but a little blurry&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Accurate:&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Lanczos filter, requires shader support (glsl or arb).&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Might be slow on weaker GPUs and even cause various troubles with broken drivers. (From overbrightning to segfaults)&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Fall back to &amp;quot;Smooth&amp;quot; if you've problems&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Crisp</string>
</property>
</item>
<item>
<property name="text">
<string>Smooth</string>
</property>
</item>
<item>
<property name="text">
<string>Accurate</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="unredirectFullscreen">
<property name="text">
<string>Suspend desktop effects for fullscreen windows</string>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item>
<widget class="KComboBox" name="compositingType">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>OpenGL</string>
</property>
</item>
<item>
<property name="text">
<string>XRender</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Keep window thumbnails:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>windowThumbnails</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="windowThumbnails">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Always (Breaks minimization)</string>
</property>
</item>
<item>
<property name="text">
<string>Only for Shown Windows</string>
</property>
</item>
<item>
<property name="text">
<string>Never</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="disableChecks">
<property name="whatsThis">
<string>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.
</string>
</property>
<property name="text">
<string>Disable functionality checks</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QGroupBox" name="glGroup"> <widget class="QGroupBox" name="glGroup">
<property name="title"> <property name="title">
<string>OpenGL Options</string> <string>OpenGL Options</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5"> <property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_9"> <widget class="QLabel" name="label_9">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>1</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
@ -444,7 +546,7 @@
<widget class="KComboBox" name="glMode"> <widget class="KComboBox" name="glMode">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed"> <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch> <horstretch>3</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
@ -465,51 +567,7 @@
</item> </item>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Texture filter:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>glTextureFilter</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="glTextureFilter">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Nearest (fastest)</string>
</property>
</item>
<item>
<property name="text">
<string>Bilinear</string>
</property>
</item>
<item>
<property name="text">
<string>Trilinear (best quality)</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="glDirect"> <widget class="QCheckBox" name="glDirect">
<property name="text"> <property name="text">
<string>Enable direct rendering</string> <string>Enable direct rendering</string>
@ -519,7 +577,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="glVSync"> <widget class="QCheckBox" name="glVSync">
<property name="text"> <property name="text">
<string>Use VSync</string> <string>Use VSync</string>
@ -532,45 +590,19 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="5" column="0" colspan="2"> <item>
<widget class="QGroupBox" name="xrenderGroup"> <spacer name="verticalSpacer_3">
<property name="title">
<string>XRender Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QCheckBox" name="xrenderSmoothScale">
<property name="text">
<string>Smooth scaling (slower)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="0" colspan="2">
<spacer name="verticalSpacer_6">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>0</height> <height>40</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="unredirectFullscreen">
<property name="toolTip">
<string>Improves performance of fullscreen applications like games and video players. This option can cause flickering when another window is opened above the fullscreen window.</string>
</property>
<property name="text">
<string>Suspend desktop effects for fullscreen windows</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>

View file

@ -40,7 +40,7 @@ LanczosFilter::LanczosFilter( QObject* parent )
#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifdef KWIN_HAVE_OPENGL_COMPOSITING
, m_offscreenTex( 0 ) , m_offscreenTex( 0 )
, m_offscreenTarget( 0 ) , m_offscreenTarget( 0 )
, m_shader( new LanczosShader( this ) ) , m_shader( 0 )
#endif #endif
, m_inited( false) , m_inited( false)
{ {
@ -60,8 +60,13 @@ void LanczosFilter::init()
return; return;
m_inited = true; m_inited = true;
#ifdef KWIN_HAVE_OPENGL_COMPOSITING #ifdef KWIN_HAVE_OPENGL_COMPOSITING
// check the blacklist
KSharedConfigPtr config = KSharedConfig::openConfig( "kwinrc" ); 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" ); KConfigGroup blacklist = config->group( "Blacklist" ).group( "Lanczos" );
if( effects->checkDriverBlacklist( blacklist ) ) if( effects->checkDriverBlacklist( blacklist ) )
{ {
@ -69,6 +74,7 @@ void LanczosFilter::init()
return; return;
} }
m_shader = new LanczosShader( this );
if( !m_shader->init() ) if( !m_shader->init() )
{ {
delete m_shader; delete m_shader;

View file

@ -265,7 +265,7 @@ void Options::reloadCompositingSettings()
glMode = GLFallback; glMode = GLFallback;
glDirect = config.readEntry("GLDirect", prefs.enableDirectRendering() ); glDirect = config.readEntry("GLDirect", prefs.enableDirectRendering() );
glVSync = config.readEntry("GLVSync", prefs.enableVSync() ); 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()); glStrictBinding = config.readEntry( "GLStrictBinding", prefs.strictBinding());
xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false ); xrenderSmoothScale = config.readEntry("XRenderSmoothScale", false );

View file

@ -1427,18 +1427,7 @@ void SceneOpenGL::Window::performPaint( int mask, QRegion region, WindowPaintDat
else else
filter = ImageFilterFast; filter = ImageFilterFast;
if( filter == ImageFilterGood ) if( filter == ImageFilterGood )
{ texture.setFilter( GL_LINEAR );
// 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 );
}
else else
texture.setFilter( GL_NEAREST ); texture.setFilter( GL_NEAREST );
// do required transformations // do required transformations
@ -1604,18 +1593,7 @@ void SceneOpenGL::Window::paintDecoration( const QPixmap* decoration, TextureTyp
else else
return; return;
if( filter == ImageFilterGood ) if( filter == ImageFilterGood )
{ decorationTexture->setFilter( GL_LINEAR );
// 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 );
}
else else
decorationTexture->setFilter( GL_NEAREST ); decorationTexture->setFilter( GL_NEAREST );
decorationTexture->setWrapMode( GL_CLAMP_TO_EDGE ); decorationTexture->setWrapMode( GL_CLAMP_TO_EDGE );