Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dGPU with nvidia-drivers and Gnome Wayland
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
Faraclas
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2014
Posts: 117

PostPosted: Fri Jan 06, 2023 7:27 pm    Post subject: dGPU with nvidia-drivers and Gnome Wayland Reply with quote

Hey guys,

I got an eGPU enclosure and an nvidia 3060 Ti and am trying to get it running in Gnome Wayland. The desired end result it to have my laptop screen and another display driven by the Intel Iris XE GPU (via a thunderbolt hub) and then have another monitor connected to the DisplayPort output of the nvidia card. This is working great in windows (dual-boot), but Windows makes me sad and I would like to get this going in my gentoo system. Here is what I have done so far:

* Added nvidia to make.conf
Code:
VIDEO_CARDS="intel i965 iris nvidia"


* Built nvidia-drivers with wayland support
Code:
$ eix nvidia-drivers
[I] x11-drivers/nvidia-drivers
     Available versions:  390.157(0/390) 470.161.03(0/470) 510.108.03(0/510) 515.86.01(0/515) [M]~525.47.04(0/vulkan) 525.60.13(0/525) ~525.78.01(0/525) {+X dist-kernel (+)driver kernel-open persistenced +static-libs +tools wayland ABI_X86="32 64"}
     Installed versions:  525.60.13(0/525)(09:12:40 01/05/23)(X driver static-libs tools wayland -dist-kernel -kernel-open -persistenced ABI_X86="32 64")
     Homepage:            https://www.nvidia.com/download/index.aspx
     Description:         NVIDIA Accelerated Graphics Driver

* Worked through this to setup my kernel: https://wiki.gentoo.org/wiki/NVIDIA/nvidia-drivers#Kernel
* Worked through this post: https://www.reddit.com/r/Fedora/comments/yamnog/gnome_wayland_on_nvidia_egpu (I am Adaptive
13)
* Worked on getting all-ways-egpu running: https://github.com/ewagner12/all-ways-egpu/issues/6#issuecomment-1368043385
* My system can recognize the card from inside of gnome both in lspci as well as nvidia-settings: https://tinyurl.com/mrx8b59b

Any ideas?
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2937

PostPosted: Fri Jan 06, 2023 8:12 pm    Post subject: Reply with quote

Hello Faraclas,

Generally, NVIDIA doesn't care too much about Linux and especially Wayland. That's why the drivers are not up to par with their Windows counterpart and GDM won't start Gnome in Wayland mode if NVIDIA or hybrid graphics are detected.

You didn't mention if this is a laptop with hybrid graphics or a desktop.

According to Arch Wiki you can disable udev rules for GDM by

Code:
ln -s /dev/null /etc/udev/rules.d/61-gdm.rules


However according to Gentoo devs and experts in IRC it's too much trouble.

To enable them again just delete the symlink. However there's no guarantee it will work.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Faraclas
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2014
Posts: 117

PostPosted: Fri Jan 06, 2023 9:42 pm    Post subject: Reply with quote

This is a laptop with only the built in Intel Iris XE onboqard. The nvidia card is in an eGPU enclosure connected via thunderbolt.

In my system there are not rules in /etc/udev/rules.d . However, I found them in /usr/lib/udev/rules.d and there is a 61-gdm.rules that exists with a bunch of tests that can wind up with wayland disabled. And it looks like this is happening.

With eGPU powered off on boot:

Code:
$ echo $WAYLAND_DISPLAY
wayland-0


with eGPU powered on on boot:

Code:
elias@gentoo ~ $ echo $WAYLAND_DISPLAY

Back to top
View user's profile Send private message
Faraclas
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2014
Posts: 117

PostPosted: Sat Jan 07, 2023 2:51 pm    Post subject: Reply with quote

So issue number 1, is that I am definitely not in wayland. However in the Gnome X environment I wound up in, the nvidia card does show up in nvidia-setting (GUI) and in the CLI. In the nvidia-settings (GUI) while the card shows up, there are no instances of X Screens. This is probably because I normally am in Wayland and have never configured them.

$ nvidia-smi
Sat Jan 7 09:46:59 2023
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.60.13 Driver Version: 525.60.13 CUDA Version: 12.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:4F:00.0 Off | N/A |
| 0% 44C P8 12W / 200W | 1MiB / 8192MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+

