dwm_lut icon indicating copy to clipboard operation
dwm_lut copied to clipboard

Works in fullscreen apps and breaks g-sync

Open ictilkka opened this issue 4 years ago • 14 comments

I'm surprised to find out that contrary to the description, the lut does work in exclusive fullscreen apps.

At the same time, it breaks VRR. I'm on Nvidia with g-sync compatible monitor. Using monitor's OSD I see that when dwm_lut is active, refresh rate locks to native regardless of FPS cap and also when GPU is overloaded and FPS drops naturally, causing visible stutter. When disabled, refresh rate follows FPS cap as expected without stutter. Confirmed with 3 games. Same result with full screen optimizations disabled and enabled, and with windowed g-sync enabled or disabled, and it's not caused by the GUI.

I also notice that it significantly increases GPU load in game (50% to 80% in one, and 70% to 85% in another game, capped FPS), probably due to the considerable VRAM bandwidth usage mentioned in the other issue.

ictilkka avatar Aug 08 '21 00:08 ictilkka

Hmmm... that's strange. Might be some weird interaction between MPO/DirectFlip being force disabled and G-Sync? There shouldn't be a way for the LUT to work in "real" exclusive fullscreen, since that avoids DWM. Interesting observation!

ledoge avatar Aug 08 '21 08:08 ledoge

@ictilkka just use ReShade for games, much easier and without any performance impact, with dwm_lut I get 5-6 fps drop in cyberpunk, especially in the map

alansleep avatar Aug 08 '21 20:08 alansleep

I can confirm that on my g-sync compatible monitor, when the dwm-lut tool is active and I start a game (tested with RDR2), the monitor does not report VRR rate and is just fixed at desktop refresh rate (165 Hz). This effectively means that VRR is not active in the game. To enable it, I need to deactivate the tool and restart the game. It is quite an issue for me, because I though I found a solution for wide color gamut monitor over-saturation on Windows. Hearing about the performance degradation in games adds to my sorrow.

provanguard avatar Aug 17 '21 15:08 provanguard

@provanguard Check out this tool I made and let me know if it fixes your oversaturation troubles.

ledoge avatar Aug 17 '21 19:08 ledoge

@ledoge Wow. Are you a magician? :) Results from a quick test: colors appear to be less saturated, in line with sRGB saturation levels. G-sync is working in RDR2, and the lower saturation level takes effect in the game.

A big question for me now is: is this "true" sRGB emulation/clamping mode, or an approximation? I have some ICC profiles done with DisplayCAL previously - can I use them together with the new tool? Should I recalibrate? What about color managed photo editing apps? Does the setting persist across PC restarts? I have so many questions.

provanguard avatar Aug 17 '21 20:08 provanguard

@provanguard Glad it works!

It uses the primaries reported in the EDID to calculate a color space transform matrix that gets applied by the GPU. If your monitor reports its primaries accurately (you can view the xy coordinates by clicking the Info button and compare them to what DisplayCAL reports when you inspect the profile) and your white point is calibrated to D65, this should be a true sRGB emulation mode. Since the API is undocumented, I don't know what gamma curve it uses to (de)linearize the values when applying the matrix, but I assume it's sRGB.

Right now it doesn't let you specify the primaries yourself, but that may change in the future. For now I would activate it and create a new ICC profile in that state – so the monitor + the clamp should more or less correspond to sRGB now, and the profile should take care of the remaining inaccuracies. I don't think it persists across reboots, but I haven't tested it.

Also, I would appreciate it if you could send me an unclamped ICC profile and one made with my sRGB clamp enabled so I can compare them.

ledoge avatar Aug 17 '21 20:08 ledoge

@ledoge Great! I will do calibrations and more testing of the new tool in the coming days. I will report back my findings.

provanguard avatar Aug 17 '21 21:08 provanguard

I don't know if I should report my observations here, but here it is: it looks like the setting persists across Windows reboots, which I guess is a good thing :) I have Windows 10 20H2, and the latest nvidia studio drivers.

provanguard avatar Aug 18 '21 17:08 provanguard

@provanguard Interesting! It doesn't really matter, but I think it would be better if you put your observations in a separate issue on the other repo.

ledoge avatar Aug 19 '21 07:08 ledoge

I'm surprised to find out that contrary to the description, the lut does work in exclusive fullscreen apps.

