optimus-manager icon indicating copy to clipboard operation
optimus-manager copied to clipboard

Nvidia 470 is it making any difference in GPU offload in hybrid mode?

Open michaldybczak opened this issue 3 years ago • 30 comments

Nvidia 470 drivers were released, and they are already available in Manjaro testing. All works fine on my end with hybrid mode.

Since there is a note that there are some Optimus improvements, I wonder, if this driver changes anything regarding GPU offload in hybrid mode?

michaldybczak avatar Jul 04 '21 18:07 michaldybczak

I think the improvements was on the Intel only mode side,because in Intel mode only I can now use the NVIDIA card,not hybrid mode requirement,and when I'm done the NVIDIA turn off by itself (1050 Ti).

There is still some problems,applications using the NVIDIA doesn't sync with the refresh rate of the monitor,and have a little worse performance,and also cannot cannot execute 32-bit OpenGL games with the NVIDIA card (it gives me an error),but this is a beta driver so i'm pretty sure this will be fixed.

XRaTiX avatar Jul 11 '21 06:07 XRaTiX

How did you access Nvidia in Intel mode? Or are you talking about Nouveau, which worked for me for a long time in Intel session?

michaldybczak avatar Jul 11 '21 10:07 michaldybczak

No,I'm talking about the official NVIDIA drivers,not Nouveau.

And I just upgraded and switch to Intel mode,I don't have to do anything,in optimus-manager just make sure you are not using any switching methods,this is are my settings (using optimus-manager-qt),in fact you don't need optimus-manager at all and will it work (but then you cannot change to hybrid/nvidia mode to be able to use the HDMI port,so you kind of need it).

image

Here is nvidia-smi in Intel mode image

And when I execute vkcube with the NVIDIA card.

image

EDIT: Actually I remember that I had to do something but with TLP,I need to make sure to have SOUND_POWER_SAVE_ON_AC to 1 (is 0 by default),without sound power save,the NVIDIA card still remains on and cannot powered off in Intel mode,I can check if the NVIDIA is on by running the command

watch -n1 -d -t cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status

If is ON,it says active, otherwise it says suspended

XRaTiX avatar Jul 11 '21 15:07 XRaTiX

No,I'm talking about the official NVIDIA drivers,not Nouveau.

And I just upgraded and switch to Intel mode,I don't have to do anything,in optimus-manager just make sure you are not using any switching methods,this is are my settings (using optimus-manager-qt),in fact you don't need optimus-manager at all and will it work (but then you cannot change to hybrid/nvidia mode to be able to use the HDMI port,so you kind of need it).

image

Here is nvidia-smi in Intel mode image

And when I execute vkcube with the NVIDIA card.

image

EDIT: Actually I remember that I had to do something but with TLP,I need to make sure to have SOUND_POWER_SAVE_ON_AC to 1 (is 0 by default),without sound power save,the NVIDIA card still remains on and cannot powered off in Intel mode,I can check if the NVIDIA is on by running the command

watch -n1 -d -t cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status

If is ON,it says active, otherwise it says suspended

Doesn't works for me, GTX1060 on Acer G3-571 (Arch Linux).

bayasdev avatar Oct 05 '21 03:10 bayasdev

No,I'm talking about the official NVIDIA drivers,not Nouveau. And I just upgraded and switch to Intel mode,I don't have to do anything,in optimus-manager just make sure you are not using any switching methods,this is are my settings (using optimus-manager-qt),in fact you don't need optimus-manager at all and will it work (but then you cannot change to hybrid/nvidia mode to be able to use the HDMI port,so you kind of need it). image Here is nvidia-smi in Intel mode image And when I execute vkcube with the NVIDIA card. image EDIT: Actually I remember that I had to do something but with TLP,I need to make sure to have SOUND_POWER_SAVE_ON_AC to 1 (is 0 by default),without sound power save,the NVIDIA card still remains on and cannot powered off in Intel mode,I can check if the NVIDIA is on by running the command watch -n1 -d -t cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status If is ON,it says active, otherwise it says suspended

