Penguin

I had some trouble getting my laptop (Dell Precision M65) to work using nvidia's TwinView. I wanted it to automatically use my CRT monitor @ 1280x1024 if docked but to use the laptop panel @ 1920x1200 if not docked.

Here's my xorg.conf after I figured out how to do it, all this is documented in Nvidia's README but it's a bit confusing without an example.

The key points are that there are two "Screen"s and that the Twinview and Metamodes options are needed in the "Device" section. In my case the Usedisplaydevice options in the Screen sections are also required otherwise it can choose the wrong one. That's why these intructions http://javier.rodriguez.org.mx/index.php/2006/09/08/xorgconf-configuration-for-nvidia-twinview-on-the-dell-620/ didn't work for me.


Section "ServerLayout"

    Identifier     "Default Layout"
    Screen         0 "Docked"
    Screen         1 "Laptop"
    InputDevice    "Generic Keyboard"
    InputDevice    "Docked Mouse"
    InputDevice    "Configured Mouse"
    InputDevice    "stylus" "SendCoreEvents"
    InputDevice    "cursor" "SendCoreEvents"
    InputDevice    "eraser" "SendCoreEvents"
    InputDevice    "Synaptics Touchpad"
EndSection

Section "Files"

        # path to defoma fonts
    FontPath        "/usr/share/X11/fonts/misc"
    FontPath        "/usr/share/X11/fonts/cyrillic"
    FontPath        "/usr/share/X11/fonts/100dpi/:unscaled"
    FontPath        "/usr/share/X11/fonts/75dpi/:unscaled"
    FontPath        "/usr/share/X11/fonts/Type1"
    FontPath        "/usr/share/X11/fonts/100dpi"
    FontPath        "/usr/share/X11/fonts/75dpi"
    FontPath        "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
EndSection

Section "Module"
    Load           "bitmap"
    Load           "ddc"
    Load           "extmod"
    Load           "freetype"
    Load           "glx"
    Load           "int10"
    Load           "type1"
    Load           "vbe"
EndSection

Section "InputDevice"
    Identifier     "Generic Keyboard"
    Driver         "kbd"
    Option         "CoreKeyboard"
    Option         "XkbRules" "xorg"
    Option         "XkbModel" "pc104"
    Option         "XkbLayout" "us"
EndSection

Section "InputDevice"
    Identifier     "Configured Mouse"
    Driver         "mouse"
    Option         "CorePointer"
    Option         "Device" "/dev/input/mice"
    Option         "Protocol" "ExplorerPS/2"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    Identifier     "Docked Mouse"
    Driver         "mouse"
    Option         "CorePointer"
    Option         "Device" "/dev/psaux"
    Option         "Protocol" "ExplorerPS/2"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"
    Identifier     "Synaptics Touchpad"
    Driver         "synaptics"
    Option         "SendCoreEvents" "true"
    Option         "Device" "/dev/psaux"
    Option         "Protocol" "auto-dev"
    Option         "ZAxisMapping" "4 5"
    Option         "HorizScrollDelta" "0"
EndSection

Section "InputDevice"

                                                      # /dev/input/event
                                                      # for USB
    Identifier     "stylus"
    Driver         "wacom"
    Option         "Device" "/dev/wacom"          # Change to
    Option         "Type" "stylus"
    Option         "ForceDevice" "ISDV4"               # Tablet PC ONLY
EndSection

Section "InputDevice"

                                                      # /dev/input/event
                                                      # for USB
    Identifier     "eraser"
    Driver         "wacom"
    Option         "Device" "/dev/wacom"          # Change to
    Option         "Type" "eraser"
    Option         "ForceDevice" "ISDV4"               # Tablet PC ONLY
EndSection

Section "InputDevice"

                                                      # /dev/input/event
                                                      # for USB
    Identifier     "cursor"
    Driver         "wacom"
    Option         "Device" "/dev/wacom"          # Change to
    Option         "Type" "cursor"
    Option         "ForceDevice" "ISDV4"               # Tablet PC ONLY
EndSection

Section "Monitor"
    Identifier     "Laptop Panel"
    HorizSync       30.0 - 75.0
    VertRefresh     30.0 - 60.0
    #DisplaySize     334    210
    Option         "DPMS"
EndSection

Section "Monitor"
    Identifier     "ExternalCRT"
    VendorName     "Dell"
    ModelName      "Dell D1226H"
    HorizSync       30.0 - 95.0
    VertRefresh     50.0 - 160.0
    Gamma           1
    #DisplaySize            360 270
    Option         "DPMS"
    ModeLine       "640x480@60" 25.2 640 656 752 800 480 490 492 525 -hsync -vsync
    ModeLine       "640x480@72" 31.5 640 664 704 832 480 489 491 520 -hsync -vsync
    ModeLine       "640x480@75" 31.5 640 656 720 840 480 481 484 500 -hsync -vsync
    ModeLine       "640x480@85" 36.0 640 696 752 832 480 481 484 509 -hsync -vsync
    ModeLine       "800x600@56" 36.0 800 824 896 1024 600 601 603 625 +hsync +vsync
    ModeLine       "800x600@72" 50.0 800 856 976 1040 600 637 643 666 +hsync +vsync
    ModeLine       "800x600@75" 49.5 800 816 896 1056 600 601 604 625 +hsync +vsync
    ModeLine       "800x600@85" 56.3 800 832 896 1048 600 601 604 631 +hsync +vsync
    ModeLine       "800x600@60" 40.0 800 840 968 1056 600 601 605 628 +hsync +vsync
    ModeLine       "832x624@75" 57.3 832 864 928 1152 624 625 628 667 -hsync -vsync
    ModeLine       "1024x768@85" 94.5 1024 1072 1168 1376 768 769 772 808 +hsync +vsync
    ModeLine       "1024x768@75" 78.8 1024 1040 1136 1312 768 769 772 800 +hsync +vsync
    ModeLine       "1024x768@70" 75.0 1024 1048 1184 1328 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768@60" 65.0 1024 1048 1184 1344 768 771 777 806 -hsync -vsync
    ModeLine       "1024x768@43" 44.9 1024 1032 1208 1264 768 768 776 817 +hsync +vsync interlace
    ModeLine       "1152x864@75" 108.0 1152 1216 1344 1600 864 865 868 900 +hsync +vsync
    ModeLine       "1152x768@54" 65.0 1152 1178 1314 1472 768 771 777 806 +hsync +vsync
    ModeLine       "1280x854" 80.0 1280 1309 1460 1636 854 857 864 896 +hsync +vsync
    ModeLine       "1280x1024@75" 135.0 1280 1296 1440 1688 1024 1025 1028 1066 +hsync +vsync
    ModeLine       "1280x960@60" 102.1 1280 1360 1496 1712 960 961 964 994 -hsync +vsync
    ModeLine       "1280x960@85" 148.5 1280 1344 1504 1728 960 961 964 1011 +hsync +vsync
    ModeLine       "1280x1024@85" 157.5 1280 1344 1504 1728 1024 1025 1028 1072 +hsync +vsync
    ModeLine       "1280x1024@60" 108.0 1280 1328 1440 1688 1024 1025 1028 1066 +hsync +vsync
    ModeLine       "1280x960@75" 129.9 1280 1368 1504 1728 960 961 964 1002 -hsync +vsync
    ModeLine       "1400x1050@60" 122.6 1400 1488 1640 1880 1050 1051 1054 1087 -hsync +vsync
    ModeLine       "1400x1050@75" 155.8 1400 1496 1648 1896 1050 1051 1054 1096 -hsync +vsync
    ModeLine       "1600x1200@65" 175.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
    ModeLine       "1600x1200@60" 162.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
    ModeLine       "1600x1200@75" 202.5 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
    ModeLine       "1600x1200@70" 189.0 1600 1664 1856 2160 1200 1201 1204 1250 +hsync +vsync
    ModeLine       "1792x1344@60" 204.8 1792 1920 2120 2448 1344 1345 1348 1394 -hsync +vsync
    ModeLine       "1856x1392@60" 218.3 1856 1952 2176 2528 1392 1393 1396 1439 -hsync +vsync
    ModeLine       "1920x1440@60" 234.0 1920 2048 2256 2600 1440 1441 1444 1500 -hsync +vsync
    ModeLine       "2048x1536@60" 266.9 2048 2200 2424 2800 1536 1537 1540 1589 -hsync +vsync
EndSection

Section "Device"
    Identifier     "NVIDIA 0"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
    Option         "TwinView" "On"
    Option         "MetaModes" "DFP-0: 1920x1200, CRT-0: NULL; DFP-0: NULL, CRT-0: 1280x1024"

    #Option         "MetaModes" "DFP-0: 1920x1200, CRT-0: 1280x1024; DFP-0: 1920x1200, CRT-0: NULL; DFP-0: NULL, CRT-0: 1280x1024"
    #Option         "HorizSync" "DFP-0: 30-75; CRT-0: 30-95"
    #Option         "VertRefresh" "DFP-0: 30-60; CRT-0: 50-160"
    #Option         "SecondMonitorHorizSync" "30-75"
    #Option         "SecondMonitorVertRefresh" "30-60"
    #Option        "TwinViewOrientation" "Leftof"
    #Option        "ConnectedMonitor" "DFP, CRT"
    #Option         "UseEdidDpi" "False"
EndSection

Section "Screen"
    Identifier     "Laptop"
    Device         "NVIDIA 0"
    Monitor        "Laptop Panel"
    Option         "UseDisplayDevice" "DFP-0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       1
        Modes      "1920x1200" "1680x1050" "1440x900" "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       4
        Modes      "1920x1200" "1680x1050" "1440x900" "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection     "  Display"
        Depth       8
        Modes      "1920x1200" "1680x1050" "1440x900" "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       15
        Modes      "1920x1200" "1680x1050" "1440x900" "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       16
        Modes      "1920x1200" "1680x1050" "1440x900" "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
    SubSection     "Display"
        Depth       24
        Modes      "1920x1200" "1680x1050" "1440x900" "1280x1024" "1024x768" "800x600" "640x480"
    EndSubSection
EndSection

Section "Screen"
    Identifier     "Docked"
    Device         "NVIDIA 0"
    Monitor        "ExternalCRT"
    Option         "UseDisplayDevice" "CRT-0"
    DefaultDepth    24
    SubSection     "Display"
        Depth       24
        Modes      "1600x1200@75" "1280x1024@85" "1280x1024@60" "1280x960@85" "1280x960@75" "1280x960@60" "1400x1050@60" "1280x1024@75" "1400x1050@75" "1280x854" "1600x1200@65" "1152x768@54" "1600x1200@60" "1152x864@75" "1600x1200@75" "1024x768@43" "1600x1200@70" "1024x768@60" "1792x1344@60" "1024x768@70" "1856x1392@60" "1024x768@75" "1920x1440@60" "1024x768@85" "2048x1536@60" "832x624@75" "800x600@60" "800x600@85" "800x600@75" "800x600@72" "800x600@56" "640x480@85" "640x480@75" "640x480@72" "640x480@60"
    EndSubSection
EndSection