Radeon

radeon is a family of open source graphics drivers for AMD/ATI Radeon graphics cards.

Hardware detection
To choose the right driver, first detect the graphics card. You can use lspci for this task:

Feature support

 * 1) Needs testing packages: >=mesa-9.1
 * 2) Work in Progress

See also the http://wiki.x.org/wiki/RadeonFeature/ site for the latest feature/hardware list.

Kernel
You need to set the following kernel options:

The options from the Sound card support menu need only to be set if the card supports HDMI or DisplayPort audio and you want to use it. Other options there might be needed as well, e.g. don't set the number of soundcards too low, because even with one Radeon card alsa may detect more than one HDA ATI HDMI device, e.g.

Firmware
Microcode is required for R600 and newer GPUs. Install either or  (contains also other firmware), either:

or:

Also, with packages like these, which introduce a number of non-free blobs into your system, if you are security aware, it pays to use the savedconfig use flag, and do some removing of the unnecessary lines, or better yet uncommenting them, from the respective savedconfig file. See "How to install the linux-firmware package in Gentoo" in External resources in bottom.

However, savedconfig editing is entirely optional, if you are in a hurry. System will work the same, with or without the savedconfig editing.

If you compiled radeon directly into the kernel instead of as a module, make sure firmware for your model (check available ones in ) is included in kernel:

Below is a list of the firmware files needed for each family/chipset of cards:

Driver
Portage uses the variable VIDEO_CARDS for enabling support for various graphics cards in packages. Setting VIDEO_CARDS to e.g. radeon (see the feature matrix) will pull in the correct driver:

Check the USE flags of :

After setting this you want to update your system so the changes take effect:

xorg.conf
The X server is designed to work out-of-the-box, with no need to manually edit X.Org's configuration files. It should detect and configure devices such as displays, keyboards, and mice.

However, the main configuration file of the X server is the xorg.conf.

You can force the X server to use desired driver with:

Power Management
Power management can be set in the sysfs filesystem as follows:


 * Check the current power method:


 * Change the power method:
 * The "dynpm" method dynamically changes the clocks based on demand. (not effective as of June 27, 2012)
 * The "profile" method lets you set a profile on how the card should behave.
 * The "profile" method lets you set a profile on how the card should behave.


 * Check the current profile:


 * Change the profile:
 * Options for profile:
 * "default" no change of clock speeds
 * "auto" switches between "mid" and "high" power states based on the whether the system is on battery power or not. The "low" power state are selected when the monitors are in the dpms off state.
 * "low" forces the GPU to be in the low power state all the time. Note that "low" can cause display problems on some laptops; this is why auto does not use "low" when displays are active.
 * "mid" forces the GPU to be in the "mid" power state all the time. The "low" power state is selected when the monitors are in the dpms off state.
 * "high" forces the GPU to be in the "high" power state all the time. The "low" power state is selected when the monitors are in the dpms off state.


 * Check the current GPU, Memory clocks and voltage (needs to have kernel debugfs enabled):

Power Management with Linux Kernel 3.11, 3.12
Linux Kernel 3.11 introduces improved power management for some radeon cards, to activate it pass the parameter radeon.dpm=1 to the kernel.


 * Check the dynamic power management state


 * Change the dynamic power management state
 * Other valid options include "battery" and "balanced"
 * Other valid options include "battery" and "balanced"

In order to verify that the new dynamic power management code is active check radeon_pm_info (see above), it should say something like
 * uvd   vclk: 0 dclk: 0
 * power level 0   sclk: 25000 mclk: 15000 vddc: 900 vddci: 950



Power Management with Linux Kernel >= 3.13
Linux Kernel 3.13 enabled dynamic power managment by default for a lot of video cards.


 * Check the current GPU, Memory clocks and voltage (needs to have kernel debugfs enabled):

Tuning
I couldn't find a summary of all options available so feel free to add to this.

Tuning with mesa from git
Mesa from git (=mesa-9999) offers a different way to tune the 3D driver. Use the environment variable R600_DEBUG with the following options See mesa commit for more information.


 * Kernel parameters can be just added to the kernel commandline in or.
 * Environment variables could be put into a file like to have them initialized during boot.
 * parameter are usual in the Device section for the card.
 * A full list of kernel parameters can be found here: X.Org Wiki - RadeonFeature
 * S3TC compression needed for some applications like most 3D games:


 * 1) supported by Linux kernel 3.11

Monitoring
lm sensors can be used to monitor the cards temperature. It uses the I2C interface, which needs to be enabled in the kernel:



Audio over HDMI
Audio through the HDMI port is available for some cards. Check the X.Org Wiki - Radeon Feature Matrix for the model family. A recent 3.x kernel may be needed.

If you are using a kernel older than 3.13, HDMI audio must be explicitly enabled using the kernel commandline paramater radeon.audio=1. In addition, ALSA typically does not use HDMI as the default audio, so one way to force this as the default is to add a config file:

which may be moved to to make HDMI audio the system-wide default.

Another solution is to set the USE-flag pulseaudio, update the system and use pavucontrol to set the HDMI port as fallback (or use pavucontrol to change manually which application uses which audio port).

Multichannel LPCM
If you want to enjoy full 5.1 HDMI sound on your gentoo rig try out anssi's HDMI audio patch as mentioned in the phoronix forums.

Check your bootloader config to use the correct kernel and reboot.

Glamor Does Not Load
If you see errors like "glamor detected, failed to initialize EGL.", then try enabling USE="gbm egl gles2 llvm" in your mesa builds.

If you see errors like "Failed to link: error: fragment shader lacks `main'", then make sure the glamor package has been built with USE="-gles".

Poor X Performance
If graphic performance (such as playing videos) is terrible, then make sure KMS Color Tiling is enabled. You can see this in your Xorg log: [ 3407.235] (II) RADEON(0): KMS Color Tiling: enabled [ 3407.235] (II) RADEON(0): KMS Color Tiling 2D: enabled [ 3407.235] (II) RADEON(0): KMS Pageflipping: enabled

If you see "no" instead of "enabled", then you'll have to look earlier in the log to see why it's been disabled. If glamor failed to load, see the previous troubleshooting item.

Poor Gaming Performance
If you use a 64bit system and play 32bit games (mostly everything in wine and steam), then the main bottleneck are old libraries in the emul-linux packages. For radeonsi cards there is a huge difference in performance between mesa 10.0 (part of emul-linux-opengl, used for everything 32bit like wine and steam) and mesa 10.2 (used for everything 64bit like the desktop). The only solution is to update the 32bit binaries, either by waiting for an emul-linux-* update or by allowing the system to compile equivalent 32bit binaries to the currently installed 64bit versions, see https://wiki.gentoo.org/wiki/Multilib_System_without_emul-linux_Packages

External resources

 * X.Org Wiki
 * X.Org radeon feature matrix
 * Status of OpenGL features in Mesa
 * Phoronix Forums multichannel for radeon
 * hdmi multichannel patch
 * How to install the linux-firmware package in Gentoo