File 0004-Do-a-count-down-of-framesToTestForSafety.patch of Package kwin5

From 8e49998eb3677cf0b25bf652ba13ab86bf18b9bc Mon Sep 17 00:00:00 2001
From: Antonio Larrosa <larrosa@kde.org>
Date: Mon, 24 Oct 2016 09:39:55 +0200
Subject: [PATCH 4/4] Do a count down of framesToTestForSafety

Use one variable instead of two and do a count down from
m_framesToTestForSafety to 0
---
 composite.cpp | 10 +++++-----
 composite.h   |  3 +--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/composite.cpp b/composite.cpp
index 37cd54d..0abf531 100644
--- a/composite.cpp
+++ b/composite.cpp
@@ -136,7 +136,7 @@ Compositor::Compositor(QObject* workspace)
     );
 
     if (qEnvironmentVariableIsSet("KWIN_MAX_FRAMES_TESTED"))
-       m_maxFramesTestedForSafety = qEnvironmentVariableIntValue("KWIN_MAX_FRAMES_TESTED");
+       m_framesToTestForSafety = qEnvironmentVariableIntValue("KWIN_MAX_FRAMES_TESTED");
 
     // register DBus
     new CompositorDBusInterface(this);
@@ -738,16 +738,16 @@ void Compositor::performCompositing()
     // clear all repaints, so that post-pass can add repaints for the next repaint
     repaints_region = QRegion();
 
-    if (m_frameCount < m_maxFramesTestedForSafety && (m_scene->compositingType() & OpenGLCompositing)) {
+    if (m_framesToTestForSafety > 0 && (m_scene->compositingType() & OpenGLCompositing)) {
         kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreFrame);
     }
     m_timeSinceLastVBlank = m_scene->paint(repaints, windows);
-    if (m_frameCount < m_maxFramesTestedForSafety) {
+    if (m_framesToTestForSafety > 0) {
         if (m_scene->compositingType() & OpenGLCompositing) {
             kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame);
         }
-        m_frameCount++;
-	if (m_frameCount >= m_maxFramesTestedForSafety) {
+        m_framesToTestForSafety--;
+	if (m_framesToTestForSafety == 0) {
             kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastFrame);
 	 }
     }
diff --git a/composite.h b/composite.h
index c6effe0..c439148 100644
--- a/composite.h
+++ b/composite.h
@@ -239,8 +239,7 @@ private:
     Scene *m_scene;
     bool m_bufferSwapPending;
     bool m_composeAtSwapCompletion;
-    int m_frameCount = 0;
-    int m_maxFramesTestedForSafety = 30;
+    int m_framesToTestForSafety = 30;
 
     KWIN_SINGLETON_VARIABLE(Compositor, s_compositor)
 };
-- 
2.10.1

openSUSE Build Service is sponsored by