This is my first tutorial, so I hope I cover everything on the topic.

Setting up multiple monitors in XFree86 with Xinerama:

I know many people have multiple monitors, and enjoy running Windows
because it automatically detects all your monitor configurations, and sets them
up for you.

Linux doesn't have these capabilities, yet . Hopefully, if you have been
running Linux for a while, and want to add another monitor, or if you have
multiple monitors, and want to switch to Linux, this tutorial will help you in
setting up your monitors.

For this tutorial I will be referring to RedHat 7.3.

It is important that when using this tutorial that you find all the information
out before you start changing settings in your XF86Config files. Once you start
changing things, there is a slight chance of being able to do any other work on
the computer other than editing the files, and testing the setup.

During the installation for RH 7.3 you were asked to select the drivers, and
resolution settings for your video card and monitor. Hopefully, you know the
limits of your card and monitor. If you do not know these limits, consult
the manuals and documentation that came with your hardware to find out these
values. A safe value for card bitrates would be 16 bit. Most cards will support
this bitrate, so you run less of a risk damaging your hardware by pushing settings
that aren't supported. A good resolution depends on the size of your monitor.
This is a good estimate as to the native resolution of your monitor.

< 15" --- 800 x 600
15" --- 1024 x 768
17" --- 1280 x 1024
> 17" --- 1600 x 1200

Now that we have this generic information out of the way, we must move on to more
vendor specific information. XFree86 can support almost all monitors, and many
video cards. The important information that you will need concerning your monitor
is the Horizontal Sync and the Vertical Refresh rate.
And example of these is:

HorizSync 30.0-70.0
VertRefresh 50.0-160.0

These two sets of numbers might be included in your monitor manual, or on the
manufacturers website. If you cannot find these numbers in either of these sources
try this website:

http://www.monitorworld.com/monitors_home.html

Locate the manufacturer of your monitor and the make, and the Horizontal Sync and
Vertical Refresh rates will be listed under "H Freq/ V Freq:." Once you have these
numbers, write them down. You will have to locate these numbers for all your monitors
It is relatively easy to locate the values in the database, so take some time now to
get all the numbers.

Got 'em? Ok, good.

Now we need to find the drivers that are needed for your video card. XFree86 comes,
like Windows, with a large amount of video card drivers. Unless you have a 'brand-
spankin'-new' video card that was just released two days ago, it is most likely that
your drivers are already included in XFree86. To find the driver for your card, goto
this website:

http://www.xfree86.org/current/Status.html

This is the most current listing of video card drivers supported by XFree86. Find
your card manufacturer, and look under the listing for 4.2.0 which is the current
version of XFree86. The driver for your card will be a short one word name. For my
Nvidia TNT2, the driver is called "nv". For a Silicon Integrated Systems card,
the driver is "sis"... You get the idea. If you have multiple cards of the same
type, you can get away with copying the setup information.

Find the driver name for all of your video cards, and write them down.

Got 'em? Ok, good.

Now it's time to backup you existing configuration files. I did this by doing:

root# > cp /etc/X11/XF86Config-4 /etc/X11/XF86Config-4.working

It is important that you make a backup of this file in case you get lost, or
something doesn't work right, so you can go back to your original configuration
and not have to reinstall Linux.

Next is a very important part. Scanning the PCI bus and finding the values for
your video cards. This is a good time to put all your video cards in your system
and connect the monitors to them. Set everything up the way you would want it at
the end, because if you change things, you will have to go back and repeat steps.
Scanning the PCI Bus needs to be done from the console without having X running.
In order to do this, you must stop any display managers that are running. The
easiest way to do this from RedHat is:

root# > telinit 3

For Debian, Storm or Corel:

root# > /etc/init.d/xdm stop

If neither of these methods work, boot your computer into single user mode.

In order for the system to correctly recognize the video configurations, you need
to use the PCI Bus Identifier your system assigns the card. All your video cards
need to be in the system at this point. To find the PCI Bus IDs:

root# > XFree86 -scanpci

X will output a code and a name for each device attached to your PCI Bus.

e.x.

(0:0:0) Intel 82810E Host-Controller
(0:1:0) Intel 82810E PCI-Video
(0:7:2) Intel 82810E PIIIX4 USB
(0:7:3) Intel 82810E PIIX4 Sound
(0:9:0) Creative SB PCI 1.223
(0:11:0) 3COM 10/100 Ethernic 4/223
(1:11:0) Nvidia TNT2 m64 using a Sony MS 17sf II

Locate your video cards in this list. Mine were:

Intel 810e Video Controller : 0:1:0
NVidia TNT2 m64 : 1:11:0

Yours will be different depending on your configuration. You might have to use some
deductive reasoning to figure out which IDs belong to video cards. Your output might
not be as obvious as mine. AGP cards will be listed here as well.

Write down the numbers that are associated with each card. It is important that you
know which ID goes with which card.

It is important that you know what goes into the XFree86 config files, so you should
read the man pages for it.

root# > man XF86Config

Got it read, or at least skimmed? Good.

This can get pretty confusing, but if you have a small background in programming,
it'll be a little clearer. Open up your XF86Config-4 file and scroll down to the
Monitor section, and copy that section and make a duplicate of it right below the
current one. Repeat this for the Device section and Screen section for as many
video cards as you have. You can change the identifier, driver, and BusID for each
setup. Make sure the identifiers are different for each section. Refer to the
example XF86Config-4 file that I have included if you need more information.

Here is an example for just one of my video card's device section:

Section "Device"
Identifier "NVIDIA Riva TNT2 (generic)"
Driver "nv"
BusID "PCI:1:11:0"
EndSection

This is all that is needed for this Device section. The monitor section is similar
in how small it is:

Section "Monitor"
Identifier "Monitor0"
HorizSync 31.0-65.0
VertRefresh 50.0-120.0
EndSection

See? Very little needed to define the monitor. The screen section can get a little
trickier:

Section "Screen"
Identifier "Screen0"
Device "NVIDIA Riva TNT2 (generic)"
Monitor "Monitor0"
DefaultDepth 16

Subsection "Display"
Depth 16
Modes "1280x1024" "1024x768"
EndSubsection

EndSection

Here you call the Identifiers from the Device and Monitor sections, and combine them
together in the appropriate card/monitor configurations. You can change your depth
values to accommodate your setup.

** Note: I ran into problems when I had my two cards running different color depths.
I had 1 card running 32 bit, and the other running 24 bit, and XFree86 would crash
during startup. I reccomend that you find the least-common-bitrate (LCB) for all
your cards. It might have just been a configuration problem with my hardware, or
it might be bad coding in xinerama. If you get two different bitrates working, I
would have to commend you.

Now for the setting up of screen positions. Here is an example of my screen layout:


Section "ServerLayout"
Identifier "Simple Layout"
Screen "Screen0"
Screen "Screen1" RightOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

An important thing to note is the first Screen you identify will be set as your
default monitor. I suggest identifying your best setup first, and determing the
layout of the rest of your monitors based on that first monitor.

Now to test your setup...

root# > startx -- +xinerama

Hopefully if all went well, you can now use your multiple monitors with great ease
and happiness. If it works, I know you will want to startup X with multiple monitors
all the time, so now you have to edit your startup files.

To Configure gdm to start with the xinerama extentions look for [servers] section
at the bottom of /etc/X11/gdm/gdm.conf. Add the +xinerama extension to the end of
the line that starts with 0=. It should look like this :

0=/usr/bin/X11/X +xinerama

Here's what you would change for slackware 7.x
(If using use KDM and x4.01)

edit /var/X11R6/lib/xdm/Xservers
add +xinerama to the end of last line
i.e.
:0 local /usr/X11R6/bin/X +xinerama


My sample XFree86 Config file:



Section "ServerLayout"
#Identifier "Anaconda Configured"
Identifier "Simple Layout"
Screen "Screen0"
Screen "Screen1" RightOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
RgbPath "/usr/X11R6/lib/X11/rgb"
FontPath "unix/:7100"
EndSection

Section "Module"
Load "GLcore"
Load "dbe"
Load "extmod"
Load "fbdevhw"
Load "dri"
Load "glx"
Load "record"
Load "freetype"
Load "type1"
EndSection

Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "XkbRules" "xfree86"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
#Option "XkbVariant" ""
#Option "XkbOptions" ""
EndSection

Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "PS/2"
Option "Device" "/dev/psaux"
Option "ZAxisMapping" "4 5"
Option "Emulate3Buttons" "no"
EndSection

Section "Monitor"
Identifier "Monitor0"
HorizSync 30.0-70.0
VertRefresh 50.0-160.0
EndSection

Section "Monitor"
Identifier "Monitor1"
HorizSync 31.0-65.0
VertRefresh 50.0-120.0
EndSection

Section "Device"
Identifier "NVIDIA Riva TNT2 (generic)"
Driver "nv"
BusID "PCI:1:11:0"
EndSection

Section "Device"
Identifier "Intel 810e Chipset"
Driver "i810"
BusID "PCI:0:1:0"
EndSection

Section "Screen"
Identifier "Screen0"
Device "NVIDIA Riva TNT2 (generic)"
Monitor "Monitor0"
DefaultDepth 16

Subsection "Display"
Depth 16
Modes "1280x1024"
EndSubsection

EndSection

Section "Screen"
Identifier "Screen1"
Device "Intel 810e Chipset"
Monitor "Monitor1"
DefaultDepth 16

SubSection "Display"
Depth 16
Modes "1280x1024"
EndSubsection
EndSection

Section "DRI"
Mode 0666
EndSection

Advanced topic: An alternate ServerLayout Section with one Monitor above the other.

Section "ServerLayout"
Identifier "Simple Layout"
Screen "Screen 0"
Screen "Screen 1" Below "Screen 0"
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection

Screens can overlap too. In this configuration I make the two monitors overlap by 80 pixels..

Section "ServerLayout"
Identifier "Simple Layout"
Screen "Screen 0"
Screen "Screen 1" Relative "Screen 0" 1200 0
InputDevice "Mouse1" "CorePointer"
InputDevice "Keyboard1" "CoreKeyboard"
EndSection


Resources:

Monitor technical specs and information -- http://www.monitorworld.com/monitors_home.html
Driver Status for XFree86[tm] 4.2.0 -- http://www.xfree86.org/current/Status.html
Using the Xinerama Extensions to MultiHead XFree86 V. 4.0+ -- http://www.tldp.org/HOWTO/Xinerama-HOWTO.html
Xinerama - Multi-screens -- http://seismo.ethz.ch/linux/xinerama.html