Windows: display mode not kept and revert fails when displays are powered off (regression from #5625)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 22/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- cpp
- Domain
- desktop, operating-systems
Research direction
Start with the Windows display device code, WinDisplayDevice, where SDC_SAVE_TO_DATABASE is reportedly no longer set, and with the libdisplaydevice bump in commit e9b24114. Check how the mode is applied and reverted when the display is off, and compare against the earlier libdisplaydevice revision 6e9722f. Done means the requested mode survives stream start, and the original mode and HDR state are restored at stream end when the display is powered off.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your issue described in the documentation?
- I have read the documentation
Is your issue present in the latest beta/pre-release?
This issue is present in the latest pre-release
Describe the Bug
Since #5625 (and the libdisplaydevice update that came with it), display configuration breaks on my host if Windows has turned the displays off (display idle timeout) by the time a client connects. The mode change at stream start doesn't stick, and the revert at stream end fails. v2026.914.233613 handled the same setup fine every time.
At stream start the mode change reports success, but 0.2 s later the desktop is back at its original resolution, so the client gets a scaled-down 4K desktop:
[2026-10-15 21:07:52.469]: Info: Changing display modes to:
"{4236e3ab-60af-5eba-8de2-b4f439c20277}": { "refresh_rate": 120/1, "resolution": { "height": 1080, "width": 1920 } }
[2026-10-15 21:07:52.522]: Info: Changing HDR states to:
"{4236e3ab-60af-5eba-8de2-b4f439c20277}": "Disabled"
[2026-10-15 21:07:52.595]: Info: Display device configuration applied successfully.
[2026-10-15 21:07:52.598]: Info: Encoder reenumeration is required
[2026-10-15 21:07:52.804]: Info: Desktop resolution [3840x2160]
The HDR change does apply (capture is SDR afterwards). Only the mode gets lost. My guess: the mode isn't written to the display database anymore (SDC_SAVE_TO_DATABASE is now off in WinDisplayDevice), so Windows restores the saved mode while the displays are off.
At stream end the revert can't find the display, and it stays in the stream's state (HDR off) until I change it by hand:
[2026-10-15 21:11:07.790]: Info: Trying to revert applied display device settings. API is available: true
[2026-10-15 21:11:07.791]: Error: Device {4236e3ab-60af-5eba-8de2-b4f439c20277} does not exist in the available path source data!
[2026-10-15 21:11:07.791]: Error: Failed to change topology to:
[2026-10-15 21:11:07.792]: Warning: Some modified devices are unavailable, reverting settings for the remaining topology:
[]
[2026-10-15 21:11:07.793]: Error: Device {4236e3ab-60af-5eba-8de2-b4f439c20277} does not exist in the available path source data!
[2026-10-15 21:11:07.794]: Warning: Failed to revert display device configuration (will retry once devices are added or removed).
The display is connected and active the whole time (single display, no dock). Reverting e9b24114 together with the libdisplaydevice bump (back to 6e9722f) brings the old behaviour back.
Setup: one LG OLED TV on HDMI, nothing else connected. Desktop is 3840x2160 @ 120 Hz with HDR on, and the client (ROG Xbox Ally X) asks for 1920x1080 SDR.
Config: dd_configuration_option = ensure_active, dd_config_revert_delay = 3000, dd_config_revert_on_disconnect = enabled, resolution/refresh/HDR options left on their defaults (automatic). Windows had turned the displays off a few minutes before the client connected.
One thing about my build: the TV gets woken before Sunshine configures the display (it's on, screen off). That's done by one extra commit that runs a command before configure_display(). It doesn't change any display configuration code.
Expected Behavior
The client's mode (1920x1080) stays applied for the whole stream, and the original mode and HDR state come back when the stream ends, like on v2026.914.233613.
Additional Context
On my build of v2026.914.233613 (same extra commit), every connect I checked, 6 on Oct 13-14, applied 1920x1080 and reverted correctly; at least 4 of those were with the displays turned off by Windows. The first connect on a build with #5625, on Oct 15, broke both the mode change and the revert.
Host Operating System
Windows
Operating System Version
Windows 11 Pro 25H2 (10.0.26200)
Architecture
amd64/x86_64
Package
other (fork of this repo)
Sunshine commit or version
2026.1014.154843 (upstream master a178f465 plus one extra commit, see above). Last working: my build of 2026.914.233613 (commit 63d35f7, same extra commit)
GPU Type
NVIDIA
GPU Model
NVIDIA GeForce RTX 5080 (plus an AMD integrated GPU, not used for display)
GPU Driver/Mesa Version
617.42
Capture Method
Desktop Duplication API (Windows)
Apps
No response
Log output
The excerpts above are copied straight from the failing session's log. The full log got rotated away by later service restarts.
Online logs
No response
- Dominant language
- C++
- Stars
- 42.2k
- Forks
- 2.2k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 121
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from LizardByte/Sunshine
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
LizardByte/Sunshine#5953 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
LizardByte/Sunshine#5795 ·
Maintainers usually reply within 1 day
-
PIN pairing fails with "Missing CSRF token" - web UI never fetches/attaches the tokenMay be free again A pull request for this issue was closed without being merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
LizardByte/Sunshine#5467 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
LizardByte/Sunshine#5956 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 15/100
LizardByte/Sunshine#5940 · 3 comments ·
Maintainers usually reply within 1 day
All issues in LizardByte/Sunshine
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 95/100
rocketride-org/rocketride-server#2705 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ROCm/rocm-systems#13754 · 2 comments ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
neutralinojs/neutralinojs#1861 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
raspberrypi/libpisp#80 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
nanoporetech/pod5-file-format#198 ·