External monitor configuration with ATI Radeon mobility X700 laptop, X.org and xrandr

This afternoon I received a new 22″ (1680×1050) LCD monitor for use with my laptop. My laptop is an ACER Aspire 1692WLMi. It has an ATI Radeon Mobility X700 PCI Express graphics card with VGA out and a build-in 1280×800 display. ATI Radeon Mobility X700 is able to display resolutions up to 1920×1200 px. I run ubuntu linux 8.04 on the laptop. After about four hours of experimentation and tweaking I finally made it to set up X in a way that enables me to switch from the build-in monitor to the external and vice versa, auto-configuring each monitor to its native resolution. So here is the recipe:

Ingredients:

  1. A laptop with ATI Radeon Mobility X700 PCI Express graphics card (any pc with an ATI Radeon card may be ok)

  2. An external monitor with VGA input.

  3. X.Org X Server 1.4.0.90 with RandR version 1.2

  4. ATI 6.8.0 open source driver

  5. xrandr utility

Ingredients 3 to 5 come with ubuntu linux 8.04, but can also be found in many other unix based modern operating systems.

Process:

The proposed process includes editting X.org configuration file and needs basic skills and maybe some experience in editing linux configuration files. In any case keep a backup of xorg.conf before start messing with it.

  1. Edit /etc/X11/xorg.conf ‘s Device section to use ati driver – the opennsource ati driver, not the fglrx one – (omitting the driver directive from my Device Section made X auto select and use ati opensource driver)

  2. Edit /etc/X11/xorg.conf ‘s Screen Section and add the Modes you want to use with your monitors (both monitors’ native resolutions should be listed) to Display subsection.

  3. Into the Display Subsection set Virtual display size to the maximum of your displays’ resolutions.

  4. Use xrandr to switch beetween the monitors. In my case:

    To turn off the build-in display and switch to the external display at a resolution of 1680×1050 I run:

    xrandr –output LVDS –off –output VGA-0 –mode 1680×1050

    To switch back to build in monitor I run

    xrandr –output LVDS –auto –output VGA-0 –off

I also attach my xorg.conf (excuse me for the odt format, but wordpress.com does not allow uploads of plain text files) as reference and a couple of bash scripts I have made in order to not have to type in the above options. The scripts are called display2vga.sh and display2lvds.sh and running them you switch to vga external monitor or to lvds build in monitor respectively. I have also created launchers for each of the scripts at my gnome menu and thus I can switch monitors with a click. Finally I put display2vga.sh to my session startup programs list, so that when I log in to the machine and the external monitor is connected the display is automatically transferred to it (the check is performed from the display2vga.sh script – if the monitor is not connected it does not try to switch – ).

One could try more advanced configurations with xrandr. See xrandr’s man page for more info on how you can have both monitors enabled and your desktop spanned between them.