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.
This commit is contained in:
parent
4a879379b3
commit
41718a1d8f
1 changed files with 15 additions and 3 deletions
18
scene.cpp
18
scene.cpp
|
@ -1174,10 +1174,22 @@ void Scene::Window::addRepaint(const QRegion ®ion)
|
||||||
|
|
||||||
void Scene::Window::addLayerRepaint(const QRegion ®ion)
|
void Scene::Window::addLayerRepaint(const QRegion ®ion)
|
||||||
{
|
{
|
||||||
for (int screen = 0; screen < m_layerRepaints.count(); ++screen) {
|
if (kwinApp()->platform()->isPerScreenRenderingEnabled()) {
|
||||||
m_layerRepaints[screen] += region;
|
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
|
QRegion Scene::Window::repaints(int screen) const
|
||||||
|
|
Loading…
Reference in a new issue