Ubuntu

Dual Monitors TwinView HowTo
By Steve Fink

First things first... This HowTo will only cover nVidia graphics drivers, why? Because nVidia was the first to support Linux by a long shot and I continue to purchase only nVidia hardware for their support, well there was that one ATI 9600 but it doesn't count because it never worked properly in Linux anyway.

This HowTo has been tested on Breezy, Hoary and even Dapper Drake. If you want to do TwinView in Fedora Core you should read the other HowTo.

There is also a laptop specific HowTo Here.

Let me tell you what I have running right now. I have a GeForce 6600 GT with dual DVI connectors which have two Samsung 215TW monitors attached (Yea, I know it's sweet! Here's a picture if you'd like to see them ). I'm going to get another PCI video card and up the anti to three monitors next.

Using Synaptic install the following packages: nvidia-glx, the linux-restricted-modules (choose the one that matches your kernel).

After installing the necessary packages you have to edit your xorg.conf file manually ( /etc/X11/xorg.conf ).
Don't forget to make a backup copy of your xorg.conf file.

For those of you who are experts and just want to edit the file here's the quick and dirty.

Comment out the line about dri in the Module section.

Next is the Device section the original device section looked like this:

Section "Device"
Identifier "NVIDIA Corporation NV43 [GeForce 6600/GeForce 6600 Ultra]"
Driver "nv"
BusID "PCI:1:5:0"
EndSection

We then have to change it to add all the Options for TwinView to look like this:

Section "Device"
Identifier "NVIDIA Corporation NV43 [GeForce 6600/GeForce 6600 Ultra]"
Driver "nvidia"
VendorName "Videocard vendor"
BoardName "NVIDIA GeForce 6600 GT"
BusID "PCI:1:5:0"
Option "NvAGP" "2"
Option "NoLogo" "1"
Option "RenderAccel" "0"
Option "CursorShadow" "1"
Option "Coolbits" "1"
Option "ConnectedMonitor" "dfp, dfp"
Option "NoPowerConnectorCheck"
Option "TwinView" "1"
Option "Metamodes" "1280x1024,1280x1024; 1280x960,1280x960; 1152x864,1152x864; 800x600,800x600; 1024x768,1024x768; 1280x1024,NULL; 1024x768,NULL"
Option "SecondMonitorHorizSync" "31-82"
Option "SecondMonitorVertRefresh" "56-76"
# Option "NoTwinViewXineramaInfo"
EndSection

I'll explain each of the options below for those who want to know more. Notice the last line in the Device section is commented out, this has to do with Xinerama info being sent back to the Window Manager and changes the behavior of the way the screen is spanned across the monitors or not spanned, I'll explain more in the Xinerama section.

Let's go through the options in the Device section:

Option "NvAGP" "2"

This option tells the driver to use agpgart, Ubuntu uses agpgart and it is loaded as a module on boot. I'm still working on taking it out and using nvagp directly, but there doesn't seem to be a need anymore and agpgart is compatible with more hardware than nvagp is.

Option "NoLogo" "1"

This option turns off the nVidia logo when starting X. I don't mind displaying the nVidia logo but it takes an extra couple of seconds to start so I turned it off.

Option "RenderAccel" "0"

This option turns on and off render acceleration, some cards need this on and others will lockup so we start with it off by default and then once everything is working you can try turning it on.

Option "CursorShadow" "1"

This option turns on and off the Cursor Shadow, I tried it both ways and it just looks a little more 3D with it on.

Option "Coolbits" "1"

This option enables support in the NV-CONTROL X extension for manipulating GPU clock settings. When this option is set to "1" the nvidia-settings utility will contain a page labeled "Clock Frequencies" through which clock settings can be manipulated. Coolbits is only available on GeForce FX, Quadro FX, and newer GPUs.

Option "ConnectedMonitor" "dfp, dfp"

This option tells the nVidia driver what type of monitor is attached to the video card. The options are dfp (DVI) or crt (analog).

Option "NoPowerConnectorCheck"

This option turns on and off the power connector check, most monitors will fail this and it just takes extra time, so I turn it off.

Option "TwinView" "1"

This option turns on and off TwinView it won't work with out it.

Option "Metamodes" "1280x1024,1280x1024; 1280x960,1280x960; 1152x864,1152x864; 1024x768,1024x768; 800x600,800x600; 1280x1024,NULL; 1024x768,NULL"

or for widescreen (16:10)

Option "Metamodes" "1680x1050,1680x1050; 1440x900,1140x900; 1280x800,1280x800; 1024x640,1024x640; 1680x1050,NULL; 1440x900,NULL; 1280x800,NULL; 1024x640,NULL"

This option controls the meta modes that the screen can display, the purpose for having the NULL options in there is so that if it cannot connect to the second monitor X can still start on the first. This is especially handy with laptops where you might want to connect a projector or second monitor to the vga port. The first meta mode in the list should always be the default mode and then if that one fails X will try the second, then the third and so on.

Option "SecondMonitorHorizSync" "31-82"

This option is the Horizontal Sync for the second monitor, this is extremely important to have correct if you have the wrong settings you can damage your monitor.

Option "SecondMonitorVertRefresh" "56-76"

This option is the Vertical Refresh rate for your monitor and once again, this is extremely important to have correct or else...

Option "NoTwinViewXineramaInfo"

This option turns Xinerama Info off. With Xinerama info off the Window Manager believes that the entire MetaMode is the screen and will span everything across both monitors. When you click Maximize your application will fill both screens, for some applications this is ok for others it's annoying. I've tested it both ways and prefer to allow the Window Manager to know there are two displays.

Next we need to edit the Screen section, adding the Viewport line to the SubSection for each display depth. Also you should have a corrosponding size ie 1280x1024 or 800x600 here for each size specified above in the Metamodes.

Section "Screen"
Identifier "Default Screen"
Device "NVIDIA Corporation NV43 [GeForce 6600/GeForce 6600 Ultra]"
Monitor "Monitor"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1280x1024" "1280x960" "1152x864" "1024x768" "800x600"
EndSubSection
EndSection

Next we have to edit the ServerLayout section. With TwinView there is only one Monitor section and that defines the first Monitor the second Monitor was defined in the Device section. It's not necessary to add the Option "Xinerama" "off" but it's a good idea since TwinView and Xinerama are to different things.


Section "ServerLayout"
Identifier "TwinView Configuration"
Screen 0 "Default Screen" 0 0
InputDevice "Configured Mouse"
InputDevice "Generic Keyboard"
Option "Xinerama" "Off"
EndSection


Now you should be able to save your changes to your xorg.conf file and logout. Once you have logged out simply hit CTRL+ALT+Backspace and this will kill the running X server. GDM should restart with the new settings, sometimes it won't and you need to just log-in and type startx.

Several people have reported that their machine comes up with only one screen active and then they have to go to System --> Preferences --> Screen Resolution and choose one of the Dual Screen Resolutions like 2560x1024.

I know some of you are wondering, why I put all of the Options under the Device section? Well that's where they made the most sense to me, like most everything else in Linux, there's about 50 ways to do anything the Options can go under the Screen section but they modify the behavior of the device so why not just put them under the device.