Getting the NVidia linux driver working with odd monitors

The latest edition of Ubuntu (9.04) is generally excellent. There are continuing problems with graphics cards, however, that probably flow more from the proprietary (closed source) drivers provided than anything that Ubuntu folks can control. For me, its the NVidia driver that’s the baddy, failing to recognise any accurate information from my Acer widescreen monitor. This required manually writing a new xorg.conf file pretty much from scratch – here’s the solution for pairing NVidia 8500 GT with an Acer P193w

NB The following sample xorg.conf file is set specifically for a particular hardware set up. Because this configuration doesn’t allow the graphics card to take required information from the monitor (becuase it seems to get this wrong) using this configuration in a different system could cause serious hardware damage. In particular, it is essential to get the correct modelines for your monitor, using the modeline calculator referenced in the file.

sample xorg.conf for nvidia

# xorg.conf (X.Org X Window System server configuration file)
# NB this is kev's hand edited version making use of xorg.conf manual and
# nvidia linux driver manual
# keyboard and mouse sections were pasted in from an xorg found on the ubuntu wiki,
# hopefully they're applicable here
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#   sudo dpkg-reconfigure -phigh xserver-xorg
Section "Module"
  Load            "glx"
Section "InputDevice"
  Identifier      "Keyboard0"
  Driver          "kbd"
  Option          "XkbRules"      "xorg"
  Option          "XkbModel"      "pc105"
  Option          "XkbLayout"     "gb"
Section "InputDevice"
  Identifier      "Mouse0"
  Driver          "mouse"
  Option          "CorePointer"
Section "Device"
  Identifier    "NVidia0"
  Driver        "nvidia"
  Screen        0
  Option        "NoLogo"    "true"
# set false to use freqs set in xorg.conf, default is true
  Option        "UseEdidFreqs"    "false"
# true could damage monitor if incorrect info specified in xorg.conf,
# but may be necessary if driver misidentifies all edid info from monitor
# default is false
  Option        "IgnoreEDID"    "false"
# nvidia's proprietary alternative to xinerama for multiple monitors,
# default is false
  Option        "TwinView"    "false"
Section "Monitor"
  Identifier    "Monitor0"
  VendorName    "Acer"
  ModelName    "P193w"
  HorizSync    30-81
  VertRefresh    55-76
  DisplaySize    428 278
# modeline calculated by
  Modeline    "1440x900" 106.47 1440 1520 1672 1904 900 901 904 932 -HSync +Vsync
  Modeline    "1280x800" 83.46 1280 1344 1480 1680 800 801 804 828 -HSync +Vsync
  Modeline     "960x600" 45.98 960 1000 1096 1232 600 601 604 622 -HSync +Vsync
Section "Screen"
  Identifier    "Screen0"
  Device        "NVidia0"
  Monitor        "Monitor0"
  DefaultDepth    24
    SubSection    "Display"
      Depth        24
      Modes        "1440x900" "1280x800" "960x600"
Section "ServerLayout"
  Identifier     "Default Server Layout"
  Screen        "Screen0"
  InputDevice    "Keyboard0"
  InputDevice    "Mouse0"