ATI (简体中文)

From ArchWiki
Revision as of 09:15, 6 July 2013 by Fengchao (Talk | contribs) (启用 KMS)

Jump to: navigation, search

Tango-preferences-desktop-locale.png本页面需要更新翻译,内容可能已经与英文脱节。要贡献翻译,请访问简体中文翻译组Tango-preferences-desktop-locale.png

附注: please use the first argument of the template to provide more detailed indications.

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

ATI用户有两个选择:官方的专有驱动(catalystAUR)和开源驱动(xf86-video-ati)。

目前,开源驱动在新显卡的 3D 性能上不及官方专属版本,也缺乏TV输出等功能。但另一方面,它能更好地支持双显示,优秀的2D加速,为基于 OpenGL 的窗口管理器Compiz 或 KWin 提供了足够的 3D 加速。

如果你不确定该用哪种,请先试一试开源版的。开源驱动能满足大多数的需要,而且,一般来说遇到的麻烦也更少些。查看现在功能开发进展情况可访问 功能矩阵

命名规范

ATI's Radeon brand follows a naming scheme that relates each product to a market segment. Within this article, readers will see both product names (e.g. HD 4850, X1900) and code or core names (e.g. RV770, R580). Traditionally, a product series will correspond to a core series (e.g. the "X1000" product series includes the X1300, X1600, X1800, and X1900 products which utilize the "R500" core series – including the RV515, RV530, R520, and R580 cores).

具体对应关系可以查看维基百科: Wikipedia:Comparison of AMD graphics processing units.

概览

xf86-video-ati(radeon) 驱动:

  • Works with Radeon chipsets up to HD 6xxx and 7xxxM (latest Northern Islands chipsets).
    • Radeons X1xxx 以及之前的显卡系列,拥有稳定、完整的功能以及2D、3D加速功能。
    • Radeons HD 2xxx 到 HD 6xxx系列具备完整2D加速和较好的3D加速功能,但相比ati官方驱动,功能仍然不全(比如, powersaving仍然处于测试阶段)。
    • 支持DRI1, RandR 1.2/1.3, EXA加速和Kernel-Mode-Setting/DRI2(使用最新的linux kernel,libDRM和mesa版本)。

Generally, xf86-video-ati should be your first choice, no matter which ATI card you own. In case you need to use a driver for newer ATI cards, you should prefer the proprietary catalyst driver.

Note: xf86-video-ati is recognized as "radeon" by Xorg (in xorg.conf).

安装

注意: 如果你之前安装过私有驱动(catalyst),请确认卸载,删除老的/etc/X11/xorg.conf,并重启系统。

安装 位于 官方软件仓库xf86-video-ati

The -git version of the driver and other needed packages (linux-git, etc) can be found in the radeon repository or the AUR.

配置

Xorg 会自动装入驱动并通过 EDID 获得显示器分辨率,只有性能优化时才需要额外配置。

如果要手动配置,请添加文件 /etc/X11/xorg.conf.d/20-radeon.conf, 并加入:

Section "Device"
    Identifier "Radeon"
    Driver "radeon"
EndSection

通过此段可以调整显卡的设置。

Kernel mode-setting (KMS)

KMS enables native resolution in the framebuffer and allows for instant console (tty) switching. KMS also enables newer technologies (such as DRI2) which will help reduce artifacts and increase 3D performance, even kernel space power-saving.

KMS for ATI video cards requires the Xorg free video user space driver xf86-video-ati version 6.12.4 or later.

启用 KMS

从 2.6.33 内核开始, ATI 显卡的 KMS 已经默认 启用

KMS 早启动

这种方法会在 boot process 中尽早地启动 KMS(当 initramfs 被载入的时候)。

如果你使用特殊的内核(如 linux-zen), 需要注意使用正确的 mkinitcpio 配置文件,如 /etc/mkinitcpio-zen.conf。以下指导是为默认内核编写的 (linux)。

  1. Remove all vga= options from the kernel line in the bootloader configuration file (/boot/grub/menu.lst for GRUB users). Using other framebuffer drivers (such as uvesafb or radeonfb) will conflict with KMS. Remove any framebuffer related modules from /etc/mkinitcpio.conf. video= can now be used in conjunction with KMS.
  2. Add radeon to MODULES array in /etc/mkinitcpio.conf. For AGP support, it is necessary to add intel_agp (or ali_agp, ati_agp, amd_agp, amd64_agp etc.) before the radeon module.
  3. Re-generate your initramfs: # mkinitcpio -p linux
  4. AGP speed can be set with radeon.agpmode=x kernel option, where x is 1, 2, 4, 8 (AGP speed) or -1 (PCI mode).
  5. Reboot the system.

