Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new API to modify display devices for Windows #2582

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FrogTheFrog
Copy link
Collaborator

This is a continuation of the #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)
  • New feature (non-breaking change which adds functionality)
  • 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

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • 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.

  • 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.

Copy link

codecov bot commented May 26, 2024

Codecov Report

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

Project coverage is 8.33%. Comparing base (13f94f1) to head (e31f0ae).
Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##           master   #2582      +/-   ##
=========================================
- Coverage    8.96%   8.33%   -0.64%     
=========================================
  Files          94     112      +18     
  Lines       17392   19105    +1713     
  Branches     8270    9209     +939     
=========================================
+ Hits         1560    1592      +32     
- Misses      12963   14481    +1518     
- Partials     2869    3032     +163     
Flag Coverage Δ
Linux 6.62% <1.33%> (-0.17%) ⬇️
Windows 3.72% <0.49%> (-0.44%) ⬇️
macOS-12 9.65% <1.89%> (-0.40%) ⬇️
macOS-13 9.59% <1.89%> (-0.37%) ⬇️
macOS-14 9.86% <1.89%> (-0.39%) ⬇️

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

Files Coverage Δ
src/audio.h 50.00% <100.00%> (+50.00%) ⬆️
src/audio.cpp 29.07% <75.00%> (+0.50%) ⬆️
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 2.42% <0.00%> (+0.79%) ⬆️
src/platform/windows/display_base.cpp 12.47% <0.00%> (-0.03%) ⬇️
...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.19% <50.00%> (-0.05%) ⬇️
... and 18 more

... and 5 files with indirect coverage changes

@ReenigneArcher
Copy link
Member

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

@FrogTheFrog FrogTheFrog force-pushed the master branch 2 times, most recently from 32e5255 to b81c566 Compare June 25, 2024 18:50
@mirh
Copy link

mirh commented Jun 28, 2024

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.

@FrogTheFrog
Copy link
Collaborator Author

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.

@bradleycundari
Copy link

bradleycundari commented Jul 3, 2024

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.

@moi952
Copy link

moi952 commented Jul 3, 2024

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

@FrogTheFrog
Copy link
Collaborator Author

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

@mirh
Copy link

mirh commented Jul 4, 2024

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.

@FrogTheFrog
Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants