Repository navigation
fix: stop G-SYNC dropping the monitor to its lowest refresh rate - #154
Conversation
With G-SYNC enabled for windowed apps, the NVIDIA driver ties the monitor's refresh rate to the focused app. Eden draws on demand, so an idle window pulled a 240 Hz panel down to 40 Hz. Register the same driver profile setting NVIDIA ships for Explorer (G-SYNC forced off) for Eden's own exe, before the graphics device is created. An existing G-SYNC value for the exe is left alone.
mtucciarone
left a comment
There was a problem hiding this comment.
Overall it looks like a great attempt from what's likely an LLM. I'll have to test this locally first but if you don't mind making a quick refactor to get these tests out of the src files that would be great.
Thanks!
| Some(Outcome::Written) | ||
| } | ||
|
|
||
| #[cfg(test)] |
There was a problem hiding this comment.
Thanks for opening this up @Kendoismebutmaybenot. Do you mind moving all of the tests into the appropriate tests/unit folder in the repo please? Thanks 🙏🏽
There was a problem hiding this comment.
Thanks for opening this up @Kendoismebutmaybenot. Do you mind moving all of the tests into the appropriate
tests/unitfolder in the repo please? Thanks 🙏🏽
▎ Done, the tests are in tests/unit/nvidia_profile.rs now, using the same #[path] include as the other unit tests, so they can still reach the module's private helpers. And yes, I made this with the help of Claude. I've tested it on my own setup and the refresh-rate drop is gone. Let me know if you want anything else changed
Same #[path] include the other unit tests use, so they still reach the module's private helpers through super::*. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0dfdafa to
c65e332
Compare
🐛 What's Fixed
Why it happens
The driver ties the monitor's refresh rate to whichever focused app presents straight to the screen. Eden only draws when something changes, so an idle Eden window presents nothing and the panel falls to its floor. Explorer and browsers present the same way and avoid this only because NVIDIA ships a driver profile for them with G-SYNC forced off. Eden is unknown to the driver, so it gets treated like a game.
Switching to vsync does not help. I tested
PresentMode::AutoVsyncand the panel still dropped to 40 Hz, so the present mode from #119 is left as it is.The fix
On startup, before the graphics device is created, Eden registers the same driver setting for its own exe through NVAPI (
G-SYNCapplication override = force off, the value NVIDIA's own Explorer profile uses). New filesrc/core/nvidia_profile.rs, one call inmain.rs.nvapi64.dllis loaded from System32 only, and without an NVIDIA driver nothing happens.%LOCALAPPDATA%\ExplorerEden\nvidia_profile.txtrecords the exe name and driver file it was confirmed for.How I measured it
I counted real vertical blanks (
D3DKMTWaitForVerticalBlankEvent) on a 2560x1440 240 Hz G-SYNC monitor, RTX 5070 Ti, driver 32.0.16.2114, with Eden focused:AutoVsyncThe 240 Hz row was measured on the first launch, which shows the driver picks the profile up in the same process when it is written before the device is created.
🔗 Related Issues
None filed.