晚启动

With this choice, KMS will be enabled when modules are loaded during the boot process.

If you have a special kernel (e.g. linux-zen), remember to use appropriate mkinitcpio configuration file, e.g. /etc/mkinitcpio-zen.conf. These instructions are written for the default kernel (linux).

  1. Remove all vga= options from the kernel line in the bootloader configuration file (/boot/grub/menu.lst for GRUB users). Using other framebuffer drivers (such as uvesafb or radeonfb) will conflict with KMS. Remove any framebuffer related modules from /etc/mkinitcpio.conf. video= can now be used in conjunction with KMS.
  2. Add radeon to MODULES array in /etc/rc.conf. For AGP support, it may be necessary to add intel_agp (or ali_agp, ati_agp, amd_agp, amd64_agp etc.) before the radeon module.
  3. Reboot the system.
Tip: Some users have reported faster udev module loading by adding options radeon modeset=1 to /etc/modprobe.d/modprobe.conf.

Kernel Mode Setting 问题解决

停用KMS

Users should consider disabling kernel mode-setting if encountering kernel panics, distorted framebuffer on boot, no GPU signal, Xorg refusing to start, Xorg falling back to Mesa software rasterizer (no 3D acceleration) or 'POWER OFF' problem (kernel 2.6.33-2)at shutdown.

  1. Add radeon.modeset=0 (or nomodeset, if this does not work) to the kernel options line in the bootloader configuration file (/boot/grub/menu.lst for GRUB users). That should work.
    Note: Adding nomodeset to the kernel boot line might prevent Gnome 3's gnome-shell or KDE's desktop effects from running.
    If you want to remove KMS support from the initramfs, follow the next two steps.
  2. If radeon was added to the MODULES array in mkinitcpio.conf to enable early start, remove it.
  3. Rebuild the initramfs with
    # mkinitcpio -p linux

Alternatively, module options can be specified in a file within the /etc/modprobe.d directory. If using the radeon module (lsmod | grep radeon) disable KMS by creating a file containing the above code:

/etc/modprobe.d/radeon.conf
options radeon modeset=0

Renaming xorg.conf

Renaming /etc/X11/xorg.conf, which may include options that conflict with KMS, will force Xorg to autodetect hardware with sane defaults. After renaming, restart Xorg.

性能调整

下面这些选项属于/etc/X11/xorg.conf.d/20-radeon.conf. By design, xf86-video-ati runs at AGP 4x speed. It is generally safe to modify this. If you notice hangs, try reducing the value or removing the line entirely (you can use values 1, 2, 4, 8). If KMS is enabled, this option is not used and it is superseded by radeon.agpmode kernel option.

Option "AGPMode" ""

       Option "ColorTiling" "on"

ColorTiling 启用是绝对安全的,并且这被认为是默认的设置。 Most users will notice increased performance but its not yet supported on R200 and earlier cards. Can be enabled on earlier cards, but the workload is transferred to the CPU

Option "ColorTiling" "on"

Acceleration architecture; this will work only on newer cards. If you enable this and then cannot get back into X, remove it.

Option "AccelMethod" "EXA"

Page Flip is generally safe to enable. This would mostly be used on older cards, as enabling this would disable EXA. With recent drivers can be used together with EXA.

Option "EnablePageFlip" "on"

AGPFastWrite will enable fast writes for AGP cards. This one can cause instabilities, so be prepared to remove it if you cannot get into X. This option is not used when KMS is on.

Option "AGPFastWrite" "yes"

EXAVSync option attempts to avoid tearing by stalling the engine until the display controller has passed the destination region. It reduces tearing at the cost of performance and has been know to cause instability on some chips. Really useful when enabling Xv overlay on videos on a 3D accelerated desktop. It is not necessary when KMS (thus DRI2 acceleration) is enabled.

Option "EXAVSync" "yes"

Bellow is a sample config file /etc/X11/xorg.conf.d/20-radeon.conf:

Section "Device"
       Identifier  "My Graphics Card"
        Option	"AGPMode"               "8"   #not used when KMS is on
	Option	"AGPFastWrite"          "off" #could cause instabilities enable it at your own risk
	Option	"SWcursor"              "off" #software cursor might be necessary on some rare occasions, hence set off by default
	Option	"EnablePageFlip"        "on"  #supported on all R/RV/RS4xx and older hardware and set off by default
	Option	"AccelMethod"           "EXA" #valid options are XAA and EXA. EXA is the newest acceleration method and its the default.
	Option	"RenderAccel"           "on"  #enabled by default on all radeon hardware
	Option	"ColorTiling"           "on"  #enabled by default on RV300 and later radeon cards.
	Option	"EXAVSync"              "off" #default is off, otherwise on
	Option	"EXAPixmaps"            "on"  #when on icreases 2D performance, but may also cause artifacts on some old cards
	Option	"AccelDFS"              "on"  #default is off, read the radeon manpage for more information
EndSection

Defining the gartsize, if not autodetected, can be done with the following option:

In the kernel options (in this case syslinux.cfg):

APPEND root=/dev/sda1 ro 5 radeon.modeset=1 radeon.agpmode=8 radeon.gartsize=32 quiet

Size is in megabytes and 32 is for RV280 cards.

Alternatively, do it with a modprobe option in /etc/modprobe.d/radeon.conf:

options radeon gartsize=32

For further information and other options, read the radeon manpage and the module's info page:

man radeon
modinfo radeon

A fine tool to try is driconf. It will allow you to modify several settings, like vsync, anisotropic filtering, texture compression, etc. Using this tool it is also possible to "disable Low Impact fallback" needed by some programs (e.g. Google Earth).

Activate PCI-E 2.0

Can be unstable with some motherboards or not produce any performarce, test yourself adding "radeon.pcie_gen2=1" on the kernel command line.

More info on Phoronix article

节能

节能部分对是否启用 KMS 完全不同。

启用 KMS

使用 radeon 驱动,节能默认是禁用的,但是现在通常的内核 (本文写作时是 2.6.35 ) 提供了一个 "sysfs" 工具来启用它。

Power saving through KMS is still a work in progress for the most part. It should work, but some chips do have problems with it. A common issue for all is screen blinking when the kernel switches between power states, and in some configurations it even causes system freezes. But KMS is awesome, so it is your choice. The UMS method is generally more stable, however its power savings might not be as good as those provided by KMS options.

有可以使用 (未支持的) [radeon] 仓库:

This repository will grant you up-to-date packages of the radeon driver and its dependencies, from (mostly) git snapshots.

[mesa-git]
Server = http://pkgbuild.com/~lcarlier/$repo/$arch/

You can select the methods via sysfs.

With root access, you have two choices:

1. Dynamic frequency switching (depending on GPU load)

# echo dynpm > /sys/class/drm/card0/device/power_method

The "dynpm" method dynamically changes the clocks based on the number of pending fences, so performance is ramped up when running GPU intensive apps, and ramped down when the GPU is idle. The re-clocking is attempted during vertical blanking periods, but due to the timing of the re-clocking functions, does not always complete in the blanking period, which can lead to flicker in the display. Due to this, dynpm only works when a single head is active.

注意: The "profile" method mentioned below is not as aggressive as "dynpm," but is currently much more stable and flicker free and works with multiple heads active.

2. Profile-based frequency switching

# echo profile > /sys/class/drm/card0/device/power_method

The "profile" mode will allow you to select one of the five profiles below. Different profiles, for the most part, end up changing the frequency/voltage of the card.

  • "default" uses the default clocks and does not change the power state. This is the default behavior.
  • "auto" selects 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 only uses "low" when displays are off.
  • "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.

So lets say we want the "low" option...for this, run the following command:

# echo low > /sys/class/drm/card0/device/power_profile

Replace "low" with any of the aforementioned profiles as necessary.

注意: Echoing a profile value to this file is not permanent, so when you find something that fits your needs, you will need to add it to /etc/rc.local, so it is executed at system startup.

Power management is supported on all asics (r1xx-evergreen) that include the appropriate power state tables in the vbios; not all boards do (especially older desktop cards).

To view the voltage that the GPU is running at, perform the following command and you will get something like this output:

$ cat /sys/kernel/debug/dri/0/radeon_pm_info
  state: PM_STATE_ENABLED
  default engine clock: 300000 kHz
  current engine clock: 300720 kHz
  default memory clock: 200000 kHz

If /sys/kernel/debug is empty, run this command:

# mount -t debugfs none /sys/kernel/debug

To permanently mount, add the following line to /etc/fstab:

debugfs   /sys/kernel/debug   debugfs   defaults   0   0

It depends on which GPU line yours is, however. Along with the radeon driver versions, kernel versions, etc. So it may not have much/any voltage regulation at all.

Thermal sensors are implemented via external i2c chips or via the internal thermal sensor (rv6xx-evergreen only). To get the temperature on asics that use i2c chips, you need to load the appropriate hwmon driver for the sensor used on your board (lm63, lm64, etc.). The drm will attempt to load the appropriate hwmon driver. On boards that use the internal thermal sensor, the drm will set up the hwmon interface automatically. When the appropriate driver is loaded, the temperatures can be accessed via lm_sensors tools or via sysfs in /sys/class/hwmon .

There is a GUI for switching profiles here (available in AUR).

未启用 KMS

xorg.conf 文件中的 "Device" 部分添加两行:

       Option      "DynamicPM"          "on"
       Option      "ClockGating"        "on"

如果这两个选项正确启用,你可以在 /var/log/Xorg.0.log 中看见如下几行:

       (**) RADEON(0): Option "ClockGating" "on"
       (**) RADEON(0): Option "DynamicPM" "on"
       Static power management enable success
       (II) RADEON(0): Dynamic Clock Gating Enabled
       (II) RADEON(0): Dynamic Power Management Enabled

如果你喜欢低耗电,你可以在 "Device" 部分再添加以下一行:

       Option      "ForceLowPowerMode"   "on"

TV输出(TV out)

Tango-view-refresh-red.pngThis article or section is out of date.Tango-view-refresh-red.png

Reason: please use the first argument of the template to provide a brief explanation. (Discuss in Talk:ATI (简体中文)#)

自2007年8月起,所有集成了tv-out功能的Radeon显卡都有了驱动的tv-out支持。

目前tv-out还有一些局限:它对输出的自动识别并不总是正确,而且只支持NTSC制式。

首先,检查你的S端子输出:xrandr应该会给你类似如下的结果:

Screen 0: minimum 320x200, current 1024x768, maximum 1280x1200
...
S-video disconnected (normal left inverted right x axis y axis)

现在我们要告诉Xorg线已经插好了(确实插好了,是吧?)

xrandr --output S-video --set load_detection 1

设定TV制式标准

xrandr --output S-video --set tv_standard ntsc

为它添加一个分辨率(目前只支持800x600)

xrandr --addmode S-video 800x600

我打算使用复制模式(clone mode)

xrandr --output S-video --same-as VGA-0

好了,让我们来看看效果吧

xrandr --output S-video --mode 800x600

这时,在电视上你应该能看到你的桌面,分辨率是800x600。

要关掉这一输出:

xrandr --output S-video --off

你可能还发现视频只在显示器上播放,而电视上没有。XV_CRTC属性控制着Xv overlay的输出方向。

把输出指向电视:

xvattr -a XV_CRTC -v 1

要切换回显示器,把1改成0-1应用于双头显示(dual head)设置中的自动切换。

Please see Enabling TV-Out Statically for how to enable TV-out in your xorg configuration file.

Force TV-out in KMS

Kernel can recognize video= parameter in following form:

 video=<conn>:<xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd]

(see KMS)

For example:

 video=DVI-I-1:1280x1024-24@60e

or

 "video=9-pin DIN-1:1024x768-24@60e"

Parameters with whitespaces must be quoted. Current mkinitcpio implementation also requires # before. For example:

 root=/dev/disk/by-uuid/d950a14f-fc0c-451d-b0d4-f95c2adefee3 ro quiet radeon.modeset=1 security=none # video=DVI-I-1:1280x1024-24@60e "video=9-pin DIN-1:1024x768-24@60e"
  • Grub can pass such command line as is.
  • Lilo needs backslashes for doublequotes (append="...... # .... \"video=9-pin DIN-1:1024x768-24@60e\"")
  • Grub2: TODO

You can get list of your video outputs with following command:

ls -1 /sys/class/drm/ | grep -E '^card[[:digit:]]+-' | cut -d- -f2-

HDMI输出声音

xf86-video-ati can enable HDMI audio output for all supported chipsets up to r7xx when using KMS. Just use xrandr to enable the output and Test as described below.

Testing HDMI Audio

  1. Connect your PC to the Display via HDMI cable.
  2. Use xrandr to get picture to the Display. Ex: xrandr --output DVI-D_1 --mode 1280x768 --right-of PANEL. Simply typing xrandr will give you a list of your valid outputs.
  3. Run aplay -l to get the list of your sound devices. Find HDMI and note the card number and corresponding device number. Example of what you want to see: card 1: HDMI [HDA ATI HDMI], device 3: ATI HDMI [ATI HDMI]
  4. Try sending sound to this device: aplay -D plughw:1,3 /usr/share/sounds/alsa/Front_Center.wav. Be sure to change plughw:z,y to match your hardware number found with last command. You should be able to hear the test sound from your Display.
  • The audio module is disabled by default in kernel >=3.0. Add radeon.audio=1 to the end of your "kernel" line in /boot/grub/menu.lst to enable it.
  • See this thread

Dual Head Setup

Independent X Screens

