Multiple Screens Using XRandR

From openSUSE

Contents

How To use multiple Screens (Dualhead setup) using the RandR Feature

Recent X.Org drivers (e.g. intel and the newer version of the radeon driver - included since openSUSE 10.3 as radeonrandr12) allow the dynamic configuration of screens (e.g. for a so called "Dualhead" setup) with the RandR feature. This allows to e.g. use the internal laptop LCD panel and an external monitor in various modes, either "clone" mode (where both monitors show the same content) or as one big desktop, spanning multiple monitors. This HOWTO shows how to make use of that feature.

Prerequisites

A graphics card that is supported by a driver that implements the RandR extension in version 1.2. I tested this on different machines, for example with Intel 855GM and 915GM graphics chips using the intel driver and on a ATI Radeon Mobility M6 LY using the radeonrandr12 driver. Find out if you are using a capable driver by running:

seife@susi:~> xrandr --version
Server reports RandR version 1.2

My example here is on a IBM Thinkpad X32 with a Radeon Mobility M6.

First Steps

Configure your monitor as usual with sax2, configure Dual-Head mode (simple clone mode, both internal and external monitor with identical resolution). This should already work before continuing.

Edit Xorg.conf

Then edit your /etc/X11/xorg.conf like the following:

Section "Screen"
  DefaultDepth 24
  SubSection "Display"
    Depth      24
    Modes      "1680x1050" "1024x768" "800x600" "640x480"
    Virtual    2704 1050
  EndSubSection
  SubSection "Display"
    Depth      16
    Modes      "1680x1050" "1024x768" "800x600" "640x480"
    Virtual    2704 1050
  EndSubSection
  SubSection "Display"
    Depth      8
    Modes      "1680x1050" "1024x768" "800x600" "640x480"
    Virtual    2704 1050
  EndSubSection
  Device       "Device[0]"
  Identifier   "Screen[0]"
  Monitor      "Monitor[0]"
EndSection

The important part here are the

Virtual 2704 1050

lines. The numbers need to represent the total size of the screen if both monitors are added up. Since i use an external 20" panel with 1680x1050 and the internal display of the X32 has 1024x768, the combined screen has (1680+1024)x1050 with is 2704x1050. If you want to have one display above the other, it would need to be 1680x1818.

Attention: Don't make the "Virtual" size bigger than necessary, since memory will be reserved for this size.

For ATI Cards

With older ATI cards (that use the radeon driver) you also need to change the driver to radeonrandr12. Do this by editing the "Driver" line in xorg.conf to this:

  Driver       "radeonrandr12"

Restart the X Server

Now restart the X server and log in, with your external monitor connected. Open a terminal and call "xrandr":

seife@susi:~> xrandr
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2704 x 1050
VGA-0 connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1680x1050      60.0     60.0     58.9
   1600x1024      60.0
   1400x1050      60.0
   1280x1024      61.0     59.9     60.0     60.0
   1280x960       60.0
   1152x768       54.8
   1024x768       61.0*    60.0     59.9     59.9
   800x600        60.3     61.0     59.9     56.2     59.8
   640x480        59.9     61.0     59.4     59.5
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1024x768       60.0*+   60.0
   800x600        60.3     59.9
   640x480        59.9     59.4

"LVDS" is the internal display, "VGA-0" (or "VGA", depending on the driver) is the external analog VGA connector. Both are running in 1024x768 here. If you are using a DVI connection, it will be called "TMDS" or "TMDS-1" or similar.

Configure The Screens Dynamically

Now you can use the xrandr commandline tool to configure your monitors dynamically. The usage is quite straight forward:

xrandr --auto --output VGA-0 --mode 1680x1050 --output LVDS --off

simply turns on only the external VGA.

xrandr --auto --output VGA-0 --mode 1680x1050 --right-of LVDS

turns on both monitor, the external widescreen monitor is right of the notebook

xrandr --auto --output VGA-0 --off

turns off the external monitor, only the internal is still on.

xrandr --auto --output VGA-0 --mode 1024x768 --same-as LVDS

returns to "classic" clone mode. The "--auto" on all those commands turns on all available monitor, so that the system is in an defined state.

More

Call "xrandr --help" for more options and play with them, you are able to select different refresh-rates, rotate your screen etc.

GUI Tools

There is an applet for the KDE systray called krandrtray that can be used for configuring some of the settings. For GNOME there is resapplet that's supposed to do the same.