From 2cf36e640ff35ca777f989aee43cfbf4300d1ace Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Tue, 28 May 2024 18:14:19 +0200 Subject: [PATCH] core/renderloop: honor repaint scheduling requests from effects with vrr Until effects are converted to schedule repaints on the item they're modifying, we need to allow repaint scheduling from nullptr items, and handle repaints on the (cursor) render layers to still be filtered out BUG: 487480 --- src/compositor_wayland.cpp | 2 -- src/core/renderlayer.cpp | 4 ++-- src/core/renderloop.cpp | 4 ++-- src/core/renderloop.h | 3 ++- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/compositor_wayland.cpp b/src/compositor_wayland.cpp index e8f7baf0b3..691d9a5326 100644 --- a/src/compositor_wayland.cpp +++ b/src/compositor_wayland.cpp @@ -441,7 +441,6 @@ void WaylandCompositor::addOutput(Output *output) } cursorLayer->setVisible(cursor->isOnOutput(output)); cursorLayer->setGeometry(outputLocalRect); - cursorLayer->addRepaintFull(); return false; } }; @@ -477,7 +476,6 @@ void WaylandCompositor::addOutput(Output *output) } cursorLayer->setVisible(shouldBeVisible && !hardwareCursor); cursorLayer->setGeometry(outputLocalRect); - cursorLayer->addRepaintFull(); }; updateCursorLayer(); connect(output, &Output::geometryChanged, cursorLayer, updateCursorLayer); diff --git a/src/core/renderlayer.cpp b/src/core/renderlayer.cpp index c7d46c8759..d8833da8f4 100644 --- a/src/core/renderlayer.cpp +++ b/src/core/renderlayer.cpp @@ -190,7 +190,7 @@ void RenderLayer::addRepaint(const QRegion ®ion) } if (!region.isEmpty()) { m_repaints += region; - m_loop->scheduleRepaint(); + m_loop->scheduleRepaint(nullptr, this); } } @@ -237,7 +237,7 @@ void RenderLayer::updateEffectiveVisibility() } else { if (m_outputLayer) { m_outputLayer->addRepaint(mapToGlobal(boundingRect()).toAlignedRect()); - m_loop->scheduleRepaint(); + m_loop->scheduleRepaint(nullptr, this); } } diff --git a/src/core/renderloop.cpp b/src/core/renderloop.cpp index 7e618d96c1..eabb3b47fc 100644 --- a/src/core/renderloop.cpp +++ b/src/core/renderloop.cpp @@ -196,7 +196,7 @@ void RenderLoop::setPresentationSafetyMargin(std::chrono::nanoseconds safetyMarg d->safetyMargin = safetyMargin; } -void RenderLoop::scheduleRepaint(Item *item) +void RenderLoop::scheduleRepaint(Item *item, RenderLayer *layer) { if (d->pendingRepaint) { return; @@ -204,7 +204,7 @@ void RenderLoop::scheduleRepaint(Item *item) const bool vrr = d->presentationMode == PresentationMode::AdaptiveSync || d->presentationMode == PresentationMode::AdaptiveAsync; if (vrr && workspace()->activeWindow() && d->output) { Window *const activeWindow = workspace()->activeWindow(); - if (activeWindow->isOnOutput(d->output) && activeWindow->surfaceItem() && item != activeWindow->surfaceItem() && activeWindow->surfaceItem()->frameTimeEstimation() <= std::chrono::nanoseconds(1'000'000'000) / 30) { + if ((item || layer) && activeWindow->isOnOutput(d->output) && activeWindow->surfaceItem() && item != activeWindow->surfaceItem() && activeWindow->surfaceItem()->frameTimeEstimation() <= std::chrono::nanoseconds(1'000'000'000) / 30) { return; } } diff --git a/src/core/renderloop.h b/src/core/renderloop.h index f28f682afd..1a7dcef37b 100644 --- a/src/core/renderloop.h +++ b/src/core/renderloop.h @@ -17,6 +17,7 @@ class RenderLoopPrivate; class SurfaceItem; class Item; class Output; +class RenderLayer; /** * The RenderLoop class represents the compositing scheduler on a particular output. @@ -75,7 +76,7 @@ public: /** * Schedules a compositing cycle at the next available moment. */ - void scheduleRepaint(Item *item = nullptr); + void scheduleRepaint(Item *item = nullptr, RenderLayer *layer = nullptr); /** * Returns the timestamp of the last frame that has been presented on the screen.