monero-project / monero-gui

Monero: the secure, private, untraceable cryptocurrency
Other
1.71k stars 767 forks source link

Automatic fallback to softwarecontext renderer #2878

Open selsta opened 4 years ago

selsta commented 4 years ago

This wasn't fixed. Please re-open.

I also have 100% CPU using monero GUI v0.15.0.4 in a VirtualBox VM (Whonix-Workstation). It's just the first screen (language selection screen). No monero installed ever in that VM before.

QMLSCENE_DEVICE=softwarecontext ./monero-wallet-gui helps as a workaround but it's not a solution. Users shouldn't be required to figure that out the hard way. Should be the default or some other fix.

Also my CPU use is now down to 30% which still seems to much for just an idle language selection screen.

Originally posted by @adrelanos in https://github.com/monero-project/monero-gui/issues/2238#issuecomment-622497250

selsta commented 4 years ago

The best solution would be automatic fallback to softwarecontext in systems which have trouble with OpenGL. If this is not possible then I guess this will be a wontfix.

Should be the default

Setting the softwarecontext renderer as default will result in a worse experience for the majority of users. The renderer has worse quality, supports less features AFAIK also uses more CPU. See https://doc.qt.io/QtQuick2DRenderer/qtquick2drenderer-performance.html

adrelanos commented 4 years ago

Btw as for Whonix integration (which runs mostly in VMs), I guess would be best if some script [1] checked if hardware rending is enabled. And if not, set QMLSCENE_DEVICE=softwarecontext as global environment variable by default.

How to test from command line if hardware acceleration is available?

selsta:

Should be the default

Setting the softwarecontext renderer as default will result in a worse experience for the majority of users. The renderer has worse quality, supports less features AFAIK also uses more CPU. See https://doc.qt.io/QtQuick2DRenderer/qtquick2drenderer-performance.html

I agree. softwarecontext renderer should if anything only be default when needed. Not for everyone that doesn't need it.


[1] Has nothing to do with monero. The name of package is vm-config-dist. I don't suggest to implement such a script in monero that changes environment variables globally. Just wondering for a good solution for Whonix / VMs.

adrelanos commented 4 years ago

Test command from inside VM to detect if VirtualBox 3D acceleration is enabled or disabled?

adrelanos commented 4 years ago

I guess this needs a separate ticket. 30% CPU in Debian buster based VirtualBox VM https://github.com/monero-project/monero-gui/issues/2880

selsta commented 4 years ago

Forget my comment, glxinfo is what you wrote above already.

Anyway, I think this is VirtualBox related as I never had any issues with VMWare Fusion.

Maybe you can add the info to only use softwarecontext if the GUI has high CPU usage: https://github.com/Whonix/monero-gui#vm-users

adrelanos commented 4 years ago

Sure. Writing now:

Due to this VM specific Monero GUI upstream bug setting envrionment variable QMLSCENE_DEVICE=softwarecontext is required inside some virtual machines (VMs). Known affected are to VirtualBox and KVM based VMs on Debian buster. Reported unaffected is VMWare Fusion, in that case setting QMLSCENE_DEVICE=softwarecontext can be omitted.

Pull requests against VM (or anything) are also welcome.

mmortal03 commented 1 year ago

Is this only supposed to be an issue with virtual machines? I'm currently seeing constant high CPU usage on a Windows laptop with AMD graphics switching on monero-wallet-gui.exe v0.18.1.2, even after it has synced. 72%+ constant CPU usage at the password entry screen, and 12%+ constant CPU usage after entering the wallet password. I am using a Trezor and a remote node. I tried adding monero-wallet-gui.exe to the AMD switchable graphics application settings, but doing that doesn't seem to affect the CPU usage, whether I'm configuring it to use the graphics card or the CPU graphics, I get the same high CPU usage. Lowering the affinity of CPUs or the process priority also doesn't seem to make a difference.

selsta commented 1 year ago

@mmortal03 does starting "low-graphics-mode.bat" make a difference?

mmortal03 commented 1 year ago

@mmortal03 does starting "low-graphics-mode.bat" make a difference?

Oh, wow, yes, that solves it. I wonder what the cause is, though?

selsta commented 1 year ago

It seems so GPU driver related issue. low-graphics-mode.bat uses CPU software rendering, in regular mode OpenGL is used.