Tuesday, 12 September 2023
Checkpoint restore allows you to safe the state of an application to disk at any given pooint during its execution, and then recover it at that exact point.
Checkpoint restore allows you to safe the state of an application to disk at any given pooint during its execution, and then recover it at that exact point.
In the video we can see applications seamlessly move between Plasma, Gnome, Weston, Hyprland and Sway as part of the wayland robustness project.
This is a video demonstration of a new feature in Qt 6.6 to handle clients surviving a compositor restart.
Tuesday, 12 September 2023. Today KDE releases a bugfix update to KDE Plasma 5, versioned 5.27.8.
Plasma 5.27 was released in February 2023 with many feature refinements and new modules to complete the desktop experience.
This release adds five months' worth of new translations and fixes from KDE's contributors. The bugfixes are typically small but important and include:
Every release has a killer feature. Qt 6.6 features the opposite - staying alive. This blog post describes work to make Qt clients more robust and seemlessly migrate between compositors, providing resistance against compositor crashes and more.
Right now if you restart pulseaudio your sound might cut out, restart NetworkManager and you lose your wifi, restart an X11 window manager and your decorations disappear.
But within a second it's all back to normal exactly where you left off with everything recovering fine.
This isn't true for display servers. If X11 restarts you're back at the login prompt. All drafts lost, games unsaved, work wasted.
For X11 this was unfixable; clients relied on memory stored by the Xserver, they made synchronous calls that were expected to return values, and multiple clients talked to multple clients.
This was a real problem in my early days of Linux, X11 would lock up frequently enough that most distributions had a shortcut key to restart the server and send you back to the login prompt.
It's less of an issue now as X11 has been in a lengthy period of feature freeze.
Wayland makes it possible to fix all this. Memory allocations are client side, all operations are async, all protocols are designed that the compositor always has complete control.
Yet the current user-facing state is considerably worse:
Compositors and displays servers are now the same process, doubling the space for errors
Compositors are typically extensible with 3rd party plugins and scripts
The wayland security model means the compositor absorbs even more functions from global shortcuts to screencasting and input-method handling
The wayland ecosystem is not in a period of feature freeze with wayland protocols constantly evolving to cover missing features and new ideas.
Even if there was a perfect compositor:
40% of kwin's crash bug reports are either upstream or downstream causes
The current compositor developer experience is limited with developers having to relogin and restart their apps and development setup just to test their latest changes.
The solution for this? Instead of exiting when the compositor closes, simply...don't!
If we could connect to a new compositor we just need to send the right amount of information to bring it in sync and notify the application code of any changes to bring this in sync.
For Qt applications all this information is handled in the backend, in the Wayland Qt Platform Abstraction (QPA).
Qt already has to handle screens and input devices being removed, clipboards being revoked and drag and drops cancelled. Supporting a whole reset isn't introducing any new work, we just have to trigger all of these actions at once, then reconnect to the newly restored compositor and restore our contents.
Applications already have to support all of these events too as well as handle callbacks to redraw buffers. There's no changes needed at an application code level, it's all done as transparently as possible.
Handling OpenGL is a challenge, right now we don't have a way to keep that alive. Fortunately we put in lots of effort previously in supporting GPU resets throughout the Qt stack. The QtWayland backend fakes to the applications that a GPU reset has occured through the Qt abstractions.
For the majority of applications including all QtQuick users this happens automatically and flawlessly, building on the work that we put in previously.
Whilst the overall concepts might sound invasive, the final merge-request to support all of this for all Qt applications was fewer lines than supporting middle-click paste.
Almost no work needs doing on the compositor side. For a compositor there's no difference between a new client, and a client that was running previously reconnecting. The only big change we made within Kwin is having a helper process so the whole process can be seemless and race-free.
This post is about Qt, but the world is bigger than that. Not only does this technique work here, but we have pending patches for GTK, SDL and even XWayland, with key parts of SDL merged but disabled already.
The challenge for the other toolkits is we can't use the same OpenGL trick as Qt. They either lack GPU reset handling either at a toolkit level or within the applications.
Supporting OpenGL requires new infrastructure. We've tried from the start to get some infrastructure in place to allow this.It was clear that proposing library changes for client reconnection support was an uphill battle whilst being unproven in the wild.
After Qt6 is rolled out to a wider audience and shown to work reliably, we'll refocus efforts on pushing upstream changes to the other platforms.
This isn't just about crashes. If support becomes mainstream there will be additional opportunities:
We can easily upgrade to new features without having to log out and back. This is one of the reasons why kwin development is happening at such a rapid pace in recent months. We're not having to test in fake nested sessions or waste time logging in and setting up between changes.
We can support multihead, running different compositors per group of outputs and move seemlessly between them.
It's feasible to switch between compositors at runtime. With the application handling the reconnect logic, they can easily handle the case where compositor feature sets vary.
Checkpoint restore in userspace, being able to suspend your application to disk and then pick up where you left off like nothing happened. It could never work for X applications, but with wayland reconnect support we can make it work.
More information about the long term goal this can be found at the kwin wiki, or each out to me directly if you want to add support.
Discuss this at discuss.kde.org.
Man, I wish politics were boring, but that is never going to happen. The only way a party can improve their popularity is by being seen as different and in some way better, so we will always have parties saying exactly that: That the others are wrong and that they are better.
However, in many cases there is actually a right and a wrong way to engage with a problem, so what will happen if one side wants to become popular with the worse solution? Well, lies, propaganda and disinformation of course!
But all of that shouldn't matter. If you have any opinion at all about what policies are good or bad, you can look up for yourself if a specific party worked for or against you in the past. But who wants to figure that out in their free time, really? I certainly don't, but I did it anyway because various elections in Germany are coming up and some parties have been actively working against what the KDE community stands for:
https://wordsmith.social/felixernst/deutscher-wahlkampf-aus-einer-kde-perspektive (German)
Yes, that article is only in German. I don't really want to translate it because I would need to provide a lot of local background knowledge as context. I am also already annoyed enough by Germany's political landscape that I wouldn't want to spend the time figuring out how to explain it to an international readership with varying backgrounds and severity of disinformation.
In any case, I wish all of you will be able to elect the party that is the least corrupt and whose actions (or lack thereof) are the least likely to kill innocent people. Happy voting!
A lot of our code deals with text strings in one way or the other, and often not even with particularly complex ones. Seemingly simple and yet we have a myriad of different APIs for that in Qt. Here are two concrete examples on the impact of picking the right string types and using them correctly.
Qt’s JSON API provides overloads for QString
, QStringView
and QLatin1String
. The latter one is usually
said to be the most efficient option, but it’s also the most restrictive one, basically limiting you to 7bit ASCII string literals.
For JSON keys that is often sufficient though.
For a real-world example let’s look at a pending MR
for KWeatherCore,
which changes much of its JSON code from using QStringLiteral
to QLatin1String
for JSON key constants.
In a size-optimized and stripped release build this reduces the library size by about 7%. This comes in part
from a smaller read-only data section, due to string literals now using 8bit instead of 16bit per
characters, but also from a smaller text section (ie. code), due to the simpler inline construction/destruction
code of QLatin1String
.
FILE SIZE VM SIZE
-------------- --------------
-0.2% -12 -0.3% -12 .hash
-0.7% -24 -0.7% -24 .got.plt
-0.7% -48 -0.7% -48 .plt
-0.2% -62 -0.2% -62 .dynstr
-0.4% -72 -0.4% -72 .dynsym
-0.7% -72 -0.7% -72 .rela.plt
-3.2% -136 -3.2% -136 .eh_frame_hdr
-2.6% -496 -2.6% -496 .eh_frame
-3.3% -2.11Ki -3.4% -2.11Ki .text
-29.7% -8.12Ki -29.8% -8.12Ki .rodata
-7.1% -16.0Ki -5.1% -11.1Ki TOTAL
The runtime impact is harder to measure, as this drowns in the noise here. Less code to run and less data to load certainly doesn’t hurt though.
As QLatin1String
has constexpr
constructors it lends itself for centrally defined string constants, e.g.
for repeatedly used JSON keys. Quotient makes use of this for example.
constexpr QLatin1String my_magic_constant("42");
This works, but looking at the generated binary this shows static construction code being emitted in every translation
unit that includes this definition (independent of use even!). The subtle issue here is the missing inline
keyword:
constexpr inline QLatin1String my_magic_constant("42");
Fixing that in Quotient (PR) decreased the library size by about 3%, the majority of that being contributed by just 10 constants defined in a frequently used header. The savings in this case mainly come from code, and more importantly from code run as part of static construction when the library is loaded, ie. typically on startup.
We are talking about quite small improvements here, in the range of a few percent only. But those are improvements that are basically free (limited effort, limited risk of breakage, code complexity/readability doesn’t change, etc), and they are very widely applicable.
And while a few percent smaller applications might hardly be felt by the user, they easily multiply to big numbers when looking at this from the infrastructure perspective.
So it’s worth paying attention to those seemingly minor details.
This was a big week for backend work, especially on the subject of power management and energy efficiency!
General info – Open issues: 81
Welcome Center’s first page can now be customized by distros–or for that matter, by users (me: Nate Graham, link)
The KDE desktop portal implementation now supports the new cross-desktop accent color standard (Fushan Wen, Plasma 5.27.8 Link)
The separator line between the titlebar/toolbar area in KDE apps and the content below it is now drawn at the correct stroke weight with a high DPI screen (Carl Schwan, Plasma 5.27.8. Link)
KRunner-powered searches now only show you sleep modes that are actually supported by the system, and you can also now find them by searching for the word “power” (Natalie Clarius, Plasma 6.0. Link 1 and link 2)
After the work done last week to improve cursor responsiveness and lower power usage in the Plasma wayland session… we did some more! (Xaver Hugl, Plasma 6.0. Link)
The notifications about low and critically low battery power are now worded in a shorter and clearer way (me: Nate Graham, Plasma 6.0. Link)
The Lock/Logout widget no longer changes in height when configured to only show one item (Yannick, Plasma 6.0. Link)
Improved the keyboard navigation and accessibility properties of Discover’s Reviews viewer and entry page (Ivan Tkachenko, Plasma 6.0. Link 1 and link 2)
(This is a curated list of e.g. HI and VHI priority bugs, Wayland showstoppers, major regressions, etc.)
Fixed a glitch in Dolphin that could cause the view to not display the correct files after clearing the text entered in the search field (Amol Godbole, Dolphin 24.02. Link)
When run in a VM, Plasma now disables auto-suspend as this can sometimes cause the VM to hang (Natalie Clarius, Plasma 5.27.8. Link)
Hybrid Sleep now actually works (Natalie Clarius, Plasma 5.27.8. Link)
System Settings’ Accessibility page no longer erroneously asks you to save your changes when you leave it without having actually made any changes (Jürgen Dev, Plasma 5.27.8. Link)
The Baloo file indexing service no longer re-indexes everything after every reboot when using the Btrfs filesystem (Tomáš Trnka, Frameworks 6.0. Link)
The file dialog is once again capable of saving to files with quotes in their names (Andreas Bontozoglou, Frameworks 6.0. Link)
In various QtWidgets-based apps, star ratings are no longer inaccurate when using icon themes that lack the rating-unrated
icon (Felix Ernst, Frameworks 6.0. Link)
Other bug-related information of interest:
Improved some autotests in Plasma and KPipeWire (Fushan Wen and David Edmundson, link 1 and link 2)
This blog only covers the tip of the iceberg! If you’re hungry for more, check out https://planet.kde.org, where you can find more news from other KDE contributors.
If you’re a developer, work on Qt6/KF6/Plasma 6 issues! Plasma 6 is usable for daily driving now, but still in need of bugfixing and polishing to get it into a releaseable state by the end of the year.
Otherwise, visit https://community.kde.org/Get_Involved to discover other ways to be part of a project that really matters. Each contributor makes a huge difference in KDE; you are not a number or a cog in a machine! You don’t have to already be a programmer, either. I wasn’t when I got started. Try it, you’ll like it! We don’t bite!
And finally, KDE can’t work without financial support, so consider making a donation today! This stuff ain’t cheap and KDE e.V. has ambitious hiring goals. We can’t meet them without your generous donations!
KDE e.V. held its annual general meeting (German) online and at the KDE e.V. offices in Berlin. During the AGM, elections for three vacancies on the board of directors were held. Members Aleix Pol, Eike Hein, and Lydia Pintscher were (re)elected to the board.
There were no public votes or decisions in the third quarter of 2023 other than those described in the minutes of the AGM.