Multiple Monitors

Walkthrough: 3 monitors with two video cards using Mandriva Linux 2005 Club Edition.

I have been using a similiar config with Mandrake 9.2, 10 and 10.1. This configuration will give you triple monitors with working 3D acceleration on the first two monitors, and a single desktop that spans all three monitors. With minor variations, it should work on any modern Linux distribution. A minor annoyance is that new dialogue box popups appear centered between the first and second monitor.

For the sake of simplicity, you might want to just use Xinerama and drop Twinview. This will work, if you define a separate device for the second output of the first card. You will lose the ability to have accelerated 3D span the 2 monitors, however. You'll have to search the web for examples, as I don't cover that here.

As an alternative, you may be interested in setting up each monitor with a separate X session. This is possible by not using the Xinerama or Twinview options. Personally I think it would be incredibly annoying to not have the mouse and keyboard working on all three monitors at the same time, so I have never intentionally used this variation.

Caution, this tutorial only works if the first card is an Nvidia card with dual outputs. ATI will be different, and if you are running multiple cards with single outputs, it will probably just work out of the box. Once you go multiple, you'll never go back. Using variations on this setup, it should be easy scale to as many monitors and cards as you can fit in the PC.

'''Hardware:

An Intel compatible PC with AGP and PCI slots. I happen to be using a dual Xeon 1.7 with hyperthreading enabled on the motherboard, so far it seems stable. I've had up to 4 monitors working on an older Pentium 233 with no issues. The biggest problem seems to be finding motherboards with enough PCI slots.

Nvidia FX5200 AGP with dual DVI outputs - Most Nvidia will work, I have used a TI4200 with DVI and vga in the past, using the vga adapter on the dvi to get dual vga out working.

NVidia FX5200 PCI with VGA output - Nvidia not required here. Almost any PCI card will do, as long as it has enough RAM to display the color depth you want, typically 4MB and up. Cheap old cards may not refresh fast enough, and the display will flicker noticeably.

''Note: Make SURE the cards are fully seated in the motherboard and fastened down correctly. This may save you a lot of grief.''

Two 19" LCD monitors plugged into the AGP card

One 21" CRT monitor plugged into the PCI card '''

Plug everything and install your OS. If it doesn't detect and configure it correctly, try this:

ctrl-alt-f2 log in as root type init 3 to kill any running X session you may have open. edit /etc/inittab and temporarily change the default runlevel from 5 to 3 cp /etc/inittab /etc/inittab-backuporiginal vi /etc/inittab arrow down to line 18 that says "id:5:initdefault:" place the cursor over the 5, press r once then 3 the 5 should change to a 3 now press shift colon then press w q ! and press enter You should be back at the command prompt. When you are all done, you can reverse this process to get your GUI login prompt back, but for now this is safer while editing your X config. If your PC locks up during testing, just reboot and login again at the prompt.

Move the existing xorg.conf file to a safe place. mv /etc/X11/xorg.conf /etc/X11/xorg.conf-originalbackup

Start the drakconf utility - if it isn't installed, then "urpmi drakconf" drakconf It should detect the two cards correctly, and ask you to setup multiple monitors. Choose "Xinerama" when asked. You may wish to correct the autodetect of the second monitor if it gets it wrong. It seems to detect the second monitor of the first card, not the first monitor of the second card. That's okay, it will probably work.

Save and exit drakconf. Try out X and see if it works at all. startx You will probably see activity on the first monitor and the third monitor. This is the default behavior for Xinerama, it will aggregate the first monitor of each card into one desktop. If the 2nd monitor remains blank, thats normal, we'll fix it in a minute.

ctrl-alt-backspace to kill X and return to the console. Now, we need to enable the second monitor on the first card. vi /etc/X11/xorg.conf

Find the section labeled

Section "Device" Identifier "device1" VendorName "nVidia" BoardName "NVIDIA GeForce FX (generic)" Driver "nvidia" Screen 0 BusID "PCI:1:0:0" Option "DPMS" Option "IgnoreEDID" "1" EndSection

You need to modify it to look like this:

''Section "Device" Identifier "device1" VendorName "nVidia" BoardName "NVIDIA GeForce FX (generic)" Driver "nvidia" Screen 0 BusID "PCI:1:0:0" Option "DPMS" Option "IgnoreEDID" "1" # Everything below here added to enable 2nd monitor on this card Option "TwinView" "1" Option "Metamodes" "1280x1024,1280x1024;" Option "ConnectedMonitor" "DFP,DFP" Option "SecondMonitorHorizSync" "24-80" Option "SecondMonitorVertRefresh" "56-75" Option "NvAGP" "3" EndSection''

Now, find the section labeled like this:

Section "Screen" Identifier "screen1" Device "device1" Monitor "monitor1" DefaultColorDepth 24 Subsection "Display" Depth 24 Virtual 1280 1024 EndSubsection EndSection

And modify it to look like this:

''Section "Screen" Identifier "screen1" Device "device1" Monitor "monitor1" DefaultColorDepth 24 Subsection "Display" Depth 24 # Virtual 1280 1024 # This needed to be changed to use the new doublewidth virtual screen with twinview enabled Virtual 2560 1024 EndSubsection EndSection '' You may also need to define the order of your screens in the ServerLayout section:

