Wayland Clients Can Now Survive Qt Wayland Crashes / Compositor Restarts

Written by Michael Larabel in Qt on 8 March 2023 at 08:24 AM EST. 139 Comments
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.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week