xanderfrangos / twinkle-tray

Easily manage the brightness of your monitors in Windows from the system tray
https://twinkletray.com
MIT License
4.88k stars 160 forks source link

HDR support #97

Open musm opened 3 years ago

musm commented 3 years ago

When HDR support is enabled, brightness control on my monitor is disabled.

Instead, the following slider can control brightness of SDR apps, which acts like a 'pseudo' brightness bar.

image

Twinkle tray's brightness control in this scenario should either

  1. Acts as a proxy and adjust the slider shown in the image above.
  2. Disable itself

Right now I can mess around with the brightness slier in Twinkle tray, but it looks like it's corrupting my monitors brightness setting (which are disabled) and has the ability to completely turn off my monitor at setting 0%, and in general doesn't look like it's doing the correct thing and possibly corrupting some state. I had to restart my monitor to reset settings back.

xanderfrangos commented 3 years ago

Odd. I have an HDR monitor and the brightness slider works fine. I have no idea what controls that "HDR/SDR" bar and I don't think it affects true HDR content. Only SDR. I would assume the registry controls it, but I can't find any documentation on where/how it's stored.

musm commented 3 years ago

Is your monitor 10-bit? Here are the other setting on that same page image

musm commented 3 years ago

This doesn't really help: https://support.microsoft.com/en-us/windows/hdr-and-wcg-color-settings-in-windows-10-2d767185-38ec-7fdc-6f97-bbc6c5ef24e6
Sadly I also wasn't able to find anything in the regsitry.

xanderfrangos commented 3 years ago

I haven't found much on my own either. Without access to a bunch of HDR monitors, I don't know that I'll be able to do much about this. In a future update, I'll allow users to exclude their monitor from Twinkle Tray. So at least HDR displays can be excluded.

If anyone can provide DDC/CI information about their own HDR display, documentation about adjusting HDR programmatically, or a PR for this feature, it would be greatly appreciated.

drewchurch commented 3 years ago

@xanderfrangos I just dug through procmon when making the HDR toggle and can't find anything that stands out.. it's very chatty at about 47k lines in just a few seconds. If there's anything I can look for, LMK.

Also, how can I provide you DDC/CI info? I've got two HDR compatible displays from different major manufacturers.

catshitz commented 2 years ago

relevant issue here: couldn't reset back to normal mode brightness after turning on & off HDR mode (not the windows fake one but the true HDR mode in a game or a movie), for example, when I finished playing RE3R in true HDR mode, the monitor will automatically come back to normal mode after I shut the game down(let's say the brightness in HDR is 70 and normal mode 20), at first the twinkle-tray doesn't effect anything until you click it on the traybar and call out its panel, then it'll somehow think you'are still in the HDR mode and automatically set your monitor brightness "back" to 70, which really is some flawness that needs to be fixed.

FlyingFaller commented 2 years ago

Also would like to see HDR support added if possible. Makes the app unusable because I like to keep Windows HDR enabled.

kev007 commented 2 years ago

I recently upgraded to Windows 11 and the brightness control of my HDR monitor stopped working. As soon as I turn off HDR, it works again. Even the v1.14-beta1 version does not allow the control that the stable version did on Windows 10.

wywywywy commented 1 year ago

Ok I've found the registry key that the setting changes (tested on Win 11).

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\GraphicsDrivers\MonitorDataStore\DELA1E4#G7IYMxgwAAgX_10_07E6_A1\SDRWhiteLevel

The value is from 1000 (0%) to 3500 (50%) to 6000 (100%) in dec.

Once the SystemSettings.exe has changed the registry value, it calls something in D3D12 to actually apply the change.

I hope this is somewhat useful.

xanderfrangos commented 1 year ago

@wywywywy That might actually help. Thanks!

The only HDR display I have at the moment seems to control HDR brightness via DDC/CI, which is not normal. So someone else will have to look into this further for now.

wywywywy commented 1 year ago

It appears that every 1000 equals 80 nit, although I kind of question that because my screen is supposed to be 400 nit max rather than 480 nit.

Anyway I found out how to get the SDR balance through the Win32 API. I think that to be able to set the SDR balance we'll have to make a call to the display driver.

Data structure: https://docs.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-displayconfig_sdr_white_level

Get: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-displayconfiggetdeviceinfo

Set: https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-displayconfigsetdeviceinfo

lulle2007200 commented 1 year ago

@xanderfrangos Brightness of SDR content can be controlled programatically (see my answer here), HDR brightness cant be controlled by "design".