Section "ServerLayout" Identifier "layout1" InputDevice "Keyboard1" "CoreKeyboard" InputDevice "Mouse1" "CorePointer" Screen "screen1" Screen "screen2" RightOf "screen1" Option "Xinerama" EndSection

Okay, now you should be able to type "startx" and see all 3 monitors working correctly. It does take a few seconds for all 3 to initialize, so be patient. If you only see one or two of the monitors working, carefully review your steps to get here. Typos will not be forgiven, so make sure everything is correct first.

I'm attaching my full config below. Happy multi-monitoring!

Sean Harbour

Section "Files" # Multiple FontPath entries are allowed (they are concatenated together) # By default, Mandrake 6.0 and later now use a font server independent of    # the X server to render fonts. FontPath "unix/:-1" EndSection Section "ServerFlags" #DontZap # disable  (server abort) AllowMouseOpenFail # allows the server to start up even if the mouse does not work #DontZoom # disable / (resolution switching) EndSection Section "Module" Load "dbe" # Double-Buffering Extension Load "v4l" # Video for Linux Load "extmod" Load "type1" Load "freetype" Load "/usr/X11R6/lib/modules/extensions/libglx.so" EndSection Section "InputDevice" Identifier "Keyboard1" Driver "keyboard" Option "XkbModel" "pc105" Option "XkbLayout" "en_US" Option "XkbOptions" "compose:rwin" EndSection Section "InputDevice" Identifier "Mouse1" Driver "mouse" Option "Protocol" "ExplorerPS/2" Option "Device" "/dev/mouse" Option "ZAxisMapping" "4 5" EndSection Section "Monitor" Identifier "monitor1" VendorName "Plug'n Play" HorizSync 24-80 VertRefresh 56-75 # Monitor preferred modeline (60.0 Hz vsync, 64.0 kHz hsync, ratio 5/4) ModeLine "1280x1024" 108 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync # TV fullscreen mode or DVD fullscreen output. # 768x576 @ 79 Hz, 50 kHz hsync ModeLine "768x576"    50.00  768  832  846 1000   576  590  595  630 # 768x576 @ 100 Hz, 61.6 kHz hsync ModeLine "768x576"    63.07  768  800  960 1024   576  578  590  616 EndSection Section "Monitor" Identifier "monitor2" VendorName "Plug'n Play" # HorizSync 24-80 # VertRefresh 56-75 # New settings - autoconfig incorrectly uses settings from the second monitor on the first card, not the first monitor on the second card HorizSync 31.0-115.0 VertRefresh 55.0-160.0 # Monitor preferred modeline (60.0 Hz vsync, 64.0 kHz hsync, ratio 5/4) ModeLine "1280x1024" 108 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync # TV fullscreen mode or DVD fullscreen output. # 768x576 @ 79 Hz, 50 kHz hsync ModeLine "768x576"    50.00  768  832  846 1000   576  590  595  630 # 768x576 @ 100 Hz, 61.6 kHz hsync ModeLine "768x576"    63.07  768  800  960 1024   576  578  590  616 EndSection Section "Device" Identifier "device1" VendorName "nVidia" BoardName "NVIDIA GeForce FX (generic)" Driver "nvidia" Screen 0 BusID "PCI:1:0:0" Option "DPMS" Option "IgnoreEDID" "1" # Everything below here added to enable 2nd monitor on this card Option "TwinView" "1" Option "Metamodes" "1280x1024,1280x1024;" Option "ConnectedMonitor" "DFP,DFP" Option "SecondMonitorHorizSync" "24-80" Option "SecondMonitorVertRefresh" "56-75" Option "NvAGP" "3" EndSection Section "Device" Identifier "device2" VendorName "nVidia" BoardName "NVIDIA GeForce FX (generic)" Driver "nv" Screen 0 BusID "PCI:5:1:0" Option "DPMS" EndSection Section "Screen" Identifier "screen1" Device "device1" Monitor "monitor1" DefaultColorDepth 24 Subsection "Display" Depth 24 # Virtual 1280 1024 # This needed to be changed to use the new doublewidth virtual screen with twinview enabled Virtual 2560 1024 EndSubsection EndSection Section "Screen" Identifier "screen2" Device "device2" Monitor "monitor2" DefaultColorDepth 24 Subsection "Display" Depth 8 Virtual 1280 1024 EndSubsection Subsection "Display" Depth 15 Virtual 1280 1024 EndSubsection Subsection "Display" Depth 16 Virtual 1280 1024 EndSubsection Subsection "Display" Depth 24 Virtual 1280 1024 EndSubsection EndSection Section "ServerLayout" Identifier "layout1" InputDevice "Keyboard1" "CoreKeyboard" InputDevice "Mouse1" "CorePointer" Screen "screen1" Screen "screen2" RightOf "screen1" Option "Xinerama" EndSection
 * 1) File generated by XFdrake.
 * 1) Refer to the XF86Config man page for details about the format of
 * 2) this file.
 * 1) this file.