ledoge / novideo_srgb

Calibrate monitors to sRGB or other color spaces on NVIDIA GPUs, based on EDID data or ICC profiles
GNU General Public License v3.0
988 stars 35 forks source link

Clamp is lost when monitor wakes up from stand-by #46

Open jxlarrea opened 2 years ago

jxlarrea commented 2 years ago

My PC runs 24/7 but the Windows power plan that I use sends my AW3423DW to stand-by mode after 10 minutes of inactivity.

Unfortunately, the clamp is lost when my display turns back on when I come back to the PC and move my mouse to wake up the display.

Is there any workaround for this?

ghost commented 2 years ago

Which version are you using?

jxlarrea commented 2 years ago

Which version are you using?

Latest one 4.0

Note that the PC itself does not go to sleep, only the display.

MineClever commented 2 years ago

Try to use Enabling Override to reference mode in Adjust Desktop Color Settings by NV Control Panel ?

jxlarrea commented 2 years ago

Try to use Enabling Override to reference mode in Adjust Desktop Color Settings by NV Control Panel ?

I've always had "Override to reference mode" enabled. Makes no difference.

jxlarrea commented 2 years ago

As a workaround, I created a quick .NET core background app that does the following:

  1. Polls NVAPI every 5 seconds to check if the primary display is not active.
  2. When the display becomes active, it will gracefully shutdown novideo_srgb.exe using "taskkill".
  3. Restarts novideo_srgb.exe with the "-minimize" argument.

Gets the job done, but would be nice for this behavior to exist in novideo_srgb itself.

ledoge commented 2 years ago

Does the DisplaySettingsChanged event not fire when the monitor gets put into standby? I assumed it did, but if not then I'll have to look into merging the power broadcast stuff from #38 (and figuring out why that was causing crashes).

jxlarrea commented 2 years ago

Does the DisplaySettingsChanged event not fire when the monitor gets put into standby? I assumed it did, but if not then I'll have to look into merging the power broadcast stuff from #38 (and figuring out why that was causing crashes).

I could not find any reliable way to detect when the monitor is sleeping or in standby using WMI or by hooking to the OS System/Power Events. The only thing that works 100% of the time is querying the NvApi using:

NvAPIWrapper.Display.DisplayDevice.GetGDIPrimaryDisplayDevice().IsActive

jxlarrea commented 2 years ago

@ledoge Just noticed that novideo_srgb is a .NET app. I downloaded the repo, added a method with the routine I mentioned above in MainViewModel.cs and call the method from the constructor in MainWindows.cs. Now it's perfection!

exscape commented 2 years ago

@ledoge Just noticed that novideo_srgb is a .NET app. I downloaded the repo, added a method with the routine I mentioned above in MainViewModel.cs and call the method from the constructor in MainWindows.cs. Now it's perfection!

Do you have the code for this available? I'd like to test it as well!
I've had several issues with the app since I started using it last week. The clamp is occasionally lost (not sure when, as it doesn't appear to be every time the monitor goes into standby, but some?), and occasionally the monitor is even lost from the app list. I probably restart it at least twice a day, and it's getting quite tiresome already, within the first week.

jxlarrea commented 2 years ago

@exscape Here you go: https://gist.github.com/jxlarrea/4594d4676bcf96d33399967ed55b2dcf

Just replace those 2 files and compile. The CheckForSleepAndReapplyOnWakeup() method is the relevant change.

exscape commented 2 years ago

@exscape Here you go: https://gist.github.com/jxlarrea/4594d4676bcf96d33399967ed55b2dcf

Just replace those 2 files and compile. The CheckForSleepAndReapplyOnWakeup() method is the relevant change.

Thanks! However the code crashes as soon as my display goes to sleep. GetGDIPrimaryDisplayDevice() throws an exception when called during standby, it seems like.
I fixed that by adding a try/catch block around the entire foreach-loop contents.

odikzz2 commented 1 year ago

I realise that srgb clamp is just a registry hack like dithering hack by name GuZZ on a forum users report is same bug like this they say the problem is newest win 10 version and suggest only use only 1607 and win7.

"https://hub.displaycal.net/forums/topic/how-to-enable-dithering-on-nvidia-geforce-with-windows-os/"

fangsunjian commented 1 year ago

The reason is novideo_srgb didn't watch screen off event which is not provided by .NET Framework. It really need some trick. I used the stackoverflow method below and managed to fix the problem. https://stackoverflow.com/questions/2208595/c-sharp-how-to-get-the-events-when-the-screen-display-goes-to-power-off-or-on If you want to try it as soon as possible. I make a fork and you can download from here: https://github.com/fangsunjian/novideo_srgb_fix_screen_off/releases/tag/v4.0

Terepin commented 1 year ago

The reason is novideo_srgb didn't watch screen off event which is not provided by .NET Framework. It really need some trick. I used the stackoverflow method below and managed to fix the problem. https://stackoverflow.com/questions/2208595/c-sharp-how-to-get-the-events-when-the-screen-display-goes-to-power-off-or-on If you want to try it as soon as possible. I make a fork and you can download from here: https://github.com/fangsunjian/novideo_srgb_fix_screen_off/releases/tag/v4.0

Sadly, this doesn't work. When I play game with ULMB, the monitor switches off to change the mode and the clamp is lost.

beefcat666 commented 1 year ago

I had a fix for this in my pull request, but there was a bug causing it to crash on multi-monitor systems so it was left out of the merge.

Now that I have access to a 2nd displayport monitor to test with, I went to investigate the crash only to find that this issue was fixed by a recent Nvidia driver or Windows update.

If someone else can verify that the clamp is now persisting through monitor sleep/wake events, then I think @ledoge can probably close this and we can stop worrying about my janky power broadcast event listening nonsense.