You are not logged in.

#1 2022-07-10 23:19:12

Unda
Member
From: Lille, France
Registered: 2014-10-12
Posts: 21

Unable to use PRIME with Wayland

Hello,

I have a laptop with "hybrid graphics": an AMD CPU along with an NVIDIA GPU.
I am trying to use "PRIME" (from the wiki page), and I tried a bunch of things, but as I understand it, it should be as simple as preprending a

DRI_PRIME=1

in front of the command I wan't to run with my NVIDIA card. But I have no luck running

$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD RENOIR (LLVM 14.0.6, DRM 3.46, 5.18.10-arch1-1)
$ DRI_PRIME=1 glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD RENOIR (LLVM 14.0.6, DRM 3.46, 5.18.10-arch1-1)

The wiki page also relies on xrandr, but since I'm running Sway, the command

xrandr --listproviders

gives

Providers: number : 0

I'm trying to make it work with nouveau driver, I shouldn't have any nvidia package installed.

Here are some maybe-useful information

$ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation TU116M [GeForce GTX 1650 Ti Mobile] (rev a1)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c6)

I'm a bit lost in all this, it seems lots of people still run Xorg, which I would prefer not to, but then all of these related resources on the Web aren't applicable to my use case hmm

The ultimate goal would be to run video games using the NVIDIA GPU. Native games first, then maybe Windows games via Steam/Proton, but if I can make baby steps first, that'd be great big_smile

Any help is appreciated, and please let me know if I can provide more information to help you help me smile

Offline

#2 2022-07-11 09:56:51

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 16,718

Re: Unable to use PRIME with Wayland

As far as I know this doesn't really work well even with just open drivers. This needs direct support in the compositor, not sure where sway/wlroots is here. FWIW if your intention is to run games you aren't really going to get around the nvidia blob, but seeing as this is a Turing GPU you could opt for nvidia-open to have at least the kernel module be open source.

For the immediate problem you might have to set the environment correctly to access multiple DRM devices You might also want to use eglinfo to check which renderer was identified to have a tool that will be native on wayland.

Offline

#3 2022-07-11 11:00:51

Unda
Member
From: Lille, France
Registered: 2014-10-12
Posts: 21

Re: Unable to use PRIME with Wayland

V1del wrote:

As far as I know this doesn't really work well even with just open drivers. This needs direct support in the compositor, not sure where sway/wlroots is here. FWIW if your intention is to run games you aren't really going to get around the nvidia blob, but seeing as this is a Turing GPU you could opt for nvidia-open to have at least the kernel module be open source.

I'm not sure what you mean. You're saying it could be unsupported by wlsroots, but supported by something else? I'm okay with using NVIDIA drivers, I just wanted to "keep things simple" as first steps.

V1del wrote:

For the immediate problem you might have to set the environment correctly to access multiple DRM devices You might also want to use eglinfo to check which renderer was identified to have a tool that will be native on wayland.

Here too I'm not sure what you mean, from the following information

