Wayland Clients Can Now Survive Qt Wayland Crashes / Compositor Restarts
A change merged to Qt this week can allow for Wayland clients to survive compositor restarts, such as when the compositor crashes.
KDE developer David Edmundson landed the Qt Wayland improvement so clients can optionally survive compositor restarts. Edmundson explained in this merge:
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.
The functionality for Qt Wayland currently needs to be activated via the QT_WAYLAND_RECONNECT environment variable. This change will be introduced with Qt 6.6 later in the year.