pedro00dk/nvidia-exec

GPU starts correctly with nvx on but OpenGL does not still use GPU

D3vil0p3r opened this issue · 8 comments

Hello @pedro00dk ,
I have an issue related to nvx. I' working on Arch Linux with GNOME 43 + Wayland installed in baremetal and I have NVIDIA RTX 2060 as my GPU card.

When I run nvx start glxinfo | grep "OpenGL renderer" I get the correct output, that is:

$ nvx start glxinfo | grep "OpenGL renderer"

OpenGL renderer string: NVIDIA GeForce RTX 2060/PCIe/SSE2

Since I want that OpenGL uses always my GPU, when I run nvx on, I don't get the same output, and it shows the integrated Intel GPU:

$ nvx on

# turn on gpu
-- pci rescan
-- pci "PCI bridge - 6th-10th Gen Core Processor PCIe Controller (x16)" -> 0000:00:01.0
   -- pci power control on
   -- device enable "VGA compatible controller - TU106M [GeForce RTX 2060 Mobile]" -> 0000:01:00.0
# load modules
   -- module nvidia
   -- module nvidia_uvm
   -- module nvidia_modeset
   -- module nvidia_drm

$ nvx status

on

$ glxinfo | grep "OpenGL renderer

OpenGL renderer string: Mesa Intel(R) UHD Graphics 630 (CFL GT2)

Why in this last case, when I set the status of NVX as ON, OpenGL renderer is not my GPU despite all Nvidia modules are correctly loaded? Why does it work only by nvx start and not by nvx on?

Additional information: after running nvx on and when all Nvidia modules are loaded correctly, when I run nvx ps I don't get any output.

Hello @pedro00dk , I have an issue related to nvx. I' working on Arch Linux with GNOME 43 + Wayland installed in baremetal and I have NVIDIA RTX 2060 as my GPU card.

When I run nvx start glxinfo | grep "OpenGL renderer" I get the correct output, that is:

$ nvx start glxinfo | grep "OpenGL renderer"

OpenGL renderer string: NVIDIA GeForce RTX 2060/PCIe/SSE2

Since I want that OpenGL uses always my GPU, when I run nvx on, I don't get the same output, and it shows the integrated Intel GPU:

$ nvx on

# turn on gpu
-- pci rescan
-- pci "PCI bridge - 6th-10th Gen Core Processor PCIe Controller (x16)" -> 0000:00:01.0
   -- pci power control on
   -- device enable "VGA compatible controller - TU106M [GeForce RTX 2060 Mobile]" -> 0000:01:00.0
# load modules
   -- module nvidia
   -- module nvidia_uvm
   -- module nvidia_modeset
   -- module nvidia_drm

$ nvx status

on

$ glxinfo | grep "OpenGL renderer

OpenGL renderer string: Mesa Intel(R) UHD Graphics 630 (CFL GT2)

Why in this last case, when I set the status of NVX as ON, OpenGL renderer is not my GPU despite all Nvidia modules are correctly loaded? Why does it work only by nvx start and not by nvx on?

Additional information: after running nvx on and when all Nvidia modules are loaded correctly, when I run nvx ps I don't get any output.

nvx start [program] applies environment variables to the program being started. That is what sets the program to use the gpu.

nvidia-exec/nvx

Line 185 in 1dd1ece

__NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@" || true

@NicBOMB thank you. By setting those env variables, I am able to set Nvidia GPU as OpenGL Renderer.

When I use nvx on, after a reboot its status becomes off. Is there a way to keep NVX on (without turning it off) after a reboot or shutdown?

Do I need to disable only nvx.service?

@NicBOMB thank you. By setting those env variables, I am able to set Nvidia GPU as OpenGL Renderer.

When I use nvx on, after a reboot its status becomes off. Is there a way to keep NVX on (without turning it off) after a reboot or shutdown?

The nvx.service explicitly turns off the gpu during boot. Disable the service and/or make a new which turns it on.

[Unit]
Description="Turn off gpu during boot."
[Service]
Type=oneshot
ExecStart=/usr/bin/nvx off-boot
[Install]
WantedBy=multi-user.target

If you want a setup in which the gpu persists you will get better results with https://github.com/Askannz/optimus-manager
I think my setup is more representative of a good use-case for nvx #18 (comment)

The problem with optimus-manager is that it works only with Xorg, no Wayland. I discourage in general the usage of Xorg due to security concerns. Currently nvx seems the only solution working on Wayland.

The problem with optimus-manager is that it works only with Xorg, no Wayland. I discourage in general the usage of Xorg due to security concerns. Currently nvx seems the only solution working on Wayland.

I agree that Xorg is declining, but optimus-manager appears to have wayland support as a goal Askannz/optimus-manager#452 (comment). Considering Xorg is already being phased out in major distros, I wouldn't be surprised if optimus-manager gets support sooner than later.

In your opinion, for this switching task, what is better? nvx or optimus-manager? And why?

In your opinion, for this switching task, what is better? nvx or optimus-manager? And why?

nvx and optimus-manager both have their reasons.
nvx keeps the gpu totally off until you actually need it switched on.
optimus-manager allows you to configure the nvidia driver settings very clearly and switch the gpu on/off by relogging into the DE.

Personally, I'd rather not relogin just to manage my hardware. I am content with getting prompted anytime I want my GPU to turn on. That may be a showstopper for other users. For example, modding a game may require many restarts. Getting a popup to toggle the gpu drivers when you just launched an app feels like getting two confirmation prompts; bad user experience.

optimus-manager does support some of the drivers' power management features, but you'll have to check if they work on Wayland. https://github.com/Askannz/optimus-manager/wiki/A-guide--to-power-management-options

Ty for the info. Since I got the information I needed, I close the issue.