elias@gentoo ~ $ sudo lshw -c display
*-display
description: VGA compatible controller
product: TigerLake-LP GT2 [Iris Xe Graphics]
vendor: Intel Corporation
physical id: 2
bus info: pci@0000:00:02.0
logical name: /dev/fb0
version: 01
width: 64 bits
clock: 33MHz
capabilities: pciexpress msi pm vga_controller bus_master cap_list rom fb
configuration: depth=32 driver=i915 latency=0 mode=3840x2160 resolution=3840,2400 visual=truecolor xres=3840 yres=2160
resources: iomemory:600-5ff iomemory:400-3ff irq:184 memory:6054000000-6054ffffff memory:4000000000-400fffffff ioport:4000(size=64) memory:c0000-dffff memory:4010000000-4016ffffff memory:4020000000-40ffffffff
*-display
description: VGA compatible controller
product: GA104 [GeForce RTX 3060 Ti Lite Hash Rate]
vendor: NVIDIA Corporation
physical id: 0
bus info: pci@0000:4f:00.0
version: a1
width: 64 bits
clock: 33MHz
capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
configuration: driver=nvidia latency=0
resources: iomemory:600-5ff iomemory:600-5ff irq:185 memory:74000000-74ffffff memory:6000000000-600fffffff memory:6010000000-6011ffffff ioport:7000(size=128) memory:75080000-750fffff

Any suggestions?
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2937

PostPosted: Sat Jan 07, 2023 3:56 pm    Post subject: Reply with quote

Faraclas wrote:


In my system there are not rules in /etc/udev/rules.d . However, I found them in /usr/lib/udev/rules.d and there is a 61-gdm.rules that exists with a bunch of tests that can wind up with wayland disabled. And it looks like this is happening.


Don't touch the ones in /usr/lib, the symlink in /etc overrides them.

Maybe this is what you need and I hope you don't have problems with it. They disabled it for a reason.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Faraclas
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2014
Posts: 117

PostPosted: Sat Jan 07, 2023 8:39 pm    Post subject: Reply with quote

With respect to the defaults, the current nvidia-drivers do work fine in wayland. However, they are missing the functionality to sleep, hibernate, and resume. For this reason, nvidia asked the Gnome team to set the defaults for GDM to start X instead of Wayland. So, part one of getting this to work (in Wayland) would be to get into Wayland (reliably).

I edited the 61-GDM.rules file, to test, and the system I deed went I to Wayland. The monitor connected to the eGPU found the I put on scal and then stayed on with a greenish blank screen. The laptop monitor, and a 3rd monitor (connected to the laptop intel gpu) were both stuck on some terminal looking screen.

Step 2 will be to have the drivers get loaded properly such that this is avoided. I really want to use Wayland as I work on this machine daily and things like independent hdpi scaling work much better. If I need to dual-boot to use the nvidia card then I might as well use the windows partition (where the nvidia card works great, but everything else is miserable).

With respect to udev, there is literally nothing in /etc/udev/rules.d/ . I tried to put some rules in there and they were ignored. I'm really not sure which directory is the "install" and which is for "user edits". But typically isn't /etc used for install and /usr for users?
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2937

PostPosted: Sun Jan 08, 2023 9:06 am    Post subject: Reply with quote

Faraclas,

The way to edit udev rules is to create overriding files in /etc/udev/rules.d. Placing symlink to /dev/null is equivalent to negating them. Do not touch files that came from portage. And this is a general rule if you don't want to break your system.

To make nvidia sleep and hibernate, enable respective nvidia systemd services and change the following line in /lib/modprobe.d/nvidia.conf from 0 to 1, as described in the commented line above it:

Code:
NVreg_PreserveVideoMemoryAllocations=0


However you might experience problems with sleep and hibernate.

Best Regards,
Georgi
Back to top
View user's profile Send private message
logrusx
Advocate
Advocate


Joined: 22 Feb 2018
Posts: 2937

PostPosted: Sun Jan 08, 2023 8:08 pm    Post subject: Reply with quote

I just tried to use Wayland with the dGPU and it worked. I only tested sleep and it worked, however there are glitches with some applications and it's worse than it was an year ago.

Best Regards,
Georgi
Back to top
View user's profile Send private message
Fitap
Guru
Guru


Joined: 13 Mar 2011
Posts: 476
Location: Rosario, Argentina

PostPosted: Sun Mar 23, 2025 8:13 pm    Post subject: Reply with quote

Code:
echo $WAYLAND_DISPLAY
wayland-0


Code:
echo $XDG_SESSION_TYPE
wayland


Code:
lsmod | grep nvidia
nvidia_modeset       2076672  3
nvidia              12619776  53 nvidia_modeset


Code:
glxinfo | grep "OpenGL renderer"
OpenGL renderer string: NVIDIA GeForce RTX 3050 Laptop GPU/PCIe/SSE2
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum