diff --git a/compositingprefs.cpp b/compositingprefs.cpp index cf3bc1436b..a6d354a891 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -192,7 +192,8 @@ void CompositingPrefs::detect() } #else // HACK: This is needed for AIGLX - if (qstrcmp(qgetenv("KWIN_DIRECT_GL"), "1") != 0) { + const bool forceIndirect = qstrcmp(qgetenv("LIBGL_ALWAYS_INDIRECT"), "1") == 0; + if (!forceIndirect && qstrcmp(qgetenv("KWIN_DIRECT_GL"), "1") != 0) { // Start an external helper program that initializes GLX and returns // 0 if we can use direct rendering, and 1 otherwise. // The reason we have to use an external program is that after GLX @@ -201,8 +202,14 @@ void CompositingPrefs::detect() // Direct rendering is preferred, since not all OpenGL extensions are // available with indirect rendering. const QString opengl_test = KStandardDirs::findExe("kwin_opengl_test"); - if (QProcess::execute(opengl_test) != 0) + if (QProcess::execute(opengl_test) != 0) { + mEnableDirectRendering = false; setenv("LIBGL_ALWAYS_INDIRECT", "1", true); + } else { + mEnableDirectRendering = true; + } + } else { + mEnableDirectRendering = !forceIndirect; } if (!hasGlx()) { kDebug(1212) << "No GLX available"; diff --git a/kcmkwin/kwincompositing/main.cpp b/kcmkwin/kwincompositing/main.cpp index f39ace1730..02d9957744 100644 --- a/kcmkwin/kwincompositing/main.cpp +++ b/kcmkwin/kwincompositing/main.cpp @@ -123,7 +123,6 @@ 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.glDirect, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.glVSync, SIGNAL(toggled(bool)), this, SLOT(changed())); connect(ui.glShaders, SIGNAL(toggled(bool)), this, SLOT(changed())); @@ -395,7 +394,6 @@ void KWinCompositingConfig::loadAdvancedTab() ui.xrScaleFilter->setCurrentIndex((int)config.readEntry("XRenderSmoothScale", false)); ui.glScaleFilter->setCurrentIndex(config.readEntry("GLTextureFilter", 2)); - ui.glDirect->setChecked(config.readEntry("GLDirect", mDefaultPrefs.enableDirectRendering())); ui.glVSync->setChecked(config.readEntry("GLVSync", mDefaultPrefs.enableVSync())); ui.glShaders->setChecked(!config.readEntry("GLLegacy", false)); @@ -551,8 +549,6 @@ bool KWinCompositingConfig::saveAdvancedTab() if (config.readEntry("Backend", "OpenGL") != ((ui.compositingType->currentIndex() == OPENGL_INDEX) ? "OpenGL" : "XRender") - || config.readEntry("GLDirect", mDefaultPrefs.enableDirectRendering()) - != ui.glDirect->isChecked() || config.readEntry("GLVSync", mDefaultPrefs.enableVSync()) != ui.glVSync->isChecked() || config.readEntry("GLLegacy", false) == ui.glShaders->isChecked()) { m_showConfirmDialog = true; @@ -569,7 +565,6 @@ bool KWinCompositingConfig::saveAdvancedTab() config.writeEntry("XRenderSmoothScale", ui.xrScaleFilter->currentIndex() == 1); config.writeEntry("GLTextureFilter", ui.glScaleFilter->currentIndex()); - config.writeEntry("GLDirect", ui.glDirect->isChecked()); config.writeEntry("GLVSync", ui.glVSync->isChecked()); config.writeEntry("GLLegacy", !ui.glShaders->isChecked()); @@ -721,7 +716,6 @@ void KWinCompositingConfig::defaults() ui.unredirectFullscreen->setChecked(false); ui.xrScaleFilter->setCurrentIndex(0); ui.glScaleFilter->setCurrentIndex(2); - ui.glDirect->setChecked(mDefaultPrefs.enableDirectRendering()); ui.glVSync->setChecked(mDefaultPrefs.enableVSync()); ui.glShaders->setChecked(true); } diff --git a/kcmkwin/kwincompositing/main.ui b/kcmkwin/kwincompositing/main.ui index ed3da09314..4954ceff5c 100644 --- a/kcmkwin/kwincompositing/main.ui +++ b/kcmkwin/kwincompositing/main.ui @@ -771,17 +771,7 @@ p, li { white-space: pre-wrap; } true - - - - Enable direct rendering - - - false - - - - + Use VSync @@ -791,7 +781,7 @@ p, li { white-space: pre-wrap; } - + If enabled all rendering will be performed with Shaders written in the OpenGL Shading Language. diff --git a/options.cpp b/options.cpp index 09a3163e27..8cd8a87ab5 100644 --- a/options.cpp +++ b/options.cpp @@ -320,7 +320,7 @@ void Options::reloadCompositingSettings(bool force) prefs.detect(); useCompositing = config.readEntry("Enabled" , prefs.recommendCompositing()); - glDirect = config.readEntry("GLDirect", prefs.enableDirectRendering()); + glDirect = prefs.enableDirectRendering(); glVSync = config.readEntry("GLVSync", prefs.enableVSync()); glSmoothScale = qBound(-1, config.readEntry("GLTextureFilter", 2), 2); glStrictBinding = config.readEntry("GLStrictBinding", prefs.strictBinding());