Multi-seat setup with GPU passthrough, part 1

I have decided to upgrade my existing multi-seat setup. Currently I have one main seat where I am doing most work and second seat that I am using for GNOME Flashback testing and sometimes also for watching movies.

The goal is to have 3 seats where one seat can be reused for virtual machine with GPU passthrough and one seat exclusively for TV.

This part will be about my existing setup.

Software

I have always been Ubuntu user and at least for now I am still using it. I am using development version so my APT sources are already switched to Ubuntu 22.10.

As display manager I am using lightdm. Why? Mostly because it is first display manager where I got multi-seat working and I am too lazy to try configure gdm same way.

Otherwise it is more or less standard Ubuntu install.

Hardware

I have Z370M D3H motherboard with i7-8700K processor and 32 GB memory. Besides integrated graphics card I also have two NVIDA graphics cards - GTX 660 and GTX 960.

Main seat has two monitors - LG 27UD68-W and COMPAQ 1825. Second seat has two Philips 19S monitors and sometimes gets third monitor - Samsung T27A300 connected trough DENON AVR-1312.

Obviously each seat has its own keyboard and mouse.

Configuration

Probably most important configuration is udev rules. It should be possible to create new seat and attach devices to it with loginctl, but I have decided to manually create configuration file /etc/udev/rules.d/99-seats.rules:

TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:1c.4/*", ENV{ID_SEAT}="seat1", TAG+="seat1"
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb1/1-5", ENV{ID_SEAT}="seat1", TAG+="seat1"
TAG=="seat", DEVPATH=="/devices/pci0000:00/0000:00:14.0/usb1/1-6", ENV{ID_SEAT}="seat1", TAG+="seat1"

Devices that should be assigned to other seats should be tagged with seat name. seat0 always exists and does not appear in configuration file. seat1 is my second seat with following devices attached:

  • NVIDIA card - /devices/pci0000:00/0000:00:1c.4/*;
  • USB keyboard - /devices/pci0000:00/0000:00:14.0/usb1/1-6;
  • USB mouse - /devices/pci0000:00/0000:00:14.0/usb1/1-5.

NOTE: seat names must start with seat!

Xorg configuration file /etc/X11/xorg.conf.d/99-seats.conf:

Section "ServerFlags"
    Option     "AutoAddGPU" "False"
EndSection

Section "Device"
    MatchSeat  "seat0"
    Identifier "device0"
    Driver     "nvidia"
    VendorName "NVIDIA Corporation"
    BoardName  "GeForce GTX 960"
    BusID      "PCI:1:0:0"
    Option     "ProbeAllGpus" "False"
EndSection

Section "Device"
    MatchSeat  "seat1"
    Identifier "device1"
    Driver     "nvidia"
    VendorName "NVIDIA Corporation"
    BoardName  "GeForce GTX 660"
    BusID      "PCI:7:0:0"
    Option     "ProbeAllGpus" "False"
EndSection

Device sections are used to assign GPU devices to seats. Two notes about above configuration:

  • AutoAddGPU option in ServerFlags section is used to stop X server from automatically adding other GPU devices.
  • ProbeAllGpus option in Device section is used to stop NVIDIA driver from probing all GPUs in system.

LightDM configuration file /etc/lightdm/lightdm.conf.d/99-seats.conf:

[Seat:*]
xserver-command=X -core -s 120
user-session=gnome-flashback-metacity

[Seat:seat0]
xserver-command=X -core -keeptty -s 120

[Seat:seat1]
#xserver-command=X -core -s 120

[Seat:*] group is used to change configuration for all seats. [Seat:seat0] and [Seat:seat1] is used to change named seat configuration.

xserver-command is used to change default command that is used to run X server. I don't remember why I have added -s 120, most likly not needed. I also don't rember why -keeptty was added for seat0.

user-session is used to change default user session.

Whats next?

In next part I will create 3rd / TV seat on integrated graphics card. This will allow to use my 2nd seat only for testing or GPU passthrough.

No Comments
Leave a reply

You must be logged in to post a comment!