Ubuntu TwinView Laptop 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 in Hoary, Breezy and in Dapper Preview too. If you want to do TwinView in Fedora Core you should read the other HowTo.
Let me tell you what I have running right now. I have a Dell Precision M70 with the WideScreen and the Dell TrueMobile nVidia Graphics Card.
TwinView on a laptop can be configured in the same way as on a desktop machine, only that in a TwinView configuration using the laptop's internal flat panel and an external CRT, the CRT is the primary display device (specify its HorizSync and VertRefresh in the Monitor section of your X config file) and the flat panel is the secondary display device (specify its HorizSync and VertRefresh through the SecondMonitorHorizSync and SecondMonitorVertRefresh options).
Using Synaptic install the following packages: nvidia-glx, the linux-restricted-modules (choose the one that matches your kernel) and nvidia-settings.
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 just want to edit the file DON'T, follow this tutorial HowTo carefully.
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).
If you read the desktop howto, most Laptops will have to allow TwinView to probe what monitors are attached so leave that line out.
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" "NULL,1600x1200; 1024x768,1024x768; 1024x768,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. This way you can start without the external monitor disconnected ( NULL,1600x1200 ) or run with both (1024x768,1024x768 ) or external monitor only ( 1024x768,NULL). In order to change monitors you have to use CTRL+ALT+plus (on number pad) or CTRL+ALT+minus (on number pad) for most laptops you have to put the num lock on and use the fn key to get the correct + or - key. If you are using a projector with your laptop double check it's resolution capability, mine is 1024x768 but most are only 800x600.
Option "SecondMonitorHorizSync" "31-82"
This option is the Horizontal Sync for the laptop 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.
Option "TwinViewOrientation" "Clone"
This will allow both of the monitors to display exactly the same thing.
Next we need to edit the Screen section, adding the Viewport line to the SubSection for each display depth.
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 "1600x1200" "1280x1024" "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.
Or... Hit CTRL+ALT+F2 login and type: sudo /etc/init.d/gdm restart
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.