Skip to content

Commit a4035fc

Browse files
jexpositMarge Bot
authored and
Marge Bot
committed
docs/multi-gpu: Document mutter-device-preferred-primary
Add documentation explaining how to change the primary GPU using a udev rule. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4218>
1 parent 78c621a commit a4035fc

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ documentation and API references below first.
3838
- [Building and Running](doc/building-and-running.md)
3939
- [Debugging](doc/debugging.md)
4040
- [Monitor configuration](doc/monitor-configuration.md)
41+
- [Multi-GPU](doc/multi-gpu.md)
4142

4243
## API Reference
4344

doc/multi-gpu.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Multi-GPU
2+
3+
## Selecting the primary GPU
4+
5+
When multiple GPUs are present in the same system, Mutter applies a series of
6+
rules to select one of them as primary. However, it is possible to manually
7+
select a different GPU by using a udev rule.
8+
9+
To illustrate it with an example, I'm going to make the NVIDIA GPU in my system
10+
to be selected as the primary GPU.
11+
12+
Start by finding the vendor and device IDs of the target GPU:
13+
14+
```bash
15+
$ lspci -nn
16+
[...]
17+
24:00.0 VGA compatible controller [0300]: NVIDIA Corporation AD107 [GeForce RTX 4060] [10de:2882] (rev a1)
18+
```
19+
20+
In this case, we are looking for the vendor ID (10de) and the product (2882).
21+
22+
Next, create rule to set the desired GPU as primary. Make sure to replace the
23+
vendor and device IDs:
24+
25+
```bash
26+
$ cat /etc/udev/rules.d/61-mutter-preferred-primary-gpu.rules
27+
SUBSYSTEM=="drm", ENV{DEVTYPE}=="drm_minor", ENV{DEVNAME}=="/dev/dri/card[0-9]", SUBSYSTEMS=="pci", ATTRS{vendor}=="0x10de", ATTRS{device}=="0x2882", TAG+="mutter-device-preferred-primary"
28+
```
29+
30+
Finally, restart and check that the desired GPU was selected:
31+
32+
```bash
33+
$ journalctl -b0 /usr/bin/gnome-shell
34+
[...]
35+
Device '/dev/dri/card1' prefers shadow buffer
36+
Added device '/dev/dri/card1' (nouveau) using non-atomic mode setting.
37+
Device '/dev/dri/card2' prefers shadow buffer
38+
Added device '/dev/dri/card2' (amdgpu) using atomic mode setting.
39+
Created gbm renderer for '/dev/dri/card1'
40+
Created gbm renderer for '/dev/dri/card2'
41+
GPU /dev/dri/card1 selected primary given udev rule
42+
```

0 commit comments

Comments
 (0)