Xorg configuration is a wide topic which is discussed in many places so this is just a reminder for myself Wink. I'm using a laptop with a GeForce 8400M. It has a built-in 1440x900 LCD screen, a VGA output and a S-video/Composite TV output. I'm using it at work with an additionnal LCD screen and a US keyboard layout, while at home I don't use any extra screen except when watching films on TV. Here is my Xorg configuration with nvidia's TwinView.

Xorg layout configuration

To easily switch between these different setup (work, tv and "default" i.e no extra screen) I created 3 layouts. Each of them have different screens and keyboards:


Section "ServerLayout"
Identifier "work"
Screen "Workstation Screen" 0 0
InputDevice "US Keyboard"
InputDevice "Configured Mouse"
EndSection

Section "ServerLayout"
Identifier "default"
Screen "Default Screen" 0 0
InputDevice "FR Keyboard"
InputDevice "Configured Mouse"
EndSection

Section "ServerLayout"
Identifier "tv"
Screen "TV Screen" 0 0
InputDevice "FR Keyboard"
InputDevice "Configured Mouse"
EndSection

Keyboard layout configuration

I created two input devices and set a US keyboard layout for the first one and a french keyboard layout for the other one.

Section "InputDevice"
Identifier "US Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"
Option "XkbVariant" "intl"
EndSection

Section "InputDevice"
Identifier "FR Keyboard"
Driver "kbd"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "fr"
Option "XkbVariant" "latin9"
EndSection

Global graphic configuration

Here we just tell Xorg which modules we want to use. DRI stands for Direct Rendering Interface and GLX is OpenGL Extension to the X Window System. These two are needed to get hardware 3D acceleration.
We don't want Xinerama since we're relying on TwinView.

Section "Module"
Load "dri"
Load "glx"
EndSection

Section "Extensions"
Option "Composite" "Enable"
EndSection

Section "ServerFlags"
Option "Xinerama" "0"
EndSection

Screen configuration

TwinView only uses 1 logical screen so all the screen configuration is made by the nvidia driver.
We just need to define one single monitor and one screen per layout.

Section "Monitor"
Identifier "Ecran LCD"
VendorName "Asus"
Option "DPMS"
EndSection

Section "Screen"
Identifier "Default Screen"
Device "nVidia Corporation NVIDIA Default Card single head"
Monitor "Ecran LCD"
DefaultDepth 24

Option "AddARGBGLXVisuals" "true"

SubSection "Display"
Depth 24
Modes "1440x900"
EndSubSection
EndSection

Section "Screen"
Identifier "Workstation Screen"
Device "nVidia Corporation NVIDIA Default Card dual head"
Monitor "Ecran LCD"
DefaultDepth 24

Option "AddARGBGLXVisuals" "true"

SubSection "Display"
Depth 24
Modes "1440x900"
EndSubSection
EndSection

Section "Screen"
Identifier "TV Screen"
Device "nVidia Corporation NVIDIA Default Card TV"
Monitor "Ecran LCD"
DefaultDepth 24

Option "AddARGBGLXVisuals" "true"

SubSection "Display"
Depth 24
Modes "1440x900"
EndSubSection
EndSection

TwinView configuration

And now the most important part is where we configure our devices. Here are my settings :

  • The single-head configuration is the easiest since we don't use TwinView.
  • The dual-head configuration will display the VGA output at the right of the laptop LCD screen.
  • The TV setup clones the two screen.

Change the settings according to your needs Wink

Section "Device"
Identifier "nVidia Corporation NVIDIA Default Card single head"
Driver "nvidia"

Option "NoLogo" "1"
Option "AllowGLXWithComposite" "true"
Option "RenderAccel" "true"

Option "TwinView" "0"

Option "MetaModes" "DFP-0: 1440x900"
EndSection

Section "Device"
Identifier "nVidia Corporation NVIDIA Default Card dual head"
# Avoid using too much power
# see http://linux.aldeby.org/nvidia-powermizer-powersaving.html
Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefault=0x3; PowerMizerDefaultAC=0x3"
Driver "nvidia"

Option "NoLogo" "1"
Option "AllowGLXWithComposite" "true"
Option "RenderAccel" "true"

Option "TwinView" "1"

Option "TwinViewXineramaInfoOrder" "DFP, CRT"
Option "UseDisplayDevice" "DFP, CRT"
Option "TwinViewOrientation" "CRT RightOf DFP"

Option "MetaModes" "DFP-0: 1440x900, CRT-0: 1280x1024"
EndSection

Section "Device"
Identifier "nVidia Corporation NVIDIA Default Card TV"
Driver "nvidia"

Option "NoLogo" "1"
Option "AllowGLXWithComposite" "true"
Option "RenderAccel" "true"

Option "TwinView" "1"

Option "TwinViewXineramaInfoOrder" "DFP, TV"
Option "UseDisplayDevice" "DFP, TV"
Option "TwinViewOrientation" "Clone"
Option "MetaModes" "DFP-0: 640x480, TV-0: 640x480"

Option "TVOutFormat" "COMPOSITE"
Option "TVStandard" "NTSC"
EndSection

Choosing an Xorg layout

The default layout is the first one defined in your xorg.conf configuration file.
To start an application in a new X server with different Xorg layout, use this command:

$~ startx "/usr/bin/vlc" -- /usr/bin/X :1 -layout tv

You may have to grant permission to start a new X server. The easiest way to do it is with:

$~ dpkg-reconfigure x11-common