Ubuntu, Nvidia, and dual screens: what not to do

I spent far more time last week making two monitors not work than I did making them work, so here’s I few things I have learnt:

  1. Don’t use the “nv” driver. I couldn’t get it to drive two screens at once, much as I would have liked it to.
  2. Don’t use ‘Option “ConnectedMonitor” “dfp”‘ with the “nvidia” driver. I did RTFM rather too well and put that in as a hint to the driver. While ever it was in the xorg.conf file, only one screen at a time would work.

The eventual solution was, surprise, surprise, to download the latest version of the Nvidia driver — which was released partway through this epic battle — and follow its instructions to the letter — including removing existing Ubuntu packages as directed. I don’t know whether the driver had improved or my technique had improved by the time I tried that third version, but it worked for me.

Of course, the first thing I did when both screens worked was see how many 80-column Emacs frames would fill the screens: over 600 lines of Emacs visible at once, now that makes it all worthwhile!

I started out using the two monitors as separate X screens but I’m now using Twinview so it’s easy to Alt-Tab amongst the Emacs frames. The X startup log shows that X thinks the combined screen is too wide to be allowed, so it starts at a lower resolution, but once I’ve logged in, I can jigger the “NVIDIA X Server Settings” tool to get it back to it’s highest resolution.

In keeping with the long tradition of filling the Internet with example configuration files that are all purported to work but are all somehow puzzlingly different, here’s the xorg.conf file that’s working for me:

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 1.0 (buildmeister@builder26) Mon Feb 26 23:38:28 PST 2007

Section “ServerLayout”
Identifier “Layout0″
Screen 0 “Screen0″ 0 0
InputDevice “Keyboard0″ “CoreKeyboard”
InputDevice “Mouse0″ “CorePointer”

Section “Files”
RgbPath “/usr/lib/X11/rgb”

Section “Module”
Load “dbe”
Load “extmod”
Load “type1″
Load “freetype”
Load “glx”

Section “ServerFlags”
Option “Xinerama” “0″

Section “InputDevice”
# generated from default
Identifier “Mouse0″
Driver “mouse”
Option “Protocol” “auto”
Option “Device” “/dev/psaux”
Option “Emulate3Buttons” “no”
Option “ZAxisMapping” “4 5″

Section “InputDevice”
# generated from default
Identifier “Keyboard0″
Driver “kbd”

Section “Monitor”
# HorizSync source: edid, VertRefresh source: edid
Identifier “Monitor0″
VendorName “Unknown”
ModelName “Apple Cinema HD”
HorizSync 49.3 – 98.5
VertRefresh 60.0
Option “DPMS”

Section “Device”
Identifier “Videocard0″
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “Quadro FX 1500″

Section “Screen”
Identifier “Screen0″
Device “Videocard0″
Monitor “Monitor0″
DefaultDepth 24
Option “TwinView” “1″
Option “metamodes” “DFP-0: 2560×1600 +2560+0, DFP-1: 2560×1600 +0+0; DFP-0: 1280×800 +1280+0, DFP-1: 1280×800 +0+0″
SubSection “Display”
Depth 24
Modes “1600×1200″ “1280×1024″ “1024×768″ “800×600″ “640×480″