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

GPU process high CPU usage with sandboxing enabled (Windows 11) #185

Open
Girofox opened this issue May 2, 2024 · 9 comments
Open

GPU process high CPU usage with sandboxing enabled (Windows 11) #185

Girofox opened this issue May 2, 2024 · 9 comments

Comments

@Girofox
Copy link

Girofox commented May 2, 2024

Issue

When launching Mercury on Windows (AVX2, SSE version doesn't matter) i have a constant 20 percent cpu usage in Task Manager because of the GPU process. It seems that the GPU process is doing something and keeps one CPU core busy, this is visible in about:performance. This is happening even on a fresh Mercury installation without any profiles and without any extension.

The interesting thing is that this does not happen in a virtual machine, on my laptop without Nvidia GPU or on Linux. Without hardware acceleration in Mercury settings the issue still persists though.

image

Investigation

With troubleshoot mode enabled via "Hamburger menu -> Help -> Troubleshoot mode" the CPU usage is normal. The profiler option is not helpful but in a prior Mercury build there was a Decoding process with a high CPU usage visible.

Workaround (potential unsafe!)

When I set security.sandbox.gpu.level to 0 the issue is "fixed". So the GPU process sandboxing is to blame. The issue doesn't appear in normal Firefox.

image

@SashaXser
Copy link

Try rename mercury.exe to firefox.exe

@Girofox
Copy link
Author

Girofox commented May 2, 2024

Yes, this worked. Do you know why this happens when the file is mercury.exe?

@SashaXser
Copy link

Yes, this worked. Do you know why this happens when the file is mercury.exe?

It's very simple, drivers optimize programs for the exe name, for example you can replace firefox.exe with chrome.exe and the load balancing will change too.

In general, the optimization is configurable in the drivers.

I also suggest you try changing thorium.exe to chrome.exe, this should work much better because the driver knows it's Google Chrome and not something else.

@goodusername123
Copy link

If you have a Nvidia GPU I would recommend downloading this: https://github.com/Orbmu2k/nvidiaProfileInspector
and adding "mercury.exe" to the "Mozilla Firefox" which will achieve the same effect as renaming the EXE.

Same thing applies to Thorium but you add it to the "Google Chrome" profile instead.

@M0n7y5
Copy link

M0n7y5 commented May 6, 2024

I tried that but there is an issue ...
image

@M0n7y5
Copy link

M0n7y5 commented May 6, 2024

@Alex313031 please change the exe name to something like mercury_browser.exe since mercury.exe is already used by gotham knights game and can cause issues with NVidia drivers

image

@Girofox
Copy link
Author

Girofox commented May 6, 2024

@Alex313031 please change the exe name to something like mercury_browser.exe since mercury.exe is already used by gotham knights game and can cause issues with NVidia drivers

image

This explains why this issue is not present with Intel or inside a virtual machine. Maybe manually adding an application profile just for mercury.exe helps inside Nvidia control panel. But this is just a workaround.

@M0n7y5
Copy link

M0n7y5 commented May 7, 2024

... Maybe manually adding an application profile just for mercury.exe helps inside Nvidia control panel. But this is just a workaround.

You cant add it to nvidia profile since name mercury.exe is already taken.

@Girofox
Copy link
Author

Girofox commented May 7, 2024

With Nvidia Profile Inspector you can remove mercury.exe from Gotham Knights and then add mercury.exe to Firefox profile. The procedure is similar to the NVIDIA Optimus workaround from https://resolume.com/support/en/optimus-workaround

For Thorium it is even easier, just add thorium.exe to "Google Chrome" profile in Nvidia inspector and you're done.

At least for Thorium the changes to Google Chrome profile stays after driver updates (with keeping data option).

Gotham Knights shouldn't react badly after these changes (I don't play this game). The main issue is the GPU sandboxing in Mercury which relies on the exact NVIDIA Firefox profile even if you manually adjust the Nvidia profile exactly.

Removing mercury.exe from "Gotham Knights" profile (Nvidia)

  • Select mercury.exe from remove button
    image
  • hit Apply changes

Adding mercury.exe to "Mozilla Firefox" profile (Nvidia)

  • Select mercury.exe from add button (or mercury_browser.exe after renaming first)
    image
  • hit Apply changes

Update

  • Reinstalling driver (even with keeping data) resets these customizations to Gotham Knights and Firefox profile sadly.
  • Interestingly there is now a new profile pointing to the mercury.exe path in Nvidia control panel and inspector
  • this new weird profile (which can't be added manually in this way) takes higher priority over Gotham Knights profile
  • GPU process usage stays low unless Mercury is moved to another location ("weird" profile gets invalid)

Conclusion

There is no permanent way to change the default Nvidia application profiles for Gotham Knights. At least adding thorium.exe to the Google Chrome profile persists after driver updates.

After driver reinstall or update the file "mercury.exe is readded to "Gotham Knights" profile and is removed from "Mozilla Firefox" profile automatically. This causes a new profile named "mercury.exe" to be created with contains the whole path to mercury.exe and has higher priority.

Suggestion

Renaming mercury.exe to mercury_browser.exe as pointed out above by M0n7y5 seems like a better solution imo because you can add mercury_browser.exe to "Mozilla Firefox" profile if you like and this stays permanent.

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

4 participants