|
|
f38a11 |
From a97759d032a40045551546ca17300891d4067ee4 Mon Sep 17 00:00:00 2001
|
|
|
b814f0 |
From: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
b814f0 |
Date: Tue, 1 Feb 2022 13:05:36 +0200
|
|
|
f38a11 |
Subject: [PATCH 35/40] Client: Remove mWaitingForUpdateDelivery
|
|
|
b814f0 |
|
|
|
b814f0 |
Currently, mWaitingForUpdateDelivery is shared between the main thread
|
|
|
b814f0 |
(doHandleFrameCallback()) and the frame callback event thread
|
|
|
b814f0 |
(handleFrameCallback()), however the access to it is not synchronized
|
|
|
b814f0 |
between both threads. On the other hand, QWaylandWindow
|
|
|
b814f0 |
already ensures not to create a frame callback if there's already one
|
|
|
b814f0 |
pending.
|
|
|
b814f0 |
|
|
|
b814f0 |
This change removes mWaitingForUpdateDelivery flag because it should be
|
|
|
b814f0 |
already covered by mWaitingForFrameCallback and to remove unsynchronized
|
|
|
b814f0 |
shared state between threads.
|
|
|
b814f0 |
|
|
|
b814f0 |
Change-Id: I0e5a25d18d1e66c4d7683e7e972330c4d7cbbf38
|
|
|
b814f0 |
Reviewed-by: David Edmundson <davidedmundson@kde.org>
|
|
|
b814f0 |
(cherry picked from commit feb1a5c207c13d0bf87c0d8ad039279dbf8cee9e)
|
|
|
b814f0 |
---
|
|
|
b814f0 |
src/client/qwaylandwindow.cpp | 29 ++++++++++++-----------------
|
|
|
b814f0 |
src/client/qwaylandwindow_p.h | 1 -
|
|
|
b814f0 |
2 files changed, 12 insertions(+), 18 deletions(-)
|
|
|
b814f0 |
|
|
|
b814f0 |
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
|
|
|
b814f0 |
index 4c5711a0..949374b1 100644
|
|
|
b814f0 |
--- a/src/client/qwaylandwindow.cpp
|
|
|
b814f0 |
+++ b/src/client/qwaylandwindow.cpp
|
|
|
b814f0 |
@@ -648,23 +648,18 @@ void QWaylandWindow::handleFrameCallback()
|
|
|
b814f0 |
mFrameCallbackElapsedTimer.invalidate();
|
|
|
b814f0 |
|
|
|
b814f0 |
// The rest can wait until we can run it on the correct thread
|
|
|
b814f0 |
- if (!mWaitingForUpdateDelivery) {
|
|
|
b814f0 |
- auto doHandleExpose = [this]() {
|
|
|
b814f0 |
- bool wasExposed = isExposed();
|
|
|
b814f0 |
- mFrameCallbackTimedOut = false;
|
|
|
b814f0 |
- if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed?
|
|
|
b814f0 |
- sendExposeEvent(QRect(QPoint(), geometry().size()));
|
|
|
b814f0 |
- if (wasExposed && hasPendingUpdateRequest())
|
|
|
b814f0 |
- deliverUpdateRequest();
|
|
|
b814f0 |
-
|
|
|
b814f0 |
- mWaitingForUpdateDelivery = false;
|
|
|
b814f0 |
- };
|
|
|
b814f0 |
-
|
|
|
b814f0 |
- // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync()
|
|
|
b814f0 |
- // in the single-threaded case.
|
|
|
b814f0 |
- mWaitingForUpdateDelivery = true;
|
|
|
b814f0 |
- QMetaObject::invokeMethod(this, doHandleExpose, Qt::QueuedConnection);
|
|
|
b814f0 |
- }
|
|
|
b814f0 |
+ auto doHandleExpose = [this]() {
|
|
|
b814f0 |
+ bool wasExposed = isExposed();
|
|
|
b814f0 |
+ mFrameCallbackTimedOut = false;
|
|
|
b814f0 |
+ if (!wasExposed && isExposed()) // Did setting mFrameCallbackTimedOut make the window exposed?
|
|
|
b814f0 |
+ sendExposeEvent(QRect(QPoint(), geometry().size()));
|
|
|
b814f0 |
+ if (wasExposed && hasPendingUpdateRequest())
|
|
|
b814f0 |
+ deliverUpdateRequest();
|
|
|
b814f0 |
+ };
|
|
|
b814f0 |
+
|
|
|
b814f0 |
+ // Queued connection, to make sure we don't call handleUpdate() from inside waitForFrameSync()
|
|
|
b814f0 |
+ // in the single-threaded case.
|
|
|
b814f0 |
+ QMetaObject::invokeMethod(this, doHandleExpose, Qt::QueuedConnection);
|
|
|
b814f0 |
|
|
|
b814f0 |
mFrameSyncWait.notify_all();
|
|
|
b814f0 |
}
|
|
|
b814f0 |
diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h
|
|
|
b814f0 |
index d45980a8..3ff68ccb 100644
|
|
|
b814f0 |
--- a/src/client/qwaylandwindow_p.h
|
|
|
b814f0 |
+++ b/src/client/qwaylandwindow_p.h
|
|
|
b814f0 |
@@ -228,7 +228,6 @@ protected:
|
|
|
b814f0 |
WId mWindowId;
|
|
|
b814f0 |
bool mWaitingForFrameCallback = false;
|
|
|
b814f0 |
bool mFrameCallbackTimedOut = false; // Whether the frame callback has timed out
|
|
|
b814f0 |
- bool mWaitingForUpdateDelivery = false;
|
|
|
b814f0 |
int mFrameCallbackCheckIntervalTimerId = -1;
|
|
|
b814f0 |
QElapsedTimer mFrameCallbackElapsedTimer;
|
|
|
b814f0 |
struct ::wl_callback *mFrameCallback = nullptr;
|
|
|
b814f0 |
--
|
|
|
b814f0 |
2.35.1
|
|
|
b814f0 |
|