Doesn't works for me, GTX1060 on Acer G3-571 (Arch Linux).

Do you set to integrated mode in optimus manager?

This should work,someone on the Manjaro forums says it works exactly this way but with CUDA applications

https://forum.manjaro.org/t/configuring-hybrid-gpu-laptop-to-only-use-dgpu-when-requested/76265/20?u=xratix

Unless is Manjaro specific configuration i don't know

XRaTiX avatar Oct 05 '21 14:10 XRaTiX

Do you set to integrated mode in optimus manager?

This should work,someone on the Manjaro forums says it works exactly this way but with CUDA applications

https://forum.manjaro.org/t/configuring-hybrid-gpu-laptop-to-only-use-dgpu-when-requested/76265/20?u=xratix

Unless is Manjaro specific configuration i don't know

When I boot the OS the dGPU is suspended but as soon as it enables then it can't suspend again.

Well afterall seems more convenient to use the nouveau method when I don't need dGPU.

bayasdev avatar Oct 05 '21 15:10 bayasdev

Do you set to integrated mode in optimus manager? This should work,someone on the Manjaro forums says it works exactly this way but with CUDA applications https://forum.manjaro.org/t/configuring-hybrid-gpu-laptop-to-only-use-dgpu-when-requested/76265/20?u=xratix Unless is Manjaro specific configuration i don't know

When I boot the OS the dGPU is suspended but as soon as it enables then it can't suspend again.

Well afterall seems more convenient to use the nouveau method when I don't need dGPU.

I had the same problem,its TLP that prevents the dGPU to turn off again,you can either disable TLP or check your TLP config file /etc/tlp.conf check

SOUND_POWER_SAVE_ON_AC="1"
SOUND_POWER_SAVE_ON_BAT=1

Both needs to have a value of 1

Then restart TLP and it should be suspended the dGPU

sudo tlp start

XRaTiX avatar Oct 05 '21 15:10 XRaTiX

Do you set to integrated mode in optimus manager? This should work,someone on the Manjaro forums says it works exactly this way but with CUDA applications https://forum.manjaro.org/t/configuring-hybrid-gpu-laptop-to-only-use-dgpu-when-requested/76265/20?u=xratix Unless is Manjaro specific configuration i don't know

When I boot the OS the dGPU is suspended but as soon as it enables then it can't suspend again.

Well afterall seems more convenient to use the nouveau method when I don't need dGPU.

I had the same problem,its TLP that prevents the dGPU to turn off again,you can either disable TLP or check your TLP config file /etc/tlp.conf check

SOUND_POWER_SAVE_ON_AC="1"
SOUND_POWER_SAVE_ON_BAT=1

Both needs to have a value of 1

Then restart TLP and it should be suspended the dGPU

sudo tlp start

I already have that in my config as per your previous post.

bayasdev avatar Oct 05 '21 15:10 bayasdev

Do you set to integrated mode in optimus manager? This should work,someone on the Manjaro forums says it works exactly this way but with CUDA applications https://forum.manjaro.org/t/configuring-hybrid-gpu-laptop-to-only-use-dgpu-when-requested/76265/20?u=xratix Unless is Manjaro specific configuration i don't know

When I boot the OS the dGPU is suspended but as soon as it enables then it can't suspend again. Well afterall seems more convenient to use the nouveau method when I don't need dGPU.

I had the same problem,its TLP that prevents the dGPU to turn off again,you can either disable TLP or check your TLP config file /etc/tlp.conf check

SOUND_POWER_SAVE_ON_AC="1"
SOUND_POWER_SAVE_ON_BAT=1

Both needs to have a value of 1 Then restart TLP and it should be suspended the dGPU sudo tlp start

I already have that in my config as per your previous post.

Try to check if both of these are auto too,maybe thats necessary too.

RUNTIME_PM_ON_AC=auto
RUNTIME_PM_ON_BAT=auto

