Wednesday, February 11, 2009

Setting Dual-Head Displays with Radeon HD 3650 in Ubuntu Linux

I'm using a Sapphire's ATI Radeon HD 3650 card, which may help you if you are using the same thing and want to set up a dual-head display properly.


From my experiences, I found that Ubuntu versions 7.10, 8.04 and 8.10 will get the card to work straight out of the box, but I had no luck to get it to work for dual displays perfectly except for version 8.10 (You'll still need some modifications to xorg though, see below).

For the two older version 7.10 and 8.04, the closest thing that I have come to making it work on the older versions is by downloading and installing ATI's driver straight from their support site.

With the older versions, both the xserver-xorg-fglrx (did not work - black screen) and the xserver-xorg-fglrx-envy (defers to the Mesa driver, making it horridly slow) packages weren't the most fruitful experiences when I tried installing them, so avoid unless you're keen on experimenting.

Installing via the ATI Installer

I'll recommend not to use this option if you have planning to upgrade to Ubuntu 8.10. There are a few quirks with the installer version that will not work well with your window manager if you wanted a rotated screen (See later section).

The steps are straightforward in this case: just execute the downloaded installer and follow the instructions. It's important to note the that the uninstaller is located at /usr/share/ati/fglrx-uninstall.sh, which may become necessary to do to prevent conflicting installations if you decided to apt-get from Ubuntu's repository later.

Upgrading and Installing from Ubuntu 8.10's Repository

These steps are probably not necessary if you've installed Ubuntu 8.10 fresh, but may be essential if you got here through an upgrade path like I did.

The main things you want to apt-get are: xorg-driver-fglrx, jockey-common, jockey-gtk. As a non-dependent package, jockey-common is surprisingly crucial to getting your setup to work, as it contains working versions of amdpcsdb and various important files in /etc/ati.

Once you the packages installed, if you are running gnome, go to 'System -> Administration -> Hardware Drivers' and you should see the ATI Driver available for installation. Click on 'Activate' to download the driver and install. It may take a while before the installation completes.



After the installation, you may be prompted to restart your machine. Before you do, just check that the 'fglrx' driver is mentioned in /etc/X11/xorg.conf. Check that the following line is present in your "Device" Section, eg:


Section "Device"
Identifier "Configured Video Device"
Driver "fglrx"
EndSection


Add the line in red into your xorg.conf if it isn't present. Here's an example xorg.conf that may help. Once you are done with the changes, restart your machine.

Checking that fglrx Driver is Running

With luck, your X should be running on your system after the installation. The first thing to do is you check that you have the 'fglrx' driver running. You should get something like this from the output of 'fglrxinfo':


% fglrxinfo
display: :0
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Radeon HD 3600 Series
OpenGL version string: 2.1.8087 Release


You can also run fgl_glxgears to verify that the card is running correctly visually.

Setting up the Dual Display Configuration

( Update: Compiz does work OK with dual-display, and out of the box as well, just not with rotated-screens. If you don't use rotated screens, this should be fine, so skip the following section. )

The dual-head display set up does not work well with the compositing manager - this is troublesome for Gnome because the default manager is Compiz. You'll have to pass the eye-candy and rely Metacity instead. If you don't, your reconfigured X server either conks out with a backtrace failing on some deprecated calls, or you're greeted with just a wallpaper background or a black screen.

To get access to the settings, you'll need gconf-editor which is an X application, so you should change this setting before you try restarting X in dual-head mode.

Run gconf-editor and change the key value in /desktop/gnome/applications/window_manager/default and /desktop/gnome/applications/window_manager/current from '/usr/bin/compiz' to '/usr/bin/metacity'



Next is to make changes in your xorg.conf file. While ATI provided the default tools like 'aticonfig' and ATI's Catalyst Control Centre ('amdcccle'), I'll recommend you avoid them for now (see Troubleshooting for why).

Here's an excerpt from my xorg.conf as an example:


Section "Device"
Identifier "ATI Radeon HD 3650 [0]"
Driver "fglrx"
BusID "PCI:1:0:0"
Screen 0

# only need to set it one time for a dual-head card
# Option "UseFastTLS" "1"
# Option "VideoOverlay" "on"
# Option "OpenGLOverlay" "off"
EndSection

Section "Device"
Identifier "ATI Radeon HD 3650 [1]"
Driver "fglrx"
BusID "PCI:1:0:0"
Screen 1

# Rotation: Not supported as an option directly at the moment
# Option "RandRRotation"
# Option "Rotate" "CCW"
EndSection

Section "Monitor"
Identifier "Monitor 0"
EndSection

Section "Screen"
Identifier "Screen 0"
Monitor "Monitor 0"
Device "ATI Radeon HD 3650 [0]"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
Option "DPMS"
EndSection

Section "Screen"
Identifier "Screen 1"
Monitor "Monitor 1"
Device "ATI Radeon HD 3650 [1]"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
Option "DPMS"
EndSection

Section "ServerLayout"
Identifier "Default Layout"
Screen "Screen 0"
Screen "Screen 1" RightOf "Screen 0"
EndSection

Section "ServerFlags"
# have to disable xinerama if I want screen rotation
Option "Xinerama" "off"
EndSection


The full xorg.conf file can be found here. Make the relevant changes, keep your fingers crossed, and restart your computer.

Screen Rotation

If you've managed to get this far, I'd assume that you have your dual head display working by now. If you wanted more fun out of your display, you can try the rotation capabilities provided by randr. The randr extensions are disabled by default; if you tried xrandr without enabling the extensions you're going to get this message:


% xrandr --output default --rotate left
xrandr: output default cannot use rotation "left" reflection "none"


To enable the randr extenstions, use the 'aticonfig' tool:


% aticonfig --set-pcs-str='DDX,EnableRandr12,TRUE'


Restart X or your computer after you made the changes.

While the ATI installer versions works without a hitch on older versions of Ubuntu, rotation is the only case it doesn't work right. For your window manager to detect it's dimensions properly, you'll have to install Ubuntu's version of fglrx, which somehow takes care of the rotation properly compared to the ATI installer version. Rotation also will not work if you are running in Xinerama configuration - you'll end up with areas on your workspace not being accessible by your mouse.

While Gnome allows the option to change its screen rotation from its menu, it doesn't seem to be able to rotate the screen even when the option is set. This means the screen you want rotated will always start landscape every single time it starts up. At least xrandr now can detect all the screens that you have available on your card and perform rotation on it:

% xrandr
Screen 1: minimum 320 x 200, current 1024 x 1280, maximum 1280 x 1280
DFP1 disconnected (normal left inverted right x axis y axis)
DFP2 connected 1024x1280+0+0 left (normal left inverted right x axis y axis) 338mm x 270mm
1280x1024 60.0*+ 75.0 75.0 70.0 60.0*
1280x960 60.0 60.0
1152x864 75.0 70.0 60.0
1280x768 59.9
1280x720 60.0
1024x768 75.0 75.0 72.0 70.1 60.0
800x600 72.2 75.0 70.0 60.3 56.2
720x480 60.0
640x480 75.0 72.8 75.0 60.0
640x432 60.0
640x400 75.1 59.9
512x384 60.0 74.9
400x300 75.0 60.7
320x240 75.6 60.0
320x200 75.5 60.1
CRT1 disconnected (normal left inverted right x axis y axis)
CRT2 disconnected (normal left inverted right x axis y axis)
TV disconnected (normal left inverted right x axis y axis)

To do rotation, you'll have to invoke this command every single time you log in:


% xrandr --output DFP2 --rotate left


Replace DFP2 with whatever screen xrandr reports you have.

Troubleshooting

1) There are a few times I had my run-ins with the utility tools ATI provides. Firstly with 'aticonfig'. While it proves useful sometimes, at others, it screws up your xorg.conf configurations. What I'll recommend is that you play around with aticonfig, and copy the relevant parts it generated into your own xorg.conf file, instead of relying on it blindly.

2) The other tool, ATI's Catalyst Control Centre ' - amdcccle', is just pure evil IMHO. The ATI drivers install an important file called '/etc/ati/amdpcsdb', which it loads independently from xorg.conf. If you're finding that X isn't working anymore even with an xorg.conf file you know to have worked previously, it's most likely that the amdpcsdb has been corrupted, which I find that happening from tinkering around with amdcccle, which is probably the biggest time wasted in trying to hunt down spurious problems.

If your card hangs even if Sysreq keys doesn't work no matter what xorg.conf parameters you've changed, the first thing is probably to try to restore the database. The way I got it to work again was by coping over the amdpcsdb.default file to amdpcsdb, eg:


% cp /etc/ati/amdpcsdb.default /etc/ati/amdpcsdb


Do make backups of the original file before you do that, I'm not responsible for any loss or damage it would cause!

3) If X turns into a black screen after you've logged out, try adding or modifying the following line inside /etc/gdm/gdm.conf to true:


# If you are having trouble with using a single server for a long time and want
# GDM to kill/restart the server, turn this on. On Solaris, this value is
# always true and this configuration setting is ignored.
AlwaysRestartServer=true


 

11 comments:

ene said...

hello.
Great post.
Did you try to use 1680x1050 px?
and 2 monitor (each with 1680x1050)?

And the same thing in XP?

Thanks,
Enrico

Miltron B said...

Hey Mate!

Thanks for the awesome tut.

Will it work even if my 3650 is not sapphire?

And something else - do you think you can make it run Compiz at all? I REALLy want eye-candy.

Cheers and thanks in advance!

x said...

I should think it will work - the chipset should be similar enough, although I can't comment on what the individual differences will be for different manufacturers.

With regards to Compiz, a few of my colleagues run with it without a hitch on the same card, so already works, just that it doesn't work if you want a rotated screen.

I have one screen on portrait mode for document editing, which is why I had to give up using Compiz. I'm sure the developers will eventually kink out all the bugs that will allow Compiz to work with portrait mode as well. :)

Joost said...

Hello,

I've been messing around with my thinkpad laptop which has a HD3650 card inside to get dual-head with an external screen. I finally got 'something' that works (external screen works and I can drag windows from one screen to another) but now suspend/hibernate won't wake up anymore.
Reading on some forums suggested that Xinerama causes this crash.
Do I need Xinerama to drag windows from one screen to the other? I mean, I don't see it in your config file and I guess you can drag windows from one to the other, no?
Also, I disabled Randr because Xinerama wouldn't work with it enabled.
Here is my current xorg.conf:
[quote]
Section "ServerLayout"
Identifier "aticonfig Layout"
Screen 0 "aticonfig-Screen[0]-0" 0 0
Screen "aticonfig-Screen[0]-1" LeftOf "aticonfig-Screen[0]-0"
EndSection

Section "Files"
EndSection

Section "Module"
Load "glx"
EndSection

Section "ServerFlags"
# Option "Xinerama" "on"
EndSection

Section "Monitor"
Identifier "aticonfig-Monitor[0]-0"
Option "VendorName" "ATI Proprietary Driver"
Option "ModelName" "Generic Autodetecting Monitor"
Option "DPMS" "true"
EndSection

Section "Monitor"
Identifier "aticonfig-Monitor[0]-1"
Option "VendorName" "ATI Proprietary Driver"
Option "ModelName" "Generic Autodetecting Monitor"
Option "DPMS" "true"
EndSection

Section "Device"
Identifier "aticonfig-Device[0]-0"
Driver "fglrx"
Option "UseFastTLS" "1"
Option "EnableMonitor" "crt1,lvds"
Option "SwapScreens" "on" # I want my external screen to be the primary screen with the menu panel
BusID "PCI:1:0:0"
EndSection

Section "Device"
Identifier "aticonfig-Device[0]-1"
Driver "fglrx"
BusID "PCI:1:0:0"
Screen 1
EndSection

Section "Screen"
Identifier "aticonfig-Screen[0]-0"
Device "aticonfig-Device[0]-0"
Monitor "aticonfig-Monitor[0]-0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1440x900"
EndSubSection
EndSection

Section "Screen"
Identifier "aticonfig-Screen[0]-1"
Device "aticonfig-Device[0]-1"
Monitor "aticonfig-Monitor[0]-1"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24
Modes "1440x900"
EndSubSection
EndSection
[/quote]

I also tried BigDesktop but it failed from the start when I tried to add pairmode.
I would appreciate any help to get my xorg.cong file nice and clean and have a working dual-head with window drag feature.
You seem to know a lot about this issue and since you are using the same card as me, you would be the right person to ask. ;-)
Thanks in advance!

joost

x said...

@joost

Ah, suspend/hibernate - this is one of the difficult issues when it comes to Linux in general. Neither of my colleagues nor I could make it work properly, and some of them are really hard-core guys :P The explanation that I was told is it is difficult to support restoration of the graphics card state properly for all the different vendors, especially when the specifications aren't open for some, but AMD/ATI cards are getting better these days.

You do need xinerama if you want to share desktop. I didn't have it configured because I wanted them separate - I don't like my applications sliding across one window to the other, but that's just me (although I do find missing this capability annoying sometimes.)

You do not need Xrandr if you don't want a rotated (ie portrait) screen. But if you want that, then there's plenty of things that will not work: compiz mainly, and sometimes having to deal with funny window manager quirks. Maybe Xinerama will complain about not knowing how to deal with 2 screens with different dimensions (although someone in my office did manage to get it to work.) So there are some sacrifices/tradeoffs that you have to make in this case, sadly.

There are some feedback that the packages provided in Ubuntu Karmic Koala has solved some of the issues that I had in my original post - if you haven't upgraded, maybe you should try your luck with that. As far as I know, HD3650 will work nicely out of the box.

I'm like you in the sense that I'm getting the card to work by trial and error, but hopefully the more information gets posted, the more everybody gets to benefit. Hope my comments helped, and keep tweaking! :)

joost said...

Hi Vincent,

I'm using Karmic now (upgraded from Jaunty). Strange thing is now that the 10.X catalyst drivers ignore SwapScreens in xorg.conf.
So I'm destined to keep using the 9.X drivers.
Just wanted to mention it since I haven't found a solution yet to get SwapScreens working in the 10.X versions.
I now have Xinerama enabled and I love it. :)

I have learned one important thing: always back up a working xorg.conf file. It saves lives.

Emule Magazine said...

Hi Vincent,
I've a problem to configure dual monitor in Ubuntu 10.10 and my PC has Radeon HD 3650.
Have you just tested on the last version of ubuntu? Can you update this post?
Best Regards,
Emule Magazine Admin

Anonymous said...

Thank you!

You just saved me hours of headache!

Phoenamandre said...

Hi
Please please please, I'm using the sapphire radeon 3650 on ubuntu 10.10 but I can't get it worked properly even with only one screen, please, if you could help me it would be great !

here is my mail : phoenamandre at gmail dot com
Or answer here !

And sorry for my bad English

asbjornenge said...

Did anyone give this a go with the radeon driver? One of my displays turn out real blurry :-/

Anonymous said...

sudo amdcccle
set the display setting to multiscreen

Post a Comment