wpf icon indicating copy to clipboard operation
wpf copied to clipboard

WPF applications will prevent Nvidia Control Panel to change display modes

Open ShiinaRinne opened this issue 1 year ago • 4 comments

Description

We have identified a recurring issue with applications developed using the WPF, which prevents the NVIDIA Control Panel from changing display modes on laptops. Specifically, when the WPF-based application (v2rayN) is running, the NVIDIA Control Panel fails to automatically switch between integrated and dedicated GPUs. This issue has been observed across multiple versions of the v2rayN application and various laptop models and configurations  Attempts to resolve this issue by modifying hardware acceleration settings in the WPF application have been failed. https://github.com/2dust/v2rayN/pull/3493/files#diff-96773009aed874ddc50e8da8fb0d2a82ba83e862fb01c323de31a8e573bbadfdR203

Reproduction Steps

  1. Set the display mode of the NVIDIA control panel to automatic on the laptop;
  2. Start v2rayN or other WPF software;
  3. Attempt to start a game or software that can normally switch display modes on the NVIDIA control panel;
  4. You will see a pop-up message in the bottom left corner saying "Unable to change display mode". Click this message to enter the NVIDIA control panel, and a pop-up window will appear saying "Applications blocking display mode change". v2rayN will be listed in the window. image image image

This is a minimal example of creating a WPF program without any modifications using Visual Studio https://github.com/2dust/v2rayN/issues/5255#issuecomment-2182387585

Expected behavior

It should not have any impact on the automatic switching feature of this display mode

Actual behavior

See a pop-up message in the bottom left corner saying "Unable to change display mode"

Regression?

No response

Known Workarounds

No response

Impact

Probably a laptop with an Nvidia graphics card and an integrated graphics card. Although my previous laptop also had this configuration (R7 5800H, RTX 3060), but there were no relevant settings in the Nvidia Control Panel and I couldn't test them

Configuration

Other information

Related issue: https://github.com/2dust/v2rayN/issues/5255 https://github.com/2dust/v2rayN/issues/3695 https://github.com/2dust/v2rayN/issues/2981 https://github.com/QL-Win/QuickLook/issues/1126 https://github.com/QL-Win/QuickLook/issues/1450#issuecomment-2381348516 https://github.com/microsoft/PowerToys/issues/31825 https://github.com/microsoft/PowerToys/issues/27684 https://github.com/microsoft/PowerToys/issues/14677

Closing Blocking Programs NVIDIA Advanced Optimus Overview Steamwebhelper.exe blocking Advanced Optimus notebook display mode switch

ShiinaRinne avatar Jun 22 '24 12:06 ShiinaRinne

I think a better way to solve this problem is to connect NVIDIA for help. We can keep gathering some more information and collect more reports while we wait to connect NVIDIA for help.

lindexi avatar Jun 24 '24 11:06 lindexi

image Does this change anything?

Prakyy avatar Jun 28 '24 13:06 Prakyy

I think the second to last link states it pretty clearly:

  • The display will not switch to discrete GPU in the following scenarios -
    • The display will not switch to discrete GPU if the application in allow list is a DirectX9 application.
    • The display will not switch to discrete GPU if there is a DirectX9 application already running. ...
  • If any DX9 application is running and a display switch is triggered using the NV Control Panel 'display mode' settings page, the DX9 app could crash or freeze.

miloush avatar Jun 28 '24 13:06 miloush

@miloush Yeah, but maybe Nvidia can fix it. And I test the empty wpf application with software render also can repro this issues.

lindexi avatar Jun 29 '24 01:06 lindexi

@lindexi did you fix this issue or find any workaround?

whitehat102 avatar May 19 '25 04:05 whitehat102

@whitehat102 Sorry, no. And this issues can only be fiexed by Nvidia .

lindexi avatar May 19 '25 06:05 lindexi

@lindexi I tried a temporary workaround for this (permanent in my case since the issue only occurs when I'm playing GTA5), and it seems to be working for me. I just had to create a batch script that kills processes in the task manager that are preventing display mode from switching and relaunch those apps when GTA5 has exited.

whitehat102 avatar May 19 '25 10:05 whitehat102

https://github.com/steam3d/MagicPods-Windows in this program the error is intermittent

zebranco avatar Jun 22 '25 16:06 zebranco

Image I found that in the update of NVIDIA Studio Driver 580.97, Advanced Optimus has made special adjustments for Cloudflare Warp, although I don't know what it fixed...

So... this issue may indeed need to be solved by NVIDIA (by manually blocking certain programs XD).


https://www.reddit.com/r/GamingLaptops/comments/1aq305j/a_workaround_to_apps_that_prevent_advanced/ https://community.cloudflare.com/t/warp-windows-app-incompatible-w-multi-gpu-switching/444726/3 It is also mentioned in some related issues that DXVK can be attempted to solve, but this may require additional processing and may seem difficult

https://github.com/dotnet/wpf/issues/3726 https://github.com/dotnet/wpf/issues/3727 Image

ShiinaRinne avatar Aug 17 '25 16:08 ShiinaRinne

@ShiinaRinne You are right. I also think this issue should to be solved by NVIDIA.

It is hard to bring wpf to DXVK

But https://avaloniaui.net/xpf may can help.

lindexi avatar Aug 18 '25 00:08 lindexi