XRaTiX avatar Oct 06 '21 02:10 XRaTiX

@XRaTiX I am getting the same hybrid mode like behavior (minus the persistent 4Mib xorg process in nvidia-smi) with the default integrated mode settings on arch linux and no TLP installed. Does it make this mode better than the real "hybrid" mode? 🤔 image

saikat0511 avatar Nov 03 '21 13:11 saikat0511

@XRaTiX I am getting the same hybrid mode like behavior (minus the persistent 4Mib xorg process in nvidia-smi) with the default integrated mode settings on arch linux and no TLP installed. Does it make this mode better than the real "hybrid" mode? thinking image

Its definitely much better,you don't have a process consuming your NVIDIA card for nothing (4 MB is not alot,but why have it in the first place) and the NVIDIA card is powered off when is not being used.

So now the NVIDIA card behave like Windows,power off when not needed and can invoke it when I want.

https://user-images.githubusercontent.com/40683158/140162443-893c5729-fab1-43a6-b4f6-936a0f0fbeda.mp4

The only downside is the HDMI port still not working when you are in integrated mode as I said,somebody on Reddit said that in Wayland the HDMI port is working,so in the future there is no gonna be integrated/hybrid/NVIDIA mode anymore,will just work just like in Windows.

XRaTiX avatar Nov 03 '21 17:11 XRaTiX

@XRaTiX I am getting the same hybrid mode like behavior (minus the persistent 4Mib xorg process in nvidia-smi) with the default integrated mode settings on arch linux and no TLP installed. Does it make this mode better than the real "hybrid" mode? thinking image

Its definitely much better,you don't have a process consuming your NVIDIA card for nothing (4 MB is not alot,but why have it in the first place) and the NVIDIA card is powered off when is not being used.

So now the NVIDIA card behave like Windows,power off when not needed and can invoke it when I want.

video.mp4 The only downside is the HDMI port still not working when you are in integrated mode as I said,somebody on Reddit said that in Wayland the HDMI port is working,so in the future there is no gonna be integrated/hybrid/NVIDIA mode anymore,will just work just like in Windows.

