8. Enable Xwayland with NVIDIA 545.29.06 / 535.146.02 / 525.147.05 / 470.223.02 proprietary drivers on Fedora 39/38/37 GNOME 45/44/43 desktop

This is guide, howto enable NVIDIA accelerated 3D rendering and Xwayland on on Fedora 38/37/36 with NVIDIA 545.29.06 / 535.146.02 / 525.147.05 / 470.223.02 proprietary drivers on GNOME 44/43/42. Tested with latest NVIDIA drivers, I assume here that you have installed NVIDIA drivers using this guide. This might work normally with any other installation methods too, but it’s not tested.

Note: Do this using fully updated system and latest kernel, also NVIDIA 535.113.01 / 525.125.06 / 470.199.02 drivers installed. Check also NVIDIA’s own guide for this OpenGL and Vulkan on Xwayland.

Check video version of guide NVIDIA + Wayland on Fedora 39 / GNOME 45:

Check video version of guide NVIDIA + Wayland on Fedora 38 / GNOME 44:

Check video version of guide NVIDIA + Wayland on Fedora 37 / GNOME 43:

Before you start you will at least following packages installed:

  • Xwayland >= 21.1.1.901
  • libxcb >= 1.13
  • egl-wayland >= 1.1.7

Check your packages using following command:

dnf list installed xorg-x11-server-Xwayland libxcb egl-wayland

If some missing, then install all using following command:

dnf install xorg-x11-server-Xwayland libxcb egl-wayland

8.1 Change root user

su -
## OR ##
sudo -i

8.2 Edit /etc/default/grub

Append ‘nvidia-drm.modeset=1’ to end of ‘GRUB_CMDLINE_LINUX=”…”‘.

## Example row with Fedora 39/38/37 BTRFS ##
GRUB_CMDLINE_LINUX="rhgb quiet rd.driver.blacklist=nouveau nvidia-drm.modeset=1"
## OR with LVM ##
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root rhgb quiet rd.driver.blacklist=nouveau nvidia-drm.modeset=1"

8.3 Update grub2 conf

## BIOS and UEFI ##
grub2-mkconfig -o /boot/grub2/grub.cfg

8.4 Update /usr/lib/udev/rules.d/61-gdm.rules on Fedora 39/38/37

8.4.1 Fedora 39/38

Comment line ENV{NVIDIA_PRESERVE_VIDEO_MEMORY_ALLOCATIONS}!=“1”, GOTO=“gdm_disable_wayland”

# Check if suspend/resume services necessary for working wayland support is available
TEST{0711}!="/usr/bin/nvidia-sleep.sh", GOTO="gdm_disable_wayland"
TEST{0711}!="/usr/lib/systemd/system-sleep/nvidia", GOTO="gdm_disable_wayland"
IMPORT{program}="/bin/sh -c \"sed -e 's/: /=/g' -e 's/\([^[:upper:]]\)\([[:upper:]]\)/\1_\2/g' -e 's/[[:lower:]]/\U&/g' -e 's/^/NVIDIA_/'
 /proc/driver/nvidia/params\""
#ENV{NVIDIA_PRESERVE_VIDEO_MEMORY_ALLOCATIONS}!="1", GOTO="gdm_disable_wayland"
IMPORT{program}="/bin/sh -c 'echo NVIDIA_HIBERNATE=`systemctl is-enabled nvidia-hibernate`
'"
ENV{NVIDIA_HIBERNATE}!="enabled", GOTO="gdm_disable_wayland"
IMPORT{program}="/bin/sh -c 'echo NVIDIA_RESUME=`systemctl is-enabled nvidia-resume`'"
ENV{NVIDIA_RESUME}!="enabled", GOTO="gdm_disable_wayland"
IMPORT{program}="/bin/sh -c 'echo NVIDIA_SUSPEND=`systemctl is-enabled nvidia-suspend`'"
ENV{NVIDIA_SUSPEND}!="enabled", GOTO="gdm_disable_wayland"
LABEL="gdm_nvidia_end"

8.4.2 Fedora 37

Comment line which starts with DRIVER==”nvidia”, RUN+=:

# disable Wayland on Hi1710 chipsets
ATTR{vendor}=="0x19e5", ATTR{device}=="0x1711", RUN+="/usr/libexec/gdm-runtime-config set daemon WaylandEnable false"
# disable Wayland on hybrid systems with vendor nvidia driver
# default to Xorg on single gpu vendor nvidia systems
DRIVER=="nvidia", ENV{GDM_HAS_VENDOR_NVIDIA_DRIVER}="1"
#DRIVER=="nvidia", RUN+="/usr/libexec/gdm-runtime-config set daemon WaylandEnable false"
#DRIVER=="nvidia", RUN+="/usr/libexec/gdm-runtime-config set daemon PreferredDisplayServer xorg"
# disable Wayland if modesetting is disabled
IMPORT{cmdline}="nomodeset", RUN+="/usr/libexec/gdm-runtime-config set daemon WaylandEnable false"

8.5 Generate initramfs

## Backup old initramfs nvidia-nomodeset image ##
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nvidia-nomodeset.img
 
## Create new initramfs image ##
dracut /boot/initramfs-$(uname -r).img $(uname -r)

8.6 Enable kms-modifiers through gsettings (as normal user)

gsettings set org.gnome.mutter experimental-features [\"kms-modifiers\"]

8.7 Reboot

reboot

When you system boot you should be able to select GNOME Wayland session, login using it and open terminal and type:

echo $XDG_SESSION_TYPE

Output should be Wayland.