本人有空会折腾编译最新的Linux内核,使用的笔记本电脑又AMD的平台,AMD显卡fglrx驱动一直是一个巨大的坑,没有一次可以完全正常编译的,对于不同的内核本版要打无数的补丁才能编译成功,且它的驱动不支持VAPDU特性.对于不是很新的显卡用开源的radeon驱动都能很好的使用.
[参考链接]
安装依赖库
LLVM-3.8
下载LLVM3.8后解压到/usr/local/clang+llvm-3.8.0-x86_64-linux-gnu-debian8
下载后解压编译如下:
1
2
3$ ../configure --enable-udev --enable-radeon --enable-amdgpu --disable-intel --disable-nouveau --disable-vmwgfx
[...]
$ make && sudo make install下面这些依赖的库文件很简单的编译,直接解压进去,
./configure && make && make install
就可以了,安装的目录在
/usr/local
,如果编译过程碰到错误,就是少某些头文件,安装它就可以继续编译了.
安装libva
1 | $ ../configure --enable-x11 --enable-drm --enable-egl --enable-glx |
安装MESA
1 | $ tar xvf mesa-12.0.1.tar.gz |
- 替换系统的MESA库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24$cd /usr/lib/x86_64-linux-gnu/dri
debian:/usr/lib/x86_64-linux-gnu/dri$ ls -l
total 82908
-rw-r--r-- 1 root root 22504 Oct 24 2014 dummy_drv_video.so
-rw-r--r-- 5 root root 5505624 Aug 20 2015 i915_dri.so
-rw-r--r-- 5 root root 5505624 Aug 20 2015 i965_dri.so
-rw-r--r-- 7 root root 8175344 Aug 20 2015 kms_swrast_dri.so
-rw-r--r-- 7 root root 8175344 Aug 20 2015 nouveau_dri.so
lrwxrwxrwx 1 root root 18 Aug 8 2014 nouveau_drv_video.so -> vdpau_drv_video.so
-rw-r--r-- 5 root root 5505624 Aug 20 2015 nouveau_vieux_dri.so
lrwxrwxrwx 1 root root 18 Aug 8 2014 nvidia_drv_video.so -> vdpau_drv_video.so
-rw-r--r-- 5 root root 5505624 Aug 20 2015 r200_dri.so
-rw-r--r-- 7 root root 8175344 Aug 20 2015 r300_dri.so
lrwxrwxrwx 1 root root 30 Aug 6 23:20 r600_dri.so -> /usr/local/lib/dri/r600_dri.so
-rw-r--r-- 7 root root 8175344 Aug 20 2015 r600_dri.so.org
lrwxrwxrwx 1 root root 18 Aug 8 2014 r600_drv_video.so -> vdpau_drv_video.so
-rw-r--r-- 5 root root 5505624 Aug 20 2015 radeon_dri.so
-rw-r--r-- 7 root root 8175344 Aug 20 2015 radeonsi_dri.so
lrwxrwxrwx 1 root root 18 Aug 8 2014 radeonsi_drv_video.so -> vdpau_drv_video.so
lrwxrwxrwx 1 root root 18 Aug 8 2014 s3g_drv_video.so -> vdpau_drv_video.so
lrwxrwxrwx 1 root root 32 Aug 7 00:46 swrast_dri.so -> /usr/local/lib/dri/swrast_dri.so
-rw-r--r-- 7 root root 8175344 Aug 20 2015 swrast_dri.so.org
-rw-r--r-- 1 root root 97056 Aug 8 2014 vdpau_drv_video.so
-rw-r--r-- 7 root root 8175344 Aug 20 2015 vmwgfx_dri.so
1 | ls /usr/lib/x86_64-linux-gnu/libdrm_* -l |
1 | for i in {drm,egl,glx,va,tpi,wayland,x11};do sudo ln -svf /usr/local/lib/libva-$i.so.1.3904.0 libva-$i.so.1 ;done |
进入到系统MESA库目录下
下面文件中有一些是
.org
结尾是的系统的MESA库文,为保险起见保留了它1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19$cd /usr/lib/mesa-diverted/x86_64-linux-gnu
$/usr/lib/mesa-diverted/x86_64-linux-gnu$ ls -l
total 836
lrwxrwxrwx 1 root root 15 Aug 20 2015 libEGL.so -> libEGL.so.1.0.0
lrwxrwxrwx 1 root root 15 Aug 20 2015 libEGL.so.1 -> libEGL.so.1.0.0
lrwxrwxrwx 1 root root 30 Aug 7 01:08 libEGL.so.1.0.0 -> /usr/local/lib/libEGL.so.1.0.0
-rw-r--r-- 1 root root 173144 Aug 20 2015 libEGL.so.1.0.0.org
lrwxrwxrwx 1 root root 21 Aug 20 2015 libGLESv1_CM.so -> libGLESv1_CM.so.1.1.0
lrwxrwxrwx 1 root root 21 Aug 20 2015 libGLESv1_CM.so.1 -> libGLESv1_CM.so.1.1.0
lrwxrwxrwx 1 root root 36 Aug 7 01:08 libGLESv1_CM.so.1.1.0 -> /usr/local/lib/libGLESv1_CM.so.1.1.0
-rw-r--r-- 1 root root 18232 Aug 20 2015 libGLESv1_CM.so.1.1.0.org
lrwxrwxrwx 1 root root 18 Aug 20 2015 libGLESv2.so -> libGLESv2.so.2.0.0
lrwxrwxrwx 1 root root 18 Aug 20 2015 libGLESv2.so.2 -> libGLESv2.so.2.0.0
lrwxrwxrwx 1 root root 33 Aug 7 01:10 libGLESv2.so.2.0.0 -> /usr/local/lib/libGLESv2.so.2.0.0
-rw-r--r-- 1 root root 26424 Aug 20 2015 libGLESv2.so.2.0.0.org
lrwxrwxrwx 1 root root 10 Aug 6 22:07 libGL.so -> libGL.so.1
lrwxrwxrwx 1 root root 14 Aug 20 2015 libGL.so.1 -> libGL.so.1.2.0
lrwxrwxrwx 1 root root 29 Aug 7 01:10 libGL.so.1.2.0 -> /usr/local/lib/libGL.so.1.2.0
-rw-r--r-- 1 root root 627320 Aug 20 2015 libGL.so.1.2.0.org查看本机的显卡数量,我这台笔记本电脑有两个GPU如下:
1
2
3$ lspci | grep "VGA"
00:01.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] BeaverCreek [Radeon HD 6520G]
01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series]我这里修改/etc/X11/xorg.conf如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137$ grep -v '#|^$' /etc/X11/xorg.conf
Section "ServerLayout"
Identifier "X.org Configured"
Screen 0 "Screen0" 0 0
Screen 1 "Screen1" RightOf "Screen0"
InputDevice "Mouse0" "CorePointer"
InputDevice "Keyboard0" "CoreKeyboard"
EndSection
Section "Files"
ModulePath "/usr/local/lib/xorg/modules"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/X11/misc"
FontPath "/usr/share/fonts/X11/cyrillic"
FontPath "/usr/share/fonts/X11/100dpi/:unscaled"
FontPath "/usr/share/fonts/X11/75dpi/:unscaled"
FontPath "/usr/share/fonts/X11/Type1"
FontPath "/usr/share/fonts/X11/100dpi"
FontPath "/usr/share/fonts/X11/75dpi"
FontPath "built-ins"
EndSection
Section "Module"
Load "glx"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
EndSection
Section "InputDevice"
Identifier "Mouse0"
Driver "mouse"
Option "Protocol" "auto"
Option "Device" "/dev/input/mice"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Monitor"
Identifier "Monitor1"
VendorName "Monitor Vendor"
ModelName "Monitor Model"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "Accel" # [<bool>]
#Option "SWcursor" # [<bool>]
#Option "EnablePageFlip" # [<bool>]
#Option "ColorTiling2D" # [<bool>]
#Option "RenderAccel" # [<bool>]
#Option "SubPixelOrder" # [<str>]
#Option "AccelMethod" "glamor"
Option "DRI" "3"
Option "ColorTiling" "1"
Option "AccelMethod" "EXA"
Option "TearFree" "on"
#Option "EnablePageFlip" "1"
Option "RenderAccel" "on" # [<bool>]
Option "AGPMode" "4"
#Option "AIGLX" "off"
#Option "EXAVSync" # [<bool>]
#Option "EXAPixmaps" # [<bool>]
#Option "ZaphodHeads" # <str>
#Option "SwapbuffersWait" # [<bool>]
Identifier "Advanced Micro Devices, Inc. [AMD/ATI] BeaverCreek [Radeon HD 6520G]"
Driver "radeon"
BusID "PCI:0:1:0"
EndSection
Section "Device"
### Available Driver options are:-
### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
### <percent>: "<f>%"
### [arg]: arg optional
#Option "Accel" # [<bool>]
#Option "SWcursor" # [<bool>]
#Option "EnablePageFlip" # [<bool>]
#Option "ColorTiling" # [<bool>]
#Option "ColorTiling2D" # [<bool>]
Option "RenderAccel" "on" # [<bool>]
Option "AGPMode" "4"
#Option "SubPixelOrder" # [<str>]
#Option "AccelMethod" # <str>
#Option "EXAVSync" # [<bool>]
#Option "EXAPixmaps" # [<bool>]
#Option "ZaphodHeads" # <str>
#Option "EnablePageFlip" # [<bool>]
#Option "SwapbuffersWait" # [<bool>]
#Option "AIGLX" "off"
Option "DRI" "3"
Option "ColorTiling" "1"
Option "AccelMethod" "EXA"
Option "TearFree" "on"
#Option "EnablePageFlip" "1"
Identifier "Advanced Micro Devices, Inc. [AMD/ATI] Thames [Radeon HD 7500M/7600M Series]"
Driver "radeon"
BusID "PCI:1:0:0"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Card0"
Monitor "Monitor0"
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
Section "Screen"
Identifier "Screen1"
Device "Card1"
Monitor "Monitor1"
SubSection "Display"
Viewport 0 0
Depth 24
EndSubSection
EndSection
Section "Extensions"
Option "Composite" "Enable"
EndSection重启Xorg,用xrander 查看可用的GPU数量,下面显示两个GPU可供使用.
1
2
3
4$ xrandr --listproviders
Providers: number : 2
Provider 0: id: 0x8a cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 2 outputs: 3 associated providers: 0 name:radeon
Provider 1: id: 0x55 cap: 0xf, Source Output, Sink Output, Source Offload, Sink Offload crtcs: 6 outputs: 0 associated providers: 0 name:radeon修改radeon驱动的内核参数,RadeonFeature
1
2
3
4
5$ cat /etc/modprobe.d/radeon.conf
options radeon audio=1
options radeon agpmode=1
options radeon tv=1
options radeon modeset=1测试GLX信息, 如下显示GLX功能正常
1
2
3
4
5
6
7
8
9
10
11
12$ glxinfo | head -n 10
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: SGI
server glx version string: 1.4
server glx extensions:
GLX_ARB_create_context, GLX_ARB_create_context_profile,
GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float,
GLX_ARB_framebuffer_sRGB, GLX_ARB_multisample,
GLX_EXT_create_context_es2_profile, GLX_EXT_framebuffer_sRGB,
[...]检查VDPAU支持,如下显示已经开启VAPDU功能.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19$ vainfo
libva info: VA-API version 0.36.0
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/r600_drv_video.so
libva info: Found init function __vaDriverInit_0_35
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.36 (libva 1.4.1)
vainfo: Driver version: Splitted-Desktop Systems VDPAU backend for VA-API - 0.7.4
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple : VAEntrypointVLD
VAProfileMPEG2Main : VAEntrypointVLD
VAProfileMPEG4Simple : VAEntrypointVLD
VAProfileMPEG4AdvancedSimple : VAEntrypointVLD
VAProfileH264Baseline : VAEntrypointVLD
VAProfileH264Main : VAEntrypointVLD
VAProfileH264High : VAEntrypointVLD
VAProfileVC1Simple : VAEntrypointVLD
VAProfileVC1Main : VAEntrypointVLD
VAProfileVC1Advanced : VAEntrypointVLD
遇到过的名错误
- 检查Xorg错误信息 ,如果出现很多”EE”信息,轻则功能缺失,重则不能开启图界面,下面只有一个EE,没有找到出错的原因.
1
2
3$ grep "EE" /var/log/Xorg.0.log
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[ 6597.997] (EE) RADEON(1): No modes.
vainfo , vdpauinfo 出错.
1 | ~$ VDPAU_DRIVER=r600 vdpauinfo |
- 上面错误是因为
/etc/X11/xorg.conf
的AccelMethod
设置Glamor
,改成EXA
解决问题.
新显卡加载固件问题
* R7 显卡遇无法加载radeon驱动
1 | $ lspci | grep "VGA" |
通过dmesg 发现如下错误
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20[ 449.155790] radeon 0000:00:01.0: Direct firmware load for
radeon/kaveri_pfp.bin failed with error -2
[ 449.156090] radeon 0000:00:01.0: Direct firmware load for
radeon/kaveri_me.bin failed with error -2
[ 449.156407] radeon 0000:00:01.0: Direct firmware load for
radeon/kaveri_ce.bin failed with error -2
[ 449.156680] radeon 0000:00:01.0: Direct firmware load for
radeon/kaveri_mec.bin failed with error -2
[ 449.156990] radeon 0000:00:01.0: Direct firmware load for
radeon/kaveri_mec2.bin failed with error -2
[ 449.156992] cik_cp: Failed to load firmware "radeon/kaveri_mec2.bin"
[ 449.157153] [drm:cik_init [radeon]] *ERROR* Failed to load firmware!
[ 449.157241] radeon 0000:00:01.0: Fatal error during GPU init
[ 449.157327] [drm] radeon: finishing device.
[ 449.164593] [TTM] Finalizing pool allocator
[ 449.164597] [TTM] Finalizing DMA pool allocator
[ 449.164697] [TTM] Zone kernel: Used memory at exit: 0 kiB
[ 449.164701] [TTM] Zone dma32: Used memory at exit: 0 kiB
[ 449.164703] [drm] radeon: ttm finalized
[ 449.165170] radeon: probe of 0000:00:01.0 failed with error -2下载最新的固件 , 把
radeon
目录下的所有文件复制到/lib/firmware/radeon
,重新modprobe radeon
解决使用xrandr 设置多屏
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30$ xrandr
Screen 0: minimum 320 x 200, current 3286 x 1080, maximum 8192 x 8192
VGA-0 disconnected (normal left inverted right x axis y axis)
LVDS connected 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
1366x768 60.00*+
1280x720 59.86
1152x768 59.78
1024x768 59.92
800x600 59.86
848x480 59.66
720x480 59.71
640x480 59.38
HDMI-0 connected 1920x1080+1366+0 (normal left inverted right x axis y axis) 480mm x 270mm
1920x1080 60.00*+ 50.00 59.94
1920x1080i 60.00 50.00 59.94
1680x1050 59.88
1400x1050 59.95
1600x900 60.00
1280x1024 75.02 60.02
1440x900 59.90
1280x800 59.91
1152x864 75.00
1280x720 60.00 50.00 59.94
1024x768 75.08 60.00
800x600 75.00 60.32
720x576 50.00
720x480 60.00 59.94
640x480 75.00 60.00 59.94
720x400 70.08
$ xrandr --output LVDS --mode 1366x768 --output HDMI-0 --mode 1920x1080 --right-of LVDS基于
debian
发行版安装mesa 驱并支持,VDPAU,VA API,GLX, 需要安装如下的包,下面是64位系统上的包列表.
1 | # uname -a |
谢谢支持
- 微信二维码:
- 联系作者