Switching between Intel+Nvidia (Render Offload) and Intel
Closed this issue · 19 comments
Hello,
I use prime-select to keep my Nvidia GPU turned off when I work and to switch to it when needed. The Intel configuration states that it is possible to use the new Nvidia Prime Render Offload when the service is disabled (PRIME Render Offload possible with >= 435.xx NVIDIA driver with prime-select service DISABLED)
As I can tell this works for me, but it is not that comfortable to always disable the service when I want to switch to Intel+Nvidia mode and re-enable it to only use the Intel GPU.
So is there a preferred way to switch between Intel and the hybrid mode? I used Optimus-Manager (works only on Arch based distributions) in the past and they implemented this well.
Thanks for your help.
Hmm. The idea of PRIME Render Offload is to just run in normal "intel" mode. Simply use different environment variables for your VulKan/OpenGL programs. So there is no switch needed. See project description, which also refers to NVIDIA's README. Please be aware that you need a Turing GPU or later. This begs the question, which GPU you're using.
Thank you for your answer!
No, I don't have a Turing GPU or later (MX150) so the Nvidia GPU keeps using power even if it is not actively used. That's why I want to switch back to Intel only mode when I am not doing something GPU intense. Nvidia only mode is also problematic because my Notebook starts to produce much heat even in idle and video hardware acceleration in Firefox stops working. Render offloading (with service disabled) solves these problems.
MX150 is still Pascal platform, so you simply don't have this PRIME Render Offload feature. So you need this switch (prime-select intel/nvidia), and then restart Xserver/Xsession. I don't see how Optimus-Manager can make this easier for you.
Sorry if I am misunderstanding something, but I always thought that the new dynamic power management is the thing that is restricted to Turing GPUs and not render offloading itself.
Ouch. You're right. Indeed, otherwise I wouldn't be able to test this myself. Shame on me. But with that you still need to switch to save power. So same as before. Again I don't see how Optimus-Manager can make this easier for you.
Not a problem 👍
Yes I still needed to switch with Optimus-manager too, but it provided an easy way to enable offloading and disable it in Intel mode without the need to disable or enable a service.
I had a look into simopils fork and it seems like it provides the exact solution to my problem. With the 'prime-select offload' command I can easily switch between Intel and the "Hybrid" mode and it looks like it does work as intended after a few tries.
Sorry for long time without pull requests. So I have a suse-prime version that works natively with (prime-render-offload+bbswitch+active service). I added support for kernel parameters too. I'm working those days to merge with all current official release commits.
@4VRDriver You can contact me if you wanna test it before pull request, I cannot pull my version as is because needs to be adapted to current release
Regards
@4VRDriver Hi, I pushed new release in my fork. Remember you must have bbswitch blacklisted even in initrd to make this release work. I'll to a pull request when I'm sure all work correctly
Hey @simopil, I've been testing your release and haven't faced any problems yet. Switching between Intel, Nvidia, Offload works like a charm.
Here are my system specs, in case they are helpful:
$ inxi -GC
CPU: Topology: Quad Core model: Intel Core i5-8250U bits: 64 type: MT MCP L2 cache: 6144 KiB
Speed: 800 MHz min/max: 400/3400 MHz Core speeds (MHz): 1: 658 2: 800 3: 800 4: 800 5: 800 6: 800
7: 800 8: 800
Graphics: Device-1: Intel UHD Graphics 620 driver: i915 v: kernel
Device-2: NVIDIA GP108M [GeForce MX150] driver: nvidia v: 460.56
Device-3: IMC Networks USB2.0 VGA UVC WebCam type: USB driver: uvcvideo
Display: x11 server: X.org 1.20.10 driver: modesetting,nvidia resolution: <xdpyinfo missing>
OpenGL: renderer: Mesa DRI Intel UHD Graphics 620 (KBL GT2) v: 4.6 Mesa 20.3.4
Perfect!! How about kernel parameter "nvidia.prime"? Did you noticed a faster boot in offload/nvidia mode? So I already did a pull request :)
Thanks a lot @simopil ! Just accepted your pull request and made a release 0.8.0. Will take some time until SUSE package is done. Now that the -bbswitch package will be obsolete ... if you could give me some hints what package changes would be needed that would help me a lot. Otherwise I need to read all the changes and fully understand them ...
Yes sure! I try to explain as exhaustive as possible.
Runtime switch case:
intel/intel2-> unload nvidia modules, load bbswitch module (load_state=0 unload_state=1) if installed, those parameters are hard-coded in the script. If bbswitch isn't installed script only set xorg configuration and unload nvidia modules
nvidia/offload-> load nvidia modules, unload bbswitch module. the previous-set parameter unload_state=1 get nvidia card ON
systemd service never called in those cases, so nvidia power mode depends only from bbswitch availability
*I noticed that loading/unloading bbswitch takes up same time as echoing ON/OFF to it
Boot:
prime-select.service will be called during boot
intel/intel2-> load bbswitch (load_state=0 unload_state=1), not load nvidia modules at all
nvidia/offload-> load nvidia modules, not load bbswitch at all
*Results in a faster boot in nvidia/offload mode 'cause bbswitch will not be loaded
-So bbswitch will not be loaded automatically (blacklisted and absent in initrd), module parameters are hardcoded into the script.
-Nvidia modules blacklisted too as it already is
What can go wrong:
If user with nvidia/offload preference boots without service, nvidia modules will not be loaded, may be result in a unavailable offload or, in only nvidia mode, a fallback to intel
Solution: make the trigger "systemctl enable|disable prime-select" capable of blacklisting|unblacklisting nvidia modules to have them automatically loaded only if service is disabled.
IDK which is better method to do it, maybe a renaming the .conf file in modprobe.d, or keep them blacklisted and add/remove a file in modules.load.d
Can systemd service management handle this?
Thanks a lot! I'll need time to test these features out, so I can get a better understanding of it. I'll let you know when I have further questions.
Also we need a way to know if the gpu is "NVreg_DynamicPowerManagement=0x01" capable, because the feature is non-driver-dependent. I have G05 with prime render offload but I haven't power management (GTX 660M), So i need bbswitch to have low power consumption, but I'm able to use PRIME Render Offload
How about kernel parameter "nvidia.prime"? Did you noticed a faster boot in offload/nvidia mode?
Sorry for replying so late. Yes it works too, although subjectively I cannot notice a big difference in boot time.
Thanks a lot! I'll need time to test these features out, so I can get a better understanding of it. I'll let you know when I have further questions.
@simopil Finally I was able to test all your changes (at least in nvida|intel|intel2|offload mode). Things are working fine for me. I stumbled across resetting with "unset", which also disabled the service, so things were no longer working after boot. But in the package the service is enabled by default and people usually just use "nvidia" mode and probably never use "unset". And then still they can reenable it with "service restore". Package update has already been checked in for Tunbleweed.
Closing as fixed.