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

Nvidia updates #389

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
da631b6
add link to pacman hook to keep mkinitcpio configured correctly
jade-tea-h Nov 7, 2023
c4cf625
Add steps to set WLR_DRM_DEVICES environment variable
jade-tea-h Nov 7, 2023
cb8c839
Add message about GBM_BACKEND possibly causing issues
jade-tea-h Nov 7, 2023
730d5e1
Clean up some of the formatting to make the sections make more sense …
jade-tea-h Nov 7, 2023
7836a40
remove random underscore
jade-tea-h Nov 7, 2023
96993a3
Add FAQ entry about Hyprland crashing on startup with Nvidia
jade-tea-h Nov 7, 2023
4fae7cc
Remove implications that the patch will only work with nvidia-dkms
jade-tea-h Nov 8, 2023
4020025
Use the more robust path `/dev/dri/by-path/pci-...` for `WLR_DRM_DEVI…
jade-tea-h Nov 8, 2023
0b59857
Update pages/Nvidia/_index.md
jade-tea-h Nov 8, 2023
c0ec1b4
Merge branch 'main' of github.com:jade-tea-h/hyprland-wiki
jade-tea-h Nov 8, 2023
8ed6e9d
Change WLR_DRM_DEVICES instructions to just be a link to the Multi GP…
jade-tea-h Nov 8, 2023
500cf97
Add warning to make sure it is clear which drivers should be preferred
jade-tea-h Nov 8, 2023
70ce3ee
Update pages/Nvidia/_index.md
jade-tea-h Nov 11, 2023
acb5d4a
make the FAQ entry a bit clearer
jade-tea-h Dec 20, 2023
85b5ee9
missed a line removal in the merge
jade-tea-h Dec 20, 2023
a96f24f
Be more concise with the `GBM_BACKEND` suggestion
jade-tea-h Dec 20, 2023
6bf6d02
better phrasing
jade-tea-h Dec 20, 2023
0ece847
merge upstream
jade-tea-h Dec 20, 2023
32cb2ae
Update pages/Nvidia/_index.md
jade-tea-h Jan 31, 2024
6d0986b
Update pages/Nvidia/_index.md
jade-tea-h Jan 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pages/FAQ/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -303,3 +303,7 @@ Then, pressing `SUPER + Escape` will leave that mode.
# Low FPS/stutter/FPS drops on Intel iGPU with TLP (mainly laptops)

The TLP defaults are rather aggressive, setting `INTEL_GPU_MIN_FREQ_ON_AC` and/or `INTEL_GPU_MIN_FREQ_ON_BAT` in `/etc/tlp.conf` to something slightly higher (e.g. to 500 from 300) will reduce stutter significantly or, in the best case, remove it completely.

# Hyprland crashes on startup after updating packages (Nvidia)

Run `sudo mkinitcpio -P` and reboot. If that fixes the problem, make sure you have followed [this step](../../Nvidia/#kernel-parameters), specifically the bit about adding a [pacman hook](https://wiki.archlinux.org/title/NVIDIA#pacman_hook)
jade-tea-h marked this conversation as resolved.
Show resolved Hide resolved
51 changes: 39 additions & 12 deletions pages/Nvidia/_index.md
jade-tea-h marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Foreword

There is no _official_ Hyprland support for Nvidia hardware. However, you might make it work properly following this page.
There is no _official_ Hyprland support for Nvidia hardware. However, you might make it work properly following this page.

## Drivers
You can choose between the proprietary [Nvidia drivers](https://wiki.archlinux.org/title/NVIDIA) or the open source [Nouveau driver](https://wiki.archlinux.org/title/Nouveau). Under the proprietary Nvidia drivers category, there are 3 of them: the current driver named 'nvidia' (or 'nvidia-dkms' to use with custom linux kernels) which is under active development, the legacy drivers 'nvidia-3xxxx' for older cards which Nvidia no longer actively supports, and the 'nvidia-open' driver which is currently an alpha stage attempt to open source a part of their close source driver for newer cards.

You may want to use the proprietary Nvidia drivers in some cases, for example: if you have a new Nvidia GPU model, if you want more performance, if you want to play video games, if you need a wider feature set (for example, better power consumption on recent GPUs), etc. However, keep in mind that if the proprietary Nvidia drivers do not work properly on your computer, the Nouveau driver might work fine while not having as much features or performance. For [older cards](https://wiki.archlinux.org/title/NVIDIA#Unsupported_drivers), in order to use Hyprland, you will probably need to use the Nouveau driver which actively supports them.
Expand All @@ -22,9 +21,8 @@ If you have any concerns (updates, broken pkgbuild, etc), you should contact the
`nvidia-dkms` is still **required** to run this patch, Install the `nvidia-dkms` driver and add it to your initramfs & kernel parameters before running. You should still however read the content below to make sure the patch is properly working and to avoid any bugs/crashes.
{{< /hint >}}

## How to get Hyprland to possibly work on Nvidia

Install the `nvidia-dkms` driver and add it to your initramfs & kernel parameters.
## Kernel Parameters
Install the `nvidia-dkms` driver and add it to your initramfs & kernel parameters.
For people using [systemd-boot](https://wiki.archlinux.org/title/systemd-boot) you can do this adding `nvidia_drm.modeset=1` to the end of `/boot/loader/entries/arch.conf`.
For people using [grub](https://wiki.archlinux.org/title/GRUB) you can do this by adding `nvidia_drm.modeset=1` to the end of `GRUB_CMDLINE_LINUX_DEFAULT=` in `/etc/default/grub`, then run `# grub-mkconfig -o /boot/grub/grub.cfg`
For others check out [kernel parameters](https://wiki.archlinux.org/title/Kernel_parameters) and how to add `nvidia_drm.modeset=1` to your specific bootloader.
Expand All @@ -33,6 +31,8 @@ in `/etc/mkinitcpio.conf` add `nvidia nvidia_modeset nvidia_uvm nvidia_drm` to y

run `# mkinitcpio --config /etc/mkinitcpio.conf --generate /boot/initramfs-custom.img` (make sure you have the `linux-headers` package installed first)

add the [pacman hook](https://wiki.archlinux.org/title/NVIDIA#pacman_hook) to ensure mkinitcpio is regenerated when nvidia drivers are updated (arch only)

add a new line to `/etc/modprobe.d/nvidia.conf` (make it if it does not exist) and add the line `options nvidia-drm modeset=1`

More information is available here:
Expand All @@ -45,6 +45,7 @@ use that one instead. Note that on a laptop, it could cause problems with the su
{{< hint >}}To get multi monitor to work properly on a hybrid graphics device (a laptop with both an Intel and an Nvidia GPU), you will need to remove the `optimus-manager` package if installed (disabling the service does not work). You also need to change your BIOS settings from hybrid graphics to discrete graphics.
{{< /hint >}}

## Environment
Export these variables in your hyprland config:

```sh
Expand All @@ -55,21 +56,47 @@ env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = WLR_NO_HARDWARE_CURSORS,1
```

{{< hint >}}If you encounter crashes in Firefox, remove the line `env = GBM_BACKEND,nvidia-drm`.
{{< hint >}}If hyprland crashes on start or you encounter crashes in Firefox, you may want to try removing the line `env = GBM_BACKEND,nvidia-drm`.
{{< /hint >}}

{{< hint >}}If you face problems with Discord windows not displaying or screen sharing not working in Zoom, remove or comment the line `env = __GLX_VENDOR_LIBRARY_NAME,nvidia`.
{{< /hint >}}

Run `lspci | grep VGA`.
The returned line will start with some digits in the form `00:00.0`.
Run `ls -l /dev/dri/by-path`.
You should see at least one file with a filename like `pci-0000:00:00.0-card`.
The one matching the earlier pci entry should be a symbolic link to `card0`, `card1` or `card2`.
Set the environment variable `WLR_DRM_DEVICES` to that filepath.

For example, if I run `lspci | grep VGA` and get

```shell
01:00.0 VGA compatible controller: NVIDIA Corporation GM107 [GeForce GTX 750 Ti] (rev a2)
```

and when I run `ls -l /dev/dri/by-path` I see

```ls
lrwxrwxrwx 1 root root 8 Nov 7 07:02 pci-0000:01:00.0-card -> ../card0
lrwxrwxrwx 1 root root 13 Nov 7 07:02 pci-0000:01:00.0-render -> ../renderD128
```

I would add

```sh
env = WLR_DRM_DEVICES,/dev/dri/card0
fufexan marked this conversation as resolved.
Show resolved Hide resolved
```

to my hyprland config.

## Additional packages
Install `qt5-wayland`, `qt5ct` and `libva`. Additionally
`libva-nvidia-driver-git` (AUR) to fix crashes in some Electron-based
applications, such as Unity Hub.

Reboot your computer

Launch Hyprland.

It _should_ work now.
After completing all of the above Hyprland should _at least_ be able to boot.
jade-tea-h marked this conversation as resolved.
Show resolved Hide resolved

## Fixing screensharing / screenshots
Apply nvidia patches to the wlroots in `subprojects/wlroots` before building.
Expand Down Expand Up @@ -122,6 +149,6 @@ boot.kernelParams = [ "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ];
hardware.nvidia.powerManagement.enabled = true

# Making sure to use the proprietary drivers until the issue above is fixed upstream
hardware.nvidia.open = false
hardware.nvidia.open = false

```