Revert "Client: Remove mWaitingForUpdateDelivery"

The reverted commit introduces a severe performance regression
when a client window is resized while a QtQuick renderthread
animation is running.

This reverts commit e625089f40ab5b2f3220a9ffc3e047d1c3fc2740.

Fixes: QTBUG-101726
Change-Id: Ib5b52ce06efec8c86fada1623c2af82099e57fc6
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Paul Olav Tvete 2022-03-15 15:59:15 +01:00
parent 077df2acef
commit eddb08768f
2 changed files with 9 additions and 3 deletions

View File

@ -716,9 +716,12 @@ void QWaylandWindow::handleFrameCallback()
mFrameCallbackElapsedTimer.invalidate();
// The rest can wait until we can run it on the correct thread
if (!mWaitingForUpdateDelivery) {
// Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync()
// in the single-threaded case.
mWaitingForUpdateDelivery = true;
QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection);
}
mFrameSyncWait.notify_all();
}
@ -731,6 +734,8 @@ void QWaylandWindow::doHandleFrameCallback()
sendExposeEvent(QRect(QPoint(), geometry().size()));
if (wasExposed && hasPendingUpdateRequest())
deliverUpdateRequest();
mWaitingForUpdateDelivery = false;
}
bool QWaylandWindow::waitForFrameSync(int timeout)

View File

@ -283,6 +283,7 @@ protected:
WId mWindowId;
bool mWaitingForFrameCallback = false;
bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out
bool mWaitingForUpdateDelivery = false;
int mFrameCallbackCheckIntervalTimerId = -1;
QElapsedTimer mFrameCallbackElapsedTimer;
struct ::wl_callback *mFrameCallback = nullptr;