Commit ba2c0324 authored by Roman Gilg's avatar Roman Gilg
Browse files

Reset buffer swap state on stop

When the compositor is stopped there might still be a buffer swap ongoing, in
particular when a client blocks compositing on X11.

Depending on the backend the next buffer swap event might be handled in
bufferSwapComplete (Wayland) or not be handled (X11 GLX, since a new
GLX window will be created while the swap event is sent for the old one).

With this patch the buffer swap state is reset on stop such that on later
start no outdated data might create errors  and instead a new repaint can be
triggered with updated data.

BUG: 415262

Test Plan: Manually on X11 and Wayland.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision:
parent 45177bb2
......@@ -404,7 +404,7 @@ void Compositor::scheduleRepaint()
// in AnimationEffect::postPaintScreen. Why?
// Theory is that effects call addRepaintFull in there and then performCompositing
// is called again while still in the first paint. So queing it here makes sense!
QTimer::singleShot(0, this, [this]() { performCompositing(); });
compositeTimer.start(0, this);
} else {
......@@ -471,6 +471,8 @@ void Compositor::stop()
delete m_scene;
m_scene = nullptr;
m_bufferSwapPending = false;
m_composeAtSwapCompletion = false;
repaints_region = QRegion();
......@@ -739,11 +741,8 @@ void Compositor::performCompositing()
// is called the next time. If there would be nothing pending, it will not restart the timer and
// scheduleRepaint() would restart it again somewhen later, called from functions that
// would again add something pending.
if (m_bufferSwapPending) {
m_composeAtSwapCompletion = true;
} else {
template <class T>
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