XFree86 4.0 has many more features than the previous - perhaps the most interesting of these is the possibility of using more than one monitor as a large virtual desktop. This is called Xinerama, and is easy to do with commodity PC video cards, such as the dual head G400, or even with two video cards, such as an AGP card, and a PCI card. In this article, I will assume that you have a working installation of XFree86 version 4.0 (see http://www.xfree86.org/), and that the video cards are supported by Xfree86 version 4.0.
The first thing to consider about setting this up is layout. It is possible to have different resolutions on each monitor, but they both must have the same colour depth. This means you can use an old 15" monitor with your whizbang 17" monitor, but the video cards must either both support the colour depth you want to run at, or you end up with a very low amount of colours. An important fact to remember is that most window managers assume that your display is rectangular. If you are using different resolutions on your monitors, you'll end up with dead areas, which are areas that don't exist on either monitor, but the window managers interpret as empty. This can result with the window manager placing a window in an inaccessible place. However, as more window managers become Xinerama aware, this problem should disappear.
The next step is creating the configuration for each video card / monitor combination. Assuming that you have all the video cards that you want to use in the system, shut down X, and run the following command:
# XFree86 -scanpci
The output for a dual headed videocard - in this example, a dual head G400, the output will be something like:
Probing for PCI devices (Bus:Device:Function)
(0:0:0) Intel 82443BX Host
(0:1:0) Intel 82443BX AGP
(0:7:0) Intel 82371AB PIIX4 ISA
(0:7:1) Intel 82371AB PIIX4 IDE
(0:7:2) Intel 82371AB PIIX4 USB
(0:7:3) Intel 82371AB PIIX4 ACPI
(0:14:0) Creative Labs Sound Blaster PCI128 using a Ensoniq es1370 (AudioPCI)
(0:16:0) Intel unknown card (0x000c) using a Intel 82557/8/9 10/100MBit network controller
(1:0:0) Matrox unknown card (0x2179) using a Matrox MGA G400 AGP
From here, you need to create a devices section for each of your video cards. For a dual head G400, it looks something like:
Section "Device"
Identifier "G400 head 1"
Driver "mga"
BusID "PCI:1:0:0"
Screen 0
EndSection
Section "Device"
Identifier "G400 head 2"
Driver "mga"
BusID "PCI:1:0:0"
Screen 1
EndSection
Then, you need to create a configuration for each of the monitors you are going to use, as follows:
Section "Monitor"
Identifier "Trinitron 17inch"
HorizSync 30-85
VertRefresh 48-120
Option "DPMS"
EndSection
Section "Monitor"
Identifier "DiamondView 17inch"
HorizSync 30-72
VertRefresh 50-120
Option "DPMS"
EndSection
Next, its simply a matter of putting the video card and monitors together in a screen section. Note that in this example we've only shown one colour depth but you can have multiple colour depths listed.
Section "Screen"
Identifier "Default Screen"
Device "G400 head 1"
Monitor "Trinitron 17inch"
DefaultDepth 16
SubSection "Display"
Depth 16
Modes "1024x768" "800x600"
EndSubSection
EndSection
Section "Screen"
Identifier "Second Screen"
Device "G400 head 2"
Monitor "DiamondView 17inch"
DefaultDepth 16
SubSection "Display"
Depth 16
Modes "1024x768" "800x600"
EndSubSection
EndSection
Lastly, we simply lay out the screen as they are physically layed out. See XFree86 reference page <http://www.xfree86.org/4.0.2/DESIGN2.html#6> for more information on this. This is done by the following section:
Section "ServerLayout"
Identifier "Default Layout"
Screen 0 "Default Screen"
Screen 1 "Second Screen" LeftOf "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Generic Mouse"
Option "Xinerama"
EndSection
The options you have for the layout are RightOf, LeftOf, Above and Below. However, using a RightOf or LeftOf will assume that the monitors are level - moving your mouse off the screen cause it to jump up to the same position on the other monitor. To solve this you can also specify where the monitors are in relation to each other.
Now, we need to modify how we start the X server to add the ``+xinerama'' option. However, exactly this is done depends on your distribution and how you start your X server.
Under Debian, edit /etc/X11/gdm/gdm.conf, and add a +xinerama option to the X line in the [servers] section. It should look something like the following:
[servers]
0=/usr/bin/X11/X vt7 -deferglyphs 16 +xinerama
To test xinerama without changing any configuration files, use:
$ startx -- +xinerama
Now its just a simple matter of restarting gdm, or restarting X - you should have X on both monitors. It does take a bit of getting used to working with two (or more) monitors, as you can now view more information at the same time. One idea is to run something in the second monitor that you like to keep an eye on - mail, network monitoring tools, irc, whatever - and set it sticky so it exists across all virtual desktops. However you use it, Xinerama is a good way to gain some precious real estate.
For more information see the Xinerama HOWTO <http://www.linuxdoc.org/HOWTO/Xinerama-HOWTO.html> and the XFree86 server design page at <http://www.xfree86.org/4.0.2/DESIGN.html>.