Comment 3 for bug 1356332

Revision history for this message
LaƩrcio de Sousa (lbssousa) wrote :

Let's take another use case, which is the one I'm currently working on (and is the most simple case IMHO): a 3-seat system consisting of:
  - 1 CPU
  - 2 video cards (1 integrated graphics device for seat0 + 1 PCI/PCI-e dual-head graphics card for the other seats)
  - 2 USB hubs (1 for each non-seat0 seat)
  - 3 keyboards/mice

For logind versions older than 198, such a setup was impossible, because a framebuffer device is required in order to create a new seat. But now logind is much more flexible: the only requirement for a new seat to be created is that at least one suitable device tagged in Udev as "master-of-seat" is attached to that seat (in my setup, the USB hubs are tagged as "master-of-seat").

Which this flexibility, logind can work properly with much more graphics scenarios, like video cards with non-KMS drivers (e.g. NVIDIA/AMD proprietary drivers), and nested X servers. From current logind perspective, the display server setup is irrelevant, provided that it can handle input/sound devices attached to a given seat (which is currently done in Xorg by passing "-seat" option to its command line).

For nested X servers (required to load 2 seats on a single dual-head graphics device), an additional requirement is that a bare X server spanning all available outputs must be previously started and ready for connections. Because nested X servers don't reach VTs, I'm affraid of using a nested X server for seat0, so I'm proposing the use case above as the most simple one.

It's important that this bare X server doesn't interfere with any seat at all, i.e., it should neither "steal" a VT expected for the seat0 X server, nor grab input devices expected by a non-seat0 X server. Since Xorg currently doesn't check validity of value passed with "-seat" option, we can satisfy both requirements with a small trick: passing an "invalid", from logind perspective, seat ID, i.e., any name not starting with "seat" (e.g. "-seat __fake-seat__").

We have currently two choices for the nested X server: either Xephyr (built with --enable-kdrive-evdev option) with some wrapper that calculates input devices' paths from logind seat ID and Xephyr window geometry (like https://launchpad.net/multi-seat-xephyr) or a proper Xorg with some video driver that allows nesting (like http://cgit.freedesktop.org/xorg/driver/xf86-video-nested).

In my point of view, what LightDM needs to do for handling nested-X-server based multiseat is the following:
  - When a new seat is loaded, check if it tries to load a nested X server (maybe setting explicitly a seat property like "require-nesting" will be enough).
  - If at least one new seat requires nesting, check if a host (bare) X server is already loaded and ready for connections. If not, LightDM should start it, and the new seat shoud wait until it can start properly.
  - The new seat should set properly environment variables DISPLAY and XAUTHORITY from host X server before starting a nested X server.
  - If all seats that require nesting are removed, LightDM should stop the host X server.

One possible approach for this is using a special "empty" seat (which should not start local sessions) for handling the host X server, and a secondary DisplayManager object for handling the seats which require nesting. When all these seats are removed, this secondary DisplayManager object should be stopped, and then that "empty" seat should be stopped, too. We can link them with signals/callbacks.