Sunshine icon indicating copy to clipboard operation
Sunshine copied to clipboard

Add new API to modify display devices for Windows

Open FrogTheFrog opened this issue 1 year ago • 25 comments

This is a continuation of the https://github.com/LizardByte/Sunshine/pull/2032 PR after a rebase fiasco...

Description

New changes allow for Sunshine to control display devices on Windows, such as:

  • changing display mode (resolution and refresh rate);
  • activating/deactivating displays;
  • enabling/disabling HDR;

It also moves away from the \\.\DISPLAY1-like configurable output names to proper that are pretty persistent (IDs changed a little after I reinstalled my GPU drivers, after DDU).

The applied changes are saved additionally saved to a file in case the PC dies or something so that Sunshine can undo the changes once it is started again.

Screenshot

Example of the new options exposed to the user:

image image image image image

Type of Change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [x] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] Dependency update (updates to dependencies)
  • [ ] Documentation update (changes to documentation)
  • [ ] Repository update (changes to repository files, e.g. .github/...)

Checklist

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have added or updated the in code docstring/documentation-blocks for new or existing methods/components

Branch Updates

LizardByte requires that branches be up-to-date before merging. This means that after any PR is merged, this branch must be updated before it can be merged. You must also Allow edits from maintainers.

  • [x] I want maintainers to keep my branch updated

Known issues (all resolved)

  • ~~IDD HDR driver displays high-contrast colors when the display is activated and was inactive before. Seems to be a driver issue, since it does not happen with HDR dongle. A workaround would be to reset all the HDR states to off and then on again, but I don't think we should implement this workaround for this.~~
  • ~~Sound fails to reset back to whatever was used before after the stream ends if a new display (without the same sink) was the only active display.~~

FrogTheFrog avatar May 26 '24 16:05 FrogTheFrog

Codecov Report

Attention: Patch coverage is 1.10529% with 1700 lines in your changes missing coverage. Please review.

Project coverage is 8.80%. Comparing base (f4dda21) to head (b6f8573). Report is 116 commits behind head on master.

Files with missing lines Patch % Lines
.../platform/windows/display_device/windows_utils.cpp 0.00% 310 Missing :warning:
src/platform/windows/display_device/settings.cpp 0.00% 268 Missing :warning:
src/display_device/parsed_config.cpp 0.39% 176 Missing and 75 partials :warning:
...latform/windows/display_device/device_topology.cpp 0.00% 188 Missing :warning:
...c/platform/windows/display_device/device_modes.cpp 0.00% 143 Missing :warning:
src/display_device/session.cpp 1.06% 68 Missing and 25 partials :warning:
...tform/windows/display_device/settings_topology.cpp 0.00% 88 Missing :warning:
src/display_device/to_string.cpp 0.00% 48 Missing and 39 partials :warning:
...tform/windows/display_device/general_functions.cpp 2.98% 64 Missing and 1 partial :warning:
...tform/windows/display_device/device_hdr_states.cpp 0.00% 44 Missing :warning:
... and 17 more
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #2582      +/-   ##
=========================================
- Coverage    9.57%   8.80%   -0.77%     
=========================================
  Files          97     115      +18     
  Lines       17586   19289    +1703     
  Branches     8336    9275     +939     
=========================================
+ Hits         1683    1699      +16     
- Misses      13174   14529    +1355     
- Partials     2729    3061     +332     
Flag Coverage Δ
Linux 6.72% <1.33%> (-0.23%) :arrow_down:
Windows 4.54% <0.49%> (-0.54%) :arrow_down:
macOS-12 9.80% <1.89%> (-0.49%) :arrow_down:
macOS-13 9.72% <1.89%> (-0.48%) :arrow_down:
macOS-14 10.01% <1.89%> (-0.51%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/audio.h 50.00% <100.00%> (+50.00%) :arrow_up:
src/audio.cpp 29.07% <75.00%> (+0.50%) :arrow_up:
src/config.h 0.00% <0.00%> (ø)
src/display_device/parsed_config.h 0.00% <0.00%> (ø)
src/display_device/session.h 0.00% <0.00%> (ø)
src/process.cpp 1.34% <0.00%> (-0.01%) :arrow_down:
src/platform/windows/display_base.cpp 12.92% <0.00%> (-0.03%) :arrow_down:
...latform/windows/display_device/settings_topology.h 0.00% <0.00%> (ø)
...rc/platform/windows/display_device/windows_utils.h 0.00% <0.00%> (ø)
src/video.cpp 25.25% <50.00%> (-0.05%) :arrow_down:
... and 18 more

... and 19 files with indirect coverage changes

codecov[bot] avatar May 26 '24 17:05 codecov[bot]

Due to recent changes to the docs, all the doc changes to ./docs/source/source* can be dropped from this PR.

ReenigneArcher avatar Jun 25 '24 15:06 ReenigneArcher

Very little note while I was going through my comments.. But HDR control may require a "extra" mode to plug into nvapi (which somehow I just noticed you already pulled in as a dependency?) for games that do their magic through it.

mirh avatar Jun 28 '24 21:06 mirh

Very little note while I was going through my comments.. But HDR control may require a "extra" mode to plug into nvapi (which somehow I just noticed you already pulled in as a dependency?) for games that do their magic through it.

For now this PR will focus on interacting with Windows API only and enabling "global" HDR setting only.

FrogTheFrog avatar Jun 28 '24 22:06 FrogTheFrog

I can't wait for this PR to get merged, I can't stress how amazing this is, thank you! If I were to take this, build it, install, would everything work as expected aside from a bug here or there? Assuming this would be the case but just want to verify since I'm not involved in this project.

bradleycundari avatar Jul 03 '24 12:07 bradleycundari

I can't wait for this PR to get merged, I can't stress how amazing this is, thank you! If I were to take this, build it, install, would everything work as expected aside from a bug here or there? Assuming this would be the case but just want to verify since I'm not involved in this project.

I play almost every day with this dev on Windows 11 and I have no problems. You can download it with your eyes closed

moi952 avatar Jul 03 '24 12:07 moi952

@bradleycundari as moi952 just mentioned, you can download Github artifacts. However, they are needlessly hidden for someone without some previous knowledge: image image image

FrogTheFrog avatar Jul 03 '24 12:07 FrogTheFrog

Yes, that was already being (very very confusedly) requested here. Though let's appreciate this is already a very hefty 6K loc addition. The rest can wait.

mirh avatar Jul 04 '24 11:07 mirh

Please don't hijack this PR for off-topic discussions.

FrogTheFrog avatar Jul 04 '24 12:07 FrogTheFrog

I hope it's ok if I give some feedback after using this branch for a bit. It works very well, but I found that if I change my monitor configuration it can enter into a state that's unrecoverable, so I have to Win+P to get my monitor back, then resetup my displays. I was hoping on failure it could still restore my present monitors, instead of failing the all the monitors restore if one is no longer connected.

I think i may have to restart my sunshine server every time my monitor configuration changes so it can snapshot the current state, when it might be more convenient to just restore to the state before the current session, for all monitors that you can still ID as available. image

[2024:07:21:14:56:32]: Info: Sunshine version: 0.0.0.16febac0483d3107c266e6e84e0891b1126f8de9
[2024:07:21:14:56:32]: Info: Available display devices: 
DEVICE ID: {11374da5-3326-592c-a729-84763d7ee42a}
DISPLAY NAME: \\.\DISPLAY4
FRIENDLY NAME: BenQ GW2765
DEVICE STATE: PRIMARY
HDR STATE: UNKNOWN
-----------------------
DEVICE ID: {5ae0f01c-ca36-56ca-80bc-d6764ad5ef86}
DISPLAY NAME: \\.\DISPLAY1
FRIENDLY NAME: BenQ GW2765
DEVICE STATE: ACTIVE
HDR STATE: UNKNOWN
-----------------------
DEVICE ID: {6f6b3d17-756d-5f20-96b0-d83d19ada497}
DISPLAY NAME: \\.\DISPLAY3
FRIENDLY NAME: HMD-A440
DEVICE STATE: ACTIVE
HDR STATE: UNKNOWN
-----------------------
DEVICE ID: {d05cd62a-e131-5bd8-8f21-b743818ba67d}
DISPLAY NAME: \\.\DISPLAY2
FRIENDLY NAME: LG ULTRAGEAR+
DEVICE STATE: ACTIVE
HDR STATE: DISABLED
-----------------------
DEVICE ID: {e4e51468-35d5-5833-8b43-41ab3f6abc91}
DISPLAY NAME: NOT AVAILABLE
FRIENDLY NAME: IDD HDR
DEVICE STATE: INACTIVE
HDR STATE: UNKNOWN
[2024:07:21:14:56:32]: Warning: Reverting display settings will fail - retrying later...
[2024:07:21:14:56:32]: Info: nvprefs: Opened undo file from previous improper termination
[2024:07:21:14:56:32]: Info: nvprefs: Restored OGL_CPL_PREFER_DXPRESENT for base profile
[2024:07:21:14:56:32]: Info: nvprefs: Restored global profile settings from undo file - deleting the file
[2024:07:21:14:56:32]: Info: nvprefs: No need to modify application profile settings
[2024:07:21:14:56:32]: Info: nvprefs: Changed OGL_CPL_PREFER_DXPRESENT to OGL_CPL_PREFER_DXPRESENT_PREFER_ENABLED for base profile
[2024:07:21:14:56:33]: Info: Compiling shaders...
[2024:07:21:14:56:33]: Info: Compiled shaders
[2024:07:21:14:56:33]: Warning: Gamepad x360 is disabled due to gamepads.vigem-not-available
[2024:07:21:14:56:33]: Warning: Gamepad ds4 is disabled due to gamepads.vigem-not-available
[2024:07:21:14:56:33]: Warning: No gamepad input is available
[2024:07:21:14:56:33]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:07:21:14:56:33]: Info: Trying encoder [nvenc]
[2024:07:21:14:56:34]: Info: ddprobe.exe [1] [] returned: 0x00000000
[2024:07:21:14:56:34]: Info: Set GPU preference: 1
[2024:07:21:14:56:34]: Info: 
Device Description : NVIDIA GeForce RTX 4070 Ti
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00002782
Device Video Mem   : 11996 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 32653 MiB
Feature Level      : 0x0000B100
Capture size       : 1024x768
Offset             : 0x595
Virtual Desktop    : 6464x2560
[2024:07:21:14:56:34]: Info: Active GPU has HAGS enabled
[2024:07:21:14:56:34]: Info: Using realtime GPU priority
[2024:07:21:14:56:34]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.639648,0.330078]
Green Primary      : [0.299805,0.599609]
Blue Primary       : [0.149414,0.0595703]
White Point        : [0.3125,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
[2024:07:21:14:56:34]: Info: Desktop resolution [1024x768]
[2024:07:21:14:56:34]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2024:07:21:14:56:34]: Info: Display refresh rate [60.004Hz]
[2024:07:21:14:56:34]: Info: Requested frame rate [60fps]
[2024:07:21:14:56:34]: Info: SDR color coding [Rec. 601]
[2024:07:21:14:56:34]: Info: Color depth: 8-bit
[2024:07:21:14:56:34]: Info: Color range: [JPEG]
[2024:07:21:14:56:34]: Info: System tray created
[2024:07:21:14:56:34]: Info: NvEnc: created encoder P4 two-pass rfi
[2024:07:21:14:56:34]: Info: SDR color coding [Rec. 601]
[2024:07:21:14:56:34]: Info: Color depth: 8-bit
[2024:07:21:14:56:34]: Info: Color range: [JPEG]
[2024:07:21:14:56:35]: Info: NvEnc: created encoder P4 two-pass rfi
[2024:07:21:14:56:35]: Info: SDR color coding [Rec. 601]
[2024:07:21:14:56:35]: Info: Color depth: 8-bit
[2024:07:21:14:56:35]: Info: Color range: [JPEG]
[2024:07:21:14:56:35]: Info: NvEnc: created encoder P4 two-pass rfi
[2024:07:21:14:56:35]: Info: 
Device Description : NVIDIA GeForce RTX 4070 Ti
Device Vendor ID   : 0x000010DE
Device Device ID   : 0x00002782
Device Video Mem   : 11996 MiB
Device Sys Mem     : 0 MiB
Share Sys Mem      : 32653 MiB
Feature Level      : 0x0000B100
Capture size       : 1024x768
Offset             : 0x595
Virtual Desktop    : 6464x2560
[2024:07:21:14:56:35]: Info: Active GPU has HAGS enabled
[2024:07:21:14:56:35]: Info: Using realtime GPU priority
[2024:07:21:14:56:35]: Info: 
Colorspace         : DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709
Bits Per Color     : 8
Red Primary        : [0.639648,0.330078]
Green Primary      : [0.299805,0.599609]
Blue Primary       : [0.149414,0.0595703]
White Point        : [0.3125,0.329102]
Min Luminance      : 0.5 nits
Max Luminance      : 270 nits
Max Full Luminance : 270 nits
[2024:07:21:14:56:35]: Info: Desktop resolution [1024x768]
[2024:07:21:14:56:35]: Info: Desktop format [DXGI_FORMAT_B8G8R8A8_UNORM]
[2024:07:21:14:56:35]: Info: Display refresh rate [60.004Hz]
[2024:07:21:14:56:35]: Info: Requested frame rate [60fps]
[2024:07:21:14:56:35]: Info: SDR color coding [Rec. 709]
[2024:07:21:14:56:35]: Info: Color depth: 10-bit
[2024:07:21:14:56:35]: Info: Color range: [JPEG]
[2024:07:21:14:56:35]: Info: NvEnc: created encoder P4 10-bit two-pass rfi
[2024:07:21:14:56:35]: Info: SDR color coding [Rec. 709]
[2024:07:21:14:56:35]: Info: Color depth: 10-bit
[2024:07:21:14:56:35]: Info: Color range: [JPEG]
[2024:07:21:14:56:35]: Info: NvEnc: created encoder P4 10-bit two-pass rfi
[2024:07:21:14:56:35]: Info: 
[2024:07:21:14:56:35]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:07:21:14:56:35]: Info: 
[2024:07:21:14:56:35]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2024:07:21:14:56:35]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2024:07:21:14:56:35]: Info: Found AV1 encoder: av1_nvenc [nvenc]
[2024:07:21:14:56:35]: Info: Configuration UI available at [https://localhost:47990]
[2024:07:21:14:56:36]: Info: Registered Sunshine mDNS service
[2024:07:21:14:56:37]: Info: Loading persistent display device settings.
[2024:07:21:18:50:48]: Info: Applying configuration to the display device.
[2024:07:21:18:50:49]: Info: Available display devices: 
DEVICE ID: {11374da5-3326-592c-a729-84763d7ee42a}
DISPLAY NAME: \\.\DISPLAY1
FRIENDLY NAME: BenQ GW2765
DEVICE STATE: PRIMARY
HDR STATE: UNKNOWN
-----------------------
DEVICE ID: {5ae0f01c-ca36-56ca-80bc-d6764ad5ef86}
DISPLAY NAME: \\.\DISPLAY2
FRIENDLY NAME: BenQ GW2765
DEVICE STATE: ACTIVE
HDR STATE: UNKNOWN
-----------------------
DEVICE ID: {6f6b3d17-756d-5f20-96b0-d83d19ada497}
DISPLAY NAME: \\.\DISPLAY4
FRIENDLY NAME: HMD-A440
DEVICE STATE: ACTIVE
HDR STATE: UNKNOWN
-----------------------
DEVICE ID: {d05cd62a-e131-5bd8-8f21-b743818ba67d}
DISPLAY NAME: \\.\DISPLAY3
FRIENDLY NAME: LG ULTRAGEAR+
DEVICE STATE: ACTIVE
HDR STATE: DISABLED
-----------------------
DEVICE ID: {e4e51468-35d5-5833-8b43-41ab3f6abc91}
DISPLAY NAME: NOT AVAILABLE
FRIENDLY NAME: IDD HDR
DEVICE STATE: INACTIVE
HDR STATE: UNKNOWN
[2024:07:21:18:50:49]: Info: Changing display topology to: 
[
    [
        {e4e51468-35d5-5833-8b43-41ab3f6abc91}
    ]
]
[2024:07:21:18:50:49]: Info: Changing display modes to: 
{e4e51468-35d5-5833-8b43-41ab3f6abc91} -> 3840x2160x60
[2024:07:21:18:50:49]: Info: Changing hdr states to: 
{e4e51468-35d5-5833-8b43-41ab3f6abc91} -> ENABLED
[2024:07:21:18:50:51]: Info: Display device configuration applied.
[2024:07:21:18:50:51]: Info: Encoder reenumeration is required
[2024:07:21:18:50:51]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
[2024:07:21:18:50:51]: Info: Trying encoder [nvenc]
[2024:07:21:18:50:51]: Info: 
...
[2024:07:22:05:59:41]: Info: Changing display topology back to: 
[
    [
        {11374da5-3326-592c-a729-84763d7ee42a}
    ],
    [
        {5ae0f01c-ca36-56ca-80bc-d6764ad5ef86}
    ],
    [
        {d05cd62a-e131-5bd8-8f21-b743818ba67d}
    ],
    [
        {6f6b3d17-756d-5f20-96b0-d83d19ada497}
    ]
]
[2024:07:22:05:59:41]: Error: Device {6f6b3d17-756d-5f20-96b0-d83d19ada497} does not exist in the available topology data!
[2024:07:22:05:59:41]: Error: Failed to switch back to the initial topology!
[2024:07:22:05:59:41]: Error: Failed to revert display device settings!
[2024:07:22:05:59:46]: Info: Reverting display device settings.

kanjieater avatar Jul 22 '24 12:07 kanjieater

@kanjieater Since I do not know which monitor is gone, I cannot just stop trying to restore the initial configuration.

However, what about an intermediate phase? Like this:

  1. Initial displays: [[A], [B], [C], [D]]
  2. Activated display: [[E]]
  3. ...
  4. Trying to restore: [[A], [B], [C], [D]], but missing [A] and [B].
  5. Restore [[C], [D]]
  6. Keep trying to restore [[A], [B], [C], [D]]
  7. User has to click the "Reset Persistence" in Sunshine to stop

FrogTheFrog avatar Jul 22 '24 12:07 FrogTheFrog

@FrogTheFrog sorry for interfering, but do we even want to mess with manual restoration of multiple displays? Just switch to "pc screen only" topology with whatever display we want. Then switch the topology back to "extend" on the way out, windows can figure out what and how it wants to restore.

ns6089 avatar Jul 22 '24 13:07 ns6089

@kanjieater Since I do not know which monitor is gone, I cannot just stop trying to restore the initial configuration.

However, what about an intermediate phase? Like this:

  1. Initial displays: [[A], [B], [C], [D]]
  2. Activated display: [[E]]
  3. ...
  4. Trying to restore: [[A], [B], [C], [D]], but missing [A] and [B].
  5. Restore [[C], [D]]
  6. Keep trying to restore [[A], [B], [C], [D]]
  7. User has to click the "Reset Persistence" in Sunshine to stop Hmm, I'm not sure what the intermediate phase would be there (at 3?). But, 1,2,4, and finally 5 would be the state I would expect in this situation.

Originally i was thinking: If you checked again for what monitors are available before trying to restore, you could detect that one was missing. Or, alternatively, on failure of restore, restore monitors individually/iteratively.

kanjieater avatar Jul 22 '24 13:07 kanjieater

@FrogTheFrog sorry for interfering, but do we even want to mess with manual restoration of multiple displays? Just switch to "pc screen only" topology with whatever display we want. Then switch the topology back to "extend" on the way out, windows can figure out what and how it wants to restore.

Well, I have multiple displays that are mostly always inactive. I do not want them to be restored when we "extend" it on the way out. Also, what if the extension is incomplete and uses currently enabled devices OR fails (because not all devices are available, for example), then we are in the same stupid situation where "sleeping" displays would have to be restored manually. Thus, I chose to at least keep trying.

FrogTheFrog avatar Jul 22 '24 13:07 FrogTheFrog

@kanjieater Since I do not know which monitor is gone, I cannot just stop trying to restore the initial configuration. However, what about an intermediate phase? Like this:

  1. Initial displays: [[A], [B], [C], [D]]
  2. Activated display: [[E]]
  3. ...
  4. Trying to restore: [[A], [B], [C], [D]], but missing [A] and [B].
  5. Restore [[C], [D]]
  6. Keep trying to restore [[A], [B], [C], [D]]
  7. User has to click the "Reset Persistence" in Sunshine to stop Hmm, I'm not sure what the intermediate phase would be there (at 3?). But, 1,2,4, and finally 5 would be the state I would expect in this situation.

Originally i was thinking: If you checked again for what monitors are available before trying to restore, you could detect that one was missing. Or, alternatively, on failure of restore, restore monitors individually/iteratively.

The problem is sleeping displays - we cannot differentiate between disconnected ones (physically) and the ones that are off. So, a simple user would end up with a monitor that is permanently off since it could not be restored.

As for what you have suggested, that's what I'll be trying to do - restore as much as possible, but still keep trying to restore until either used acknowledges that it's time to stop or we succeed.

FrogTheFrog avatar Jul 22 '24 13:07 FrogTheFrog

Well, I have multiple displays that are mostly always inactive. I do not want them to we restored when we "extend" it on the way out.

Windows stores display configurations (resolutions and placement on the virtual desktop) on the per monitor set per topology basis. If you have any monitor disabled in one topology, switching to another topology and back will restore that too. That's why it will also resolve the newly mentioned issue, windows stores separate configurations for both [[A], [B], [C], [D]] and [[C], [D]] anyway.

ns6089 avatar Jul 22 '24 13:07 ns6089

Well, I have multiple displays that are mostly always inactive. I do not want them to we restored when we "extend" it on the way out.

Windows stores display configurations (resolutions and placement on the virtual desktop) on the per monitor set per topology basis. If you have any monitor disabled in one topology, switching to another topology and back will restore that too. That's why it will also resolve the newly mentioned issue, windows stores separate configurations for both [[A], [B], [C], [D]] and [[C], [D]] anyway.

We have talking about this in private and for now, we stick to the current, but a little improved approach. Future changes/adjustments will be possible once the PRs are merged.

FrogTheFrog avatar Jul 22 '24 14:07 FrogTheFrog

Well, I have multiple displays that are mostly always inactive. I do not want them to we restored when we "extend" it on the way out.

Windows stores display configurations (resolutions and placement on the virtual desktop) on the per monitor set per topology basis. If you have any monitor disabled in one topology, switching to another topology and back will restore that too. That's why it will also resolve the newly mentioned issue, windows stores separate configurations for both [[A], [B], [C], [D]] and [[C], [D]] anyway.

We have talking about this in private and for now, we stick to the current, but a little improved approach. Future changes/adjustments will be possible once the PRs are merged.

Do you know when you will have time to finish and when it will be released?

moi952 avatar Jul 22 '24 14:07 moi952

Do you know when you will have time to finish and when it will be released?

When it's done. Please don't manipulate people into giving deadlines, since they're all unpaid volunteers. Thank you.

ns6089 avatar Jul 22 '24 14:07 ns6089

Do you know when you will have time to finish and when it will be released?

When it's done. Please don't manipulate people into giving deadlines, since they're all unpaid volunteers. Thank you.

I'm not manipulating anyone, I'm just asking the question to know when it will be finished because that also allows us to have the latest developments. I use your version of sunshine because it really simplifies things, it's great. I know you do this voluntarily and I thank you for it.

moi952 avatar Jul 22 '24 14:07 moi952

I'm not saying you're doing it intentionally, god forbid. But it's still emotional manipulation, the person will naturally try to give to the closest reasonable date possible, then feel bad if they will be failing to meet it for whatever reason. Extra stress with no gain for all parties involved.

ns6089 avatar Jul 22 '24 14:07 ns6089

@kanjieater Since I do not know which monitor is gone, I cannot just stop trying to restore the initial configuration. However, what about an intermediate phase? Like this:

  1. Initial displays: [[A], [B], [C], [D]]
  2. Activated display: [[E]]
  3. ...
  4. Trying to restore: [[A], [B], [C], [D]], but missing [A] and [B].
  5. Restore [[C], [D]]
  6. Keep trying to restore [[A], [B], [C], [D]]
  7. User has to click the "Reset Persistence" in Sunshine to stop Hmm, I'm not sure what the intermediate phase would be there (at 3?). But, 1,2,4, and finally 5 would be the state I would expect in this situation.

Originally i was thinking: If you checked again for what monitors are available before trying to restore, you could detect that one was missing. Or, alternatively, on failure of restore, restore monitors individually/iteratively.

Please try windows build from: https://github.com/FrogTheFrog/Sunshine/actions/runs/10043062539?pr=1

The non-existent displays will not block partially reverting active displays. But it will still try to do it every 5 seconds and as I've said before, you need to tell Sunshine to stop if you're happy with current displays.

Note that this build is based on new stuff - you need to re-enable options in Sunshine and there is no resolution/refresh rate remapping yet

FrogTheFrog avatar Jul 22 '24 15:07 FrogTheFrog

I've been using the update as you recommended @FrogTheFrog . It did fix all of my issues, just wanted to confirm that - thanks for updating & sharing

kanjieater avatar Jul 29 '24 15:07 kanjieater

Random query for this, in the inital PR @FrogTheFrog states that the list of available monitors is outputted as part of Sunshines startup, could this list just be piped into a selection box in the UI for the user to select from instead of hunting through logs etc?

This would create a better user experience and also likely help to reduce user error by putting the wrong value in.

brine0m avatar Aug 05 '24 04:08 brine0m

Random query for this, in the inital PR @FrogTheFrog states that the list of available monitors is outputted as part of Sunshines startup, could this list just be piped into a selection box in the UI for the user to select from instead of hunting through logs etc?

This would create a better user experience and also likely help to reduce user error by putting the wrong value in.

Someone was already working on it little by little, however for this PR it's out of scope

FrogTheFrog avatar Aug 05 '24 06:08 FrogTheFrog

Are you aware of https://github.com/sofmeright/VirtualDisplayDriver_Wizard you can also use this to adjust resolutions provided by the indirect display drivers...

sofmeright avatar Sep 29 '24 18:09 sofmeright

@sofmeright thanks for sharing. It's a bit out of scope of this PR, which will use https://github.com/LizardByte/libdisplaydevice ... but I can add your tool to awesome-sunshine -> https://github.com/LizardByte/awesome-sunshine/pull/13

ReenigneArcher avatar Sep 29 '24 18:09 ReenigneArcher

Hi, I have a problem since an update and maybe since my migration from nvidia (rtx4070) to AMD (7900xt).

It never switches back to the right screen when the stream cuts out, but I did anything and installed a version on your repo https://github.com/FrogTheFrog/Sunshine/actions

I installed the latest, the stream freezes in 10 seconds, so I switched back to the version of this MR, and it no longer wants to switch to the specified screen, the logs (attached) indicate:

[2024:10:08:11:02:54]: Info: Changing display modes to: {526102e6-465d-522e-a135-6445e888e8d7} -> 3440x1440x140 [2024:10:08:11:02:54]: Info: Failed to change display modes using Windows recommended modes, trying to set modes more strictly! [2024:10:08:11:02:54]: Error: [code: 1610, message: The configuration data for this product is corrupted. Contact your technical support] failed to set display mode! [2024:10:08:11:02:54]: Error: Failed to set display mode(-s) completely! [2024:10:08:11:02:54]: Error: Failed to configure display: Failed to set new display modes (resolution + refresh rate) [2024:10:08:11:02:54]: Info: Reverting display device settings.

If you have time to help me with all the work you have that would be great, otherwise I will wait for the release in production.

Thanks for your work

sunshine.log

moi952 avatar Oct 08 '24 09:10 moi952

Hi, I have a problem since an update and maybe since my migration from nvidia (rtx4070) to AMD (7900xt).

It never switches back to the right screen when the stream cuts out, but I did anything and installed a version on your repo https://github.com/FrogTheFrog/Sunshine/actions

I installed the latest, the stream freezes in 10 seconds, so I switched back to the version of this MR, and it no longer wants to switch to the specified screen, the logs (attached) indicate:

[2024:10:08:11:02:54]: Info: Changing display modes to: {526102e6-465d-522e-a135-6445e888e8d7} -> 3440x1440x140 [2024:10:08:11:02:54]: Info: Failed to change display modes using Windows recommended modes, trying to set modes more strictly! [2024:10:08:11:02:54]: Error: [code: 1610, message: The configuration data for this product is corrupted. Contact your technical support] failed to set display mode! [2024:10:08:11:02:54]: Error: Failed to set display mode(-s) completely! [2024:10:08:11:02:54]: Error: Failed to configure display: Failed to set new display modes (resolution + refresh rate) [2024:10:08:11:02:54]: Info: Reverting display device settings.

If you have time to help me with all the work you have that would be great, otherwise I will wait for the release in production.

Thanks for your work

sunshine.log

Please try a build from this PR: https://github.com/FrogTheFrog/Sunshine/pull/2

Be aware that you will need to re-do the configuration as I have moved some config stuff around. Also let's more discussion to that PR if you have further questions.

FrogTheFrog avatar Oct 08 '24 09:10 FrogTheFrog

Hi, I have a problem since an update and maybe since my migration from nvidia (rtx4070) to AMD (7900xt). It never switches back to the right screen when the stream cuts out, but I did anything and installed a version on your repo https://github.com/FrogTheFrog/Sunshine/actions I installed the latest, the stream freezes in 10 seconds, so I switched back to the version of this MR, and it no longer wants to switch to the specified screen, the logs (attached) indicate: [2024:10:08:11:02:54]: Info: Changing display modes to: {526102e6-465d-522e-a135-6445e888e8d7} -> 3440x1440x140 [2024:10:08:11:02:54]: Info: Failed to change display modes using Windows recommended modes, trying to set modes more strictly! [2024:10:08:11:02:54]: Error: [code: 1610, message: The configuration data for this product is corrupted. Contact your technical support] failed to set display mode! [2024:10:08:11:02:54]: Error: Failed to set display mode(-s) completely! [2024:10:08:11:02:54]: Error: Failed to configure display: Failed to set new display modes (resolution + refresh rate) [2024:10:08:11:02:54]: Info: Reverting display device settings. If you have time to help me with all the work you have that would be great, otherwise I will wait for the release in production. Thanks for your work sunshine.log

Please try a build from this PR: FrogTheFrog#2

Be aware that you will need to re-do the configuration as I have moved some config stuff around. Also let's more discussion to that PR if you have further questions.

Thanks for your super fast response.

I saved the configuration, I saw that the part that allows to match the resolutions / frame rate was moved so I put back the frame rate matching, moreover it could be interesting for the HDMI dummies to have a maching "if greater than 60 set to the client's frame rate", 60 being a value that can be configured, it avoids doing 90 => 60, 120 => 60, 144 => 60.

It does not switch to the specified screen, except that I do not have the impression of having an error in the logs.

And I have freezes after 10 seconds, then it comes back 10 or 20 seconds later and so on.

I specify that I am on AMD drivers 24.9.1.

Sorry for the inconvenience, maybe it can help to debug.

I'll give you my configuration too. (j'ai du la transformer en .txt car le .json ne passe pas dans github)

Thanks

sunshine.log

sunshine.txt

moi952 avatar Oct 08 '24 10:10 moi952