summaryrefslogtreecommitdiff
path: root/src/client/qwaylandwindow.cpp
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2022-01-28 16:24:32 +0000
committerDavid Edmundson <davidedmundson@kde.org>2023-03-07 13:26:50 +0000
commit26d8603b523af973682b7e602f1158ae62f21c9b (patch)
treecf5223fea624e961af7150fdde44bdf1e9cfa27a /src/client/qwaylandwindow.cpp
parent83599e16789f945ef15954f2a2aabb37b245e596 (diff)
downloadqtwayland-26d8603b523af973682b7e602f1158ae62f21c9b.tar.gz
Introduce path for surviving compositor restarts
This patch introduces an optional mechanism for clients to survive a crash and reconnect seemingly seamlessly. In the event of a disconnect from the compositor socket we simply try to reconnect again and replay any data needed so that we maintain a consistent state to where we left off. From an application point-of-view any open popups will be dismissed and we we potentially get a new framecallback, but it will be almost entirely transparent. Users of custom QWaylandClientExtensions will be notified via the activeChanged signal and rebuild as though the compositor had withdrawn and re-announced the global. OpenGL contexts will be marked as invalid, and handled the same way as a GPU reset. On the next frame RHI will notice these are invalid and recreate them, only now against a new wl_display and new EGLDisplay. Users of low level EGL/native objects might be affected, but the alternative at this point is being closed anyway. The entire codepath is only activated via an environment variable. Change-Id: I6c4acc885540e14cead7640794df86dd974fef4f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/client/qwaylandwindow.cpp')
-rw-r--r--src/client/qwaylandwindow.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp
index a77cce5a..90f4c609 100644
--- a/src/client/qwaylandwindow.cpp
+++ b/src/client/qwaylandwindow.cpp
@@ -291,11 +291,21 @@ void QWaylandWindow::reset()
mFrameCallbackElapsedTimer.invalidate();
mWaitingForFrameCallback = false;
}
+ if (mFrameCallbackCheckIntervalTimerId != -1) {
+ killTimer(mFrameCallbackCheckIntervalTimerId);
+ mFrameCallbackCheckIntervalTimerId = -1;
+ }
+
mFrameCallbackTimedOut = false;
mWaitingToApplyConfigure = false;
+ mCanResize = true;
+ mResizeDirty = false;
+ mOpaqueArea = QRegion();
mMask = QRegion();
+
mQueuedBuffer = nullptr;
+ mQueuedBufferDamage = QRegion();
mDisplay->handleWindowDestroyed(this);
}
@@ -1623,6 +1633,16 @@ void QWaylandWindow::closeChildPopups() {
popup->reset();
}
}
+
+void QWaylandWindow::reinit()
+{
+ if (window()->isVisible()) {
+ initWindow();
+ if (hasPendingUpdateRequest())
+ deliverUpdateRequest();
+ }
+}
+
}
QT_END_NAMESPACE