Multi-GPU: Rewrite documentation to set WLR_DRM_DEVICES (#552)

Initial rewrite of multi GPU setup as raised here.
https://github.com/hyprwm/hyprland-wiki/issues/551
This commit is contained in:
kiecla 2024-03-25 20:30:53 +00:00 committed by GitHub
parent 019d29e32b
commit 2200f59f8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,13 +37,16 @@ lrwxrwxrwx 1 root root 8 Jul 14 15:45 pci-0000:06:00.0-card -> ../card1
lrwxrwxrwx 1 root root 13 Jul 14 15:45 pci-0000:06:00.0-render -> ../renderD129 lrwxrwxrwx 1 root root 13 Jul 14 15:45 pci-0000:06:00.0-render -> ../renderD129
``` ```
So from the above outputs, we can match the bus IDs and determine that NVIDIA is So from the above outputs, we can see that the path for the AMD card is
`card0` and AMD is `card1`. `pci-0000:06:00.0-card`, due to the matching `06:00.0` from the first command.
Do not use the `card1` symlink indicated here. It is dynamically assigned at
boot and is subject to frequent change, making it unsuitable as a marker for GPU selection.
## Telling Hyprland which GPU to use ## Telling Hyprland which GPU to use
After determining which "card" belongs to which GPU, we now have to tell After determining which "card" belongs to which GPU, we now have to tell
Hyprland the GPU we want to use primarily. Hyprland the GPU we want to use primarily.
This is done by setting the `WLR_DRM_DEVICES` environment variable.
{{< callout type=info >}} {{< callout type=info >}}
@ -55,23 +58,36 @@ with a lower and higher power rating GPUs respectively.
{{< /callout >}} {{< /callout >}}
We can do so by using the `WLR_DRM_DEVICES` variable. If you wish to use the integrated GPU to run Hyprland, no further action is
required. wlroots will set `WLR_DRM_DEVICES` to the integrated GPU by default.
Add the following template to `hyprland.conf` If instead you would like to use another GPU, you must first create a symlink to
the card from the previous section.
```ini ```
env = WLR_DRM_DEVICES,/dev/dri/cardN ln -sf /dev/dri/pci-0000:06:00.0-card ~/.config/hypr/card
``` ```
For our case, we want to use `card1` primarily and use it to render stuff. It is not possible to directly use the `/dev/dri/pci-0000:06:00.0-card` path,
as wlroots interprets the colon symbols in the path as separators. Escaping
characters will not rectify this.
Afterwards, you must set the `WLR_DRM_DEVICES` environment variable in
hyprland.conf to this linked card.
```ini ```ini
env = WLR_DRM_DEVICES,/dev/dri/card1:/dev/dri/card0 env = WLR_DRM_DEVICES,~/.config/hypr/card
``` ```
Here, we tell Hyprland to set priorities. If `card1` isn't available for If you want to set a sequence of fallback cards, symlink another card and set
whatever reason, use `card0`. So if the AMD GPU isn't available, use NVIDIA. The the var as a colon separated list in order of priority.
colon is for setting priorities, essentially.
You should now be able to use an integrated GPU for for lighter GPU loads, ```ini
including Hyprland. env = WLR_DRM_DEVICES,~/.config/hypr/card:~/.config/hypr/otherCard
```
Here, we tell Hyprland to set priorities. If `card` isn't available for
whatever reason, use `otherCard`. So if the AMD GPU isn't available, use NVIDIA.
You should now be able to use an integrated GPU for lighter GPU loads,
including Hyprland, or default to your dGPU if you prefer.