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

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

Open
jxlarrea opened this issue Sep 3, 2022 · 15 comments
Open

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

jxlarrea opened this issue Sep 3, 2022 · 15 comments

Comments

@jxlarrea
Copy link

jxlarrea commented Sep 3, 2022

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?

@jxlarrea jxlarrea changed the title Clamp is lost when monitor wakes up from sleep Clamp is lost when monitor wakes up from stand-by Sep 3, 2022
@ghost
Copy link

ghost commented Sep 3, 2022

Which version are you using?

@jxlarrea
Copy link
Author

jxlarrea commented Sep 3, 2022

Which version are you using?

Latest one 4.0

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

@MineClever
Copy link

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

@jxlarrea
Copy link
Author

jxlarrea commented Sep 3, 2022

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
Copy link
Author

jxlarrea commented Sep 4, 2022

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
Copy link
Owner

ledoge commented Sep 4, 2022

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
Copy link
Author

jxlarrea commented Sep 4, 2022

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
Copy link
Author

jxlarrea commented Sep 4, 2022

@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
Copy link

exscape commented Sep 6, 2022

@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
Copy link
Author

jxlarrea commented Sep 6, 2022

@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
Copy link

exscape commented Sep 6, 2022

@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
Copy link

odikzz2 commented Sep 29, 2022

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
Copy link

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
Copy link

Terepin commented Nov 1, 2022

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
Copy link
Contributor

beefcat666 commented Mar 21, 2023

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.

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

No branches or pull requests

8 participants