$ lspci | grep VGA
01:00.0 VGA compatible controller: NVIDIA Corporation TU116M [GeForce GTX 1650 Ti Mobile] (rev a1)
05:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Renoir (rev c6)
$ ll /dev/dri/by-path/*
lrwxrwxrwx 1 root root  8 Jul 11 12:39 /dev/dri/by-path/pci-0000:01:00.0-card -> ../card0
lrwxrwxrwx 1 root root 13 Jul 11 12:39 /dev/dri/by-path/pci-0000:01:00.0-render -> ../renderD128
lrwxrwxrwx 1 root root  8 Jul 11 12:41 /dev/dri/by-path/pci-0000:05:00.0-card -> ../card1
lrwxrwxrwx 1 root root 13 Jul 11 12:39 /dev/dri/by-path/pci-0000:05:00.0-render -> ../renderD129

I guess /dev/dri/card0 is my NVIDIA card, and /dev/dri/card1 myAMD card.
So I tried to use

WLR_DRM_DEVICES="/dev/dri/card1:/dev/dri/card0" sway -V

But it didn't change a thing. I also tried it the other way around, also didn't change a thing.

When I run sway without explicitly setting the WLR_DRM_DEVICES variable, I do have an error regarding my NVIDIA card.

0:00:00.000 [INFO] [sway/main.c:343] Sway version 1.7
00:00:00.000 [INFO] [sway/main.c:344] wlroots version 0.15.1
00:00:00.005 [INFO] [sway/main.c:120] Linux arch 5.18.10-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 07 Jul 2022 17:18:13 +0000 x86_64 GNU/Linux
00:00:00.005 [INFO] [sway/main.c:136] Contents of /etc/lsb-release:
00:00:00.005 [INFO] [sway/main.c:120] DISTRIB_ID="Arch"
00:00:00.005 [INFO] [sway/main.c:120] DISTRIB_RELEASE="rolling"
00:00:00.005 [INFO] [sway/main.c:120] DISTRIB_DESCRIPTION="Arch Linux"
00:00:00.005 [INFO] [sway/main.c:136] Contents of /etc/os-release:
00:00:00.005 [INFO] [sway/main.c:120] NAME="Arch Linux"
00:00:00.005 [INFO] [sway/main.c:120] PRETTY_NAME="Arch Linux"
00:00:00.005 [INFO] [sway/main.c:120] ID=arch
00:00:00.005 [INFO] [sway/main.c:120] BUILD_ID=rolling
00:00:00.005 [INFO] [sway/main.c:120] ANSI_COLOR="38;2;23;147;209"
00:00:00.005 [INFO] [sway/main.c:120] HOME_URL="https://archlinux.org/"
00:00:00.005 [INFO] [sway/main.c:120] DOCUMENTATION_URL="https://wiki.archlinux.org/"
00:00:00.005 [INFO] [sway/main.c:120] SUPPORT_URL="https://bbs.archlinux.org/"
00:00:00.005 [INFO] [sway/main.c:120] BUG_REPORT_URL="https://bugs.archlinux.org/"
00:00:00.005 [INFO] [sway/main.c:120] LOGO=archlinux-logo
00:00:00.005 [INFO] [sway/main.c:108] LD_LIBRARY_PATH=
00:00:00.005 [INFO] [sway/main.c:108] LD_PRELOAD=
00:00:00.005 [INFO] [sway/main.c:108] PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
00:00:00.005 [INFO] [sway/main.c:108] SWAYSOCK=
00:00:00.005 [INFO] [wlr] [libseat] [libseat/backend/seatd.c:64] Could not connect to socket /run/seatd.sock: No such file or directory
00:00:00.005 [INFO] [wlr] [libseat] [libseat/libseat.c:76] Backend 'seatd' failed to open seat, skipping
00:00:00.015 [INFO] [wlr] [libseat] [libseat/libseat.c:73] Seat opened with backend 'logind'
00:00:00.015 [INFO] [wlr] [backend/session/session.c:110] Successfully loaded libseat session
00:00:00.016 [ERROR] [wlr] [libseat] [libseat/backend/logind.c:137] Could not take device: Invalid argument
00:00:00.017 [ERROR] [wlr] [backend/session/session.c:322] Failed to open device: '/dev/dri/card0': Resource temporarily unavailable
00:00:00.018 [INFO] [wlr] [backend/backend.c:220] Found 1 GPUs
00:00:00.018 [INFO] [wlr] [backend/drm/backend.c:183] Initializing DRM backend for /dev/dri/card1 (amdgpu)
[...]

Then it switches to /dev/dri/card1 and seems happy with it... But I don't know how to diagnose this.

Last edited by Unda (2022-07-11 11:01:28)

Offline

#4 2022-07-11 13:10:10

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 16,718

Re: Unable to use PRIME with Wayland

That's what I mean, "Wayland" is an overall protocol, how much of that is effectively implemented or whether any given compositor does things differently is up to the compositor. There's no single entity "Wayland" like there's a single entity "Xorg".

Do you get nouveau errors in dmesg/the journal? It generally isn't too good with newer cards even for very basic stuff. From what I'm seeing sway/wlroots should somewhat support multiple GPUs if this is now just up to nouveau having generally little support for Turing cards you might get more out of it trying the nvidia blob directly. Note that for anything Wayland there to work you need to enable modesetting and start sway with the --unsupported-gpu flag.

See https://wiki.archlinux.org/title/NVIDIA … de_setting and note the current potential requirement for ibt=off if you wanted to opt for the nvidia driver: https://wiki.archlinux.org/title/NVIDIA#Installation (blue note box)

Offline

#5 2022-07-13 23:38:55

Unda
Member
From: Lille, France
Registered: 2014-10-12
Posts: 21

Re: Unable to use PRIME with Wayland

I do have nouveau-related errors in dmesg/the journal

$ sudo dmesg | grep -i nouveau
[    1.874113] nouveau 0000:01:00.0: enabling device (0000 -> 0003)
[    1.874283] nouveau 0000:01:00.0: NVIDIA TU116 (168000a1)
[    1.966351] nouveau 0000:01:00.0: bios: version 90.16.4e.00.1c
[    1.977604] nouveau 0000:01:00.0: pmu: firmware unavailable
[    1.998725] nouveau 0000:01:00.0: fb: 4096 MiB GDDR6
[    2.052833] nouveau 0000:01:00.0: DRM: VRAM: 4096 MiB
[    2.052838] nouveau 0000:01:00.0: DRM: GART: 536870912 MiB
[    2.052840] nouveau 0000:01:00.0: DRM: BIT table 'A' not found
[    2.052841] nouveau 0000:01:00.0: DRM: BIT table 'L' not found
[    2.052842] nouveau 0000:01:00.0: DRM: TMDS table version 2.0
[    2.052844] nouveau 0000:01:00.0: DRM: DCB version 4.1
[    2.052845] nouveau 0000:01:00.0: DRM: DCB outp 00: 02000f52 00020010
[    2.052848] nouveau 0000:01:00.0: DRM: DCB outp 01: 01011f36 04600010
[    2.052849] nouveau 0000:01:00.0: DRM: DCB outp 02: 01011f32 00020010
[    2.052850] nouveau 0000:01:00.0: DRM: DCB outp 03: 01022f46 04600020
[    2.052851] nouveau 0000:01:00.0: DRM: DCB outp 04: 01022f42 00020020
[    2.052852] nouveau 0000:01:00.0: DRM: DCB conn 00: 00010061
[    2.052853] nouveau 0000:01:00.0: DRM: DCB conn 01: 00001146
[    2.052854] nouveau 0000:01:00.0: DRM: DCB conn 02: 00002246
[    2.053300] nouveau 0000:01:00.0: DRM: MM: using COPY for buffer copies
[    2.197060] nouveau 0000:01:00.0: [drm] Cannot find any crtc or sizes
[    2.197062] snd_hda_intel 0000:01:00.1: bound 0000:01:00.0 (ops nv50_audio_component_bind_ops [nouveau])
[    2.198449] [drm] Initialized nouveau 1.3.1 20120801 for 0000:01:00.0 on minor 0
[    2.343738] nouveau 0000:01:00.0: [drm] Cannot find any crtc or sizes
[    2.487071] nouveau 0000:01:00.0: [drm] Cannot find any crtc or sizes
[   13.211043] nouveau 0000:01:00.0: timeout
[   13.211079] WARNING: CPU: 1 PID: 143 at drivers/gpu/drm/nouveau/nvkm/falcon/v1.c:247 nvkm_falcon_v1_wait_for_halt+0xe2/0xf0 [nouveau]
[   13.211258] Modules linked in: bnep amdgpu btusb uvcvideo btrtl ccm btbcm videobuf2_vmalloc btintel videobuf2_memops algif_aead btmtk videobuf2_v4l2 videobuf2_common cbc bluetooth videodev des_generic rtsx_usb_sdmmc libdes rtsx_usb_ms mmc_core memstick usbhid mc ecdh_generic gpu_sched ecb algif_skcipher cmac md4 algif_hash af_alg snd_hda_codec_realtek snd_hda_codec_generic ledtrig_audio snd_hda_codec_hdmi iwlmvm snd_hda_intel intel_rapl_msr joydev mac80211 snd_intel_dspcfg intel_rapl_common snd_intel_sdw_acpi mousedev uniwill_wmi(OE) libarc4 snd_hda_codec ucsi_ccg iwlwifi typec_ucsi snd_hda_core typec edac_mce_amd asus_wmi iwlmei nouveau snd_hwdep kvm_amd hid_multitouch platform_profile roles wmi_bmof clevo_wmi(OE) ccp mxm_wmi snd_pcm cfg80211 r8169 kvm snd_timer realtek vfat drm_ttm_helper irqbypass sp5100_tco ttm mdio_devres fat snd rfkill tpm_crb crct10dif_pclmul crc32_pclmul ghash_clmulni_intel aesni_intel crypto_simd cryptd rapl mei libphy drm_dp_helper pcspkr tpm_tis k10temp
[   13.211418] RIP: 0010:nvkm_falcon_v1_wait_for_halt+0xe2/0xf0 [nouveau]
[   13.211624]  gm200_acr_hsfw_boot+0xca/0x160 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.211798]  nvkm_acr_hsf_boot+0x88/0xe0 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.211967]  tu102_acr_init+0x19/0x30 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.212137]  nvkm_acr_load+0x52/0x110 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.212305]  nvkm_subdev_init+0x97/0xd0 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.212478]  nvkm_device_init+0x11b/0x1b0 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.212687]  nvkm_udevice_init+0x46/0x70 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.212879]  nvkm_object_init+0x41/0x110 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.213047]  nvkm_object_init+0x76/0x110 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.213214]  nvkm_object_init+0x76/0x110 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.213380]  nouveau_do_resume+0x2b/0xd0 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.213583]  nouveau_pmops_runtime_resume+0x7e/0x150 [nouveau 7d9192b297053377f541052251b298df7938145b]
[   13.213898] nouveau 0000:01:00.0: acr: AHESASC binary failed
[   13.213902] nouveau 0000:01:00.0: acr: init failed, -110
[   13.214043] nouveau 0000:01:00.0: init failed with -110
[   13.214046] nouveau: systemd-udevd[364]:00000000:00000080: init failed with -110
[   13.214049] nouveau: DRM-master:00000000:00000000: init failed with -110
[   13.214051] nouveau: DRM-master:00000000:00000000: init failed with -110
[   13.214055] nouveau 0000:01:00.0: DRM: Client resume failed with error: -110
[   13.214057] nouveau 0000:01:00.0: DRM: resume failed with: -110

So I tried using the NVIDIA driver as you suggested: I installed nvidia-open, along with nvidia-prime (which is what is stated here).

Sway was complaining so I, indeed, needed to use the --unsupported-gpu flag.

Then I had this:

$ glxinfo | grep "OpenGL renderer"
OpenGL renderer string: AMD RENOIR (LLVM 14.0.6, DRM 3.46, 5.18.11-arch1-1)
$ prime-run glxinfo | grep "OpenGL renderer"
OpenGL renderer string: NVIDIA GeForce GTX 1650 Ti/PCIe/SSE2

which is nice!

From here, I was able to launch Minecraft which is nice enough because it tells you which GPU it's using, and it was indeed using the NVIDIA GPU (using the command "prime-run minecraft-launcher").

I was even able to launch a Steam game using Proton with "prime-run %command%" as custom launch options (I couldn't launch it before with my CPU-integrated graphics).

The last thing is that you told me I needed to enable "modesetting" for which I didn't do anything (so I'm not sure if it's enabled or not). Did I miss something? From what I can tell right now, it seems to work okay but maybe there's something I haven't noticed or that doesn't work as well as it could?

Last edited by Unda (2022-07-13 23:39:12)

Offline

#6 2022-07-14 08:36:30

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 16,718

Re: Unable to use PRIME with Wayland

Hmm, maybe it just works for XWayland clients even without modesetting, or nvidia-open enables it by default (or it isn't necessary if the nvidia GPU does not actually drive a display) What does

cat /sys/module/nvidia-drm/modeset

return?

Last edited by V1del (2022-07-14 13:17:09)

Offline

#7 2022-07-14 15:09:45

Unda
Member
From: Lille, France
Registered: 2014-10-12
Posts: 21

Re: Unable to use PRIME with Wayland

It seems this file doesn't exist but I found it somewhere else

$ cat /sys/module/nvidia/modeset
cat: /sys/module/nvidia/modeset: No such file or directory
$ ls -l /sys/module/nvidia
total 0
-r--r--r-- 1 root root 4096 Jul 14 13:37 coresize
drwxr-xr-x 2 root root    0 Jul 14 13:37 drivers
drwxr-xr-x 2 root root    0 Jul 14 13:37 holders
-r--r--r-- 1 root root 4096 Jul 14 13:37 initsize
-r--r--r-- 1 root root 4096 Jul 14 13:35 initstate
drwxr-xr-x 2 root root    0 Jul 14 13:37 notes
-r--r--r-- 1 root root 4096 Jul 14 13:37 refcnt
drwxr-xr-x 2 root root    0 Jul 14 13:37 sections
-r--r--r-- 1 root root 4096 Jul 14 13:37 srcversion
-r--r--r-- 1 root root 4096 Jul 14 13:37 taint
--w------- 1 root root 4096 Jul 14 13:35 uevent
-r--r--r-- 1 root root 4096 Jul 14 13:37 version
$ ll /sys/module/nvidia* -d
drwxr-xr-x 6 root root 0 Jul 14 13:35 /sys/module/nvidia
drwxr-xr-x 6 root root 0 Jul 14 13:35 /sys/module/nvidia_drm
drwxr-xr-x 6 root root 0 Jul 14 13:35 /sys/module/nvidia_modeset
drwxr-xr-x 6 root root 0 Jul 14 13:35 /sys/module/nvidia_uvm
$ find /sys/module -name modeset
/sys/module/nvidia_drm/parameters/modeset
$ sudo cat /sys/module/nvidia_drm/parameters/modeset
N

Offline

#8 2022-07-14 15:52:01

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 16,718

Re: Unable to use PRIME with Wayland

It's not enabled. Well if it works like that you can keep using that as is, but I'm assuming this will in general only work for xwayland clients, which isn't that huge of a deal since the majority of games will still be using xorg anyway.

In any case if you did want to enable it see https://wiki.archlinux.org/title/NVIDIA … de_setting and if you consider this [SOLVED] please mark it as such by editing and amending to the title in your first post.

Offline

Board footer

Powered by FluxBB