X.Org/Dual Monitors/Nvidia
From Gentoo Linux Wiki
If you have an AGP card, make sure to specify your device correctly, or the second monitor might not display anything:
Section "Device"
Identifier "Card0"
Driver "nvidia"
VideoRam 65536
VendorName "nVidia Corporation"
BoardName "NV17 [GeForce4 MX 440]"
BusID "AGP:01:00:0"
EndSection- Also, there's lots of websites and posts out there that advocate specifying two drivers for a dual-head video card -- this is NOT needed (at least for this card). Hope this helps.
Contents |
[edit] TwinView
TwinView is a configuration for two monitors connected to one card, that will appear as one screen to the X server. There are fewer disadvantages to TwinView in Linux compared to Windows since the Nvidia driver provides its own Xinerama extension, allowing Xinerama-aware window managers and applications to be aware of monitor borders. Most 3D apps are not prepared for a double-width resolution (including, for example, UT2004) and will annoyingly appear in the middle of the virtual screen, across the split, unless you specify a MetaMode at the correct resolution for only one monitor (see Device section given below).
So that Xinerama becomes effective, your window manager must be compiled with the xinerama use flag (for KDE users do not forget qt).
Configure the server for one Monitor and Screen:
Section "ServerLayout"
Screen 0 "Screen0" 0 0
...
Section "Monitor"
Identifier "Monitor0"
...
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
...And configure one Device with TwinView. Note the MetaModes option, which is a semicolon-delimited list of the modes of one or both monitors. For full screen games, you will probalbly want at least one single-monitor MetaMode (eg: 1280x1024;) that the game can use. Replace "UseEdidFreqs" with appropriate horizontal and verticle refresh rates if your monitors don't report these values correctly. Of course, replace BusID with the appropriate value for your card (hint: lspci).
<...> 05:00.0 VGA compatible controller: nVidia Corporation NV41.8 [GeForce Go 6800] (rev a2) <...>
Note that "05:00.0" is "5:0:0" in the configuration file. PCI and PCI-Express cards will start with PCI:, while AGP cards will start with AGP:
Section "Device"
Identifier "Card0"
Driver "nvidia"
VendorName "nVidia Corporation"
BoardName "geForce 6600 GT"
BusID "PCI:5:0:0"
Screen 0
#other options I recommend:
Option "RenderAccel"
Option "HWcursor"
Option "CursorShadow"
Option "CursorShadowAlpha" "32"
Option "CursorShadowXOffset" "3"
Option "CursorShadowYOffset" "3"
#if you want Composite and GLX (they don't cooperate):
Option "AllowGLXWithComposite"
#the TwinView stuff
Option "TwinView"
Option "MetaModes" "1280x1024,1280x1024; 1280x1024; 1024x768,1024x768; 1024x768; 800x600,800x600; 800x600"
Option "TwinViewOrientation" "RightOf"
Option "SecondMonitorHorizSync" "UseEdidFreqs"
Option "SecondMonitorVertRefresh" "UseEdidFreqs"
EndSection[edit] Auto monitor detection issue
A possible downside with the above config is that it generally requires both monitors are turned on when issuing the command "startx" or when gdm loads. If X doesn't find both monitors, it falls back to the non-twin view setup and you'll have to restart x with the second monitor turned on.
[edit] Connecting a second monitor after X startup
A way around this is to add to section device to override detection of attached displays. If you use DVI cables with your LCD monitor then replace crt with dfp (digital flat panel). The inverse is important: if you use your LCD in analog mode (non-dvi cable) you should refer to the monitor as "CRT". You can also change the order here.
Section "Device" ... Option "ConnectedMonitor" "CRT,CRT" ... End Section
Since the monitor is not connected on startup and can not be queried for frequencies(no edid), you will probably have to specify them. You can use the above "SecondMonitorHorizSync" option, the "HorizSync" option(see nvidia's README) or you might have to put the vertical refresh in the Metamodes option(see the "_60" in the MetaModes option below). If you don't know which monitor you'll use, you can change the settings later on with the nvidia-settings utility.
If you occasionally lose your mouse to the second (non-connected) monitor or if you want to save some energy(laptop users), you can disable the second monitor on entering X. In order to do that, you have to have a MetaMode where the second monitor is switched off, i.e. something like:
Option "MetaModes" " DFP-0: 1440x900,CRT-0: 1280x1024_60; DFP-0: 1440x900, CRT-0: NULL"
If you use nvidia-drivers-100.14.19(and possibly others), xrandr will show you something like this
Screen 0: minimum 1440 x 900, current 2720 x 1024, maximum 2720 x 1024 default connected 2720x1024+0+0 0mm x 0mm 2720x1024 50.0* 1440x900 51.0
Now you can switch the second monitor on and off with
and
Kde 3.5.7 and compiz-fusion play along nicely as long as they are started when both displays are activated(not necessarily connected).
For KDE/GNOME: Make sure that either Qt or Metacity has the xinerama flag enabled. This is something to watch out for when moving from a single to dual head configuration as its easy to overlook.
[edit] Separate screens
From the NVidia driver README (Appendix P):
Graphics chips that support TwinView (Appendix G) can also be configured to treat each connected display device as a separate X screen.
There are several disadvantages to this approach as compared to TwinView. For instance, extra overhead for X11's Xinerama extension to be able to drag windows between X screens; software OpenGL will be used with windows spanning two or more X screens. However, it does offer several advantages over TwinView:
- If each display device is a separate X screen, then properties that may vary between X screens may vary between displays (eg: depth, root window size, etc).
- Hardware that can only be used on one display at a time (eg: video overlays, hardware accelerated RGB overlays), and which consequently cannot be used at all when in TwinView, can be exposed on the first X screen when each display is a separate X screen.
- The 1-to-1 association of display devices to X screens is more historically in line with X. This allows for more exotic configurations with multiple graphic cards.
Model your Device section after this one:
...
Section "Device"
Identifier "GeForce out 1"
Driver "nvidia"
Option "RenderAccel" "true"
Option "UseDisplayDevice" "DFP-0" # force to use specified monitor/output
BusID "PCI:1:0:0"
Screen 0
EndSection
Section "Device"
Identifier "GeForce out 2"
Driver "nvidia"
Option "RenderAccel" "true"
Option "UseDisplayDevice" "CRT-0"
BusID "PCI:1:0:0"
Screen 1
EndSection
Section "Screen"
Identifier "Screen0"
Device "GeForce out 1"
Monitor "Monitor0"
DefaultDepth 24
Subsection "Display"
Depth 24
ViewPort 0 0 # initial origin if mode is smaller than desktop
EndSubsection
EndSection
Section "Screen"
Identifier "Screen1"
Device "GeForce out 2"
Monitor "Monitor1"
DefaultDepth 24
Subsection "Display"
Depth 24
ViewPort 0 0 # initial origin if mode is smaller than desktop
EndSubsection
EndSection
Section "ServerLayout"
Identifier "Main Layout"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" Below "Screen0"
EndSection
...
Use the standard dual-head ServerLayout, Screen, and Monitor sections. Note that TwinView has not been used.