Make your own free website on Tripod.com

Configuring XFree86 4.x to use two (or more) monitors

A computer is said to be 'Dual Head' if it contains two video graphics cards and monitors attacted to both video cards can be used simultaneously. This document describes HOWTO configure XFree86 version 4 for Dual (or Multi) Head operation.

The X Graphical Envionment has historically supported multiple screens -- as evidenced by the dotted notation in its' DISPLAY variable. However, the configuration of the required X servers was typically very difficult (and for many combinations of video cards, quite impossible to achieve). The major design goal of XFree86 Version 4 was a code redesign which integrates the code from the many Xservers into libraries. This makes configuring multiple PCI and AGP video cards not only possible, but easy. The feature known as 'Xinerama' supports the arrangement of multiple monitors, screens and X servers in any horizontal, vertical or overlapping configuration thinkable.

The interested reader will notice a link on my homepage to a sample XFree86 configuration file which configures two monitors, two graphics cards, two mice and a standard keyboard. Notice how easy to read the configuration file is. The result is a single workstation console with two "screens" connected horizontally. There is a single input focus with just one mouse pointer for both screens. Thus, using either the PS/2 or USB mouse to move the mouse pointer off the left side of the primary screen causes the mouse pointer to appear on the right side of the second monitor. (This makes sense only if you place the second monitor to the left of the primary monitor -- but other alignments are supported). The primary screen has multiple desktops and a panel (governed by your window manager) and is known as :0.0 The secondary screen has a completely independent set of desktops which will have its own program menu panel (again assuming KDE or Gnome). Programs will be displayed on the screen from which they were launched. You don't get to drag programs from one screen to the other. The second screen can be connected either above, below, "leftof" or "rightof" the primary screen and is identified as :0.1 However, should you want to launch a program and always have it go to the secondary screen, you can simply set the DISPLAY variable to :0.1 prior to executing that program. Likewise the primary screen may be targeted by exporting DISPLAY=:0.0

I have also tested running multiple concurrent copies of X -- a first running KDE, and a second running Gnome. I verified (using the xhost command) that applications can also be sent to :1.0 and :1.1 (the primary Gnome screen and the secondary Gnome screen respectively) If you wish to start a second copy of X running the Gnome window manager and test this for yourself, login to a text mode channel and execute the following command:

# startx /usr/bin/gnome-session :1.0 &

Notice the lines starting with #pci in the XF86Config-4 file. The lines identifying my PCI and AGP video cards were generated by the pciscan command line program and manually pasted into the configuration file for later reference. You should not use my configuration file and will need to identify your video cards and make the necessary adjustments to your configuration. Its especially important to use the correct refresh and sync rates for your monitors or you may burn out the flyback transformer in your monitor. That said its really easy to just copy the monitor specification section from a custom XF86Config-4. Also copy the video card section from a XF86Config-4 file that you have previously tested.

The best way to do this is to get the cards working separately (using Xconfigurator) and combine the appropriate sections from the various XF86Config-4 files into one master XF86Config-4 file. The only unique part is the BusID lines (and the dual mouse support). I pasted the entire output of pciscan into the configuration file and deleted the lines referencing network, sound, scsi, and motherboard chipset resources. This left me with the two video cards. Notice that the AGP card is identified at PCI bus #1! Notice also that if you move your video card to a different slot, you will need to edit your /etc/X11/XF86Config-4 file and update the BusID statement with the output from the pciscan command. If you have additional monitors, and video cards, you can add additional heads up to the number of available PCI card slots. Also available but expensive, are the PCI cards with dual video chipsets supporting two monitors in a single expansion slot.

The Virtual lines deserve some explanation. My primary screen, a 21" display, supports 1600x1200. Setting Virtual on this monitor to 1920x1200 gives me additional window space on the right side of my desktop. To view that part of the screen, simply move the mouse to pan into the area of interest. This has the two-fold effect of increasing the number of buttons available on the panel and hiding the application start button (until you pan again to the left). I like it -- you may not. The Virtual line for the smaller monitor is more important. It supports a maximum resolution of 1280x1024 (the larger video modes are dynamically ignored). Thus it is not as tall as the 21" screen (1024 < 1200). This is not good. When the mouse comes off the larger screen onto the smaller screen, it may not be visible. It needs to be as tall as the edge to which it is connected to the primary screen (horizontally) or the mouse may arrive in a dead area which is not displayable. Likewise, if you decide to attach your monitors vertically, the width of the two screens should be made equal using the Virtual directive. Summary: the supplied example pans the primary screen horizontally up to 320 pixels and the secondary screen pans vertically up to 176 pixels.

One last thing, If you have 3rd monitor dedicated to a Windows, NT, 2000 or XP box networked to your primary Linux box and you want more screen real estate, goto www.cygwin.com and install Cygwin/XFree86. It will give you yet another screen on which to DISPLAY your Linux applications albeit with a separate keyboard and mouse. Cygwin/X wasn't very hard to install and configure, but I feel that Xinerama was easier to configure and get working because of the wealth of available on-line documentation. I was not able to find much information on configuring and using Cygwin/X on the web. That said, its comparable to Xwin32 and Exceed but its GPL!

Have fun with Linux + X,
Othniel Graichen