Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:42.2:Ports
kwin5
0005-Use-only-one-timer-to-detect-freezes-and-o...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0005-Use-only-one-timer-to-detect-freezes-and-other-optim.patch of Package kwin5
From 8f5dbeba06ce05d6474f369a95a1a9d1f814a06f Mon Sep 17 00:00:00 2001 From: Antonio Larrosa <larrosa@kde.org> Date: Mon, 24 Oct 2016 16:45:04 +0200 Subject: [PATCH 5/7] Use only one timer to detect freezes and other optimizations stop/restart the same timer instead of creating a new one for each frame tested for freezes. Merged PreInit with PreFrame and PostInit with PostFrame so there's no need to call both before/after init, which didn't make sense contextually. Also moved group.sync() so PreFrame/PostFrame don't call it continuously. Finally, also renamed PostLastFrame to PostLastGuardedFrame --- composite.cpp | 4 +- platform.h | 2 +- plugins/platforms/x11/standalone/x11_platform.cpp | 55 ++++++++++++----------- 3 files changed, 31 insertions(+), 30 deletions(-) diff --git a/composite.cpp b/composite.cpp index 0abf531..573e7a6 100644 --- a/composite.cpp +++ b/composite.cpp @@ -207,11 +207,9 @@ void Compositor::slotCompositingOptionsInitialized() qCWarning(KWIN_CORE) << "KWin has detected that your OpenGL library is unsafe to use"; else { kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreInit); - kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreFrame); m_scene = SceneOpenGL::createScene(this); - kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastFrame); kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostInit); if (m_scene && !m_scene->initFailed()) { @@ -748,7 +746,7 @@ void Compositor::performCompositing() } m_framesToTestForSafety--; if (m_framesToTestForSafety == 0) { - kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastFrame); + kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastGuardedFrame); } } m_timeSinceStart += m_timeSinceLastVBlank; diff --git a/platform.h b/platform.h index 83e41bb..de0b3bf 100644 --- a/platform.h +++ b/platform.h @@ -145,7 +145,7 @@ public: PostInit, PreFrame, PostFrame, - PostLastFrame + PostLastGuardedFrame }; /** * This method is invoked before and after creating the OpenGL rendering Scene. diff --git a/plugins/platforms/x11/standalone/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp index 39652c2..88b37ea 100644 --- a/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/plugins/platforms/x11/standalone/x11_platform.cpp @@ -201,47 +201,50 @@ void X11StandalonePlatform::createOpenGLSafePoint(OpenGLSafePoint safePoint) switch (safePoint) { case OpenGLSafePoint::PreInit: group.writeEntry(unsafeKey, true); - break; - case OpenGLSafePoint::PostInit: - group.writeEntry(unsafeKey, false); - break; + group.sync(); + // Deliberately continue with PreFrame case OpenGLSafePoint::PreFrame: if (m_openGLFreezeProtectionThread == nullptr) { + Q_ASSERT(m_openGLFreezeProtection == nullptr); m_openGLFreezeProtectionThread = new QThread(this); m_openGLFreezeProtectionThread->setObjectName("FreezeDetector"); m_openGLFreezeProtectionThread->start(); - } - Q_ASSERT(m_openGLFreezeProtection == nullptr); - m_openGLFreezeProtection = new QTimer; - m_openGLFreezeProtection->setInterval(15000); - m_openGLFreezeProtection->setSingleShot(true); - m_openGLFreezeProtection->start(); - m_openGLFreezeProtection->moveToThread(m_openGLFreezeProtectionThread); - connect(m_openGLFreezeProtection, &QTimer::timeout, m_openGLFreezeProtection, - [] { - const QString unsafeKey(QLatin1String("OpenGLIsUnsafe") + (kwinApp()->isX11MultiHead() ? QString::number(kwinApp()->x11ScreenNumber()) : QString())); - auto group = KConfigGroup(kwinApp()->config(), "Compositing"); - group.writeEntry(unsafeKey, true); - group.sync(); - qFatal("Freeze in OpenGL initialization detected"); - }, Qt::DirectConnection); + m_openGLFreezeProtection = new QTimer; + m_openGLFreezeProtection->setInterval(15000); + m_openGLFreezeProtection->setSingleShot(true); + m_openGLFreezeProtection->start(); + m_openGLFreezeProtection->moveToThread(m_openGLFreezeProtectionThread); + connect(m_openGLFreezeProtection, &QTimer::timeout, m_openGLFreezeProtection, + [] { + const QString unsafeKey(QLatin1String("OpenGLIsUnsafe") + (kwinApp()->isX11MultiHead() ? QString::number(kwinApp()->x11ScreenNumber()) : QString())); + auto group = KConfigGroup(kwinApp()->config(), "Compositing"); + group.writeEntry(unsafeKey, true); + group.sync(); + qFatal("Freeze in OpenGL initialization detected"); + }, Qt::DirectConnection); + } + else + { + Q_ASSERT(m_openGLFreezeProtection); + QMetaObject::invokeMethod(m_openGLFreezeProtection, "start", Qt::QueuedConnection); + } break; + case OpenGLSafePoint::PostInit: + group.writeEntry(unsafeKey, false); + group.sync(); + // Deliberately continue with PostFrame case OpenGLSafePoint::PostFrame: + QMetaObject::invokeMethod(m_openGLFreezeProtection, "stop", Qt::QueuedConnection); + break; + case OpenGLSafePoint::PostLastGuardedFrame: m_openGLFreezeProtection->deleteLater(); m_openGLFreezeProtection = nullptr; - break; - case OpenGLSafePoint::PostLastFrame: - if (m_openGLFreezeProtection) { - m_openGLFreezeProtection->deleteLater(); - m_openGLFreezeProtection = nullptr; - }; m_openGLFreezeProtectionThread->quit(); m_openGLFreezeProtectionThread->wait(); delete m_openGLFreezeProtectionThread; m_openGLFreezeProtectionThread = nullptr; break; } - group.sync(); } } -- 2.10.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor