ATI (简体中文)
| Summary |
|---|
| 有关 ATI/AMD显卡的开源驱动。 |
| Related |
| AMD Catalyst |
| Xorg |
ATI/AMD显卡用户有两个选择:官方的专有驱动(catalyst)和开源驱动(xf86-video-ati)。本文介绍开源驱动.
目前,开源驱动在新显卡的 3D 性能上不及官方专属版本,也缺乏TV输出等功能。但另一方面,它能更好地支持双显示,优秀的2D加速,为基于 OpenGL 的窗口管理器如 Compiz 或 KWin 提供了足够的 3D 加速。
如果你不确定该用哪种,请先试一试开源版的。开源驱动能满足大多数的需要,而且,一般来说遇到的麻烦也更少些。查看现在功能开发进展情况可访问 功能矩阵。
Contents |
命名规范
ATI的Radeon品牌遵循这样的命名规则:每个产品关联与某个市场分段.这篇文章中读者将会见到产品名(比如 HD 4850, X1900)与代码或者核心名(比如 RV770, R580). 传统地, 一个产品系列将匹配一个核心系列 (比如产品系列 "X1000" 包含 X1300, X1600, X1800, 和 X1900 ,他们的核心系列是"R500" – 包含 RV515, RV530, R520, 和 R580 核心).
具体对应关系可以查看维基百科: Wikipedia:Comparison of AMD graphics processing units.
概览
xf86-video-ati(radeon) 驱动:
- 支持至 Radeon HD 6xxx 和 7xxxM 显卡系列(“北方群岛” 系列显卡)。
- HD 77xx (南方群岛系列)部分支持.查看功能矩阵以了解不受支持的功能.
- Radeons X1xxx 以及之前的显卡系列,拥有稳定、完整的功能以及2D、3D加速功能。
- Radeons HD 2xxx 到 HD 6xxx系列具备完整2D加速和较好的3D加速功能,但相比ati官方驱动,功能仍然不全(比如, powersaving仍然处于测试阶段)。
- 支持 DRI1, RandR 1.2/1.3/1.4, EXA 加速 和 kernel mode-setting/DRI2.
一般来说,xf86-video-ati 应该是是你的首选,无论你用什么ATI显卡。当然如果你使用的是最新ATI显卡,你可能更喜欢 catalyst 驱动。
安装
安装 位于 官方软件仓库 的 xf86-video-ati。
配置
Xorg 会自动装入驱动并通过 EDID 获得显示器分辨率,只有性能优化时才需要额外配置。
如果要手动配置,请添加文件 /etc/X11/xorg.conf.d/20-radeon.conf, 并加入:
Section "Device"
Identifier "Radeon"
Driver "radeon"
EndSection
通过此段可以调整显卡的设置。
Kernel mode-setting (KMS)
KMS 支持 framebuffer 原始分辨率以及允许即时控制台切换(tty),同时支持新技术(如 DRI2),有利于减少失真,提高3D性能,甚至是内核级的电源管理
启用 KMS 需要 Xorg 用户级的显卡驱动 xf86-video-ati
早启动
这两种方法会在 boot process 中尽早地启动 KMS(当 initramfs 被载入的时候)。
1. 移除所有与KMS冲突的UMS驱动的内核参数:
- 在启动引导器配置文件中,从kernel行移除所有的
vga=选项.使用其他的framebuffer驱动(比如uvesafb或者radeonfb)将冲突于KMS. - AGP速度可以通过内核选项
radeon.agpmode=x设置, x可以是 1, 2, 4, 8 (AGP 速度) 或者 -1 (PCI 模式).
2. 也可以在initramfs被加载时启用:
- 如果你是非官方内核(比如 linux-zen), 需要注意使用单独的(并且正确的)mkinitcpio配置文件 (比如
/etc/mkinitcpio-zen.conf) 而不是/etc/mkinitcpio.conf. - 从mkinitcpio配置中移除所有framebuffer相关模块.
- 添加
radeon到mkinitcpio配置文件的MODULES列.若需要AGP支持,在radeon之前添加适用于你的芯片组的AGP驱动程序(intel_agp,ali_agp,ati_agp,amd_agp,amd64_agp等等). - 重生成你的 initramfs.
最后,重启系统.
晚启动
若使用这种方式,在boot process中KMS将在模块被加载时激活.
如果你使用特殊的内核(如 linux-zen), 需要注意使用正确的 mkinitcpio 配置文件,如 /etc/mkinitcpio-zen.conf。以下指导是为默认内核编写的(linux).
- 在启动引导器配置文件中,从kernel行移除所有的
vga=选项.使用其他的framebuffer驱动(比如uvesafb或者radeonfb)将冲突于KMS.从/etc/mkinitcpio.conf配置中移除所有framebuffer相关模块.video=现在可以与KMS一起使用. - 重启系统.
性能调整
下面这些选项属于/etc/X11/xorg.conf.d/20-radeon.conf.
ColorTiling 是绝对安全的,并且默认被启用. 大多数用户能注意到性能的提升,但是这个功能R200及更早的显卡不支持. 早的显卡虽可以启用,但是工作负担转移到了cpu上
Option "ColorTiling" "on"
Acceleration architecture; 这只在新卡上有用. 如果你激活了这个功能然后进不了X,删除这个选项吧
Option "AccelMethod" "EXA"
Page Flip 一般来说是安全的. 老显卡可以启用这个功能,不过这样将会禁用EXA. 最近的驱动可以使这项功能和EXA都启用.
Option "EnablePageFlip" "on"
EXAVSync 选项试图通过stalling the engine until the display controller has passed the destination region来避免撕裂。在开启了Xv overlay视频选项的3D加速桌面非常有用,使用KMS时则没有必要。
Option "EXAVSync" "yes"
下面是一个简单的配置文件示例: /etc/X11/xorg.conf.d/20-radeon.conf:
Section "Device" Identifier "My Graphics Card" Driver "radeon" 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 on by default Option "AccelMethod" "EXA" #valid options are XAA, EXA and Glamor. EXA is 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. Only works if EXA activated Option "EXAPixmaps" "on" #when on icreases 2D performance, but may also cause artifacts on some old cards. Only works if EXA activated Option "AccelDFS" "on" #default is off, read the radeon manpage for more information EndSection
如果gartsize没有自动检测到,可以通过向kernel parameters添加radeon.gartsize=32来实现,单位时Mb,32用于RV280显卡。
另外可以向modprobe文件/etc/modprobe.d/radeon.conf里添加选项实现:
options radeon gartsize=32
其他选项,可以阅读radeon manpage和模块的info page: man radeon, modinfo radeon.
可以尝试 driconf. 可以设置如 vsync, anisotropic filtering, texture compression 等诸多选项。还可以实现一些程序需要的"disable Low Impact fallback"选项(比如Goole Earth)。
关闭 PCI-E 2.0
从3.6版内核开始,radeon里PCI-E v2.0选项默认启用。
对一些主板可能不稳定,可以向kernel command line添加radeon.pcie_gen2=0来关闭。
Glamor
Glamor是一种使用OpenGL的 2D加速方式,适用于R300及以上显卡驱动。
自xf86-video-ati版本1:7.2.0-1后, 在radeonsi(南方群岛系列 和 superior GFX cards)上glamor默认启用; 在其他显卡上想启用的话,添加 AccelMethod glamor 到你的 xorg.conf 文件的Device部分:
Option "AccelMethod" "glamor"
然而,使用前必须加上以下部分
Section "Module" Load "dri2" Load "glamoregl" EndSection
混合交火
It is the technology used on recent laptops equiped with two GPUs, one power-efficent (generally Intel integrated card) and one more powerful and more power-hungry (generally Radeon or Nvidia). There are three ways to get it work:
- If you do not need to run any GPU-hungry application, you can plainly disable the discrete card:
echo OFF > /sys/kernel/debug/vgaswitcheroo/switch. You can do more things with vgaswitcheroo (see Ubuntu wiki for more information) but ultimately at best one card is bound to one graphic session, you cannot use both on one graphic session. - You can use PRIME. It is the proper way to use hybrid graphics on Linux but still requires a bit of manual intervention from the user.
- You can also use bumblebee with radeon, there is a bumblebee-amd-git package on AUR.
节能
开源驱动的节电功能默认关闭,需要可手动启用.
三种方法可供选择:
不好说哪个方法对你最合适, 你该自己试试.
所有vbios中有合适的电源状态表的芯片(R1xx和更新的)都支持电源管理. "dpm" 仅在R6xx和更新的芯片上被支持.(Power management is supported on all chips that include the appropriate power state tables in the vbios (R1xx and newer). "dpm" is only supported on R6xx and newer chips.)
详见 http://www.x.org/wiki/RadeonFeature/#index3h2 .
老方法
动态频率调整
此方法根据GPU负载自动改变时钟频率,所以性能忙碌时自动提高,空闲时降低。自动降频试图在垂直消隐期间工作,但由于 降频函数运行时间限制,在周期内可能无法完成,这可能导致显示闪烁。因此,动态调整只能在单显卡下正常工作。
可以通过以下命令启用:
# echo dynpm > /sys/class/drm/card0/device/power_method
基于配置文件的频率调整
该方法允许你选择5种不同工作方式。这些方式不同大部分在于时钟频率和电压。这种方式不同于激进方式,所以更稳定,少闪屏。而且可以在多显卡环境下工作
要激活此方式,可运行以下命令:
# echo profile > /sys/class/drm/card0/device/power_method
可选的配置文件方式:
-
default使用默认时钟频率,不改变时钟状态。这是默认启用方式。 -
auto根据系统是否使用电池,在状态mid和high间自动切换,当显示器进入节能状态时,将自动切换为 *low方式 -
low强制GPU一直以最低功耗运行,注意此方式在某些笔记本上可能导致显示问题。这就是*auto方式只有在显示器关闭时才启用此方式的原因。 -
mid强制GPU一直以中等功耗运行,当显示器进入节能状态时,将自动切换为 *low方式 -
high强制GPU以最高频率运行,此时性能最高,功耗也最高。同样当显示器进入节能状态时,将自动切换为 *low方式
例如,我们可以激活low 配置方式,你可以根据需要替换为上述其他方式:
# echo low > /sys/class/drm/card0/device/power_profile
永久配置
上述方法不是永久性的,系统重启后将丢失。为了让它一直有效,你可以使用systemd-tmpfiles (例如 #Dynamic frequency switching):
/etc/tmpfiles.d/radeon-pm.conf
w /sys/class/drm/card0/device/power_method - - - - dynpm
你也可以使用udev规则替代 (例如 #Profile-based frequency switching):
/etc/udev/rules.d/30-radeon-pm.rules
KERNEL=="dri/card0", SUBSYSTEM=="drm", DRIVERS=="radeon", ATTR{device/power_method}="profile", ATTR{device/power_profile}="low"
KERNEL=="card0", SUBSYSTEM=="drm", DRIVERS=="radeon", ATTR{device/power_method}="profile",
图形化工具
- Radeon-tray — 通过状态栏图标控制配置方式的小工具。基于PyQt4编写,适合非gnome桌面的用户。
- power-play-switcher — 控制开源Radeon驱动电源的小工具
- Gnome-shell-extension-Radeon-Power-Profile-Manager — gnome-shell扩展,允许你改变开源Radeon驱动的电源配置方式
- https://github.com/StuntsPT/shell-extension-radeon-power-profile-manager || gnome-shell-extension-radeon-ppm gnome-shell-extension-radeon-power-profile-manager-git
注意
要查看当前GPU频率,可以运行如下命令,你可以看到类似如下输出:
$ 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
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.
动态电源管理
内核3.11已默认启用ASPM,但没有启用DPM。如果要启用可加入参数 radeon.dpm=1 到 kernel parameters。
不像#动态频率调整,“dpm"方式根据GPU负载情况动态调整时钟频率和电压,同时它会启用频率和电压门控.
TV输出(TV out)
自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)
设定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 (see KMS for more details):
video=<conn>:<xres>x<yres>[M][R][-<bpp>][@<refresh>][i][m][eDd]
For example:
video=DVI-I-1:1280x1024-24@60e
Parameters with whitespaces must be quoted:
"video=9-pin DIN-1:1024x768-24@60e"
Current mkinitcpio implementation also requires # in front. 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 audio
HDMI audio is supported in the xf86-video-ati video driver. By default HDMI audio is disabled in the driver kernel versions >=3.0 because it can be problematic. However, if your Radeon card is listed in the Radeon Feature Matrix it may work. To enable HDMI audio add radeon.audio=1 to the Kernel parameters.
- If there is no video after bootup, the driver option will have to be disabled.
- If HDMI audio doesn't simply work after installing the driver, test your setup with the procedure at Advanced_Linux_Sound_Architecture#HDMI_output_does_not_work.
Notes:
- As of 2013-09-20, the driver doesn't support HDMI Audio for Central Islands cards.
- If the sound is distorted in PulseAudio try setting
tsched=0and make surertkitdaemon is running.
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".
启动视频加速
最新 mesa 包已为开源驱动带来MPEG1/2的硬件解码支持,安装 libvdpau 后将自动启用。
你也可以通过声明环境变量 LIBVA_DRIVER_NAME 为 vdpau 和 VDPAU_DRIVER 对应驱动强制启用
例如:
~/.bashrc
export LIBVA_DRIVER_NAME=vdpau export VDPAU_DRIVER=r600
对于基于 r600 系列的显卡,所有可用VDPAU 驱动位于 /usr/lib/vdpau/) 目录下找到
关闭垂直同步刷新
radeon 驱动默认启用垂直同步刷新,除了跑分外各种情况下工作良好。要关闭它,可以创建 ~/.drirc (如果已存在请修改),加入以下部分 :
~/.drirc
<driconf>
<device screen="0" driver="dri2">
<application name="Default">
<option name="vblank_mode" value="0" />
</application>
</device>
<!-- Other devices ... -->
</driconf>
也可以通过以下方法
~/.bashrc
export vblank_mode=0
注意它仅对 dri2 起作用,不针对显卡型号(如 r600 )。
故障排除
Artifacts upon logging in
如果遇到了artifacts, 先试试不用/etc/X11/xorg.conf启动X. 最近版本的Xorg有可靠的自动检测/配置能力.过时或者不当的 xorg.conf 会导致问题.
不以配置文件启动时,推荐先安装xorg-input-drivers软件包组.
你也可以试着禁用 EXAPixmaps.在/etc/X11/xorg.conf.d/20-radeon.conf中:
Section "Device"
Identifier "Radeon"
Driver "radeon"
Option "EXAPixmaps" "off"
EndSection
若想进一步地调整,还可以禁用 AccelDFS:
Option "AccelDFS" "off"
添加没有被侦测到的分辨率
比如,EDID在DisplayPort连接上失效(e.g. When EDID fails on a DisplayPort connection. )
参见Xrandr的文章.
AGP被禁用(KMS启用)
如果性能很差,dmesg也有如下信息
[drm:radeon_agp_init] *ERROR* Unable to acquire AGP: -19
那么检查针对你主板的agp驱动(如 via_agp, intel_agp 等)是否在 radeon 前被加载, 参见 #启用 KMS.
电视屏幕显示黑边
我的Radeon HD 5770用HDMI连接到电视时, 电视显示图像模糊,周围有2-3cm黑边,用催化剂时不是这样. 这是对付过扫描(Overscan)的(参见Wikipedia:Overscan),使用xrandr关闭它:
xrandr --output HDMI-0 --set underscan off
从睡眠恢复后X显示一个黑屏,鼠标指针还在
32MB或者更低的卡可能会有这个问题. 鼠标指针移动过的区域可能会被重绘.在 /etc/X11/xorg.conf.d/20-radeon.conf 中强制EXAPixmaps 为 "enabled" 可能能解决此问题.参见#性能调整 .
X1300上KDE4没有桌面特效
KDE4的一个问题可能使视频硬件检测不准确,因此禁用了桌面特效,即使X1300的GPU有足够的能力. 一个可行的办法是,禁用掉KDE的检测,在/usr/share/kde-settings/kde-profile/default/share/config/kwinrc 和/或 .kde/share/config/kwinrc中
添加
DisableChecks=true
到 [Compositing] 部分. 确保compositing是启用的:
Enabled=true
KMS启用时,黑幕,没有控制台,但是 X 能够工作
当在同一台PC使用两张或以上的ATI显卡时可能会遇到此问题. 例如 Fujitsu Siemens Amilo PA 3553 笔记本就有这个问题. 这是因为fbcon控制台驱动程序映射自己到已存在于错误的显卡的framebuffer设备上(This is due to fbcon console driver mapping itself to wrong framebuffer device that exist on the wrong card). 在内核参数添加:
fbcon=map:1
这将告诉fbcon映射自己到 /dev/fb1 而不是 /dev/fb0.
有些3D应用程序纹理显示为全黑或崩溃
你可能需要纹理压缩支持,这个没有被包含在开源驱动里. 安装 libtxc_dxtn (和 lib32-libtxc_dxtn,对于multilib).
2D 性能(比如滚动滑块)缓慢
如果2D性能(比如在终端或浏览器的滚动滑块)有问题, 你可以将 Option "MigrationHeuristic" "greedy" 添加到你的 xorg.conf 文件的 Device 部分.
这是一个样例 /etc/X11/xorg.conf.d/20-radeon.conf:
Section "Device"
Identifier "My Graphics Card"
Driver "radeon"
Option "MigrationHeuristic" "greedy"
EndSection
在ATI X1600 (RV530 series)上3D应用程序显示黑窗口
这三种方法可能有效:
- 将
pci=nomsi添加到你的启动器的 内核参数. - 如果没用的话,试试用
noapic代替pci=nomsi. - 如果还是没用,你可以试试
vblank_mode=0 glxgears或者vblank_mode=1 glxgears,看看哪个对你有用. 然后用pacman安装driconf, 在~/.drirc里设置此参数.