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

[BUG] Nvidia mode not fully working in Wayland #178

Open
Reonu opened this issue Aug 3, 2024 · 6 comments
Open

[BUG] Nvidia mode not fully working in Wayland #178

Reonu opened this issue Aug 3, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@Reonu
Copy link

Reonu commented Aug 3, 2024

Describe the bug
When using Nvidia mode, I expect every piece of software to only see and use the Nvidia GPU. However, many pieces of software, such as Blender (!), GPU Screen Recorder, Firefox, etc, as well as Wayland itself, run on the Intel GPU unless I launch them with the __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia env vars. I wouldn't expect these env vars to ever be necessary when using Nvidia mode. This doesn't seem to be the case in X11.

To Reproduce
Steps to reproduce the behavior:

  1. Use Nvidia mode on Wayland
  2. Launch Blender or any other non-game app where you still want to use the Nvidia GPU.

Expected behavior
All software should be running on the Nvidia GPU

Screenshots
Not applicable

System Information:

  • Model: MSI GE65 Raider 9SF
  • Distro: EndeavourOS
  • Kernel: 6.10.2-arch1-1
  • DE/WM and Display Manager (if applicable): KDE Plasma 6.1 / KWin 6.1
  • EnvyControl version: 3.4.0-1
  • Nvidia driver version: 555.58.02
  • lspci output:
00:00.0 Host bridge: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers (rev 0d)
00:01.0 PCI bridge: Intel Corporation 6th-10th Gen Core Processor PCIe Controller (x16) (rev 0d)
00:02.0 VGA compatible controller: Intel Corporation CoffeeLake-H GT2 [UHD Graphics 630] (rev 02)
00:12.0 Signal processing controller: Intel Corporation Cannon Lake PCH Thermal Controller (rev 10)
00:14.0 USB controller: Intel Corporation Cannon Lake PCH USB 3.1 xHCI Host Controller (rev 10)
00:14.2 RAM memory: Intel Corporation Cannon Lake PCH Shared SRAM (rev 10)
00:15.0 Serial bus controller: Intel Corporation Cannon Lake PCH Serial IO I2C Controller #0 (rev 10)
00:15.2 Serial bus controller: Intel Corporation Cannon Lake PCH Serial IO I2C Controller #2 (rev 10)
00:16.0 Communication controller: Intel Corporation Cannon Lake PCH HECI Controller (rev 10)
00:17.0 SATA controller: Intel Corporation Cannon Lake Mobile PCH SATA AHCI Controller (rev 10)
00:1b.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #17 (rev f0)
00:1b.2 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #19 (rev f0)
00:1b.4 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #21 (rev f0)
00:1d.0 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #9 (rev f0)
00:1d.6 PCI bridge: Intel Corporation Cannon Lake PCH PCI Express Root Port #15 (rev f0)
00:1f.0 ISA bridge: Intel Corporation HM470 Chipset LPC/eSPI Controller (rev 10)
00:1f.3 Audio device: Intel Corporation Cannon Lake PCH cAVS (rev 10)
00:1f.4 SMBus: Intel Corporation Cannon Lake PCH SMBus Controller (rev 10)
00:1f.5 Serial bus controller: Intel Corporation Cannon Lake PCH SPI Controller (rev 10)
01:00.0 VGA compatible controller: NVIDIA Corporation TU106M [GeForce RTX 2070 Mobile] (rev a1)
01:00.1 Audio device: NVIDIA Corporation TU106 High Definition Audio Controller (rev a1)
01:00.2 USB controller: NVIDIA Corporation TU106 USB 3.1 Host Controller (rev a1)
01:00.3 Serial bus controller: NVIDIA Corporation TU106 USB Type-C UCSI Controller (rev a1)
03:00.0 Network controller: Intel Corporation Wi-Fi 6 AX200 (rev 1a)
04:00.0 Non-Volatile memory controller: Samsung Electronics Co Ltd NVMe SSD Controller SM981/PM981/PM983
06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. Killer E2600 GbE Controller (rev 21)

@Reonu Reonu added the bug Something isn't working label Aug 3, 2024
@Reonu
Copy link
Author

Reonu commented Aug 4, 2024

I've been looking at other issues and it seems that the reason Nvidia mode is not supported on Wayland is Nvidia not having proper Wayland support? This is no longer the case however, as Nvidia drivers starting from driver version 555 have proper Wayland support now. So could this be reconsidered? Is it possible to add Nvidia mode support now?

@iriusas
Copy link

iriusas commented Aug 19, 2024

I have the same problem, version 555 driver, I use wayland and envycontrol, but the applications use embedded graphics, although nvidia mode is set

@bayasdev
Copy link
Owner

Wayland is not supported as it requires a DE/WM specific logic to override the primary GPU.

I remember GNOME has a setting for that but at the time I tested Nvidia had completely broken Wayland support (only external screens worked and it was prone to crashes). For KDE I’m not sure.

@dec05eba
Copy link

dec05eba commented Aug 19, 2024

On kde plasma wayland you can choose which device to use as the primary device by using the KWIN_DRM_DEVICES environment variable. You do it like this KWIN_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0 and it will prioritize card1 over card0. I tested it on an intel laptop with dedicated nvidia gpu and it works and it can display both the laptops monitor (powered by the intel iGPU) and the external monitor (powered by the nvidia dedicated gpu).
You also need to have the nvidia-drm.modeset=1 kernel option set as you would expect

@Impeta
Copy link

Impeta commented Aug 23, 2024

On kde plasma wayland you can choose which device to use as the primary device by using the KWIN_DRM_DEVICES environment variable. You do it like this KWIN_DRM_DEVICES=/dev/dri/card1:/dev/dri/card0 and it will prioritize card1 over card0. I tested it on an intel laptop with dedicated nvidia gpu and it works and it can display both the laptops monitor (powered by the intel iGPU) and the external monitor (powered by the nvidia dedicated gpu). You also need to have the nvidia-drm.modeset=1 kernel option set as you would expect

Bit off-topic but whereas this works like a charm and all, unfortunately Firefox of all, least on my end, refuses to just still keep using my Intel iGPU for hardware acceleration as long you keep your discrete NVIDIA card as your main graphic displays. Says this on my about:support:
image
Tried already MOZ_DRM_DEVICE=/dev/dri/renderD128, but that didn't seem to do any difference. So far, this seems to be the only drawback from switching to NVIDIA Wayland KWin.
I'm sure there's a command to make it run on iGPU only, but to my research, there's none really. DRI_PRIME doesn't work.

@klmcwhirter
Copy link
Contributor

klmcwhirter commented Nov 30, 2024

FWIW, I have successfully added GPU preference using the freedesktop.org .desktop file configuration. I did this for the kitty terminal for example.

I copied the kitty.desktop file into ~/.local/share/applications/kitty.desktop and added the following line:
PrefersNonDefaultGPU=true

Setting it to false does not preclude it from using the discrete GPU, but certain apps (like VS Code) will switch to the integrated GPU when set to false (at least in my experience).

Be aware that, as the docs linked above suggests, support for this hint is WM/DE (as @bayasdev said above) and app specific.

So, @Impeta you might try creating a custom firefox.desktop file with PrefersNonDefaultGPU=false as an additional thing to try. If that doesn't work try setting it to true since you have configured the nvidia GPU to be your default.

On my system the installed file is at: /usr/share/applications/org.mozilla.firefox.desktop.

FYI - here is my setup:
Fedora WS 41
GNOME 47.1 using mutter (Wayland) WM
rpmfusion nvidia 565 driver (akmod)
Acer Nitro 5 with RTX 3050 Ti Mobile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants