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.

View the full xorg.conf configuration file
  1. Section "ServerLayout"
  2. Identifier "TwinView_Dual"
  3. Screen 0 "Screen_TwinView_Dual" 0 0
  4. InputDevice "Keyboard0" "CoreKeyboard"
  5. InputDevice "USB Mouse" "CorePointer"
  6. # InputDevice "LIRC-Mouse"
  7. Option "AIGLX" "false"
  8. Option "AllowEmptyInput" "off"
  9. EndSection
  10.  
  11. Section "ServerFlags"
  12. Option "AllowMouseOpenFail" "true"
  13. # Option "Xinerama" "true"
  14. Option "DefaultServerLayout" "Twinview_Dual"
  15. EndSection
  16.  
  17. Section "Files"
  18. FontPath "/usr/share/fonts/misc"
  19. FontPath "/usr/share/fonts/corefonts"
  20. FontPath "/usr/share/fonts/arkpandora"
  21. FontPath "/usr/share/fonts/artwiz-aleczapka-en"
  22. FontPath "/usr/share/fonts/artwiz"
  23. FontPath "/usr/share/fonts/cheapskatefonts"
  24. FontPath "/usr/share/fonts/dejavu"
  25. FontPath "/usr/share/fonts/efont-unicode"
  26. FontPath "/usr/share/fonts/essays1743"
  27. FontPath "/usr/share/fonts/TTF"
  28. FontPath "/usr/share/fonts/freefonts"
  29. FontPath "/usr/share/fonts/hunkyfonts"
  30. FontPath "/usr/share/fonts/intlfonts"
  31. FontPath "/usr/share/fonts/lfpfonts-fix"
  32. FontPath "/usr/share/fonts/mathematica-fonts"
  33. FontPath "/usr/share/fonts/sgi-fonts"
  34. FontPath "/usr/share/fonts/tengwar-fonts"
  35. FontPath "/usr/share/fonts/terminus"
  36. FontPath "/usr/share/fonts/texcm-ttf"
  37. FontPath "/usr/share/fonts/ttf-gentium"
  38. FontPath "/usr/share/fonts/unifont"
  39. FontPath "/usr/share/fonts/urw-fonts"
  40. FontPath "/usr/share/fonts/vc"
  41. FontPath "/usr/share/fonts/jmk"
  42. FontPath "/usr/share/fonts/Type1"
  43. FontPath "/usr/share/fonts/100dpi"
  44. FontPath "/usr/share/fonts/75dpi"
  45. FontPath "/usr/share/fonts/cyrillic"
  46. FontPath "/usr/share/fonts/default/ghostscript"
  47. FontPath "/usr/share/fonts/ttf-bitstream-vera"
  48. FontPath "/usr/share/fonts/cronyx/100dpi/:unscaled"
  49. FontPath "/usr/share/fonts/cronyx/misc/:unscaled"
  50. FontPath "/usr/share/fonts/cronyx/75dpi/:unscaled"
  51. ModulePath "/usr/lib/xorg/modules"
  52. ModulePath "/usr/lib/opengl/xorg-x11/extensions/"
  53. EndSection
  54.  
  55. Section "Module"
  56. Load "ddc"
  57. Load "vbe"
  58. Load "dbe"
  59. Load "extmod"
  60. SubSection "extmod"
  61. Option "omit xfree86-dga"
  62. EndSubSection
  63. Load "glx"
  64. Load "bitmap"
  65. Load "freetype"
  66. Load "record"
  67. EndSection
  68.  
  69. Section "InputDevice"
  70. Identifier "Keyboard0"
  71. Driver "evdev"
  72. Option "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd"
  73. Option "CoreKeyboard"
  74. Option "XkbRules" "xorg"
  75. Option "XkbModel" "pc105"
  76. Option "XkbLayout" "pl"
  77. Option "XkbVariant" ",winkeys"
  78. Option "XkbOptions" "eurosign:5,terminate:ctrl_alt_bksp"
  79. EndSection
  80.  
  81. Section "InputDevice"
  82. Identifier "Serial Mouse"
  83. Driver "mouse"
  84. Option "Protocol" "Microsoft"
  85. Option "Device" "/dev/ttyS0"
  86. Option "Emulate3Buttons" "true"
  87. Option "Emulate3Timeout" "70"
  88. Option "SendCoreEvents" "true"
  89. EndSection
  90.  
  91. Section "InputDevice"
  92. Identifier "PS/2 Mouse"
  93. Driver "mouse"
  94. Option "Protocol" "IMPS/2"
  95. Option "Device" "/dev/input/mice"
  96. Option "Emulate3Buttons" "false"
  97. Option "Emulate3Timeout" "70"
  98. Option "SendCoreEvents" "true"
  99. Option "ZAxisMapping" "4 5"
  100. EndSection
  101.  
  102. Section "InputDevice"
  103. Identifier "USB Mouse"
  104. Driver "evdev"
  105. Option "Device" "/dev/input/by-id/usb-Logitech_USB_Receiver-event-mouse"
  106. # Option "SendCoreEvents" "true"
  107. # Option "Protocol" "IMPS/2"
  108. Option "ZAxisMapping" "4 5"
  109. Option "Buttons" "5"
  110. EndSection
  111.  
  112. Section "InputDevice"
  113. Identifier "LIRC-Mouse"
  114. Driver "mouse"
  115. Option "Device" "/var/run/lirc/lircm"
  116. Option "Protocol" "IntelliMouse"
  117. Option "SendCoreEvents"
  118. Option "Buttons" "5"
  119. Option "ZAxisMapping" "4 5"
  120. EndSection
  121.  
  122. #Modes configuration for TV Sony Bravia 32 KDL32S2030
  123.  
  124. Section "Modes"
  125. Identifier "Modes_SONY"
  126. Mode "WXGA_1360x768" # vfreq 60.015Hz, hfreq 47.712kHz
  127. DotClock 85.500000
  128. HTimings 1360 1424 1536 1792
  129. VTimings 768 771 777 795
  130. Flags "+HSync" "+VSync"
  131. EndMode
  132. Mode "WXGA_1280x768" # vfreq 59.870Hz, hfreq 47.776kHz
  133. DotClock 79.500000
  134. HTimings 1280 1344 1472 1664
  135. VTimings 768 771 778 798
  136. Flags "+HSync" "-VSync"
  137. EndMode
  138. Mode "XGA_1024x768" # vfreq 60Hz, hfreq 48.4kHz
  139. DotClock 65.000000
  140. HTimings 1024 1032 1176 1344
  141. VTimings 768 771 777 806
  142. Flags "+HSync" "-VSync"
  143. EndMode
  144. EndSection
  145.  
  146. #Modes configuration for LCD Samsung Syncmaster 226bw 22 inch
  147.  
  148. # Configuration for Samsung 226BW Primary LCD Monitor
  149.  
  150. Section "Monitor"
  151. Identifier "Samsung_226BW"
  152. VendorName "Samsung"
  153. ModelName "226BW (22inch)"
  154. DisplaySize 473.8 296.1
  155. HorizSync 48
  156. VertRefresh 60
  157. Option "DPMS" "true"
  158. EndSection
  159.  
  160. # Configuration for Philips 107B Primary CRT Monitor
  161.  
  162. Section "Monitor"
  163. Identifier "Philips_107B"
  164. VendorName "Philips"
  165. ModelName "107B (17inch)"
  166. DisplaySize 320 240
  167. HorizSync 30.0 - 69.0
  168. VertRefresh 50.0 - 130.0
  169. Option "DPMS" "true"
  170. EndSection
  171.  
  172. # Configuration for Generic Monitor
  173.  
  174. Section "Monitor"
  175. Identifier "Generic"
  176. VendorName "Unknown"
  177. ModelName "Unknown"
  178. VertRefresh 60
  179. Option "DPMS" "true"
  180. EndSection
  181.  
  182. #Configuration for Sony Bravia 32in Secondary LCD TV/Monitor
  183.  
  184. Section "Monitor"
  185. Identifier "Sony_Bravia_32in"
  186. Option "DPMS" "true"
  187. VendorName "Sony"
  188. ModelName "Bravia 32 inches"
  189. UseModes "Modes_SONY"
  190. #HorizSync 31.5-47.8
  191. #VertRefresh 60
  192. EndSection
  193.  
  194. #Configuration for GForce 8800GTS Graphics TwinView Dual
  195.  
  196. Section "Device"
  197. Identifier "GForce_TwinView_Dual"
  198. Driver "nvidia"
  199. VendorName "ASUS"
  200. BoardName "ASUS Nvidia EN8800GTS"
  201. BusID "PCI:4:0:0"
  202. Option "NoLogo" "false"
  203. # Option "LogoPath" ""
  204. Option "BackingStore" "true"
  205. Option "RenderAccel" "true"
  206. # Option "UBB" "true"
  207. Option "NoFlip" "true"
  208. # Option "Dac8bit" "false"
  209. # Option "Overlay" "false"
  210. # Option "CIOverlay" "false"
  211. # Option "TransparentIndex" "0"
  212. # Option "OverlayDefaulVisual" "false"
  213. # Option "EmulatedOverlaysTimerMS" "0"
  214. # Option "EmulatedOverlaysThreshold" "true"
  215. # Option "EmulatedOverlaysThresholdValue" "5"
  216. Option "RandRRotation" "true"
  217. # Option "Rotate" ""
  218. # Option "AllowDDCCI" "true"
  219. Option "PixmapCacheSize" "1000000"
  220. # Option "AllowSHMPixmaps" "0"
  221. Option "XvmcUsesTextures" "true"
  222. # Option "UseEDID" "true"
  223. Option "SWCursor" "false"
  224. Option "HWCursor" "true"
  225. Option "CursorShadow" "true"
  226. Option "CursorShadowAlpha" "64"
  227. Option "CursorShadowXOffset" "4"
  228. Option "CursorShadowYOffset" "2"
  229. Option "ConnectedMonitor" "DFP-1, CRT-0"
  230. # Option "UseDisplayDevice" "CRT"
  231. Option "UseEdidFreqs" "true"
  232. Option "TwinView" "true"
  233. Option "SecondMonitorHorizSync" "UseEdidFreqs"
  234. Option "SecondMonitorVertRefresh" "UseEdidFreqs"
  235. Option "OnDemandVBlankInterrupts" "true"
  236. Option "MetaModes" "DFP-1: 1680x1050, CRT-0: 1360x768; DFP-1: 1680x1050, CRT-0: null; DFP-1: null, CRT-0: 1360x768"
  237. Option "TwinViewXineramaInfoOrder" "DFP-1, CRT-0"
  238. Option "TwinViewOrientation" "CRT-0 RightOf DFP-1"
  239. # Option "TVStandard" ""
  240. # Option "TVOutFormat" ""
  241. # Option "TVOverScan" ""
  242. # Option "Stereo" ""
  243. # Option "AllowDFPStereo" ""
  244. # Option "ForceStereoFlipping" ""
  245. # Option "XineramaStereoFlipping" ""
  246. # Option "NoBandWidthTest" "false"
  247. # Option "MuiltisampleCompatibility" "true"
  248. # Option "NoPowerConnectorCheck" "false"
  249. # Option "AllowGLXWithCompisite" "false"
  250. Option "AddARGBGLXVisuals" "true"
  251. # Option "DamageEvent" "true"
  252. Option "TripleBuffer" "true"
  253. Option "UseEdidDpi" "true"
  254. Option "UseEvents" "false"
  255. Option "DynamicTwinView" "true"
  256. Option "ConnectToAcpid" "true"
  257. EndSection
  258.  
  259. #Screen Configuration for TwinView_Dual
  260.  
  261. Section "Screen"
  262. Identifier "Screen_TwinView_Dual"
  263. Device "GForce_TwinView_Dual"
  264. Monitor "Samsung_226BW"
  265. DefaultDepth 24
  266. SubSection "Display"
  267. Depth 24
  268. Modes "1680x1050" "1280x1024" "1280x960" "1280x768" "1152x864" "1024x768" "800x600" "640x480"
  269. EndSubSection
  270. EndSection
  271.  
  272. Section "dri"
  273. Mode 0666
  274. EndSection
  275.  
  276. Section "Extensions"
  277. Option "Composite" "Enable"
  278. Option "RENDER" "Enable"
  279. 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

Comments

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.

Leave a comment