add GUI config to select the swapstrategy

REVIEW: 109322
This commit is contained in:
Thomas Lübking 2013-03-06 22:05:34 +01:00
parent 285cdce324
commit 903c95dd52
3 changed files with 221 additions and 163 deletions

View file

@ -136,6 +136,17 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
#define XRENDER_INDEX -1
#endif
ui.glSwapStrategy->addItem(i18n("None"), "n");
ui.glSwapStrategy->setItemData(0, i18n("The painting is not synchronized with the screen."), Qt::ToolTipRole);
ui.glSwapStrategy->addItem(i18n("Automatic"), "a");
ui.glSwapStrategy->setItemData(1, i18n("Tries to re-use older buffers and if that is not possible,\npicks a stragtegy matching your hardware."), Qt::ToolTipRole);
ui.glSwapStrategy->addItem(i18n("Only when Cheap"), "e");
ui.glSwapStrategy->setItemData(2, i18n("When major regions of the screen are updated,\nthe entire screen will be repainted.\nCan cause tearing with small updates."), Qt::ToolTipRole);
ui.glSwapStrategy->addItem(i18n("Full scene repaints"), "p");
ui.glSwapStrategy->setItemData(3, i18n("The complete screen is repainted for every frame.\nCan be slow with large blurred areas."), Qt::ToolTipRole);
ui.glSwapStrategy->addItem(i18n("Re-use screen content"), "c");
ui.glSwapStrategy->setItemData(4, i18n("WARNING:\nThis strategy is usually slow with Open Source drivers.\nUndamaged pixels will be copied from GL_FRONT to GL_BACK"), Qt::ToolTipRole);
connect(ui.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int)));
connect(ui.rearmGlSupportButton, SIGNAL(clicked()), this, SLOT(rearmGlSupport()));
@ -160,7 +171,8 @@ KWinCompositingConfig::KWinCompositingConfig(QWidget *parent, const QVariantList
connect(ui.glScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.xrScaleFilter, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.glVSync, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.glSwapStrategy, SIGNAL(currentIndexChanged(int)), this, SLOT(glSwapStrategyChanged(int)));
connect(ui.glSwapStrategy, SIGNAL(currentIndexChanged(int)), this, SLOT(changed()));
connect(ui.glShaders, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(ui.glColorCorrection, SIGNAL(toggled(bool)), this, SLOT(changed()));
connect(m_showDetailedErrors, SIGNAL(triggered(bool)), SLOT(showDetailedEffectLoadingInformation()));
@ -337,6 +349,11 @@ void KWinCompositingConfig::loadGeneralTab()
ui.desktopSwitchingCombo->setCurrentIndex(3);
}
void KWinCompositingConfig::glSwapStrategyChanged(int idx)
{
ui.glSwapStrategy->setToolTip(ui.glSwapStrategy->itemData(idx, Qt::ToolTipRole).toString());
}
void KWinCompositingConfig::rearmGlSupport()
{
// rearm config
@ -357,7 +374,6 @@ void KWinCompositingConfig::suggestGraphicsSystem()
ui.graphicsSystem->setCurrentIndex(0);
}
void KWinCompositingConfig::toogleSmoothScaleUi(int compositingType)
{
ui.glScaleFilter->setVisible(compositingType == OPENGL_INDEX);
@ -416,7 +432,10 @@ void KWinCompositingConfig::loadAdvancedTab()
ui.xrScaleFilter->setCurrentIndex((int)config.readEntry("XRenderSmoothScale", false));
ui.glScaleFilter->setCurrentIndex(config.readEntry("GLTextureFilter", 2));
ui.glVSync->setChecked(config.readEntry("GLVSync", true));
int swapStrategy = ui.glSwapStrategy->findData(config.readEntry("GLPreferBufferSwap", "a"));
if (swapStrategy < 0)
swapStrategy = ui.glSwapStrategy->findData("n");
ui.glSwapStrategy->setCurrentIndex(swapStrategy);
ui.glShaders->setChecked(!config.readEntry<bool>("GLLegacy", false));
ui.glColorCorrection->setChecked(config.readEntry("GLColorCorrection", false));
@ -530,7 +549,7 @@ bool KWinCompositingConfig::saveAdvancedTab()
if (config.readEntry("Backend", "OpenGL")
!= ((ui.compositingType->currentIndex() == OPENGL_INDEX) ? "OpenGL" : "XRender")
|| config.readEntry("GLVSync", true) != ui.glVSync->isChecked()
|| ((config.readEntry("GLPreferBufferSwap", "a") == "n") xor (ui.glSwapStrategy->itemData(ui.glSwapStrategy->currentIndex()) == "n"))
|| config.readEntry<bool>("GLLegacy", false) == ui.glShaders->isChecked()) {
m_showConfirmDialog = true;
advancedChanged = true;
@ -550,7 +569,7 @@ bool KWinCompositingConfig::saveAdvancedTab()
config.writeEntry("XRenderSmoothScale", ui.xrScaleFilter->currentIndex() == 1);
config.writeEntry("GLTextureFilter", ui.glScaleFilter->currentIndex());
config.writeEntry("GLVSync", ui.glVSync->isChecked());
config.writeEntry("GLPreferBufferSwap", ui.glSwapStrategy->itemData(ui.glSwapStrategy->currentIndex()).toString());
config.writeEntry("GLLegacy", !ui.glShaders->isChecked());
config.writeEntry("GLColorCorrection", ui.glColorCorrection->isChecked());
@ -820,7 +839,7 @@ void KWinCompositingConfig::defaults()
ui.unredirectFullscreen->setChecked(false);
ui.xrScaleFilter->setCurrentIndex(0);
ui.glScaleFilter->setCurrentIndex(2);
ui.glVSync->setChecked(true);
ui.glSwapStrategy->setCurrentIndex(ui.glSwapStrategy->findData("a"));
ui.glShaders->setChecked(true);
ui.glColorCorrection->setChecked(false);
}

View file

@ -78,6 +78,7 @@ public slots:
private slots:
void confirmReInit() { showConfirmDialog(true); }
void glSwapStrategyChanged(int idx);
void rearmGlSupport();
void suggestGraphicsSystem();
void toogleSmoothScaleUi(int compositingType);

View file

@ -10,7 +10,7 @@
<height>541</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="KMessageWidget" name="messageBox">
<property name="frameShape">
@ -24,7 +24,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
@ -514,81 +514,18 @@
</property>
</spacer>
</item>
<item row="1" column="2">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<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="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Qt graphics system:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="graphicsSystem">
<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;It is &lt;span style=&quot; font-weight:600;&quot;&gt;strongly recommended&lt;/span&gt; to use the &lt;span style=&quot; font-weight:600;&quot;&gt;native&lt;/span&gt; system when using the &lt;span style=&quot; font-weight:600;&quot;&gt;XRender&lt;/span&gt; backend.&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;On the other hand, many decorations perform better with the &lt;span style=&quot; font-weight:600;&quot;&gt;raster&lt;/span&gt; system on the &lt;span style=&quot; font-weight:600;&quot;&gt;default and generally preferred OpenGL&lt;/span&gt; backend (though some don't - also the impact here can be anything between &amp;quot;slight&amp;quot; and &amp;quot;incredible&amp;quot; depending on the GPU and driver)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Native</string>
</property>
</item>
<item>
<property name="text">
<string>Raster</string>
</property>
</item>
</widget>
</item>
</layout>
<item row="0" column="4" rowspan="7">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="3">
<spacer name="horizontalSpacer_13">
@ -603,6 +540,94 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="5" column="1" colspan="3">
<widget class="QGroupBox" name="glGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>OpenGL Options</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,5">
<item>
<widget class="QLabel" name="glSwapStrategyLabel">
<property name="text">
<string>Tearing Prevention (VSync)</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>glSwapStrategy</cstring>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="glSwapStrategy"/>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="glShaders">
<property name="toolTip">
<string>If enabled all rendering will be performed with Shaders written in the OpenGL Shading Language.
On legacy hardware disabling Shaders can improve the performance.</string>
</property>
<property name="text">
<string>Use OpenGL 2 Shaders</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="glColorCorrection">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;p&gt;Activates color correction if possible, using the Kolor-Manager. Requires OpenGL 2 Shaders to be enabled and Kolor-Manager to be installed. May fail silently.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Experimental&lt;/strong&gt;.&lt;/p&gt;</string>
</property>
<property name="text">
<string>Enable color correction (experimental)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="6" column="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="4" column="1" colspan="3">
<widget class="QGroupBox" name="groupBox_3">
<property name="sizePolicy">
@ -765,19 +790,6 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
</item>
<item row="0" column="4" rowspan="7">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" rowspan="7">
<spacer name="horizontalSpacer_10">
<property name="orientation">
@ -791,71 +803,6 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item row="5" column="1" colspan="3">
<widget class="QGroupBox" name="glGroup">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>OpenGL Options</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QCheckBox" name="glShaders">
<property name="toolTip">
<string>If enabled all rendering will be performed with Shaders written in the OpenGL Shading Language.
On legacy hardware disabling Shaders can improve the performance.</string>
</property>
<property name="text">
<string>Use OpenGL 2 Shaders</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="glVSync">
<property name="text">
<string>Use VSync</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="glColorCorrection">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>&lt;p&gt;Activates color correction if possible, using the Kolor-Manager. Requires OpenGL 2 Shaders to be enabled and Kolor-Manager to be installed. May fail silently.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Experimental&lt;/strong&gt;.&lt;/p&gt;</string>
</property>
<property name="text">
<string>Enable color correction (experimental)</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="6" column="2">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
@ -869,6 +816,82 @@ On legacy hardware disabling Shaders can improve the performance.</string>
</property>
</spacer>
</item>
<item row="1" column="2">
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<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="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Qt graphics system:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="graphicsSystem">
<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;It is &lt;span style=&quot; font-weight:600;&quot;&gt;strongly recommended&lt;/span&gt; to use the &lt;span style=&quot; font-weight:600;&quot;&gt;native&lt;/span&gt; system when using the &lt;span style=&quot; font-weight:600;&quot;&gt;XRender&lt;/span&gt; backend.&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;On the other hand, many decorations perform better with the &lt;span style=&quot; font-weight:600;&quot;&gt;raster&lt;/span&gt; system on the &lt;span style=&quot; font-weight:600;&quot;&gt;default and generally preferred OpenGL&lt;/span&gt; backend (though some don't - also the impact here can be anything between &amp;quot;slight&amp;quot; and &amp;quot;incredible&amp;quot; depending on the GPU and driver)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Native</string>
</property>
</item>
<item>
<property name="text">
<string>Raster</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_12">
<property name="orientation">
@ -883,6 +906,8 @@ On legacy hardware disabling Shaders can improve the performance.</string>
</spacer>
</item>
</layout>
<zorder>groupBox_3</zorder>
<zorder>glGroup</zorder>
</widget>
</widget>
</item>
@ -924,11 +949,24 @@ On legacy hardware disabling Shaders can improve the performance.</string>
</customwidgets>
<tabstops>
<tabstop>tabWidget</tabstop>
<tabstop>rearmSafetyCheck</tabstop>
<tabstop>rearmGlSupportButton</tabstop>
<tabstop>useCompositing</tabstop>
<tabstop>effectWinManagement</tabstop>
<tabstop>effectAnimations</tabstop>
<tabstop>desktopSwitchingCombo</tabstop>
<tabstop>animationSpeedCombo</tabstop>
<tabstop>effectSelector</tabstop>
<tabstop>ghns</tabstop>
<tabstop>compositingType</tabstop>
<tabstop>graphicsSystem</tabstop>
<tabstop>windowThumbnails</tabstop>
<tabstop>xrScaleFilter</tabstop>
<tabstop>glScaleFilter</tabstop>
<tabstop>unredirectFullscreen</tabstop>
<tabstop>glShaders</tabstop>
<tabstop>glSwapStrategy</tabstop>
<tabstop>glColorCorrection</tabstop>
</tabstops>
<resources/>
<connections>
@ -959,8 +997,8 @@ On legacy hardware disabling Shaders can improve the performance.</string>
<y>315</y>
</hint>
<hint type="destinationlabel">
<x>204</x>
<y>358</y>
<x>307</x>
<y>375</y>
</hint>
</hints>
</connection>