Fix buffer swap assert

After paint in case we have swap events the buffer swap should be pending.

This is not always the case with the X11 standalone plugin what needs to be
investigated some more. This is for now a quick fix to make sessions work
again without failing on the assert.
This commit is contained in:
Roman Gilg 2019-12-24 17:43:21 +01:00
parent b78a104f50
commit be01ba0ae7

View file

@ -603,7 +603,6 @@ void Compositor::timerEvent(QTimerEvent *te)
void Compositor::aboutToSwapBuffers() void Compositor::aboutToSwapBuffers()
{ {
Q_ASSERT(!m_bufferSwapPending); Q_ASSERT(!m_bufferSwapPending);
m_bufferSwapPending = true; m_bufferSwapPending = true;
} }
@ -712,7 +711,16 @@ void Compositor::performCompositing()
if (m_framesToTestForSafety > 0 && (m_scene->compositingType() & OpenGLCompositing)) { if (m_framesToTestForSafety > 0 && (m_scene->compositingType() & OpenGLCompositing)) {
kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreFrame); kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreFrame);
} }
Q_ASSERT(!m_bufferSwapPending);
// Start the actual painting process.
m_timeSinceLastVBlank = m_scene->paint(repaints, windows); m_timeSinceLastVBlank = m_scene->paint(repaints, windows);
// TODO: In case we have swap events the buffer swap should now be pending, but this is not
// always the case on X11 standalone platform. Look into that.
// Q_ASSERT(m_scene->hasSwapEvent() ^ !m_bufferSwapPending);
if (m_framesToTestForSafety > 0) { if (m_framesToTestForSafety > 0) {
if (m_scene->compositingType() & OpenGLCompositing) { if (m_scene->compositingType() & OpenGLCompositing) {
kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame); kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PostFrame);
@ -741,7 +749,6 @@ void Compositor::performCompositing()
// is called the next time. If there would be nothing pending, it will not restart the timer and // 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 // scheduleRepaint() would restart it again somewhen later, called from functions that
// would again add something pending. // would again add something pending.
Q_ASSERT(!m_bufferSwapPending);
scheduleRepaint(); scheduleRepaint();
} }