At the same time, it breaks VRR. I'm on Nvidia with g-sync compatible monitor. Using monitor's OSD I see that when dwm_lut is active, refresh rate locks to native regardless of FPS cap and also when GPU is overloaded and FPS drops naturally, causing visible stutter. When disabled, refresh rate follows FPS cap as expected without stutter. Confirmed with 3 games. Same result with full screen optimizations disabled and enabled, and with windowed g-sync enabled or disabled, and it's not caused by the GUI.

I also notice that it significantly increases GPU load in game (50% to 80% in one, and 70% to 85% in another game, capped FPS), probably due to the considerable VRAM bandwidth usage mentioned in the other issue.

I just tested this on my PC, and it definitely is not breaking G-Sync.

I can enable and disable the LUT, and I see the color change to my display.

I have the refresh FPS being shown on my monitor (a feature of the G-Sync monitor) and I can see that it stays locked to the game's actual FPS with this LUT tool enabled and disabled.

I am not seeing a real measurable difference (outside of margin of error) in game performance according to game benchmarks either.

nicko88 avatar Sep 02 '21 19:09 nicko88

Just to add some more information about this issue. I encounter problems with 2 games. Both tested with fullscreen mode.

Overwatch:

  1. If the "Disable fullscreen optimizations" compatibility option is off as default, G-Sync no longer works. Once dwm_lut is disabled, it works. There is no color-wise issue.
  2. If the option is on, thus fullscreen optimizations is off, G-Sync works again even with dwm_lut. There comes the "blank screen" issue. 2.1 During game, if I alt-tab to desktop then back to game, sometimes the screen stays blank forever. My monitor even goes to sleep mode, as if all video signals cut off in the cable. 2.2 When the game exits, it never goes back to desktop as normal. Instead, the screen stays blank forever. I need to Ctrl-Alt-Del to restore it.

Elden Ring: If only happens if dwm_lut is active, and I'm using HDR mode in game. The color gamut in game becomes extremely clamped and bland, to a level that it might be as well black and white. Whether or not I use HDR LUT in dwm_lut matters not. SDR mode never have problem.

=====

Proposal: Since dwm_lut has these compatibility issues mostly for fullscreen, and to be honest I really don't care color accuracy that much during games, I wonder if dwm_lut, when run and stay in background, can detect fullscreen games and automatically disable the inject temporarily, and restore when the game process terminates. Basically automate what user's doing manually right now.

CrendKing avatar Apr 04 '22 01:04 CrendKing

During game, if I alt-tab to desktop then back to game, sometimes the screen stays blank forever. My monitor even goes to sleep mode, as if all video signals cut off in the cable.

Weird – If DWM crashes, it should restart automatically. Really not sure what could be causing the screen to stay blank (or why Ctrl-Alt-Del would then fix that). I'll see if I can figure out a way to debug/investigate that issue, but I can't promise anything. Strange that it's the first time anyone's reported something like that though.

If only happens if dwm_lut is active, and I'm using HDR mode in game.

I think this is caused by the game using NVAPI (or whatever the AMD equivalent is) HDR, where Windows isn't actually in HDR mode, but the GPU is sending out HDR metadata anyway. Not sure if this is something that can be supported properly by dwm_lut, as both NVAPI HDR and this tool are hacks.

I wonder if dwm_lut, when run and stay in background, can detect fullscreen games and automatically disable the inject temporarily

That wouldn't be a good idea, because I don't think there's a way to distinguish between a fullscreen game and something like a fullscreen video. Alternatively, maybe an application blacklist would work better, which would disable the LUT for a monitor where a specific application is running? This would require a bit of an architectural change first though, as there is currently no way for the dwm_lut GUI to communicate with the injected DLL.

ledoge avatar Apr 06 '22 13:04 ledoge

During game, if I alt-tab to desktop then back to game, sometimes the screen stays blank forever. My monitor even goes to sleep mode, as if all video signals cut off in the cable.

This is one of the reasons exclusive fullscreen is being deprecated for the more modern flip technologies, fwiw. It's slow, prone to breaking, and prone to messing with color management stuff :) It's not a problem that ledoge can address.

Given that exclusive fullscreen is usually undesirable, and given I really don't care color accuracy that much during games might be a common pov, I think the option to not disable MPOs/Flip should be given to the user. That would be the simplest method of not causing issues with games.

AeliusSaionji avatar Aug 19 '22 06:08 AeliusSaionji

Freesync works and the app does not work in exclusive fullscreen games (as expected) for me on an AMD GPU. Everything works as expected for me.

lextra2 avatar Oct 07 '22 00:10 lextra2