Repository navigation
Conversation
oSoMoN
requested changes
Oct 13, 2026
oSoMoN
left a comment
Collaborator
There was a problem hiding this comment.
"dbus.cpp" is a very generic name that suggests it contains general dbus scaffolding code, can it be renamed to reflect its specific purpose?
In the future we may need to factor out some common D-Bus helpers, and I can imagine that they would go into a dbus.{h,cpp} pair of files.
nfraprado
force-pushed
the
dbus-prepare-for-sleep-display-off
branch
from
October 16, 2026 15:10
c3b38b0 to
a912dc3
Compare
oSoMoN
reviewed
Oct 16, 2026
nfraprado
force-pushed
the
dbus-prepare-for-sleep-display-off
branch
from
October 21, 2026 19:20
a912dc3 to
9db305b
Compare
Author
|
Thank you for the feedback. I've addressed all the feedback from this second pass, and also did a few other tweaks while at it. |
oSoMoN
approved these changes
Oct 26, 2026
oSoMoN
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Just a couple of minor suggestions inline, and this will be good to merge.
Hook into the PrepareForSleep D-Bus signal from logind and trigger screen sleep before the system goes to sleep. This improves the user experience when the system goes into hibernation, since currently during the time window between when userspace threads get frozen and the display driver in the kernel gets suspended, which can take a few seconds, the last image on the screen stays frozen. Furthermore, on some platforms like the Steam Machine, during this time window the last second of audio also gets repeated in a loop. By turning off the display early in the hibernation process, we avoid both issues and give a smoother experience to the user. This also mimics the behavior from KDE plasma. In order to achieve this: * Extend the backend interface to expose screen sleep functionality (which is currently only supported by the DRM backend) and make the new code a no-op when the backend doesn't support it. * Spawn a new thread and rely on libsystemd to listen for the PrepareForSleep signal from logind and turn the display off/on in response, and take an inhibitor lock to delay system sleep until the screen has been turned off. * In the DRM backend, make the atomic commit blocking for screen sleep operations and update the sleep status after commit to allow callers to wait for the sleep to actually be applied on hardware. The introduced dependency on libsystemd is optional and in practice is not new: the only backend that currently supports screen sleep is DRM, and it already requires libsystemd indirectly, since it requires the libinput backend in wlroots, which requires libseat, which in turn requires libsystemd. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
nfraprado
force-pushed
the
dbus-prepare-for-sleep-display-off
branch
from
October 27, 2026 21:10
9db305b to
3c9e30c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hook into the PrepareForSleep D-Bus signal from logind and trigger screen sleep before the system goes to sleep. This improves the user experience when the system goes into hibernation, since currently during the time window between when userspace threads get frozen and the display driver in the kernel gets suspended, which can take a few seconds, the last image on the screen stays frozen. Furthermore, on some platforms like the Steam Machine, during this time window the last second of audio also gets repeated in a loop. By turning off the display early in the hibernation process, we avoid both issues and give a smoother experience to the user. This also mimicks the behavior from KDE plasma.
In order to achieve this:
The introduced dependency on libsystemd is optional and in practice is not new: the only backend that currently supports screen sleep is DRM, and it already requires libsystemd indirectly, since it requires the libinput backend in wlroots, which requires libseat, which in turn requires libsystemd.