Btw how did you get gpu suspension to work? arch wiki and the nvidia page mentioned it only works on turing and ampere GPUs so I just accepted that it wont work for my system (MX330, optimus laptop. icelake cpu so that's supported atleast). It just stays active all the time.

Going by your previous posts you have a 1050ti (pascal) so technically it shouldn't work for you.

saikat0511 avatar Nov 03 '21 18:11 saikat0511

On GTX 970M HDMI port works without problems in hybrid mode (not attached to GPU thou).

michaldybczak avatar Nov 03 '21 19:11 michaldybczak

Btw how did you get gpu suspension to work? arch wiki and the nvidia page mentioned it only works on turing and ampere GPUs so I just accepted that it wont work for my system (MX330, optimus laptop. icelake cpu so that's supported atleast). It just stays active all the time.

Going by your previous posts you have a 1050ti (pascal) so technically it shouldn't work for you.

Yes I have a 1050 Ti,but to be honest I don't even know why it works,just make TLP RUNTIME_PM_ON_AC enabled (on) but even sometimes that doesn't work (see the previous comments above,was helping the guy and somehow it doesn't work for him),I don't know if it something related with Manjaro that does the power management and in Arch is not present.

One thing for sure it the recent nvidia-utils package for 495,my NVIDIA card was Active all the time like you and I found out that the culprit is a file located /usr/share/egl/egl_external_platform.d/15_nvidia_gbm.json,if I delete that file and reboot,my NVIDIA card is able to poweroff again,I explain more details here

https://gitlab.manjaro.org/packages/extra/nvidia-utils/-/issues/2#note_24337

So try deleting that file to see if your card power off too.

On GTX 970M HDMI port works without problems in hybrid mode (not attached to GPU thou).

Yeah the HDMI port works in hybrid,I was talking about in Integrated mode the HDMI port doesn't work unless the port is attached to your iGPU (And this is solved in Wayland).

XRaTiX avatar Nov 04 '21 03:11 XRaTiX

One thing for sure it the recent nvidia-utils package for 495,my NVIDIA card was Active all the time like you and I found out that the culprit is a file located /usr/share/egl/egl_external_platform.d/15_nvidia_gbm.json,if I delete that file and reboot,my NVIDIA card is able to poweroff again,I explain more details here

https://gitlab.manjaro.org/packages/extra/nvidia-utils/-/issues/2#note_24337

So try deleting that file to see if your card power off too.

Didn't work for me, using nvidia-utils 495.44-3 I dont mind much about that tho when I am not connected to power I just disable the nvidia gpu from bios. Not that convenient but it works....

saikat0511 avatar Nov 04 '21 04:11 saikat0511

If somebody is interested I made a simple CLI tool (GUI soon) to effectively turn OFF and ON the Nvidia dGPU on laptops using Udev rules.

https://github.com/geminis3/EnvyControl

Nvidia ON:

Captura de pantalla de 2021-11-04 18-55-16

Nvidia OFF:

Captura de pantalla de 2021-11-04 18-56-54

This tool supports both Nouveau and Nvidia propietary drivers, it should work on any Linux distro.

bayasdev avatar Nov 05 '21 00:11 bayasdev

No,I'm talking about the official NVIDIA drivers,not Nouveau.

And I just upgraded and switch to Intel mode,I don't have to do anything,in optimus-manager just make sure you are not using any switching methods,this is are my settings (using optimus-manager-qt),in fact you don't need optimus-manager at all and will it work (but then you cannot change to hybrid/nvidia mode to be able to use the HDMI port,so you kind of need it).

image

Here is nvidia-smi in Intel mode image

And when I execute vkcube with the NVIDIA card.

image

EDIT: Actually I remember that I had to do something but with TLP,I need to make sure to have SOUND_POWER_SAVE_ON_AC to 1 (is 0 by default),without sound power save,the NVIDIA card still remains on and cannot powered off in Intel mode,I can check if the NVIDIA is on by running the command

watch -n1 -d -t cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status

If is ON,it says active, otherwise it says suspended

But can you run other applications with nvidia GPU? And can you run nvidia settings? I have the same result but is seems like without xorg process nothing can be ran.

I-dont-need-name avatar Dec 01 '21 09:12 I-dont-need-name

No,I'm talking about the official NVIDIA drivers,not Nouveau. And I just upgraded and switch to Intel mode,I don't have to do anything,in optimus-manager just make sure you are not using any switching methods,this is are my settings (using optimus-manager-qt),in fact you don't need optimus-manager at all and will it work (but then you cannot change to hybrid/nvidia mode to be able to use the HDMI port,so you kind of need it). image Here is nvidia-smi in Intel mode image And when I execute vkcube with the NVIDIA card. image EDIT: Actually I remember that I had to do something but with TLP,I need to make sure to have SOUND_POWER_SAVE_ON_AC to 1 (is 0 by default),without sound power save,the NVIDIA card still remains on and cannot powered off in Intel mode,I can check if the NVIDIA is on by running the command watch -n1 -d -t cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status If is ON,it says active, otherwise it says suspended

But can you run other applications with nvidia GPU? And can you run nvidia settings? I have the same result but is seems like without xorg process nothing can be ran.

Yes,I can use any application with the NVIDIA gpu,see the video I posted.

https://github.com/Askannz/optimus-manager/issues/420#issuecomment-959772366

NVIDIA settings doesn't work tho unless I switch to hybrid or nvidia mode for some reason,but to me it doesn't matter I never use that application.

XRaTiX avatar Dec 02 '21 00:12 XRaTiX

If somebody is interested I made a simple CLI tool (GUI soon) to effectively turn OFF and ON the Nvidia dGPU on laptops using Udev rules.

https://github.com/geminis3/EnvyControl

Nvidia ON:

Captura de pantalla de 2021-11-04 18-55-16

Nvidia OFF:

Captura de pantalla de 2021-11-04 18-56-54

This tool supports both Nouveau and Nvidia propietary drivers, it should work on any Linux distro.

Hi @geminis3 does this tool is another tool for switching like optimus manager, and what's the diff between them ?

molitona avatar Dec 26 '21 17:12 molitona

Hi @geminis3 does this tool is another tool for switching like optimus manager, and what's the diff between them ?

Hi, EnvyControl is a tool written from scratch in Python that allows optimus-manager like graphics switching. The integrated mode works by blacklisting all Nvidia related modules as well as removing the Nvidia card from the PCI bus allowing good battery savings.

Unlike optimus-manager, EnvyControl is not only compatible with Arch Linux (it's available on the AUR) but should work with any other Linux distro (Debian derivatives require the initramfs to be rebuilt and EnvyControl does it automatically on newer versions).

You can read the FAQs here.

bayasdev avatar Dec 26 '21 20:12 bayasdev

@geminis3

Sometimes, when I launch firefox, I get that black rectangle border. https://i.ibb.co/TMLQFnT/d.png, so I've to kill/relaunch it.

I use Firefox 95.0.2 from Arch Repo.

When I launch firefox from terminal, I get that when getting that black rectangle border.

ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost

When firefox starts normally, I get that instead:

ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
[GFX1-]: Failed to create EGLContext!: 0x3001
ATTENTION: default value of option mesa_glthread overridden by environment.
!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost

I noticed the same thing for telegram app, but I can't get a screen because it disappears fastly.

I started after using optimus-manager to switch gpus with default config. It does happen only on Xorg, wayland no (obviously cause wayland not supported by optimus manager) I think it's something related to GPU and display.

Do you have any idea ? I'll change optimus-manager by envycontrol and tell you results, but before that I've to know what causes that problem after using optimus-manager (maybe it will reoccur with envycontrol ? dunno what's the root cause ?)

molitona avatar Dec 28 '21 14:12 molitona

@geminis3

Sometimes, when I launch firefox, I get that black rectangle border. https://i.ibb.co/TMLQFnT/d.png, so I've to kill/relaunch it.

I use Firefox 95.0.2 from Arch Repo.

When I launch firefox from terminal, I get that when getting that black rectangle border.

ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost

When firefox starts normally, I get that instead:

ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
ATTENTION: default value of option mesa_glthread overridden by environment.
[GFX1-]: Failed to create EGLContext!: 0x3001
ATTENTION: default value of option mesa_glthread overridden by environment.
!!! [Parent][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost

I noticed the same thing for telegram app, but I can't get a screen because it disappears fastly.

I started after using optimus-manager to switch gpus with default config. It does happen only on Xorg, wayland no (obviously cause wayland not supported by optimus manager) I think it's something related to GPU and display.

Do you have any idea ? I'll change optimus-manager by envycontrol and tell you results, but before that I've to know what causes that problem after using optimus-manager (maybe it will reoccur with envycontrol ? dunno what's the root cause ?)

I had the same bug on Gnome Wayland using EnvyControl integrated mode, sometimes Firefox works and sometimes it gets frozen with black rectangles all over the screen.

It doesn't happens on Xorg for me.

bayasdev avatar Dec 28 '21 14:12 bayasdev

@geminis3 Why Isn't a logout sufficient to switch mode like optimus manager ?

molitona avatar Dec 28 '21 16:12 molitona

@geminis3 Why Isn't a logout sufficient to switch mode like optimus manager ?

I think optimus-manager loads and unloads Nvidia modules whilst the system is running (as well as restarting Xorg), EnvyControl just creates the necessary files to tell the system to load this or blacklist this on next boot.

I can achieve the same results but I don't find it necessary with today's SSD and NVMe drives that boot up in just a couple of seconds.

bayasdev avatar Dec 28 '21 16:12 bayasdev

@geminis3 Not all people have SSD, like mine. BTW, is there any command to know if HDMI ports are wired to the dGPU or IGPU ?

molitona avatar Dec 28 '21 20:12 molitona

@geminis3 Not all people have SSD, like mine. BTW, is there any command to know if HDMI ports are wired to the dGPU or IGPU ?

If on integrated mode HDMI ports don't work then it's wired to the dGPU, also you can check the service manual for your laptop model mine has a system block diagram where it explicitly shows that as well that it's a muxless (mshybrid) design.

bayasdev avatar Dec 28 '21 20:12 bayasdev

No,I'm talking about the official NVIDIA drivers,not Nouveau. And I just upgraded and switch to Intel mode,I don't have to do anything,in optimus-manager just make sure you are not using any switching methods,this is are my settings (using optimus-manager-qt),in fact you don't need optimus-manager at all and will it work (but then you cannot change to hybrid/nvidia mode to be able to use the HDMI port,so you kind of need it). image Here is nvidia-smi in Intel mode image And when I execute vkcube with the NVIDIA card. image EDIT: Actually I remember that I had to do something but with TLP,I need to make sure to have SOUND_POWER_SAVE_ON_AC to 1 (is 0 by default),without sound power save,the NVIDIA card still remains on and cannot powered off in Intel mode,I can check if the NVIDIA is on by running the command watch -n1 -d -t cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status If is ON,it says active, otherwise it says suspended

But can you run other applications with nvidia GPU? And can you run nvidia settings? I have the same result but is seems like without xorg process nothing can be ran.

Yes,I can use any application with the NVIDIA gpu,see the video I posted.

#420 (comment)

NVIDIA settings doesn't work tho unless I switch to hybrid or nvidia mode for some reason,but to me it doesn't matter I never use that application.

@XRaTiX I've the same "active" problem on Integrated+Hybrid modes. Deleting that file doesn't work. I use 470.94 driver. Any solution ?

molitona avatar Jan 01 '22 22:01 molitona

@XRaTiX I've the same "active" problem on Integrated+Hybrid modes. Deleting that file doesn't work. I use 470.94 driver. Any solution ?

I noticed that are some files that prevent the NVIDIA card from powering off,check if you have this files (at least on Manjaro,maybe Arch and other Arch based system have this too)

/usr/share/egl/egl_external_platform.d/15_nvidia_gbm.json

/usr/lib/udev/rules.d/60-nvidia.rules

If you have it delete them,the first file is for wayland and doesn't affect xorg,the second file I don't know what is but I have delete it and it doesn't affect my system,keep a backup just in case.

After that reboot and now it should say suspended instead of active,also make sure to have TLP blacklisted the NVIDIA card via PCIe,I have it like this in TLP UI

image

After that is just like in the video,I can invoke it when I want and it powered off when not in use.

XRaTiX avatar Jan 02 '22 18:01 XRaTiX

Thanks @XRaTiX I followed config 2 here to disable nvidia card on intel mode. https://github.com/Askannz/optimus-manager/wiki/A-guide--to-power-management-options#configuration-2--pci-power-control

It worked for me by loading nouveau, so no nvidia driver anymore on lsmod output. But, it's hacky solution, because when I launch firefox and some other programs, watch -n1 -d -t cat /sys/bus/pci/devices/0000:08:00.0/power/runtime_status out goes from suspended --> active --> suspending --> suspended. They are polling the nvidia driver.

So, I removed nouveau option and used pci_power_control=yes, pci_remove=yes as they said there. Now lsmod for nvidia or nouveau doesn't return anything.

molitona avatar Jan 04 '22 11:01 molitona

This doesn't seem to work anymore with drivers 515? I get this when trying to run something in integrated mode:

prime-run glxgears                                                                                                                                                                       1 
/usr/bin/prime-run: line 2:  4057 Segmentation fault      (core dumped) __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"

I-dont-need-name avatar Jun 13 '22 12:06 I-dont-need-name