Wednesday, June 3, 2009

Dual monitor setup with Fedora 10 and ATI graphics card

I have a Lenovo T60 with ATI graphics card. Here is the detail

[prabhat@eejot ~]$ lspci | grep VGA
01:00.0 VGA compatible controller: ATI Technologies Inc Radeon Mobility X1400

I installed Fedora 10 (Cambridge) and everything worked out of box except dual monitor setup. I can not function well without dual monitor. I usually put Eclipse/JBDS on one screen and the rest (email, chat, browser etc) on the other screen. Now dual monitor not working out of the box is not unusual given that ATI driver is proprietary and Fedora does not bundle it. But installing the driver should not be hard, right? I was in for a surprise. It took me more than a day and help of my colleague who also uses similar environment to figure this out. I have seen that lots of other folks have this problem but I could not find the complete solution in one place so here is my attempt to help others and possibly myself in future.

The driver you get from ATI is crap. If you follow the document (which makes you feel like you are going to setup a rocket for launch), it will act as if everything was installed but when you restart your machine, all you get is a black screen. What you need is a fglrx driver. Here are the details:

1. Get RPMFusion Repos

rpm -Uvh

2. Install Fglrx

yum install akmod-fglrx xorg-x11-drv-fglrx xorg-x11-drv-fglrx-libs -y

3. Blacklist Radeon
Add the line "blacklist radeon" in the file /etc/modprobe.d/blacklist

4. Reboot

5. Make initrd with fglrx
While booting at grub, press 'a' and append 'single' to the command.
cd /boot/
mv initrd-`uname -r`.img initrd-`uname -r`.img.backup
mkinitrd initrd-`uname -r`.img `uname -r` --with=fglrx
6. Reboot

This installs fglrx driver. Now if you do
 aticonfig --initial -f
It will create a basic xorg.conf at /etc/X11. At this stage your two monitors are clone to each other. For dual monitor, aticonfig --help says to do 'aticonfig --dtop=horizontal' or 'aticonfig --initial=dual-head --screen-layout=right'. Doing the latter approach changed the xorg.conf but on restart, it did not give me a dual monitor and it messed up lots of other stuff like mouse pointer would only show up on one monitor etc. Then I tried 'aticonfig --dtop=horizontal' and I got the error Error: Options, e.g. --dtop and --desktop-setup, are not supported when RandR 1.2 is enabled!. So I had to disable RandR and you do that by:

7.1. Edit /etc/ati/amdpcsdb and in the section labeled [AMDPCSROOT/SYSTEM/DDX] add :

7.2. In the Device section under /etc/X11/xorg.conf, add:
Option      "EnableRandR12" "false" 
8. Reboot. This should give you a dual monitor which are not clone of each other.

Now, I was not able to drag windows across monitors and this was because of Xinerama was not enabled.

9. Enable Xinerama
In ServerLayout section in xorg.conf, add

Option     "Xinerama" "on"
Reboot and you are done. From now I would think twice before I get a laptop with ATI graphics card.

Note: For changes in xorg.conf, you don't have to literally reboot. You just have to restart xwindow which you can do by Ctrl+Alt+Backspace.