From 76739f1f2fc1abcbf6b7de39215a7de0a74675e3 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 5 Jun 2024 16:38:31 +0200 Subject: [PATCH] core/renderloop: don't do triple buffering with vrr or tearing While in theory it could be useful with both, I'm not sure that it makes sense in practice, and the current triple buffering logic doesn't support it. BUG: 487605 --- src/core/renderloop.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/renderloop.cpp b/src/core/renderloop.cpp index eabb3b47fc..be590e7396 100644 --- a/src/core/renderloop.cpp +++ b/src/core/renderloop.cpp @@ -202,13 +202,15 @@ void RenderLoop::scheduleRepaint(Item *item, RenderLayer *layer) return; } const bool vrr = d->presentationMode == PresentationMode::AdaptiveSync || d->presentationMode == PresentationMode::AdaptiveAsync; - if (vrr && workspace()->activeWindow() && d->output) { + const bool tearing = d->presentationMode == PresentationMode::Async || d->presentationMode == PresentationMode::AdaptiveAsync; + if ((vrr || tearing) && workspace()->activeWindow() && d->output) { Window *const activeWindow = workspace()->activeWindow(); if ((item || layer) && activeWindow->isOnOutput(d->output) && activeWindow->surfaceItem() && item != activeWindow->surfaceItem() && activeWindow->surfaceItem()->frameTimeEstimation() <= std::chrono::nanoseconds(1'000'000'000) / 30) { return; } } - if (d->pendingFrameCount < d->maxPendingFrameCount && !d->inhibitCount) { + const int effectiveMaxPendingFrameCount = (vrr || tearing) ? 1 : d->maxPendingFrameCount; + if (d->pendingFrameCount < effectiveMaxPendingFrameCount && !d->inhibitCount) { d->scheduleNextRepaint(); } else { d->delayScheduleRepaint();