Client: Remove mWaitingForUpdateDelivery
Currently, mWaitingForUpdateDelivery is shared between the main thread (doHandleFrameCallback()) and the frame callback event thread (handleFrameCallback()), however the access to it is not synchronized between both threads. On the other hand, QWaylandWindow already ensures not to create a frame callback if there's already one pending. This change removes mWaitingForUpdateDelivery flag because it should be already covered by mWaitingForFrameCallback and to remove unsynchronized shared state between threads. Change-Id: I0e5a25d18d1e66c4d7683e7e972330c4d7cbbf38 Reviewed-by: David Edmundson <davidedmundson@kde.org>
This commit is contained in:
parent
fcf3fc37a4
commit
e625089f40
@ -715,12 +715,9 @@ void QWaylandWindow::handleFrameCallback()
|
|||||||
mFrameCallbackElapsedTimer.invalidate();
|
mFrameCallbackElapsedTimer.invalidate();
|
||||||
|
|
||||||
// The rest can wait until we can run it on the correct thread
|
// 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()
|
||||||
// Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync()
|
// in the single-threaded case.
|
||||||
// in the single-threaded case.
|
QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection);
|
||||||
mWaitingForUpdateDelivery = true;
|
|
||||||
QMetaObject::invokeMethod(this, &QWaylandWindow::doHandleFrameCallback, Qt::QueuedConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
mFrameSyncWait.notify_all();
|
mFrameSyncWait.notify_all();
|
||||||
}
|
}
|
||||||
@ -733,8 +730,6 @@ void QWaylandWindow::doHandleFrameCallback()
|
|||||||
sendExposeEvent(QRect(QPoint(), geometry().size()));
|
sendExposeEvent(QRect(QPoint(), geometry().size()));
|
||||||
if (wasExposed && hasPendingUpdateRequest())
|
if (wasExposed && hasPendingUpdateRequest())
|
||||||
deliverUpdateRequest();
|
deliverUpdateRequest();
|
||||||
|
|
||||||
mWaitingForUpdateDelivery = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QWaylandWindow::waitForFrameSync(int timeout)
|
bool QWaylandWindow::waitForFrameSync(int timeout)
|
||||||
|
@ -280,7 +280,6 @@ protected:
|
|||||||
WId mWindowId;
|
WId mWindowId;
|
||||||
bool mWaitingForFrameCallback = false;
|
bool mWaitingForFrameCallback = false;
|
||||||
bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out
|
bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out
|
||||||
bool mWaitingForUpdateDelivery = false;
|
|
||||||
int mFrameCallbackCheckIntervalTimerId = -1;
|
int mFrameCallbackCheckIntervalTimerId = -1;
|
||||||
QElapsedTimer mFrameCallbackElapsedTimer;
|
QElapsedTimer mFrameCallbackElapsedTimer;
|
||||||
struct ::wl_callback *mFrameCallback = nullptr;
|
struct ::wl_callback *mFrameCallback = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user