diff --git a/src/renderloop.cpp b/src/renderloop.cpp index 8504cd10a1..caa25228dc 100644 --- a/src/renderloop.cpp +++ b/src/renderloop.cpp @@ -33,7 +33,7 @@ RenderLoopPrivate::RenderLoopPrivate(RenderLoop *q) void RenderLoopPrivate::scheduleRepaint() { - if (kwinApp()->isTerminating()) { + if (kwinApp()->isTerminating() || compositeTimer.isActive()) { return; } if (vrrPolicy == RenderLoop::VrrPolicy::Always || (vrrPolicy == RenderLoop::VrrPolicy::Automatic && hasFullscreenSurface)) { @@ -42,25 +42,11 @@ void RenderLoopPrivate::scheduleRepaint() presentMode = SyncMode::Fixed; } const std::chrono::nanoseconds vblankInterval(1'000'000'000'000ull / refreshRate); - - if (presentMode == SyncMode::Adaptive) { - std::chrono::nanoseconds timeSincePresent = std::chrono::steady_clock::now().time_since_epoch() - lastPresentationTimestamp; - if (timeSincePresent > vblankInterval) { - // client renders slower than refresh rate -> immediately present - compositeTimer.start(0); - return; - } - // client renders faster than refresh rate -> normal frame scheduling - } - if (compositeTimer.isActive()) { - return; - } - const std::chrono::nanoseconds currentTime(std::chrono::steady_clock::now().time_since_epoch()); // Estimate when the next presentation will occur. Note that this is a prediction. nextPresentationTimestamp = lastPresentationTimestamp + vblankInterval; - if (nextPresentationTimestamp < currentTime) { + if (nextPresentationTimestamp < currentTime && presentMode == SyncMode::Fixed) { nextPresentationTimestamp = lastPresentationTimestamp + alignTimestamp(currentTime - lastPresentationTimestamp, vblankInterval); }