Independent dual-headed setups can be configured the usual way. However you might want to know that the radeon driver has a "ZaphodHeads" option which allows you to bind a specific device section to an output of your choice, for instance using:

       Section "Device"
       Identifier     "Device0"
       Driver         "radeon"
       Option         "ZaphodHeads"   "VGA-0"
       VendorName     "ATI"
       BusID          "PCI:1:0:0"
       Screen          0
       EndSection

This can be a life-saver, because some cards which have more than two outputs (for instance one HDMI out, one DVI, one VGA), will only select and use HDMI+DVI outputs for the dual-head setup, unless you explicitely specify "ZaphodHeads" "VGA-0".

Moreover, this option allows you to easily select the screen you want to mark as primary.

已知问题及解决

I encounter artifacts when logging into my DE or WM

If you encounter artifacts, first try starting X without /etc/X11/xorg.conf. Recent versions of Xorg are capable of reliable auto-detection and auto-configuration for most use cases. Outdated or improperly configured xorg.conf files are known to cause trouble.

In order to run without a configuration tile, it is recommended that the xorg-input-drivers package group be installed.

Artifacts may also be related to kernel mode setting. Consider disabling KMS.

You may as well try disabling EXAPixmaps to Section "Device" in /etc/X11/xorg.conf:

Option "EXAPixmaps" "off"

AccelDFS option is likely to cause the artifacts, try disabling this as well

Option "AccelDFS" "off"

I have installed a free driver and my card is painfully slow

注意: Make sure you are member of video group.

Some cards can be installed by default trying to use KMS. You can check whether this is your case running:

dmesg | egrep "drm|radeon"

This command might show something like this, meaning it is trying to default to KMS:

[drm] radeon default to kernel modesetting.
...
[drm:radeon_driver_load_kms] *ERROR* Failed to initialize radeon, disabling IOCTL

If your card is not supported by KMS (anything older than r100), then you can disable KMS. This should fix the problem.

AGP is disabled (with KMS)

If you experience poor performance and dmesg shows something like this

[drm:radeon_agp_init] *ERROR* Unable to acquire AGP: -19

then check if the agp driver for your motherboard (e.g., via_agp, intel_agp etc.) is loaded before the radeon module, see Enabling KMS.

My TV is showing a black border around the screen

When I connected my TV to my Radeon HD 5770 using the HDMI port, the TV showed a blurry picture with a 2-3cm border around it. This is not the case when using the proprietary driver. However, this protection against overscanning (see Wikipedia:Overscan) can be turned off using xrandr:

xrandr --output HDMI-0 --set underscan off

Black screen and no console, but X works in KMS

This is a solution to no-console problem that might come up, when using two or more ATI cards on the same PC. Fujitsu Siemens Amilo PA 3553 laptop for example has this problem. This is due to fbcon console driver mapping itself to wrong framebuffer device that exist on the wrong card. This can be fixed by adding a this to the kernel boot line:

fbcon=map:1

This will tell the fbcon to map itself to the /dev/fb1 framebuffer dev and not the /dev/fb0, that in our case exist on the wrong graphics card.


Some 3D applications show textures as all black or crash

You might need texture compression support, which is not included with the open source driver. Install libtxc_dxtn (and lib32-libtxc_dxtn for multilib systems).

2D performance (e.g. scrolling) is slow

If you have problem with 2D performance, like scrolling in terminal or browser, you might need to add Option "MigrationHeuristic" "greedy" into the "Device" section of your xorg.conf file.

Bellow is a sample config file /etc/X11/xorg.conf.d/20-radeon.conf:

Section "Device"
        Identifier  "My Graphics Card"
        Driver  "radeon"
        Option  "MigrationHeuristic"  "greedy"
EndSection

满屏彩色竖线条 发生在主板为RS482 (Xpress 200M 系列) 不论是开了还是关了KMS

问题描述:在主板为RS482 (Xpress 200M 系列) ,系统启动到x的时候,会发生满屏的彩色竖线条,导致屏幕的内容完全看不到。

问题严重程度:自从有了kms后,就开始出现这问题。出现之后,x完全不可用。

问题解决:之前一开始以为是kms问题,但最近的更新(20121001起),发现即使是关了kms仍然无法解决此问题,之后经过研究,发现是dri引起的。详情可见:[1]

初步解决办法:关闭dri (具体的就是在xorg.conf的Section "Device"处,反注释有NoAccel的那一行,把NoAccel 的属性改为True)

副作用:启动还是会有彩色竖线条,如果是笔记本,只要合上,休眠后再开启,即可消除彩色竖线条。如果是台式机,可以抹黑重启x,即可解决问题。另外,不能使用任何3维加速软件,使用必出现各种问题