xanderfrangos commented 1 year ago

@xanderfrangos Brightness of SDR content can be controlled programatically (see my answer here), HDR brightness cant be controlled by "design".

That's great! Thank you for sharing. I'm not sure when I'll have a chance to look into this again, but it's great to finally have a working example.

lulle2007200 commented 1 year ago

For HDR brightness control, you could adjust the (reported) peak luminance in color profile, but that is a hacky solution at best and most HDR applications and games ignore that anyway and roll their own brightness calibration.

I've also left some more info that may be relevant on the issue over at Monitorian, see link above.

T0biasCZe commented 11 months ago

Acts as a proxy and adjust the slider shown in the image above. Right now I can mess around with the brightness slier in Twinkle tray, but it looks like it's corrupting my monitors brightness setting (which are disabled)

thats just your monitor. it depends on the specific monitor. For example on my samsung oddysey, I can control the screen brightness in the OSD menu when HDR is on so twinkle tray should control the brightness when hdr is on on compatible monitors

lightingman117 commented 10 months ago

IMO, this is super complicated and while it would be lovely to fix in the future.

I don't think it would be worth the immediate effort. Dev time is precious.

Let's consider the use-case scenarios. -Gaming - HDR looks glorious -Movies - HDR is useful -TV - eh? -YT - eh? -Work [spreadsheets]- eh? -Other - who cares

I mainly want HDR to operate how f.lux works [disable for full-screen apps] (in reverse).

Enable HDR when full-screen apps are running. Disable when not (use brightness control).

HDR would now auto-enable (and f.lux would auto-disable) at the same time when I launch a game or a movie in full-screen.

This solves a few things: 1) reduced dev time (ain't got time for dat)

2) HDR functions as intended by developers (no fancy overrides/scaling)

3) fixes several open tickets #447 #419 #316 #260 (yay dopamine)

4) gets a 'fix' in the hands of users sooner rather than later "Don't chase perfection when good will do." -someone

My 2cents

Thanks for awesome software!

lulle2007200 commented 10 months ago

I don't agree. Implementing the HDR on-off switching properly and correctly is not simple either and i don't think it requires less resources to implement. Besides that, why would you want to limit HDR to fullscreen (games)? YT and other platforms can deliver HDR content just fine, i might want to watch some content in one window while doing other stuff in another. Just straight up dismissing windowed HDR content seems a little too far.

Having what you propose is better than nothing, but it's only a workaround and doesn't really solve the original issue imo (not being able to control SDR brightness with HDR enabled).

lulle2007200 commented 6 months ago

@xanderfrangos I am starting to work on adding HDR support (unless you are already doing that?). Basic idea is: If there is atleast one monitor with HDR enabled, add an SDR brightness slider to the taskbar menu. Clamp the SDR slider to the smallest peak brightness over all HDR monitors and the highest minim brightness over all HDR monitors, additionally make the range adjustabel in settings, those values come from monitor EDID or from OS default if EDID is not available. For all monitors with HDR enabled, hide or grey out their "own" brightness slider by default, add a setting to show it anyway. Additionally, a HDR toggle per monitor could be added.

Let me know what you think about this.

xanderfrangos commented 6 months ago

@lulle2007200 I'm not actively working on it. A PR for it would be very welcome. Are you working off the master or beta branch? In the beta branch I've added more code related to dynamically adding user-controlled sliders per-monitor. It might make sense to piggyback off of that instead of having it use separate logic/UI/settings for just the one slider. The HDR (well, SDR-in-HDR) slider could also replace the brightness slider and work off the existing "linked levels" and "normalize brightness" features. Either way, I'm sure the feature would make several users happy.

If you can get the code for updating the SDR brightness working per-display, I can get it wired up to the UI if needed.

lulle2007200 commented 6 months ago

Yeah, i am on the beta branch.

If you can get the code for updating the SDR brightness working per-display

Im currently researching how to do that. If it is possible to set per monitor, it'd make sense to just replace the slider for HDR monitors.

ChiIIBiII commented 2 months ago

Hey, having this feature would be awesome, how is it coming along? Maybe I'll have a look at it too. In the meantime, I wanted to point out that there is a script here that is adjusting sdr 'brightness' over multiple monitors if that helps

klofi commented 1 month ago

Some dev posted yesterday info about an undocumented Windows 10/11 API allowing to change SDR brightness on HDR display here: https://stackoverflow.com/a/78435051/1054589

carbongo commented 1 month ago

When I switched to HDR monitors, I was shocked to find out that this hadn't been implemented yet :(