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
This commit is contained in:
Xaver Hugl 2024-05-28 18:14:19 +02:00
parent cefcdf7db5
commit 2cf36e640f
4 changed files with 6 additions and 7 deletions

View file

@ -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);

View file

@ -190,7 +190,7 @@ void RenderLayer::addRepaint(const QRegion &region)
}
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);
}
}

View file

@ -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;
}
}

View file

@ -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.