Skip to content

Regarding optimus support on wayland

Hey fellow people . I am having a strange problem. Been running nvidia optimus with amd vega gpu on my laptop on with gnome as my desktop environment. The thing is after setting up everyrhing according to the wiki, the driver loads up just fine when using Xorg. But as soon as i switch to wayland, the driver is not working. Nvidia-smi output gives no running processes found. Also i am running the latest nvidia drivers, one which has the wayland support.

Any help would be great.

2 points3 comments
Open on Reddit
About this post
Posted
Archived
Score
2 · 75% up
Kind
Text
ID
py16xc

Author

7
posts
36
comments
1
media
View profile

2 comments

Also i am running the latest nvidia drivers, one which has the wayland support.

Wayland was already supported by the Nvidia drivers. It was accelerated XWayland which wasn't supported until 470. Which would have no effect on whether or not Optimus would work.

But yeah, Optimus isn't supported on Wayland:

Only Archlinux and Archlinux-based distributions (such as Manjaro) are supported for now. Only Xorg sessions are supported (no Wayland).

That's from the official documentation at https://github.com/Askannz/optimus-manager

Some poor soul posted on the Manjaro forums earlier in the year saying "Hey Optimus works on Manjaro" and their screenshot to show it working was them running nvidia-smi successfully but it shows no running processes lmao.

However I've seen people that appear to have had success with bumblebee/primus. Maybe try that.

3 points

I dont know about gnome but in kde wayland or sway (wayland) configured to use the amd gpu you can use the prime-run command to launch a xwayland using the nvidia card , you just have to set correctly some env variables :

In your session (bash, zsh) set :

export __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/radeon_icd.x86_64.json:/usr/share/vulkan/icd.d/radeon_icd.i686.json
export DXVK_FILTER_DEVICE_NAME="AMD"
export VKD3D_FILTER_DEVICE_NAME="AMD"
export __GLX_VENDOR_LIBRARY_NAME="mesa"

And prepend to or better create a new prime-run (cause it can be replaced in an update) the same variables but for nvidia:

#!/bin/bash
__EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/10_nvidia.json DXVK_FILTER_DEVICE_NAME=NVIDIA VKD3D_FILTER_DEVICE_NAME=NVIDIA VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json __NV_PRIME_RENDER_OFFLOAD=1 __VK_LAYER_NV_optimus=NVIDIA_only __GLX_VENDOR_LIBRARY_NAME=nvidia "$@"

You have to have the nvidia modules loaded (via mkinitcpio.conf or in modprobe.d) or in my case I use a simple script to load/unload the modules.

Then prime-run app, should appear in nvidia-smi .

The problem is with my amd/nvidia laptop is that when the nvidia_drm module is loaded the opengl/vulkan games show some kind of stutter/artifacts like showing parts of a previous frame like if is not syncing but with normal/high fps, if the nvidia_drm is not loaded only with nvidia, nvidia_modeset, nvidia_uvm modules runs almost smooth but the fps could be lower and/or without sync. I dont know yet if is the xwayland or the driver.

edit: if nvidia-smi show no process means you are running your de/wm session with the integrated gpu (amdgpu), if the nvidia drivers were not loaded the nvidia-smi will crash with an error, only when using X11 config you will see a xorg process running in the case of prime offload until you launch others using it (prime-run) or many when X11 is configured to use only nvidia.

2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.