Saturday, September 20, 2008

X on RADEONHD with two monitors

Technical details:

  • Linux version 2.6.24-1-686 (Debian 2.6.24-7).
  • X.org X Server version 1.4.2.
  • Video chipset is ATI Radeon HD 3650
  • I am running with the testing (Lenny) packages

The following xorg.conf file is what I am currently running with, it is sufficient for providing me with an X desktop spanning both my displays.

# xorg.conf (X.Org X Window System server configuration file) # # This file was generated by dexconf, the Debian X Configuration tool, using # values from the debconf database. # # Edit this file with caution, and see the xorg.conf manual page. # (Type "man xorg.conf" at the shell prompt.) # # This file is automatically updated on xserver-xorg package upgrades *only* # if it has not been modified since the last upgrade of the xserver-xorg # package. # # If you have edited this file but would like it to be automatically updated # again, run the following command: # sudo dpkg-reconfigure -phigh xserver-xorg #--------------------------------------------------------------------- # Section "InputDevice" Identifier "Generic Keyboard" Driver "kbd" Option "XkbRules" "xorg" Option "XkbModel" "pc104" Option "XkbLayout" "us" EndSection #--------------------------------------------------------------------- # Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Device" "/dev/input/mice" EndSection #--------------------------------------------------------------------- # Options for the video card. # Current card is Radeon HD 3650 (RV635), running 2 displays. # # NOTE: the option "monitor-" uses the display name reported # by xrandr. In my case that's "DVI-I_1/digital" and "DVI-I_2/digital" Section "Device" Identifier "Card0" driver "radeonhd" Option "monitor-DVI-I_1/digital" "Monitor0" Option "monitor-DVI-I_2/digital" "Monitor1" EndSection #--------------------------------------------------------------------- # Monitor identifier. I'm sure I don't need the VendorName and # ModelName anymore, this is legacy from prior installs. Section "Monitor" Identifier "Monitor0" VendorName "GSM" ModelName "L206W" EndSection #--------------------------------------------------------------------- # Monitor identifier. Same as above. The option "RightOf" lets # X position the screens properly. Section "Monitor" Identifier "Monitor1" VendorName "GSM" ModelName "L206W" Option "RightOf" "Monitor0" EndSection #--------------------------------------------------------------------- # This section is considerably lighter from prior versions of X. # with the RADEONHD driver this is all that's needed. Section "Screen" Identifier "Screen0" Device "Card0" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection EndSection #--------------------------------------------------------------------- # Section "ServerLayout" Identifier "Server" Screen 0 "Screen0" InputDevice "Mouse0" "CorePointer" EndSection #--------------------------------------------------------------------- # not sure if this is still needed. In any case the current state of # the RADEONHD driver (testing) does not support DRI. (17/09/2008) # this does not seem to hurt anything. Section "dri" Mode 0666 EndSection

Configuring X on a new box was relatively easy. After the new hardware was all in place, and the latest ati driver downloaded, I backed up the original xorg.conf file and run:

dpkg-reconfigure xserver-org

This created a vanilla configuration which got the X server up and running, although the desktop was mirrored across both displays. The next step is to configure dual display to emulate one large screen. For this you will need the xrandr tool, which is part of x11-xserver-utils.

apt-get install x11-xserver-utils

After you have the tools installed, run xrandr at the command prompt, this should give you an output similar to the following:

Orthanc:/home/mike# xrandr Screen 0: minimum 320 x 200, current 3360 x 1050, maximum 3360 x 1680 DVI-I_1/digital connected 1680x1050+0+0 434mm x 270mm 1680x1050 59.9*+ 60.0 60.0 1600x1024 60.0 1400x1050 60.0 1280x1024 75.0 59.9 60.0 1440x900 60.2 60.0 1280x960 60.0 59.9 1280x800 60.0 1152x864 75.0 74.9 1280x768 60.0 1024x768 75.1 70.1 60.0 832x624 74.6 800x600 72.2 75.0 60.3 56.2 640x480 75.0 72.8 75.0 60.0 59.9 720x400 70.1 DVI-I_1/analog disconnected TV_7PIN_DIN disconnected DVI-I_2/digital connected 1680x1050+1680+0 434mm x 270mm 1680x1050 59.9*+ 60.0 60.0 1600x1024 60.0 1400x1050 60.0 1280x1024 75.0 59.9 60.0 1440x900 60.2 60.0 1280x960 60.0 59.9 1280x800 60.0 1152x864 75.0 74.9 1280x768 60.0 1024x768 75.1 70.1 60.0 832x624 74.6 800x600 72.2 75.0 60.3 56.2 640x480 75.0 72.8 75.0 60.0 59.9 720x400 70.1 DVI-I_2/analog disconnected

In my case, I have two monitors connected, DVI-I_1/digital and DVI-I_2/digital. Keep those names handy, you will need them later on. Next, we need to define both monitors in xorg.conf. This is done through the "Monitor" sections in the file. I defined "Monitor1" to be "RightOf" "Monitor0". If your configuration is different, you can reverse that. . . or swap monitor cables at the video card.

Section "Monitor" Identifier "Monitor0" VendorName "GSM" ModelName "L206W" EndSection Section "Monitor" Identifier "Monitor1" VendorName "GSM" ModelName "L206W" Option "RightOf" "Monitor0" EndSection

With the monitors defined, we attach them to the video card through the "Device" section. Notice the monitor labels are the name as is used by xrandr AND prefixed with "monitor-". This is important and took me a while to figure out.

Section "Device" Identifier "Card0" driver "radeonhd" Option "monitor-DVI-I_1/digital" "Monitor0" Option "monitor-DVI-I_2/digital" "Monitor1" EndSection

Now we define the screen through the "Screen" section, this defines the geometry. With older versions of X I had to be pretty explicit here how the screen was to be emulated. With the latest version I just need to identify the graphic device which is driving the display.

Section "Screen" Identifier "Screen0" Device "Card0" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection EndSection
Since the graphic device has two screens attached to it, and one of the screens defines where it is in relation to the other, the X server knows now to launch with the two monitors defined as one large virtual screen.

This is it, when X restarts, it will now come up with one large virtual screen. If this worked, only one of the screens should now have the login prompt.

Final notes: the RADEONHD driver is still in it's infancy; DRI is not yet supported, so it has no 3d capabilities. You can also use the graphical interface to xrandr to configure multi display after you log into X. It's quick and easy although not permanent - you will need to repeat the task when you re-start X. The tool is called "grandr" and is contained in a debian package by the same name.