Note:: this solution was created in 2006, so it is not up-to-date anymore.

Dual-seat X using a single dual-head card

A while ago I saw an article explaining how you could configure your PC to run several X-Windows instances, each with its own keyboard, mouse and monitor. I found this so-called Multi-seat X setup very interesting since this provided a way for me and my wife to use our computer at the same time (without using a laptop and a remote X session, which is still somewhat slower).

Since the solution presented in that article required several VGA cards, I went out and bought an nVidia GeForce FX 5200 based card. The mainboard of our PC already had an on-board VGA card, I figured that one extra card should do it. Unfortunately, inserting the new card disabled the on-board card, which was obviously a bit of a setback.

New hope arrived when I noticed that the card had the ability to control two monitors, so I began searching for web pages which described how you could set up this kind of Dual-seat X system.

Xephyr-based solution

I was pleased to quickly find a web page describing how to use Xephyr for a one-card dual-seat solution. Xephyr is an X-Windows server which can use a running X display to render the windows in. It is similar to the Xnest 'nested X server', but is far more advanced, supporting several X extensions.

Basically, what you do is the following: use your usual X server to initialize the two monitors as two X screens of a single X display. Then, on each screen, a Xephyr server is started, each taking control of a particular keyboard and mouse. In the new X displays created by this process, a login manager is started.

This solution worked well, and at first I was very pleased to have successfully created a nice Dual-seat X setup. However, as time went by, I experienced some drawbacks:

  • Occasionally, one of the Xephyr servers would crash
  • Using MPlayer, only slow rendering modes could be used, leading to heavy CPU usage.
  • Although the GeForce FX 5200 card supports accellerated OpenGL, using Xephyr prevented this to be used.

Xgl-based solution

Around the same time, I had been reading about Xgl, and noticed it did pretty much the same thing as Xephyr: the Xgl server also runs on top of another X server. The advantage of Xgl is that more X extensions (including OpenGL accelleration) are available, so I started experimenting to see if Xephyr could be replaced by Xgl.

Starting two Xgl servers, each on a screen of the underlying display, is pretty much the same as starting two Xephyr servers. The main difficulty is that the Xephyr server from the project above, was modified so that each server instance could grab a specific keyboard and mouse. Instead of modifying the Xgl source code, I decided to write XevdevServer: this is a small program which can capture events of a specific keyboard and mouse - using the Linux evdev interface - and redirect these to a specified X display - using the XTEST extension.

Although the Xgl servers themselves consume quite a few CPU cycles, this solution is much more stable than the Xephyr based one. The approach is quite flexible, you can even create a multi-seat-single-screen setup, as is shown in the image below.

Instructions

Some instructions and other files you may need to get this kind of setup working, can be downloaded here:

Note that the XglScript.sh script can be easily modified to use Xephyr or Xnest instead of Xgl. This allows you to use the standard Xephyr or Xnest binaries, without needing to patch them to grab specific keyboard and mouse devices.

Use at your own risk!

Links

Here are some interesting links related to multi-seat X configurations: