Nvidia Dual Screen
Foreword
Dual screen configuration for NVidia proprietary driver can be a little tricky. Nvidia has only support for very old RandR specification which is no longer used anywhere else. What is even worst when you will configure dual screen using these old configuration you will loose 3D acceleration on both screens and you can forget about games or 3D Desktop. This is shameful for such a big corporation because they was promising new RandR support with acceleration few years ago and still it's not working.
So what can we do? We can use native NVidia TwinView technology to setup the screens. The TwinView settings are well documented in driver documentation, however I found out that few configuration options provided as optional are actually needed to make both screens work without problems. I must point out that my minor problems were most likely cosed by the fact that my second screen is not fully supporting Edid auto detection. If you have problems with settings up two screens using Nvidia TwinView look and my explanation and configuration file. I hope this will help you.
Xorg Server Configuration
My primary screen is Samsung SyncMaster 226BW wide screen DFP monitor with native resolution 1680x1050. The second screen is Sony Bravia 32in LCD TV with native resolution 1360x768. This screen is connected using standard VGA cable and therefor is recognized as CRT monitor. I'm using my second monitor to watch movies and also to lunch MythTV media center. This screen is attached to 2nd VGA connector to my graphics card and is positioned on the right of my main monitor. Below you will find configuration file, that is letting me use both screens with full 3D acceleration.
Section "ServerLayout" Identifier "TwinView_Dual" Screen 0 "Screen_TwinView_Dual" 0 0 InputDevice "Keyboard0" "CoreKeyboard" InputDevice "USB Mouse" "CorePointer" # InputDevice "LIRC-Mouse" Option "AIGLX" "false" Option "AllowEmptyInput" "off" EndSection Section "ServerFlags" Option "AllowMouseOpenFail" "true" # Option "Xinerama" "true" Option "DefaultServerLayout" "Twinview_Dual" EndSection Section "Files" FontPath "/usr/share/fonts/misc" FontPath "/usr/share/fonts/corefonts" FontPath "/usr/share/fonts/arkpandora" FontPath "/usr/share/fonts/artwiz-aleczapka-en" FontPath "/usr/share/fonts/artwiz" FontPath "/usr/share/fonts/cheapskatefonts" FontPath "/usr/share/fonts/dejavu" FontPath "/usr/share/fonts/efont-unicode" FontPath "/usr/share/fonts/essays1743" FontPath "/usr/share/fonts/TTF" FontPath "/usr/share/fonts/freefonts" FontPath "/usr/share/fonts/hunkyfonts" FontPath "/usr/share/fonts/intlfonts" FontPath "/usr/share/fonts/lfpfonts-fix" FontPath "/usr/share/fonts/mathematica-fonts" FontPath "/usr/share/fonts/sgi-fonts" FontPath "/usr/share/fonts/tengwar-fonts" FontPath "/usr/share/fonts/terminus" FontPath "/usr/share/fonts/texcm-ttf" FontPath "/usr/share/fonts/ttf-gentium" FontPath "/usr/share/fonts/unifont" FontPath "/usr/share/fonts/urw-fonts" FontPath "/usr/share/fonts/vc" FontPath "/usr/share/fonts/jmk" FontPath "/usr/share/fonts/Type1" FontPath "/usr/share/fonts/100dpi" FontPath "/usr/share/fonts/75dpi" FontPath "/usr/share/fonts/cyrillic" FontPath "/usr/share/fonts/default/ghostscript" FontPath "/usr/share/fonts/ttf-bitstream-vera" FontPath "/usr/share/fonts/cronyx/100dpi/:unscaled" FontPath "/usr/share/fonts/cronyx/misc/:unscaled" FontPath "/usr/share/fonts/cronyx/75dpi/:unscaled" ModulePath "/usr/lib/xorg/modules" ModulePath "/usr/lib/opengl/xorg-x11/extensions/" EndSection Section "Module" Load "ddc" Load "vbe" Load "dbe" Load "extmod" SubSection "extmod" Option "omit xfree86-dga" EndSubSection Load "glx" Load "bitmap" Load "freetype" Load "record" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "evdev" Option "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd" Option "CoreKeyboard" Option "XkbRules" "xorg" Option "XkbModel" "pc105" Option "XkbLayout" "pl" Option "XkbVariant" ",winkeys" Option "XkbOptions" "eurosign:5,terminate:ctrl_alt_bksp" EndSection Section "InputDevice" Identifier "Serial Mouse" Driver "mouse" Option "Protocol" "Microsoft" Option "Device" "/dev/ttyS0" Option "Emulate3Buttons" "true" Option "Emulate3Timeout" "70" Option "SendCoreEvents" "true" EndSection Section "InputDevice" Identifier "PS/2 Mouse" Driver "mouse" Option "Protocol" "IMPS/2" Option "Device" "/dev/input/mice" Option "Emulate3Buttons" "false" Option "Emulate3Timeout" "70" Option "SendCoreEvents" "true" Option "ZAxisMapping" "4 5" EndSection Section "InputDevice" Identifier "USB Mouse" Driver "evdev" Option "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-mouse" # Option "SendCoreEvents" "true" # Option "Protocol" "IMPS/2" Option "ZAxisMapping" "4 5" Option "Buttons" "5" EndSection Section "InputDevice" Identifier "LIRC-Mouse" Driver "mouse" Option "Device" "/var/run/lirc/lircm" Option "Protocol" "IntelliMouse" Option "SendCoreEvents" Option "Buttons" "5" Option "ZAxisMapping" "4 5" EndSection #Modes configuration for TV Sony Bravia 32 KDL32S2030 Section "Modes" Identifier "Modes_SONY" Mode "WXGA_1360x768" # vfreq 60.015Hz, hfreq 47.712kHz DotClock 85.500000 HTimings 1360 1424 1536 1792 VTimings 768 771 777 795 Flags "+HSync" "+VSync" EndMode Mode "WXGA_1280x768" # vfreq 59.870Hz, hfreq 47.776kHz DotClock 79.500000 HTimings 1280 1344 1472 1664 VTimings 768 771 778 798 Flags "+HSync" "-VSync" EndMode Mode "XGA_1024x768" # vfreq 60Hz, hfreq 48.4kHz DotClock 65.000000 HTimings 1024 1032 1176 1344 VTimings 768 771 777 806 Flags "+HSync" "-VSync" EndMode EndSection #Modes configuration for LCD Samsung Syncmaster 226bw 22 inch # Configuration for Samsung 226BW Primary LCD Monitor Section "Monitor" Identifier "Samsung_226BW" VendorName "Samsung" ModelName "226BW (22inch)" DisplaySize 473.8 296.1 HorizSync 48 VertRefresh 60 Option "DPMS" "true" EndSection # Configuration for Philips 107B Primary CRT Monitor Section "Monitor" Identifier "Philips_107B" VendorName "Philips" ModelName "107B (17inch)" DisplaySize 320 240 HorizSync 30.0 - 69.0 VertRefresh 50.0 - 130.0 Option "DPMS" "true" EndSection # Configuration for Generic Monitor Section "Monitor" Identifier "Generic" VendorName "Unknown" ModelName "Unknown" VertRefresh 60 Option "DPMS" "true" EndSection #Configuration for Sony Bravia 32in Secondary LCD TV/Monitor Section "Monitor" Identifier "Sony_Bravia_32in" Option "DPMS" "true" VendorName "Sony" ModelName "Bravia 32 inches" UseModes "Modes_SONY" #HorizSync 31.5-47.8 #VertRefresh 60 EndSection #Configuration for GForce 8800GTS Graphics TwinView Dual Section "Device" Identifier "GForce_TwinView_Dual" Driver "nvidia" VendorName "ASUS" BoardName "ASUS Nvidia EN8800GTS" BusID "PCI:4:0:0" Option "NoLogo" "false" # Option "LogoPath" "" Option "BackingStore" "true" Option "RenderAccel" "true" # Option "UBB" "true" Option "NoFlip" "true" # Option "Dac8bit" "false" # Option "Overlay" "false" # Option "CIOverlay" "false" # Option "TransparentIndex" "0" # Option "OverlayDefaulVisual" "false" # Option "EmulatedOverlaysTimerMS" "0" # Option "EmulatedOverlaysThreshold" "true" # Option "EmulatedOverlaysThresholdValue" "5" Option "RandRRotation" "true" # Option "Rotate" "" # Option "AllowDDCCI" "true" Option "PixmapCacheSize" "1000000" # Option "AllowSHMPixmaps" "0" Option "XvmcUsesTextures" "true" # Option "UseEDID" "true" Option "SWCursor" "false" Option "HWCursor" "true" Option "CursorShadow" "true" Option "CursorShadowAlpha" "64" Option "CursorShadowXOffset" "4" Option "CursorShadowYOffset" "2" Option "ConnectedMonitor" "DFP-1, CRT-0" # Option "UseDisplayDevice" "CRT" Option "UseEdidFreqs" "true" Option "TwinView" "true" Option "SecondMonitorHorizSync" "UseEdidFreqs" Option "SecondMonitorVertRefresh" "UseEdidFreqs" Option "OnDemandVBlankInterrupts" "true" Option "MetaModes" "DFP-1: 1680x1050, CRT-0: 1360x768; DFP-1: 1680x1050, CRT-0: null; DFP-1: null, CRT-0: 1360x768" Option "TwinViewXineramaInfoOrder" "DFP-1, CRT-0" Option "TwinViewOrientation" "CRT-0 RightOf DFP-1" # Option "TVStandard" "" # Option "TVOutFormat" "" # Option "TVOverScan" "" # Option "Stereo" "" # Option "AllowDFPStereo" "" # Option "ForceStereoFlipping" "" # Option "XineramaStereoFlipping" "" # Option "NoBandWidthTest" "false" # Option "MuiltisampleCompatibility" "true" # Option "NoPowerConnectorCheck" "false" # Option "AllowGLXWithCompisite" "false" Option "AddARGBGLXVisuals" "true" # Option "DamageEvent" "true" Option "TripleBuffer" "true" Option "UseEdidDpi" "true" Option "UseEvents" "false" Option "DynamicTwinView" "true" Option "ConnectToAcpid" "true" EndSection #Screen Configuration for TwinView_Dual Section "Screen" Identifier "Screen_TwinView_Dual" Device "GForce_TwinView_Dual" Monitor "Samsung_226BW" DefaultDepth 24 SubSection "Display" Depth 24 Modes "1680x1050" "1280x1024" "1280x960" "1280x768" "1152x864" "1024x768" "800x600" "640x480" EndSubSection EndSection Section "dri" Mode 0666 EndSection Section "Extensions" Option "Composite" "Enable" Option "RENDER" "Enable" EndSection
Now I will try to briefly explain this configuration. I will focus on most important things.
First thing you will see is ServerLayout section. This section is using configuration options defined lower in the file. What is important here is Screen option. You may be surprised to see only one screen definition. That is how you do it in TwinView. Second screen positioning for TwinView is defined in Device section. As you may noticed I have Lirc mouse configuration for remote controller acting as pointing device. I commented this out because I no longer find it useful. I prefer to use Bluetooth GamePad with QJoyPad application as remote pointing device. I additionally disabled AIGLX support as NVidia is using it's own extension to provide 3D desktop feature.
Second section of my file is ServerFlags section. Very important thing here is not to use native Xorg Xinerama extensions as NVidia TwinView is providing it's own implementation which will not work with default Xinerama enabled. That's why I commented out Xinerama option in my configuration file.
Section Files is place when I define my fonts location. The two last lines of this section are somehow important. Without pointing to modules and extensions catalogs Xorg was complying about not being able to load dri and dri2 modules, additionally it was also reporting not being able to use libvdpau which is NVidia video playback acceleration technology. After adding this two lines all warnings disappeared.
The Module section is loading defaults Xorg modules. Module called glx is important for NVidia driver acceleration.
Lower you will find InputDevice section. As you can see I'm using evdev, this is standard driver for input devices now. You may be surprised to see how I'm pointing to my keyboard and mouse event devices. I'm doing this this way because /dev/input/event* device nodes are changing between reboots, especially if I'm plugging in additional devices like Joysticks.
The modes for my Sony Bravia TV and Sony Bravia monitor definition are not used in current configuration I was using them before. They do not interfere so I'm still keeping them. The monitor definition for Samsung 226BW is used, consult Screen section.
Now we are getting to most important thing the Device section. First lines are standard for NVidia proprietary driver. The first important line for double screen is: Option "RandRRotation" "true", this option is allowing me to use RandR extension to set screen options. I use xrandr console interface in my scripts so this is very important setting for me. As I'm using CRT monitor it's important to tell driver what types of monitors are connected to graphics card, Option "ConnectedMonitor" "DFP-1, CRT-0" will do it. Option "TwinView" "true" is enabling TwinView configuration. The Option "MetaModes" is marked as optional but without providing correct meta modes for both screens the resolutions and screen positions were incorrect. If you are wondering why I put more then one meta mode, it's because only defined here meta modes will be available for xrandr console interface. As I want to be able to change screen configuration in my scripts I need to define all possible screen configurations I want to use. Another important option is: Option "TwinViewXineramaInfoOrder" "DFP-1, CRT-0" without it TwinView was acting very weird always setting my CRT-0 Bravia TV as main monitor. To define screen positioning I use Option "TwinViewOrientation" "CRT-0 RightOf DFP-1". I wouldn't recommend setting second screen on the left as some of GTK applications will have problems remembering proper positions if you will disable screens in run time. The last option used for TwinView configuration is: Option "DynamicTwinView" "true", which is enabling dynamic dual screen configuration. You shouldn't disable Option "AddARGBGLXVisuals" if you intend to use 3D desktop.
The other things in the configuration file are standard. You can see Screen configuration and enabled Composite extension required to use accelerated desktop manager.
Prove that it's working
Sources
- Nvidia Linux driver documentation - shipped with the driver
- man xorg.conf
- man Xorg
- man xranrd
If you have found something wrong with the information provided above or maybe you just want to speak your mind about it, feel free to leave a comment.
All comments will show up on page after being approved. Sorry for such policy but I want to make sure that my site will be free of abusive or vulgar content. I don't mind being criticized just do it using right words.
Processing a comment.