diff --git a/composite.h b/composite.h --- a/composite.h +++ b/composite.h @@ -222,18 +222,17 @@ QTimer m_unusedSupportPropertyTimer; qint64 vBlankInterval, fpsInterval; int m_xrrRefreshRate; - QElapsedTimer nextPaintReference; QRegion repaints_region; QTimer compositeResetTimer; // for compressing composite resets bool m_finishing; // finish() sets this variable while shutting down bool m_starting; // start() sets this variable while starting qint64 m_timeSinceLastVBlank; - qint64 m_timeSinceStart = 0; Scene *m_scene; bool m_bufferSwapPending; bool m_composeAtSwapCompletion; int m_framesToTestForSafety = 3; + QElapsedTimer m_monotonicClock; KWIN_SINGLETON_VARIABLE(Compositor, s_compositor) }; diff --git a/composite.cpp b/composite.cpp --- a/composite.cpp +++ b/composite.cpp @@ -101,7 +101,7 @@ connect(&compositeResetTimer, SIGNAL(timeout()), SLOT(restart())); connect(options, &Options::configChanged, this, &Compositor::slotConfigChanged); compositeResetTimer.setSingleShot(true); - nextPaintReference.invalidate(); // Initialize the timer + m_monotonicClock.start(); // 2 sec which should be enough to restart the compositor static const int compositorLostMessageDelay = 2000; @@ -727,7 +727,6 @@ if (repaints_region.isEmpty() && !windowRepaintsPending()) { m_scene->idle(); m_timeSinceLastVBlank = fpsInterval - (options->vBlankTime() + 1); // means "start now" - m_timeSinceStart += m_timeSinceLastVBlank; // Note: It would seem here we should undo suspended unredirect, but when scenes need // it for some reason, e.g. transformations or translucency, the next pass that does not // need this anymore and paints normally will also reset the suspended unredirect. @@ -769,12 +768,12 @@ kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostLastGuardedFrame); } } - m_timeSinceStart += m_timeSinceLastVBlank; if (waylandServer()) { + const auto currentTime = static_cast(m_monotonicClock.elapsed()); for (Toplevel *win : qAsConst(windows)) { if (auto surface = win->surface()) { - surface->frameRendered(m_timeSinceStart); + surface->frameRendered(currentTime); } } }