[PowerDisplay] Add HDR SDR brightness controls and shortcuts - #49479
[PowerDisplay] Add HDR SDR brightness controls and shortcuts#49479Gavin 北稱 (gavinzhangth) wants to merge 1 commit into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
|
@microsoft-github-policy-service agree |
| /// Private device-info request used by the Windows HDR settings page to commit the | ||
| /// SDR content brightness value. This is deliberately isolated behind capability checks. | ||
| /// </summary> | ||
| public const uint DisplayconfigDeviceInfoSetSdrWhiteLevel = 0xFFFFFFEE; |
There was a problem hiding this comment.
There's no document list this enum value.
https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ne-wingdi-displayconfig_device_info_type
| /// The associated device-info type is private, so callers must capability-gate failures. | ||
| /// </summary> | ||
| [StructLayout(LayoutKind.Sequential)] | ||
| public struct DisplayConfigSetSdrWhiteLevel |
There was a problem hiding this comment.
Any document provide this structure? or give any evidence?
| public struct DisplayConfigSdrWhiteLevel | ||
| { | ||
| public DisplayConfigDeviceInfoHeader Header; | ||
| public uint SdrWhiteLevel; |
moooyo
left a comment
There was a problem hiding this comment.
ok, seems it will use some undocumented API. Niels Laute (@niels9001) any suggestion?
moooyo We can't use undocumented APIs. Is this something we could integrate into the CI so it scans for unofficial/undocumented APIs in case we are not doing that already? |
|
Close this PR due to undocumented API usage. |
will investigate. But seems no any same pattern can help us to use. |
Summary of the Pull Request
Adds HDR-aware SDR content brightness controls and configurable adjustment shortcuts to Power Display.
PR Checklist
Detailed Description of the Pull Request / Additional comments
Power Display currently controls monitor hardware brightness through WMI or DDC/CI. On an HDR desktop, Windows has a separate SDR reference-white control that changes how ordinary SDR content is presented without changing the physical backlight or HDR highlights.
This change:
1000–6000) to the flyout's0–100slider.SDR-labeled flyout row and an optional setting that replaces each HDR display's primary brightness target with SDR content brightness.Compatibility boundary
The Windows SDK publicly exposes the SDR white-level getter but not a corresponding setter. The write path uses the private
DisplayConfigSetDeviceInforequest type used by Windows Settings (0xFFFFFFEE). It is isolated inHdrSdrBrightnessController, capability-gated by successful public state/read queries, and returns a normal failed monitor operation if Windows or a display driver rejects it.The new settings fields are optional and constructor-defaulted, so existing
settings.jsonfiles deserialize without migration.No new third-party dependencies, binaries, GPO behavior, elevation behavior, installer changes, or Runner/Settings IPC contracts are introduced.
Validation Steps Performed
PowerDisplay.csproj, x64 Debug, with the repository build script.PowerToys.Settings.csproj, x64 Debug, with the repository build script.PowerDisplay.Lib.UnitTests.csproj, x64 Debug.PowerToys.Interop.ConstantsCOM class to be registered in standalone VSTest (REGDB_E_CLASSNOTREG).SDRlabel renders without clipping.Local builds used
/p:SpectreMitigation=falsebecause the local Visual Studio installation does not include the Spectre-mitigated libraries, and suppressed an existing unrelated C4819 warning from the ZoomIt header.