This site is 100% Micro$oft-free -- no Micro$oft products of any kind were used to create or serve these pages.

Connecting Multiple Monitors under LINUX/RedHat 9/XFree

Using Multiple monitors is a nice way to get more screen real estate..

LINUX uses XFree for the grafic display. You might have seen the file /etc/X11/XF86Config That's the file you need to edit to use multiple screens under LINUX.

RTFM

First of all, it helps a great deal if you read the man page, e.g. man XF86Config. Then make a backup copy of your XF86Config file and keep it in a safe place!

Beware: Newer versions of XFree may use a configuration file called XF86Config-4 and the auto-configuration tools for these newer versions of XFree silently remove any existing versions of XF86Config . Make a backup copy of any existing XF86Config-4 file by renaming it -- we'll use the old format here, because the newer versions of XFree still understand the old-style configuration files.

Finding out the Status Quo

Things you need to know about your XFree installation..

which version are you running? Run xdpyinfo in a window. On the top it says what the XFree-version is and it also shows you the resolution and pixel depth of each display.

It's not working.. where can I see the errors?

The file /var/log/XFree86.0.log is created / overwritten every time X gets restarted. Check this file whenever X crashes, or doesn't start up the way you want it to. Make sure you read the top portion of the file, where it explains what (--),(**),(==),(++),(!!),(II),(WW),(EE),.. mean.

Here's an example of a XFree86.0.log file that I get when the server starts up correctly. Not sure if this is of help for anybody, but i'll include it anyhow as a reference.

Starting X / Stopping X

You can start X either by going to runlevel 5 (e.g. telinit 5 or setting runlevel 5 as the default runlevel in /etc/inittab) or for debugging purposes it's usually smarter to set the default runlevel to 3 (in /etc/inittab) and then to manually start X by hand as root (via startx).

You can always exit the X server by Ctrl-Alt-F1 and then typing Ctrl-C. Or by hitting Ctrl-Alt-Backspace. CAREFUL NOW! you will loose your X-session with all your windows!!

Check out your /var/log/XFree86.0.log file and get familiar with it's format.

Modifying your XF86Config File

The F86Config file is divided in sections, which describe your hardware and your setup. e.g. here is my XF86Config file.

These sections are mostly independent of each other.. e.g. the monitors are defined in one section, the grafics cards are defined in the "Device" sections. And the "Screen" sections define which monitor is connected to which grafics card, and what resolution is supposed to be used. There is also a section called "ServerLayout" which is interesting if you have more than one monitor.. it defines how the Screens are set up on your desk - e.g. which monitor is left, which one is right..

Last not least: each section in the XF86Config file contains an Identifier, which is nothing more than a free-form text string, which you can use to name your hardware. You can use pretty much any name you want. Just make sure that you use exactly the same string whereever you refer to a section.

Please do read the manual! man XF86Config !

Monitor Sections

Find the exact type of your monitor, and look up the monitor's specs (HorizSync, VertRefresh rates). The VendorName and ModelName are free-form text strings. Good to have, but not must-have. For each monitor you need one "Monitor" section. If you have two identical monitors, you need two "Monitor" sections in the XF86Config file.

e.g. I have two IBM P260 monitors and a Samsung SyncMaster 213T LCD display:

		Section "Monitor"
			Identifier   "Monitor Center"
			VendorName   "IBM"
			ModelName    "P260"
			HorizSync    30.0 - 121.0
			VertRefresh  50.0 - 160.0
			Option      "dpms"
		EndSection

		Section "Monitor"
			Identifier   "Monitor Right"
			VendorName   "IBM"
			ModelName    "P260"
			HorizSync    30.0 - 121.0
			VertRefresh  50.0 - 160.0
			Option      "dpms"
		EndSection
The Samsung Syncmaster 213T LCD display is tricky to set up (to say the least!). It has a very low maximum refresh rate of 60Hz and usually the built-in modes are "too fast" for it -- it can not sync them!

Samsung should really rename it to NoSync-Master 213T!!

Don't get confused with the modelines.. that part of the configuration is optional. We're manually defining a mode here and just use the one called "1600x1200@74".

		Section "Monitor"
			Identifier   "Monitor Left"
			VendorName   "Samsung"
			ModelName    "213T"

		#       Max Pixel Clock Rate 162 MHz

		#   For Analog Side ONLY:
			VertRefresh  56.0 - 75.0
			HorizSync    30.0 - 81.0
		#   For Digital Side ONLY:
		#       VertRefresh  56.0 - 60.0
		#       HorizSync    30.0 - 75.0
			Option      "dpms"

			# -- 1600x1200 Modelines : --
			# 51 Hz
			ModeLine "1600x1200" 137.61 1600 1672 2032 2176 1200 1202 1214 1240

			 # 1600x1200 @ 60Hz, 75.00 kHz hsync
			Modeline "1600x1200"  162   1600 1664 1856 2160  1200 1201 1204 1250 +HSync +VSync
			Modeline "1600x1200" 59.90 1600 1616 1968 2080 1200 1200 1204 1253

                # we will be using the next modeline only:

			Modeline "1600x1200@74"  130.4  1600 1648 1680 1760  1200 1202 1206 1235

		#       Modeline "1600x1200@74"  140    1600 1648 1700 1800  1200 1201 1204 1235

		EndSection

Device Sections

For each head of each grafics card you have, you need a "Device" section. Getting this one right may be a bit painful, especially which driver to use and what driver options to use. Read the man page of the driver (e.g. man radeon). Usually you can steal pieces of config-file from a previous installation where the XF86Config file was generated automatically. Again: just make sure that the identifiers that you assign for each device (=head) are unique and easy to understand.

For grafics cards with multiple heads, you might have to check the file /proc/pci and get the exact bus address for each grafics card. The lines "Screen 0" vs. "Screen 1" then define which physical connector on the card that device section is referencing.

e.g. I have an AGP card with one head, and a PCI card with two heads:

		Section "Device"
			Identifier  "AGP Card"
			Driver      "savage"
			BoardName   "Unknown"
			BusID       "PCI:1:0:0"
		EndSection


		Section "Device"
			Identifier  "ATI Card Head1"
			Driver      "radeon"
			BoardName   "unknown"
			BusID       "PCI:0:12:0"
			Screen       0

			Option "SWcursor"      "true"
			Option "BusType"       "PCI"
			Option "DDCMode"       "off"

			Option "IgnoreEDID"    "true"

			Option "MonitorLayout"             "TMDS,CRT"
			Option "OverlayOnCRTC2"             "off"
		EndSection

		Section "Device"
			Identifier  "ATI Card Head2"
			Driver      "radeon"
			BoardName   "unknown"
			BusID       "PCI:0:12:0"
			Screen       1

			Option "SWcursor"      "true"
			Option "BusType"       "PCI"
			Option "DDCMode"       "off"
			Option "IgnoreEDID"    "true"

			Option "OverlayOnCRTC2"             "off"
			Option "NoTV"           "yes"
		EndSection

Screen Sections

The Screen sections define how the monitors are connected to each head and what resolution should be used. I only use 1600x1200 pixel resolution at the max possible color-depth (that's called a Mode in XFree lingo), that's why there is usually only one mode referenced in my XF86Config files.

With CRT monitors, XFree is very smart of figuring out which is the best (fastest) Mode for a given resolution to be compatible with your monitor. With LCD monitors it's a bit more difficult. You might have to force XFree to use the one mode you want. I did that by defining a mode that has a different name compared to all the predefined modes.. i defined "1600x1200@74" using a modeline in the Monitor section (above). e.g.:

		Section "Screen"
			Identifier "Screen1"
			Device     "ATI Card Head1"
			Monitor    "Monitor Left"
			DefaultDepth     24
			SubSection "Display"
				Depth     24
                        # only the first entry is used - the other ones were for debugging and didn't work for me.
				Modes    "1600x1200@74" "1600x1200" "1280x1024"
			EndSubSection
		EndSection

		Section "Screen"
			Identifier "Screen0"
			Device     "AGP Card"
			Monitor    "Monitor Center"
			DefaultDepth     24
			SubSection "Display"
				Depth     24
				Modes    "1600x1200"
			EndSubSection
		EndSection

		Section "Screen"
			Identifier "Screen2"
			Device     "ATI Card Head2"
			Monitor    "Monitor Right"
			DefaultDepth     24
			SubSection "Display"
				Depth     24
				Modes    "1600x1200"
			EndSubSection
		EndSection

Server Layout Section

Last not least you may want to tell X11 how you have arranged your monitors on your desk, so when you move your mouse to the left it really goes to the monitor on the left.. wouldn't that be helpful? ;-)

This little section does exactly that:

		Section "ServerLayout"
			Identifier     "XFree86 Configured"
			Screen      0  "Screen0" 0 0
			Screen      1  "Screen1" LeftOf "Screen0"
			Screen      2  "Screen2" RightOf "Screen0"
			InputDevice    "Mouse0" "CorePointer"
			InputDevice    "Keyboard0" "CoreKeyboard"
		EndSection
In my setup the LCD is on the left called Screen1 (DISPLAY variable: localhost:0.1) ,
one IBM monitor is in the middle called Screen0 (DISPLAY variable: localhost:0.0) ,
and one IBM monitor is on the right called Screen2 (DISPLAY variable: localhost:0.2).

The initial X login-screen will always go to localhost:0.0, that's why that one is in the middle for my setup.

Window Manager

The whole X-server configuration we just went through, is independent of what window manager you later use. You may choose whatever you like. My favourite window managers are fvwm and fvwm2.

My Fvwm Sales-Pitch:

My personal opinion is that GNOME, KDE, and GDK are nice for users who want to play with their desktop a lot and/or miss Windows .. but I hate Windows, and don't want to be reminded of it's stupid userinterface and it's looks, and I really hate it if configuration files get modified at an unknown location by a GUI!
So I prefer good-old FVWM and XDM instead.. Let's not let LINUX become another Windows-like mess!

I don't want to play with my desktop, I want to work with it ;-)

See also: My XF86Config file for multiple monitors

See also: Getting Rid of GNOME or KDE

See also: Screenshot of my 1600x1200 center monitor with Fvwm

I hope this page helps somebody else..

Back to the UNIX tips


Maintainer: Tilo Sloboda linux AT unixgods.org
last update: $Revision: 1.4 $ / $Date: 2003/08/25 08:40:49 $