From fbb7c241c748e7881d2691981686b943041dd7b3 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Thu, 9 Jan 2020 18:06:09 +0100 Subject: [PATCH] Revert "Composite without timer on swap events" This reverts commit 00bf75d06e678a6b1aa19f8e7da6c5d8b5a2106c. See: https://mail.kde.org/pipermail/kwin/2020-January/002999.html --- composite.cpp | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/composite.cpp b/composite.cpp index 69bb80c142..2fbf3e269c 100644 --- a/composite.cpp +++ b/composite.cpp @@ -384,30 +384,8 @@ void Compositor::startupWithWorkspace() void Compositor::scheduleRepaint() { - if (m_state != State::On) { - return; - } - - // Don't repaint if all outputs are disabled - if (!kwinApp()->platform()->areOutputsEnabled()) { - return; - } - - // TODO: Make this distinction not on the question if there is a swap event but if per screen - // rendering? On X we get swap events but they are aligned with the "wrong" screen if - // it the primary/first one is not the one with the highest refresh rate. - // But on the other side Present extension does not allow to sync with another screen - // anyway. - - if (m_scene->hasSwapEvent()) { - // TODO: If we don't call it back from the event loop we often crash on Wayland - // in AnimationEffect::postPaintScreen. Why? - // Theory is that effects call addRepaintFull in there and then performCompositing - // is called again while still in the first paint. So queing it here makes sense! - QTimer::singleShot(0, this, [this]() { performCompositing(); }); - } else { + if (!compositeTimer.isActive()) setCompositeTimer(); - } } void Compositor::stop() @@ -788,7 +766,16 @@ bool Compositor::windowRepaintsPending() const void Compositor::setCompositeTimer() { - if (compositeTimer.isActive()) { + if (m_state != State::On) { + return; + } + + // Don't start the timer if we're waiting for a swap event + if (m_bufferSwapPending && m_composeAtSwapCompletion) + return; + + // Don't start the timer if all outputs are disabled + if (!kwinApp()->platform()->areOutputsEnabled()) { return; }