From bd01bfefb44e5aeb24339810f3db6a5b5075c96b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 24 May 2013 14:50:17 +0200 Subject: [PATCH] Improve multi-head detection for OpenGLIsUnsafe This was currently basically broken: * Screen number got always attached * openGLIsBroken did not check for screen number -> KCM reported "everything is fine" while it wasn't Now changed to: * only attach screen number if it is a multi-head setup * use same logic in both Composite and CompositingPrefs Still problematic: * kcm is not multi-head aware so it will report everything is fine in case of a broken multi-head setup REVIEW: 110631 --- composite.cpp | 3 ++- compositingprefs.cpp | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/composite.cpp b/composite.cpp index eddd663c96..bb00d5f77c 100644 --- a/composite.cpp +++ b/composite.cpp @@ -162,6 +162,7 @@ void Compositor::setup() } extern int screen_number; // main.cpp +extern bool is_multihead; void Compositor::slotCompositingOptionsInitialized() { @@ -182,7 +183,7 @@ void Compositor::slotCompositingOptionsInitialized() // Some broken drivers crash on glXQuery() so to prevent constant KWin crashes: KSharedConfigPtr unsafeConfigPtr = KGlobal::config(); KConfigGroup unsafeConfig(unsafeConfigPtr, "Compositing"); - const QString openGLIsUnsafe = "OpenGLIsUnsafe" + QString::number(screen_number); + const QString openGLIsUnsafe = "OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : ""); if (unsafeConfig.readEntry(openGLIsUnsafe, false)) kWarning(1212) << "KWin has detected that your OpenGL library is unsafe to use"; else { diff --git a/compositingprefs.cpp b/compositingprefs.cpp index 729c2f2b63..b79106c25b 100644 --- a/compositingprefs.cpp +++ b/compositingprefs.cpp @@ -38,6 +38,9 @@ along with this program. If not, see . namespace KWin { +extern int screen_number; // main.cpp +extern bool is_multihead; + CompositingPrefs::CompositingPrefs() : mEnableDirectRendering(true) { @@ -49,15 +52,17 @@ CompositingPrefs::~CompositingPrefs() bool CompositingPrefs::openGlIsBroken() { - return KConfigGroup(KGlobal::config(), "Compositing").readEntry("OpenGLIsUnsafe", false); + const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : "")); + return KConfigGroup(KGlobal::config(), "Compositing").readEntry(unsafeKey, false); } bool CompositingPrefs::compositingPossible() { // first off, check whether we figured that we'll crash on detection because of a buggy driver KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing"); + const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : "")); if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" && - gl_workaround_group.readEntry("OpenGLIsUnsafe", false)) + gl_workaround_group.readEntry(unsafeKey, false)) return false; if (!Xcb::Extensions::self()->isCompositeAvailable()) { @@ -85,8 +90,9 @@ QString CompositingPrefs::compositingNotPossibleReason() { // first off, check whether we figured that we'll crash on detection because of a buggy driver KConfigGroup gl_workaround_group(KGlobal::config(), "Compositing"); + const QString unsafeKey("OpenGLIsUnsafe" + (is_multihead ? QString::number(screen_number) : "")); if (gl_workaround_group.readEntry("Backend", "OpenGL") == "OpenGL" && - gl_workaround_group.readEntry("OpenGLIsUnsafe", false)) + gl_workaround_group.readEntry(unsafeKey, false)) return i18n("OpenGL compositing (the default) has crashed KWin in the past.
" "This was most likely due to a driver bug." "

If you think that you have meanwhile upgraded to a stable driver,
"