Stephens Home

Ubuntu and Multiple Monitors – AMD Edition

There are several ways to end up with a satisfactory experience on the desktop with Ubuntu despite their recent confusion of the user interface. We will discuss some of those another day (KDE vs. Gnome vs. Cinammon vs. Unity). Today we are going to talk about setting up your desktop environment for multiple monitors. This article assumes you are running Ubuntu 12.04 LTS or 12.10, however, the process should work equally well back to version 10.04 LTS unless otherwise noted.

Assuming you have installed Ubuntu and are successfully sitting at the desktop (the window manager at this point is irrelevant), a couple of questions will now come to mind. What am I going to be using my linux desktop environment for? If you are going to be running office applications, email, basic web browsing and the occassional movie, you might be done. The default (read: Open Source) binary video drivers for both AMD (radeon) and Nvidia (nouveaux) are perfectly acceptable for all of those things. In fact, recently, they both have picked up some compositing support (so you can run the nifty 3D window effects in Compiz or KWin) as well as support for gaming. However, that support is spotty and performance still leaves a lot to be desired.

We will address NVidia in another posting, today we will talk about AMD and their proprietary binary driver (fglrx) and its administration tool. Specifically, post installation, how to set up multi-monitor support. I realize not everyone uses multiple monitors for their desktop, however, many of us do. Some of us (me) use multiple video cards and multiple monitors to meet our needs (2×20″ 1600×1200 Displays for one desktop, 3×24″ 1200×1920 Display in Portrait for another). We will quickly walk through the setup and some of the pitfalls and how to prepare for information you may need after installation.

Tricks of the Trade
Since we have a fully working desktop using the default ‘radeon’ AMD display driver currently, let’s take advantage and gather some information we may need to refer to later (Note: if you only have a single monitor, you can skip this section and go to ‘Installing the Binary Drivers’).

The first thing you will want to know is what card(s) are in your system and what Bus ID do they reside in. This is important for several reasons: the first reason is because AMD has diminishing driver support for their models prior to the HD6xxx/7xxx series in Linux (in Windows too, but less obvious), the second reason is because as of Ubuntu 11.04 and the associated switch to XOrg, there is no default ‘xorg.conf’ file to be found on the system. As you may know, that was the configuration file that defined the myriad of video options (driver, monitor parameters, font server, etc) for your XWindows desktop session. However, if you have more than one monitor, you are likely going to need to edit or create an ‘xorg.conf’ file for anything out of the ordinary (in my case, I have multiple video cards spanning multiple desktops, one portrait and one landscape). The easiest way to find the information to note, is the following command:

lspci | grep VGA

This will list the video cards installed in your system and the Bus ID (the slot) they are installed in, you will see something like this:

In this case, there is a single AMD HD Series 6450 video card in the first slot (01:00.0). Now, each video card support (generally) more than one monitor (as many as six in some AMD HD series 6xxx/7xxx cards) and each connector (HDMI, Display Port, VGA, DVI, etc) has an internal reference and when constructing our configuration manually, we would need to know which monitors are connected to which and the internal reference name of each. You can view what is connected where (and what the designated connection is referred to as) by issuing the following command:

xrandr

You will see something like this:

This tells us we have a monitor designation ‘DFP1’ at a resolution and position of 1600×1200 x0y0 (meaning it is the first monitor in the desktop since it starts at ‘x’ and ‘y’ coordinate ‘0’). Additionally, we have internal connection references of DFP2, DFP3, DFP4, and DFP5 which are disconnected. Finally, at ‘CRT1’ we have another monitor at a resolution and position of 1600×1200 x1600y0. We get some other information about the supported resolutions and refresh rates of each monitor. As a point of interest, anything connection to a designation ‘DFP’ is a digital connection whereas any reference to ‘CRT’ is analog (VGA). Armed with this information, we can move on.

Installing the Binary Drivers
As of the date of this article, the latest binary drivers available from AMD are the 13.1 Catalyst Drivers dated 1/17/2013. For Ubuntu users prior to 12.04, you will need the 12.10 Catalyst Drivers on the archive page, the 13.1 Driver will not compile correctly for your kernel.

Once downloaded, put them somewhere you can find, unzip them and ‘chmod 755’ the resulting binary. Execute the following command:

sudo ./amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run

and you will be greeted with the following:

Do NOT elect to create a distribution specific package as that goes beyond the scope of this article and can cause issues depending on the branch of the 3.5.x kernel you may be on. Rather than clutter the article with a number of screen prints you may not need to see, here are links to the various screens during the installation:

