Commit 41718a1d authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

scene: Schedule a repaint only for outputs affected by layer repaint

If an output is not affected by a layer repaint, then we don't have to
schedule a repaint. This improves the overall performance.
parent 4a879379
......@@ -1174,10 +1174,22 @@ void Scene::Window::addRepaint(const QRegion &region)
void Scene::Window::addLayerRepaint(const QRegion &region)
{
for (int screen = 0; screen < m_layerRepaints.count(); ++screen) {
m_layerRepaints[screen] += region;
if (kwinApp()->platform()->isPerScreenRenderingEnabled()) {
if (m_repaints.count() != screens()->count()) {
return; // Repaints haven't been reallocated yet, do nothing.
}
for (int screenId = 0; screenId < m_repaints.count(); ++screenId) {
AbstractOutput *output = kwinApp()->platform()->findOutput(screenId);
const QRegion dirtyRegion = region & output->geometry();
if (!dirtyRegion.isEmpty()) {
m_layerRepaints[screenId] += dirtyRegion;
output->renderLoop()->scheduleRepaint();
}
}
} else {
m_layerRepaints[0] += region;
kwinApp()->platform()->renderLoop()->scheduleRepaint();
}
Compositor::self()->scheduleRepaint();
}
QRegion Scene::Window::repaints(int screen) const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment