radeon

From Gentoo-en
Jump to: navigation, search


This is a guide for setting up the radeon (x11-drivers/xf86-video-ati) open-source driver for AMD/ATI-based graphics cards. See FreeDesktops Radeon wiki article for supported chipsets and features.

This driver is generally slightly slower in 3D and in some cases significantly faster in 2D than the proprietary fglrx driver, however is completely open source and able to utilize KMS, which provides a framebuffer as well.

Support for most recent cards is usually included in newer kernels, however, newer features may only be available in recent versions of the driver. If you need newer versions, try to make sure that you keyword x11-libs/libdrm, media-libs/mesa and x11-drivers/xf86-video-ati at the same time.

Alternate Drivers

Before starting this guide, take a look at the other drivers available for your card.

Kernel Config

For the newest cards (R8xx, Radeon HD5xxx and above), kernel-2.6.36 or above is necessary.

Kernels >=3.0.0

Linux Kernel Configuration: Enabling radeon driver and KMS
Device Drivers  --->
	Graphics support  --->
		<*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->
			<*> ATI Radeon
				[*] Enable modesetting on radeon by default - NEW DRIVER
General setup  --->
	[*] Enable PCI quirk workarounds

Looks like KMS and FB drivers conflicting now (Nov 2012), at least on old cards like R250 and R350 (see http://www.spinics.net/lists/xorg/msg54751.html). If X doesn't start after upgrade and you see in Xorg.0.log this error:

[    33.188] (II) [KMS] drm report modesetting isn't supported.
[    33.188] (EE) Screen 0 deleted because of no matching config section.
[    33.188] (II) UnloadModule: "radeon"
[    33.188] (EE) Device(s) detected, but none match those in the config file.

then switch off framebuffer driver:

Linux Kernel Configuration: Radeon I2C capability
Device Drivers --->
    Graphics support --->
        <M> Support for frame buffer devices --->
            < > ATI Radeon display support 
                [ ] DDC/I2C for ATI Radeon support

Kernels >=2.6.33

Linux Kernel Configuration: Enabling radeon driver and KMS
Device Drivers  --->
	Graphics support  --->
		<*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->
			<*> ATI Radeon
				[*] Enable modesetting on radeon by default
General setup  --->
	[*] Enable PCI quirk workarounds

Kernels <= 2.6.32

Linux Kernel Configuration: Enabling radeon driver and KMS
Device Drivers  --->
	Graphics support  --->
		<*> /dev/agpgart (AGP Support)
		<*> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  --->
			<*> ATI Radeon
	[*] Staging drivers  --->
		[ ] Exclude Staging drivers from being built
			[*] Enable modesetting on radeon by default

AGP Cards

Linux Kernel Configuration: AGP Cards
Device Drivers  --->
	Graphics support  --->
		<*> /dev/agpgart (AGP Support)
                    (Enable your AGP Chipset as well)


If building with modules, go ahead and build the kernel and restart the system. If using built-in drivers, don't build until after the firmware is installed in the next section.

Device Firmware

The radeon driver requires the device firmware for proper operation. This firmware needs to be compiled into the kernel if the drivers are built-in, or simply installed and available if they are built as modules.

Installing a firmware package

First, determine the chipset of the card using
lspci
from sys-apps/pciutils. Wikipedia's list is also an excellent resource for matching model numbers to GPU part numbers.


In general, for cards with R600 (Radeon HD2000) or newer:

emerge x11-drivers/radeon-ucode

And all other cards:

emerge sys-kernel/linux-firmware

If compiling with modules, skip to Recompiling and Configuring.

With a built-in driver

Linux Kernel Configuration: Adding the radeon-ucode firmware into the kernel
Device Drivers --->
	Generic Driver Options --->
		[*]  Include in-kernel firmware blobs in kernel binary
		# RadeonHD 2000, 3000, and 4000 series cards:
		(radeon/R600_rlc.bin 
                 radeon/R700_rlc.bin) External firmware blobs
		# RadeonHD 5000 and above(Evergreen):
		(radeon/CEDAR_me.bin 
                 radeon/CEDAR_pfp.bin 
                 radeon/CEDAR_rlc.bin
                 radeon/CYPRESS_me.bin
                 radeon/CYPRESS_pfp.bin 
                 radeon/CYPRESS_rlc.bin 
                 radeon/JUNIPER_me.bin 
                 radeon/JUNIPER_pfp.bin 
                 radeon/JUNIPER_rlc.bin
		 radeon/REDWOOD_me.bin 
                 radeon/REDWOOD_pfp.bin 
		 radeon/REDWOOD_rlc.bin) External firmware blobs
		(/lib/firmware/) Firmware blobs root directory

If the correct firmware is selected, compile the kernel and reboot.

For example:

CONFIG_EXTRA_FIRMWARE="radeon/PALM_pfp.bin"
CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware/"
Using module auto-detect for a hint

To find out which firmware files are specifically needed, build the radeon driver as a module, install the firmware packages and load the module with kernel modesetting (KMS) enabled.

  • Build the kernel with "Enable KMS by Default" and reboot.
  • In a running system:
modprobe radeon modeset=1
  • Reboot and enable modesetting in the arguments to the kernel:
grub> kernel /KERNEL root=ROOT radeon.modeset=1


Now read the output of dmesg and Xorg.N.log. There should be a line such as" requesting firmware" or "microcode" and card generation. As an example, an X1300 card which is from the R500 generation, the requested file is R520_cp.bin. Newer cards may need more than one file.

If the kernel has an initrd and includes the radeon kernel module, then the initrd should also include the firmware. (If unsure, it is safe to skip this step.)

Recompilation and Configuring

Mesa and X11 Drivers

Edit /etc/make.conf to reflect the new driver:

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


Recompile mesa to support DRI in the new driver. Without this step, 3D support will not work.

emerge -1av mesa


Next, recompile xorg-drivers to pull in the necessary packages for radeon:

emerge -1av x11-base/xorg-drivers


For the best performance with modern drivers, make sure Gallium is selected.

Code: eselect mesa list
r300 (Radeon R300-R500)
  [1]   classic 
  [2]   gallium *
r600 (Radeon R600-R700, Evergreen, Northern Islands)
  [1]   classic 
  [2]   gallium *
sw (Software renderer)
  [1]   classic
  [2]   gallium *

X.Org Configuration

A default radeon setup with KMS installed should not need an /etc/X11/xorg.conf file. If one exists, move it aside to let X.Org auto-detect everything:

mv /etc/X11/xorg.conf /etc/X11/xorg.conf.old

User Settings

For acceleration, users must be in the video group.

gpasswd -a <USERNAME> video

At this point, installation of a default radeon driver is complete. Reboot the system or start X from scratch. If it doesn't start immediately, see the Troubleshooting section.

Testing for 3D Acceleration

3D acceleration can be tested with glxinfo (part of mesa-progs):

glxinfo | grep "renderer string"


If the following string (or similar) appears, hardware acceleration is working:

OpenGL renderer string: Mesa DRI R200 (RV280 5C61) 20090101 x86/MMX+/3DNow!+/SSE TCL DRI2


If the following appears, X was unable to enable the radeon OpenGL driver and is using the software fallback:

OpenGL renderer string: Software Rasterizer


If this happens, see /var/log/Xorg.0.log for errors(which are prefixed with (EE)). If there are no errors in the log, make sure that the user is in the video group.

Additional Features

Dual Monitor Setup

Read the X.Org/Dual Monitors for information on setting up dual monitor support.

Temperature, Fans, Power - LM_sensors

In general, follow the lm_sensors guide.

In order to access sensors on graphic card, I2C must be enabled for Radeon frame buffer driver. (this is outdated information, framebuffer works fine with 3.0.0 series kernels without lm_sensors)

Linux Kernel Configuration: Radeon I2C capability
Device Drivers --->
    Graphics support --->
        <M> Support for frame buffer devices --->
            <M> ATI Radeon display support 
                [*] DDC/I2C for ATI Radeon support

Crossfire

Crossfire is a method of combining the capabilities of two ATI cards. As of 2011-11, it is only supported by the x11-drivers/ati-drivers driver, which has its own article: fglrx.

Not Satisfied? Try some Live Ebuilds!

If you want to use bleeding edge radeon features(and bugs) you might want to try live ebuilds, straight from source control trunk. To do this you need first need to get the x11 overlay using Layman.

Follow the Overlays article for instructions on how to do this.

Overlay packages (especially live ones) are usually KEYWORDed or MASKed. Follow the article on Unmasking Packages for information on this.

Once you have the overlay added, and the packages unmasked:

emerge -uDavN libdrm mesa xf86-video-ati

If you are using gentoo-hardened, please check the Troubleshooting section.

Troubleshooting

Warning: These are user-reports, and are hard to verify, replicate or determine whether they are still valid. Follow instructions at your own peril! Please provide dates and link to bug reports if you add to this section. FILE BUG REPORTS.

X11 Configuration

Modern X11 installs will pick up the radeon driver automatically, but if you find yourself needing to tell X11 to use the radeon driver specifically, set Driver to "radeon" in /etc/X11/xorg.conf.

File: /etc/X11/xorg.conf
...
Section "Device"
        Identifier           "My AMD/ATI Video Card"
        Driver               "radeon"
        Option "AccelMethod" "EXA"

        # AccelDFS is enabled by default on PCI-E cards, but not on AGP cards.
        Option "AccelDFS"    "True"
EndSection
...

Custom EDID

Using of a custom EDID is (at the moment) only possible without KMS. Deactivate KMS with "radeon.modeset=0" or "nomodeset" at command line (grub.conf) and add a line to the "Device" section of your xorg.conf:

File: /etc/X11/xorg.conf
...
Section "Device"
        Identifier           "My AMD/ATI Video Card"
        Driver               "radeon"
        
        Option "CustomEDID" "DVI-0:/MyEdidDir/MyEdid.bin"
        
EndSection
...

Cannot switch to better resolution / refresh rate on VGA connected display

This is because VGA does not have EDID, which is supposed to communicate with the display device, and ask for working display resolutions and refresh rates. Because the EDID is failed, ATI falls back to some driver default settings that are usually decent but might not be the best. First thing to do is determine the resolutions and refresh rates you want to use that are supported by your display. You can calculate modelines with gtf or (my favorite) cvt e.g. cvt WIDTH HEIGHT. Be aware that using refresh rates / resolutions beyond your display's capacity can cause damage to your display. You can look at /var/log/Xorg.0.log to determine what Xorg is currently using (0-CRT / VGA-0) or just use xrandr to get a nice listing for all your auto-detected outputs.

File: /var/log/Xorg.0.log
...
[  1603.609] (II) RADEON(0): Output DVI-0 has no monitor section         <<< no monitor found plugged in
[  1603.618] (II) RADEON(0): EDID for output VGA-0
[  1603.618] (II) RADEON(0): Not using mode "848x480" (hsync out of range)
[  1603.618] (II) RADEON(0): Printing probed modes for output VGA-0     <<< found device on VGA-0 named monitor
...

If you have the correct refresh rates, you need to edit the xorg.con like:

File: /etc/X11/xorg.conf
...
Section "Monitor"

##      This was an annoying mistake from aticonfig --initial :(
#       Identifier   "aticonfig-Monitor[0]-0"
        Identifier   "VGA-0"              <<< this must be the same as the Xorg.0.log shows
        HorizSync    31.5 - 92.0
        VertRefresh  40.0 - 150.0
        ModeLine     "800x600_60.00" 38.2 800 832 912 1024 600 601 604 622 -hsync +vsync       <<< display mode timings, generated from resolution / refresh rate
        ModeLine     "800x600_75.00" 48.9 800 840 920 1040 600 601 604 627 -hsync +vsync
        ModeLine     "800x600_80.00" 53.1 800 840 928 1056 600 601 604 629 -hsync +vsync
        ModeLine     "800x600_85.00" 53.1 800 840 928 1056 600 601 604 629 -hsync +vsync
        ModeLine     "1024x768_60.00" 64.1 1024 1080 1184 1344 768 769 772 795 -hsync +vsync
        ModeLine     "1024x768_75.00" 81.8 1024 1080 1192 1360 768 769 772 802 -hsync +vsync
        ModeLine     "1024x768_80.00" 88.5 1024 1088 1200 1376 768 769 772 804 -hsync +vsync
        ModeLine     "1280x1024_60.00" 108.9 1280 1360 1496 1712 1024 1025 1028 1060 -hsync +vsync
        ModeLine     "1280x1024_75.00" 138.5 1280 1368 1504 1728 1024 1025 1028 1069 -hsync +vsync
        ModeLine     "1280x1024_80.00" 149.6 1280 1376 1512 1744 1024 1025 1028 1072 -hsync +vsync
        Option      "DefaultModes" "false"              <<< asking xorg, to use the custom refresh rates above
        Option      "VendorName" "ATI Proprietary Driver"
        Option      "ModelName" "Generic Autodetecting Monitor"
#       Option      "DPMS" "true"
        Option      "PreferredMode" "1280x1024"         <<< what resolution you prefer at Xorg start up
        Option      "TargetRefresh" "80"              <<< what refresh rate you prefer at Xorg start up 
        Option      "UseEDID" "false"                   <<< disabling EDID, important
EndSection
...

Section "Device"

#       Option      "UseFastTLS" "0"
#       Identifier  "aticonfig-Device[0]-0"
        Identifier  "Radeon"
        Driver      "radeon"
#       Driver      "fglrx"                     <<< with different monitor name it seems to work with fglrx too
        Option      "DynamicClocks" "on"
        Option      "UseEDID" "false"
        Option      "Monitor-CRT1" "VGA-0"      <<< redirect to the monitor's name
        BusID       "PCI:1:5:0"
EndSection

...

Remember, these are my settings, may not work for you. You must recalculate your display modes, this can cause permanent demage to your display!

Frozen or black console on boot

If incorrect firmware is built into the kernel, the console will appear "frozen" or black after the kernel tries to switch the resolution. Switch to a previous kernel with VESA or VGA console support and correct the error.

In some cases, the system may still boot into X.Org, in which case the error can be corrected from there.

Naming of output depends ...

If you are using KMS the output "DVI-0" and "DVI-1" can be switched in relation to "without KMS". This is important in the case of deactivating outputs:

File: /etc/X11/xorg.conf
...
Section "Monitor"
    Identifier     "HDMI-0"
    Option "Ignore" "true"
EndSection

Section "Monitor"
    #is DVI-0 for KMS
    Identifier     "DVI-1"
    Option "Ignore" "true"
EndSection
...

VGA arb prevents direct rendering

Note: Reported by User:Gagern on 2011-09-30

If your Xorg log shows that dri is disabled due to VGA arbitration, then try enabling KMS. The log output indicating that this might be required looks like this:

File: /var/log/Xorg.0.log
...
(WW) RADEON(0): Direct rendering is not supported when VGA arb is necessary for the device
(EE) RADEON(0): [dri] DRIScreenInit failed.  Disabling DRI.
...
(WW) RADEON(0): Direct rendering disabled
(EE) RADEON(0): Acceleration initialization failed
(II) RADEON(0): Acceleration disabled
...

Boot Process stalls (Black screen for 30s)

One common cause for this is having kernel modesetting enabled, but without access to the correct firmware. Try disabling framebuffer/KMS, and try building different (or all available) firmware into the kernel.

X Fails to load mesa with Missing Symbols

Note: 2011-10: Search history for when this was added; is it still relevant?

The -z lazy ld flag is required for the x11 overlay live build, otherwise xserver will fail to load mesa, complaining of missing symbols.

Flickering on wine and low FPS

Try disabling the sync to vblank, to do this you need to set "SwapbuffersWait" to off

File: /etc/X11/xorg.conf
...
Section "Device"
        Identifier "RV770"
        Driver "radeon"
        Option "SwapbuffersWait" "off"
EndSection
Section "dri"
        Mode 0666
EndSection

...

and use driconf to disable vsync OR add this to your .bashrc


File: ~/.bashrc
export vblank_mode=0

See also