Finally, although logging out and back into the desktop (effectively restarting the x-session) will activate your new settings, a reboot is a good idea. If there are any kernel module messages or incompatibilities, we will find out during that process. If all goes well, you should be able to reboot and sign back into your desktop. In fact, if you have multiple monitors, odds are they will be picked up and some form of desktop extension will likely be displayed on them, or they may be mirrored (same desktop image on all of them). AMD seems to change the default behavior version to version. Next, we are going to try to configure our desktop ‘the easy way’ with the Catalyst Control Center.

Controlling the Control Center
Once we are logged back in, we will want to start up the AMD Catalyst Control Center to get a handle on our layout and configuration. You can choose it from the menu (make sure to choose the one labelled ‘AMD Catalyst Control Center (Admistrative)’ since we will be making changes to our layout and saving them which will require elevated (sudo) privileges. If you so choose, you can accomplish the same thing at the command line like so:

sudo amdcccle

To see the following:

So, we see two monitors connected to our card. The tab underneath is what we are most interested in, this is where we set the type of multimonitor system that we want. We can set it to ‘mirrored’ (to be honest, the only practical use for that is for presentations), ‘Single Display Desktop’ (which means we will have as many independent desktops as we have monitors) or ‘Mult-display desktop with display(s) 1’ (which is what we want, one desktop spanning multiple monitors).

Once you make your choice, you can choose ‘Apply’ for all the good it will do. Unlike in Windows, you won’t see the results of your choice until you log out and log back in to your session. Something that AMD says they are working on but has been that way since the beginning of time for their binary driver (and in all fairness, NVidia’s binary driver is no better in this regard, which we will see in our next article on this subject). After logging out and back in and restarting this Control Center, you should have a single desktop spanning multiple displays. What you also have for the first time, is a detailed ‘xorg.conf’ file. You can find a copy of the ‘xorg.conf’ file for this configuration here if you would like to see what it looks like.

If you review that file, you will see that each monitor is referenced both by the type of connection we noted in the ‘xrandr’ command as well as the Bus ID noted by the ‘lspci’ command. There are a large number of options you can edit in this file that are not directly editable from within the AMD Catalyst Control Center GUI, but that is beyond the scope of this article as it pertains to your Xorg configuration in general and can affect many other aspects of your session beyond just the video card and monitor layout.

Here is where you can also (finally) set the orientation of one or more of your displays. Clicking the arrow next to the display number in the diagram allows you to ‘flip’ or ‘rotate’ one or more of the displays and customize your multimonitor setup even more, like so:

What this leaves us with is one monitor in portrait mode while the second is in landscape (so one is at 1200×1600 resolution and the other is 1600×1200). The advantages of one or more displays in portrait mode is it makes for reading PDFs and web pages easier since you get closer to 100% view of a full page. I find that writing code, editing articles and viewing documentation works well on a portrait display while watching movies, playing games and editing pictures lends itself better to landscape.

Final Notes
Something to note about this configuration: compositing support is ‘limited’. Compiz, as of the date of this article, does not support a desktop with a mix of portrait and landscape displays. Meaning that the ‘desktop cube’ and the various window animations will fail to work. However, in KDE 4, the KWin display manager compositor does not seem to mind at all and happily displays all the effects that are available with it. I have to imagine at some point Compiz will fix this problem but your mileage may vary.

Note: Earlier, I noted that if you receive a notice during installation that you need to remove the old AMD driver first, you can simply open a command prompt and type:
sudo ./amd-driver-installer-catalyst-13.1-linux-x86.x86_64.run --remove
You can do this from the directory you downloaded and extracted the binary from. You will simply see a message indicating that the kernel module was removed and the default (open source ‘radeon’ driver) was restored. Make sure you type ‘–remove’ rather than ‘–uninstall’ as listed in some of their documentation.

What we have been leading up to with this routine is you can have a very customized desktop environment with many monitors across multiple video cards. I have found that AMD’s binary display driver has a bit more flexibility that the one available from NVidia (again, we will tackle their driver in a future article) but the performance of the NVidia driver seems to be better when comparing like powered video cards.

If anyone has any questions not only about the driver installation or configuration, but about the ‘xorg.conf’ file itself, leave a comment and I will do my best to assist. It took me quite a long time to put together all the pieces of how this file needs to be laid out.

Here is a picture of the system I am running at home. I am using an AMD HD7850 with three displays and an AMD HD6450 with two displays. I do have two independent sessions, but running on one computer.

Finally, here is my customized ‘xorg.conf’ file for this system.


Section "ServerLayout"
Identifier "amdcccle Layout"
Screen 0 "amdcccle-Screen[1]-0" 0 0
Screen "amdcccle-Screen[3]-0" 0 1920
EndSection

Section “Module”
Load “glx”
EndSection

Section “Monitor”
Identifier “0-DFP5”
Option “VendorName” “ATI Proprietary Driver”
Option “ModelName” “Generic Autodetecting Monitor”
Option “DPMS” “true”
Option “PreferredMode” “1920×1200”
Option “TargetRefresh” “60”
Option “Position” “1200 0”
Option “Rotate” “right”
Option “Disable” “false”
EndSection

Section “Monitor”
Identifier “0-DFP10”
Option “VendorName” “ATI Proprietary Driver”
Option “ModelName” “Generic Autodetecting Monitor”
Option “DPMS” “true”
Option “PreferredMode” “1920×1200”
Option “TargetRefresh” “60”
Option “Position” “0 0”
Option “Rotate” “right”
Option “Disable” “false”
EndSection

Section “Monitor”
Identifier “0-DFP9”
Option “VendorName” “ATI Proprietary Driver”
Option “ModelName” “Generic Autodetecting Monitor”
Option “DPMS” “true”
Option “PreferredMode” “1920×1200”
Option “TargetRefresh” “60”
Option “Position” “2400 0”
Option “Rotate” “right”
Option “Disable” “false”
EndSection

Section “Monitor”
Identifier “1-Default monitor”
Option “VendorName” “ATI Proprietary Driver”
Option “ModelName” “Generic Autodetecting Monitor”
Option “DPMS” “true”
Option “PreferredMode” “640×480”
Option “TargetRefresh” “60”
Option “Position” “0 0”
Option “Rotate” “normal”
Option “Disable” “false”
EndSection

Section “Monitor”
Identifier “1-DFP2”
Option “VendorName” “ATI Proprietary Driver”
Option “ModelName” “Generic Autodetecting Monitor”
Option “DPMS” “true”
Option “PreferredMode” “1600×1200”
Option “TargetRefresh” “60”
Option “Position” “1600 0”
Option “Rotate” “normal”
Option “Disable” “false”
EndSection

Section “Monitor”
Identifier “1-CRT1”
Option “VendorName” “ATI Proprietary Driver”
Option “ModelName” “Generic Autodetecting Monitor”
Option “DPMS” “true”
Option “PreferredMode” “1280×1024”
Option “TargetRefresh” “60”
Option “Position” “0 0”
Option “Rotate” “normal”
Option “Disable” “false”
EndSection

Section “Device”
Identifier “amdcccle-Device[1]-0”
Driver “fglrx”
Option “Monitor-DFP5” “0-DFP5”
Option “Monitor-DFP10” “0-DFP10”
Option “Monitor-DFP9” “0-DFP9”
BusID “PCI:1:0:0”
EndSection

Section “Device”
Identifier “amdcccle-Device[3]-0”
Driver “fglrx”
Option “Monitor-CRT1” “1-CRT1”
BusID “PCI:3:0:0”
EndSection

Section “Screen”
Identifier “Default Screen”
DefaultDepth 24
EndSection

Section “Screen”
Identifier “amdcccle-Screen[1]-0”
Device “amdcccle-Device[1]-0”
DefaultDepth 24
SubSection “Display”
Viewport 0 0
Virtual 3600 1920
Depth 24
EndSubSection
EndSection

Section “Screen”
Identifier “amdcccle-Screen[3]-0”
Device “amdcccle-Device[3]-0”
DefaultDepth 24
SubSection “Display”
Viewport 0 0
Depth 24
EndSubSection
EndSection

Terrence T. Cox

A veteran of twenty years in Information Technology in a variety of roles. He has worked in development, security and infrastructure well before they merged into what we now call DevOps. He provides training in Linux, VMWare, DevOps (Ansible, Jenkins, etc) as well as containers and AWS topics.

11 thoughts on “Ubuntu and Multiple Monitors – AMD Edition

  1. Thanks! This is a very welcome guide.

    I gradually arrived at a similar configuration for my Ubuntu Studio 12.04 64-bit system with an ATI Radeon HD3650 graphics card. I wish I had had this article then! I’m now running Ubuntu Studio 12.10 and it works a little more smoothly now.

    I set dual monitor mode using a script (at ~/scripts/dual_monitor.sh)
    #=========================================
    #!/bin/bash

    # RESOLUTION SETTINGS
    # This sets your DVI monitor to its best resolution.
    xrandr –output DVI-0 –mode 1920×1080 –rate 60
    # This sets your HDMI monitor to its best resolution.
    xrandr –output HDMI-0 –mode 1920×1080–rate 60

    # MONITOR ORDER
    # Put the HDMI TV display right, DVI monitor left
    # xrandr –output DVI-0 –left-of HDMI-0
    # Put the Laptop left, VGA1 monitor right
    xrandr –output DVI-0 –left-of HDMI-0

    # PRIMARY MONITOR
    # This sets your DVI monitor as your primary monitor.
    xrandr –output DVI-0 –primary
    # This sets your HDMI monitor as your primary monitor.
    # xrandr –output HDMI-0 –primary

    #====================================================

    1. P.S. Anybody who comes across this post looking for help with the AMD HD3650 should be aware that the AMD Linux driver only supports the card as legacy and only under certain restrictions. See:

    2. Yes, it is unfortunate, but AMD has decided that anything prior to the HD series 6xxx/7xxx cards will be supported by previous drivers only for linux. They are moving that way in Windows as well, but the drivers are still unified install whereas linux the versions are different.

      XRANDR is a wonderful utility for doing all kinds of things with your setup. However, it can change version to version and/or have bugs (and has in the past). So I would recommend that if you have a working configuration, translate that into an ‘xorg.conf’ file and make it permanent on reboot without needing your script.

      Good luck!

  2. Thanks for the article, a few months ago I had all sorts of issues with trying to get 3 monitors setup with Ubuntu 12.04 and 12.10 using AMD cards. I first tried a R7750 which was on special at the local computer store, and knew at the time of purchase that I should have researched how this card works with Linux. Anyway I could not get this card to work with 3 monitors either with the native Ubuntu drivers or the Catalyst drivers.

    So I tried another AMD card, HD6570 with 2MB RAM and had more success with this, straight up the native Ubuntu drivers worked after selecting the 3 displays. I then tried installing the Catalyst drivers and although the install went fine, I could only get two monitors to work, the 3rd was greyed out and could not be activated for some reason? So in the end I’ve left the native Ubuntu drivers and have the 3 screens working to my satisifaction, sometimes I get glitches and have to reboot, but that might be more to do with running Reminna RDP session to a Windows box and then having a VirtualBOX VM running on another screen.

    Anyway, I would be interested in what you think about the issue I had with the 3rd monitor greyed out with the Catalyst drivers, they would have been older that the driver you use in this article, as I did this back in November last year. Also, given I have it all working, is it worth going to the AMD Catalyst driver or switching to an nVidia based card?

    Thanks again for the article, there is not much out there on multi-screens and Linux.

    1. Glad you got everything to work, that’s sometimes the hardest step. At least now you know you have a ‘fall back’ if you decide to pursue the ‘fglrx’ binary drivers.

      I would recommend them for several reasons: first, accelerated flash video playback. Much as we all hate flash video, its not going anywhere in the short term and having it video card accelerated means your HD videos will play back much smoother. Second, any gaming at all you are going to want the ‘fglrx’ drivers and their support for OpenGL (which all linux games are going to require in order to work and the performance of the stock radeon drivers are terrible at).

      Be sure to use the ‘xrandr’ command as listed in the article to find out which interfaces correspond to which of your monitors. If you note that, getting all three working with the binary driver will be much easier. If you have issues, hit me up in the comments and I can give a hand.

  3. Great post. Can’t wait to read the nvidia version. I have a hard time getting my two Samsung work correctly especially after a kernel upgrade. I continually need to reinstall nouveau then proprietary drivers.

    Such a shame I do not have a ATI card.
    🙂

    1. NVidia is a little harder to install (more sensitive to installation in ‘text only’ mode with X not running at all). Fortunately, NVidia drivers updated through channel repositories are more regular than AMD, which means you can install a DKMS version of NVidia most times and it will update with the kernel (likely the reason you have to reinstall after upgrades). I will get to it shortly though! Thanks for the feedback.

    1. Depends – with a fresh restart, Compiz can take 30% or more of my CPU for the first two minutes. It does tend to settle down after that and I routinely see it only consuming a few % unless I am doing something like the 3D cube with transparency and an animation in the middle. Although not offering quite the number of graphical widgets, I have found the compositing supporting in the KWIN manager now for KDE more than sufficient, with eye candy, and a significantly less impact on my CPU even after a restart.

Leave a Reply

Your email address will not be published. Required fields are marked *