Search:  
Gentoo Wiki

Radeon


Please improve it in any way that you see fit, and remove this notice {{Cleanup}} from the article. For tips on cleaning and formatting see Cleanup process


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Installation

Configuration

HIDevices

Fonts

Video Cards

OpenGL Compositing

Fonts

Monitors

edit

Contents

Introduction

If you do not want to use ATi's proprietary fglrx driver, then you should use the open source driver which will get you direct rendering for most R2x0 and R3x0 chips, and for old ATI hardware like the Mach64 card found in most old notebooks.

If you have a GPU from the Radeon HD series and really want to use open-source drivers, the RadeonHD drivers might suit you better.

This guide definitely applies to the following cards (and hopefully a great deal more):

As of June, 07, 3D acceleration of the ATI Xpress 200M is in a (very) experimental state and although it works with AIGLX, (I get 1500 fps) complicated OpenGL programs will not work with it - this includes beryl, compiz and compiz-fusion. An alternative compositing manager like xcompmgr/metacity works well however.

See also [1] and Radeon at Wikipedia if you're trying to relate which chip belongs to which card number/model.

Tip: If you use an r300 chipset e.g. Radeon 9600XT mob., 9500 ,X300,M300 you will have to follow the part of the guide which builds the modules from source. If you don't succeed the guide linked at the bottom of the page may help you. (this isn't true anymore, as the mesa-driver now supports at least the 9600XT --Henry78 12:59, 23 March 2007 (UTC)). (As of 10th January 2008 it is sufficient for Radeon 9600 PRO to follow the Kernel guide only --Anonymous User.)

Kernel

First of all you need the right kernel modules. There are three alternatives.

If the module for your graphic card is not in the kernel, then you obviously must use the 2nd alternative.

Kernel options

You MUST compile the AGP driver from the kernel source.

Linux Kernel Configuration: Kernel 2.4
Character devices  --->
  <M> /dev/agpgart (AGP Support) 
  Direct Rendering Manager (XFree86 DRI support)  --->
    <M>   ATI Radeon

In kernel 2.6 you need to build an additional module for your AGP chipset. In this example we use the Intel module. Make sure the kernel module for your AGP bridge loads before the driver module for your chipset. For example, if your AGP bridge is an AMD Irongate (this can be determined via lspci -v and looking for the line containing AGP), make sure that amd_k7_agp is loaded before the driver module (radeon).

If you choose to build the non-kernel DRM, do not enable the DRM modules here.

Linux Kernel Configuration: Kernel 2.6.24 or lower
Device Drivers  --->
  Character devices  --->
    <M> /dev/agpgart (AGP Support)
    <M>   Intel 440LX/BX/GX, I8xx and E7x05 chipset support (or whatever your chipset is)
    <M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
    <M>   ATI Radeon
Linux Kernel Configuration: Kernel 2.6.25
Device Drivers  --->
  Graphics support  --->
    <M> /dev/agpgart (AGP Support)
    <M>   Intel 440LX/BX/GX, I8xx and E7x05 chipset support (or whatever your chipset is)
    <M> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
    <M>   ATI Radeon

Then you should add the modules to be autoloaded

File: /etc/modules.autoload.d/kernel-2.4
agpgart
radeon
File: /etc/modules.autoload.d/kernel-2.6
intel-agp # your AGP chipset
agpgart
radeon

Note that 'intel-agp' above depends on your chipset, for example: 'via-agp' on a via chipset, 'nvidia-agp' on a nforce chipset, 'amd64-agp' for a amd64 chipset (can be nvidia or via). Also note there will also be a kernel module ati-agp. Don't use it, use lspci to detect your PCI to AGP bridge chipset and load the correct module. Make sure you load modules in the right order (intel-agp [which will load agpgart], drm, ati [ati will load the correct driver for your ATI card automagically]). lsmod should show the loaded modules in reverse order.

Tip: If glxinfo still shows no working dri/drm ("Direct Rendering: No") try this symlink:

ln -s /usr/lib/dri/r200_dri.so /usr/lib/xorg/modules/dri/

Tip: Most AGP-gart chipsets are hidden, unless you turn off the IOMMU support in the processor config part of the kernel (tested on 2.6.20 kernel on AMD64):

Linux Kernel Configuration: Kernel 2.6
Processor type and features  ---> Processor family (AMD-Opteron/Athlon64)
    [ ] IOMMU support

If you still can't select agpgart as a module, you have to edit the file arch/your_cpu_architecture/Kconfig: find this part:

config IOMMU bool "IOMMU support" if EMBEDDED default y select SWIOTLB select AGP depends on PCI

and, instead of "default y" write "default n"

Emerging the DRM modules separately

Follow the preceding section but do NOT select the module Direct Rendering Manager

Linux Kernel Configuration: Kernel 2.6
Device Drivers  --->
  Character devices  --->
    <M> /dev/agpgart (AGP Support)
    <M>   Intel 440LX/BX/GX, I8xx and E7x05 chipset support
    < > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)
emerge -av x11-base/x11-drm
# you might also have to do 
emerge xf86-video-ati

The second line may be necessary every time you install a new kernel because it is where the driver is actually contained. So simply reemerging x11-drm may not be sufficient. Finally, add the radeon driver to /etc/modules.autoload.d/kernel-2.? as shown above.

Compiling kernel modules from MESA/DRM source

Tip: NOTE: there is an alternative in using primozic's overlay see below for instructions. What follows is just a poor copy of http://dri.freedesktop.org/wiki/Building

If you did not find the module needed for you graphic card (Mach64 for instance), then no reason to give up :-) You now need to download the DRM source code from the xorg cvs, compile it by hand, and install the correct module. Although it sounds quite complicated, it's really quite easy, and on a fast machine, you'll have the module compiled in no time. libdrm is a Mesa dependency, so upgrade it to the latest release available in portage can help:

File: /etc/portage/package.keywords
x11-libs/libdrm     # This should now be unnecessary.
emerge --sync
emerge libdrm

You need to download 2 things - Mesa and DRM:

# fetch DRM sources
git clone git://anongit.freedesktop.org/git/mesa/drm

# fetch Mesa sources
git clone git://anongit.freedesktop.org/git/mesa/mesa

Let's say, that you are located in /usr/local/src/. After downloading the DRM and Mesa source, you should have 2 directories in /usr/local/src - Mesa and drm. To set up Mesa for your driver compilation, edit the file Mesa/configs/linux-dri. Make the following modifications:

OPT_FLAGS = <compiler flags>( optionally )
...
DRI_DIRS = <dri drivers>

From the <dri drivers> select only the one(s) you need - it's pointless to build all of the kernel modules.

The following DRI_DIRS are available: (see http://dri.freedesktop.org/wiki/Building)

DRI_DIRS = i810 i830 i915 mach64 mga r128 r200 radeon s3v \
           savage sis tdfx trident unichrome r300

Now you're all set to compile. Run make linux-dri-x86 from within the Mesa directory or make-linux-dri-x86-64 for amd64 users.

The DRI modules will be found in the mesa/lib folder. To install them you have to copy them to the /usr/X11R6/lib/modules/dri folder (see the DRI Wiki).

#x86-32
cp lib/*_dri.so /usr/lib/xorg/modules/dri/

#x86-64
cp lib64/*_dri.so /usr/lib/xorg/modules/dri/

Check that /usr/lib/dri points to your xorg dri, and if it doesn't, fix it:

ls -l /usr/lib/dri
# if this doesn't point to /usr/lib/xorg/modules/dri
mv /usr/lib/dri /usr/lib/dri.backup
ln -s /usr/lib/xorg/modules/dri /usr/lib/dri

Now, you'll notice we build a bunch of shared objects (.so), they are responsible for the DRI, as indicated by their names. If you want to build the Direct Rendering Manager (drm) from source also, do this:

# assuming your drm/mesa source is located in /usr/local/src
cd /usr/local/src/drm/linux-core/
make
cp *.ko /lib/modules/`uname -r`/video/
depmod -a

Given that you either compiled DRM from CVS or portage, you should have it installed now. To make use of it, edit /etc/modules.autoload.d/kernel-2.6:

File: /etc/modules.autoload.d/kernel-2.6
# Load ATI
agpgart
amd64_agp
drm
radeon

When you start your X server, make sure you have

Driver "radeon"

in your device subsection.

Important! When x11 loads up, it actually loads the module radeon_drv.so which determines the behavior of your DRI's. To avoid compatibility issues and use the features in your new modules, always update this file by

emerge -av xf86-video-ati

Next time the X server load the 'radeon' instance, the DRM/DRI and Mesa 3D should be enabled.

Alternative installation

Use layman to get primozic's overlay:

File: /etc/layman/layman.cfg

overlays:

file:///etc/layman/my-list.xml

File: /etc/layman/my-list.xml
<layman>
  <overlay 
   type = "rsync" 
   src = "rsync://rsync.sturmartillerie.org/mesa-cvs"
   contact = "idunno@whonows.com"
   status = "official"
   name = "r300-driver">

    <link>
      http://forums.gentoo.org/viewtopic-t-374745.html
    </link>

    <description>
      This overlay enables the primozic opensource r300 display driver overlay
    </description>
  </overlay>
</layman>


Update keyword and mask:

File: /etc/portage/package.keywords
media-libs/mesa **
x11-apps/mesa-progs **
x11-base/x11-drm **
x11-base/xorg-server **
x11-drivers/xf86-video-ati **
x11-libs/libdrm **
File: /etc/portage/package.mask
>x11-base/x11-drm-9999
File: /etc/portage/package.unmask
media-libs/mesa
x11-apps/mesa-progs
<=x11-base/xorg-server-1.2.0
x11-drivers/xf86-video-ati


List available overlays: layman -L

Add primozic's overlay: layman -a r300-driver

Emerge packages: emerge -av1 libdrm x11-drm xf86-video-ati xorg-server mesa mesa-progs

Xorg

Next you need to install Xorg.

Modular Xorg introduces a new system for managing the driver packages for your devices. You need to set the appropriate VIDEO_CARDS and INPUT_DEVICES flags in /etc/make.conf. To see what flags are available, run emerge -upv xorg-x11.

On an ATI System, the VIDEO_CARDS line should be like this:

File: /etc/make.conf
VIDEO_CARDS="radeon vesa"

Add the dri USE flag to /etc/make.conf to enable Direct Rendering support, which most graphics drivers use.

If you are running on older ati hardware (like the Mach64 chipset used in the cards like 3D Rage Pro, etc...), in older Xorg versions (<=xorg-x11-6.9.0) then make sure to use the insecure-drivers USE flag. It saves you a whole bunch of trouble that you would come into later on. Also in older Xorg versions, for this to work properly, you need to have sdk in your USE flags.

 USE="insecure-drivers sdk" emerge x11-base/xorg-x11

You can use MergedFB to provide dualhead Xinerama-like setups. MergedFB's pseudo-Xinerama is not Xorg server's Xinerama. You don't have to enable Xorg server's Xinerama to use MergedFB's pseudo-Xinerama. However, applications compiled with Xinerama support (USE="xinerama") can interpret pseudo-Xinerama hints, for example, to maximize to a single monitor instead of spanning two monitors.

The following (partial) Xorg config will make the Radeon card use 1024x768 on the internal lcd display and 1280x1024 on the external (Note: only one screen/monitor section is needed (it controls the setup of the internal monitor) even though we have two displays): N.B.: Modes used in the MetaModes also have to be present in the screen modes section.

When Xorg has been installed you should run xorgcfg to generate a simple configuration. Then you add the following lines to your /etc/X11/xorg.conf to enable 3D-acceleration. Make sure not to capitalize dri...

File: /etc/X11/xorg.conf

...

Section "dri"
        Mode    0666
EndSection

...

Make sure that the following lines are present in your config file under the section modules:

File: /etc/X11/xorg.conf

...

Section "Module"
        Load "dri"
        Load "drm"
        Load "glx"
        ...
EndSection

...

You need also to specify what driver should be used for you video card (example) - use either "ati" or "radeon"

File: /etc/X11/xorg.conf
Section "Device"
        Identifier  "ATI Radeon"
        VendorName  "ATI Technologies Inc"
        Driver      "radeon"
        ...
EndSection

Additional options for the radeon driver

The defaults are safe, but not 100% optimal. You may want to test different options, but note that these may lock up your computer. Stop xdm and use startx command with a lightweight windowmanager to test the setup.

File: ~/.xinitrc
xterm &
exec fluxbox


By default, the open source radeon driver forces 1x AGP speed. Higher speeds can be enabled by adding Option "AGPMode" "X" (where X is a number).

ColorTiling is supposed to be enabled by default. But, it looks like setting it explicitly to "on" increases the FPS in glxgears.

Page Flip increases performance but is not always supported. It will be disabled if the EXA architecture is used.

By default, the XAA architecture is used. EXA is newer and supposed to have better performance. It looks like it reduces the FPS in glxgears (maybe because it disables Page Flip) but makes the Composite extension be fast.

NOTE: Setting the AccelMethod to EXA on a ATI Radeon 9000 (and most likely other cards) leads to strange graphical effects. XAA in this case is the better choice.

When the video overlay is used (e.g., by most video players) in dual-screen configuration, the content will be shown only on one head (LCD or CRT) and the other will display a blank rectangle. To control which head displays the video, use the video overlay option. On a laptop, you can configure acpid to execute these commands automatically when the lid is opened or closed. To switch on the fly, use these commands:

xvattr -a XV_SWITCHCRT -v 0   (LCD) 
xvattr -a XV_SWITCHCRT -v 1   (CRT) 


File: /etc/X11/xorg.conf
Section "Device"
        Identifier "ATI Radeon"
        Driver "radeon"
        # this may solve some issues
        Option      "BusType" "PCI"

        # acceleration
        Option          "AGPMode" "4"
        Option          "AGPFastWrite" "yes"
        Option          "EnablePageFlip" "on"
        Option          "RenderAccel" "on"
        Option          "AccelMethod"   "EXA" # or XXA
#	Option		"BackingStore" "true"
#	Option 		"ExaNoOffscreenPixmaps" 

        # enable (partial) PowerPlay features
        Option          "DynamicClocks" "on"

        # use bios hot keys on thinkpad (aka fn+f7)
        Option          "BIOSHotkeys" "on"

        # enable radeon specific xinerama
        Option          "MergedFB" "true"
        Option          "CRT2Position" "RightOf"
        Option          "CRT2Hsync" "50-75"
        Option          "CRT2VRefresh" "30-82"
        Option          "MetaModes" "1024x768-1280x1024"
        Option          "MergedNonRectangular" "true"

        # Color Tiling
        Option          "ColorTiling"   "on"

        # Video overlay
        Option          "OverlayOnCRTC2"        "on"

EndSection

# on a laptop
Section "Monitor"
        Identifier "InternalLCD"
        Option "DPMS"
EndSection

http://www.thinkwiki.org/wiki/Additional_options_for_the_radeon_driver

Although the link above has some options. This link is more detailed:

http://www.die.net/doc/linux/man/man4/radeon.4.html

IMPORTANT NOTE: The bustype pci setting seems to slow down glxgears ALOT. From MY experience it seems that the problem was related to the fact that the agpfastwrite froze X. I commented the Option"AGPFastWrite" "yes" line and the Option "BusType" "PCI" out and everything was great. I would not suggest using bustype pci for an agp card and only use it as a last resort. - WebDawg@Efnet - June 09, 2007


LESS IMPORTANT NOTE (SOMEONE CHECK OR TEST THIS): option OverlayOnCRTC2 seems to have been replaced: "if no position is given it defaults to clone mode (the old clone options are now deprecated, also, the option OverlayOnCRTC2 has been replaced by the Xv attribute XV_SWITCHCRT; the overlay can be switched to CRT1 or CRT2 on the fly in clone mode)." Quote from: (http://www.die.net/doc/linux/man/man4/radeon.4.html)- WebDawg@Efnet - June 09, 2007

Starting Xorg

If you installed the drivers from DRM source, then do not run opengl-update. To make sure you have the right OpenGL implementation do:

eselect opengl set xorg-x11

Start X, open an Xterm and run glxinfo. One of the first lines should say:

# glxinfo | grep -i "direct rendering"
direct rendering: Yes

That's it folks!

Xorg starts with no errors but monitor is black

This seems to be an issue with the R300 drivers, to resolve:

File: /etc/X11/xorg.conf

...

Section "Device"
        Option "MonitorLayout" "NONE, LVDS"
EndSection

...

or

File: /etc/X11/xorg.conf

...

Section "Device"
        Option "MonitorLayout" "LVDS, TMDS"
EndSection

...


There is also a kernel AGP gart issue that can cause X to only show a black screen and run at 100% CPU usage. More information about it can be found at http://bugzilla.kernel.org/show_bug.cgi?id=7273 and the workaround is to force PCI-style transfers in your graphics card section:

File: /etc/X11/xorg.conf

...

Section "Device"
        Option "BusType" "PCI"
EndSection

...

2007-01-11: I had a problem like this, with hard lock and black screen (but with sync signal to monitor) when X started, that could be circumvented with the "BusType PCI" option. However, further testing showed that the problem could also be fixed by changing the AGP Aperture Size setting in BIOS from 64M to 128M. Radeon X800 PRO, AMD64, nForce3 250, 1 GiB RAM. YMMV. --Arvid

2008-02-22: I confirm Arvid's fix. I had the same problem, everything seemed to run fine but I had a black screen with signal to the monitor. I went to my BIOS and changed my AGP Aperture Size to 256MB, and it worked! Incredible. I have an ATI Radeon x700 Pro.

2008-06-30: Also confirming this fix. I have an X1550 64-bit 256MB card. Gave me the hard lock + black screen until I changed my BIOS AGP Aperture setting to 256MB.

There seems to be cases, where X hard locks due to AGPFastWrite-flag being enabled ( [2] for example hints for this). To correct this you must disable or comment out fast writes. Comment out the "bustype pci" line also as it will speed up glxgears.

File: /etc/X11/xorg.conf

...

Section "Device"
        Identifier "ATI Radeon"
        Driver "radeon"
        #Option "AGPFastWrite" "1" # causes X to hard lock
        ...
EndSection

...

TV-out (tvoutput) support

There is no official support for Xorg 7 (yet), however you can try to patch it yourself with the following:

Troubleshooting

Similar Tutorials

Retrieved from "http://www.gentoo-wiki.info/Radeon"

Last modified: Sun, 31 Aug 2008 22:31:00 +0000 Hits: 143,478