Multihead

Setting up dual-screen using XRandR 1.2

If you have an ATI, Intel, or Nvidia video card with multiple outputs (such as a VGA + DVI) or a laptop with a secondary output port you can set up a dual screen configuration using the X Resize, Rotate and Reflection Extension (XRandR 1.2).

The easiest way to do this is using the Monitors GNOME applet (used to be called Screen Resolution) under System > Preferences (or run gnome-display-properties). This tool doesn't modify your xorg.conf, but rather applies the changes dynamically during GNOME startup. To customize your dual-head setup, simply drag and drop where you want your displays.

In Ubuntu 8.04 and earlier, there is unfortunately still one manual configuration step required to create dual-screen layouts, which is to add a Virtual framebuffer size. The size needs to be equal or greater than the maximum combined size of your displays. For example, if you have two 1920x1200 monitors you wish to put side-by-side, you would add a Virtual line like this:

Section "Screen"
        Identifier      "Default Screen"
        Device          "Configured Video Device"
        DefaultDepth    24
        SubSection "Display"
            Depth           24
            Virtual         3840 1200
        EndSubSection
EndSection

Note that setting Virtual to a large but still conceivable value may result in an inability to use hardware acceleration on some cards.

Manual XRandR 1.2 Configuration

One can also manually set up a multi-monitor configuration manually in xorg.conf. You might want to do this if you're not running GNOME, or if you want it to take effect earlier on in the bootup sequence, or if you want to trick things out beyond what the GUI tool is capable of.

Here is an example xorg.conf setting up dual-head with XRandR in Ubuntu 8.04:

Section "InputDevice"
        Identifier      "Generic Keyboard"
        Driver          "kbd"
        Option          "XkbRules"      "xorg"
        Option          "XkbModel"      "pc105"
        Option          "XkbLayout"     "us"
        Option          "XkbOptions"    "lv3:ralt_switch"
EndSection

Section "InputDevice"
        Identifier      "Configured Mouse"
        Driver          "mouse"
        Option          "CorePointer"
        Option          "Emulate3Buttons"       "true"
EndSection

Section "Device"
        Identifier      "Configured Video Device"
        BusID           "PCI:1:0:0"
        Option          "Monitor-VGA-0" "Left Monitor"
        Option          "Monitor-DVI-0" "Right Monitor"
EndSection

Section "Monitor"
        Identifier      "Left Monitor"
EndSection

Section "Monitor"
        Identifier      "Right Monitor"
        Option          "Right Of" "Left Monitor"
EndSection

Section "Screen"
        Identifier      "Default Screen"
        Device          "Configured Video Device"
        DefaultDepth    24
        SubSection "Display"
            Depth           24
            Virtual         3840 1200
        EndSubSection
EndSection

Section "ServerLayout"
        Identifier      "Default Layout"
        Screen          "Default Screen"
        InputDevice     "Generic Keyboard"
        InputDevice     "Configured Mouse"
EndSection

There are three important things to note that you may have to alter.

The first is the BusID; look at the output of lspci | grep VGA to see what Bus ID your video card is on. You may even be able to omit this entirely.

The second is the Virtual setting in the Display subsection. In general, this should be set to the total size of your combined screen. So if you have two 1920x1200 monitors you plan to put side by side, this would be (1920+1920) x 1200 = 3840 x 1200.

The third is the name of your device's output name. In the above, it is "Monitor-VGA-0", but it could be "Monitor-VGA0" or something entirely different. Look at the output of xrandr to see what name your graphics driver uses.

As with the GNOME XRandR configuration method, setting Virtual to too large a value may result in a loss of hardware acceleration, and thus an inability to use Compiz and its desktop effects.

X/Config/Multihead (last edited 2010-08-09 15:08:43 by 131)