platform:RK OS:Linux Kernel: 4.4.143 filesystem:debian10
简易查看GPU硬件加速
系统的GPU glmark2是正常使用, chrome浏览器正常启动,基本Chrome浏览器硬件加速就可以用起来。 查看方式:chrome://gpu 敲入地址栏可以查看gpu 支持的情况。(硬件加速:WebGL:Hardware accelerated WebGL2:Hardware accelerated) GPU硬件加速未开启(WebGL:Disabled WebGL2:Disabled)
开启GPU硬件加速
(1) 启动桌面的浏览器加速配置脚本
启动桌面的浏览器加速配置脚本,文件系统Chrome接口配置:
/etc/X11/xorg.conf.d/20-modesetting.conf
Section "Device"
Identifier "Rockchip Graphics"
Driver "modesetting"
Option "AccelMethod" "exa"
# Option "AccelMethod" "glamor"
Option "DRI" "2"
Option "FlipFB" "none"
Option "NoEDID" "true"
(2) 查看启动信息以及相关LOG
上面Chrome接口配置显示使用exa进行GPU硬件加速,查看LOG(路径:/var/log/Xorg.0.log,/var/log/Xorg.0.log.old)
[ 12.503] (II) modeset(0): Using internal exa
[ 12.509] (EE) modeset(0): exa initialization failed
kernel的rga没有开启,导致出错(无法启动GPU硬件加速)。
(3) 开启RGA
使用RGA进行加速步骤: 先打开RGA进行GPU加速,再选择是用exa还是glamor方式进行GPU的硬件加速。 内核设备树配置GPU打开:
&gpu {
status = "okay";
mali-supply = <&vdd_gpu>;
};
改设备树:
rga: rga@ff920000 {
compatible = "rockchip,rga2";
reg = <0x0 0xff920000 0x0 0x180>;
interrupts = <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>;
resets = <&cru SRST_RGA_CORE>, <&cru SRST_RGA_AXI>, <&cru
SRST_RGA_AHB>;
reset-names = "core", "axi", "ahb";
clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA>;
clock-names = "aclk_rga", "hclk_rga", "clk_rga";
dma-coherent;
status = "okay";
};
或者在rk3288_linux.dtsi下添加
&rga {
compatible = "rockchip,rga2";
clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA>;
clock-names = "aclk_rga", "hclk_rga", "clk_rga";
assigned-clocks = <&cru ACLK_RGA>, <&cru SCLK_RGA>;
assigned-clock-rates = <300000000>, <300000000>;
status = "okay";
};
配置完设备树后,将内核编译重新烧写 在/dev下生成rga节点
root@linaro-alip:/dev# ls -l rga
crw-rw---- 1 root video 10, 52 Feb 14 18:11 rga
打开桌面浏览器,报错:
mali ffa30000.gpu: Stride passed to job_submit doesn't match kernel
文件系统里面的libmali库与内核对不上(第一方法:可能是版本问题,换高版本内核),查看启动信息中
[ 0.000000] Linux version 4.4.143 (root@ubuntu) (gcc version 6.3.1 20170404 (Linaro GCC 6.3-2017.05) ) #425 SMP Wed Apr 21 15:42:44 CST 2021
[ 7.729227] I : [File] : drivers/gpu/arm/mali400/mali/linux/mali_kernel_linux.c; [Line] : 417; [Func] : mali_module_init(); svn_rev_string_from_arm of this mali_ko is '-2cda2e6', rk_ko_ver is '5', built at '14:39:09', on 'Apr 21 2021'.[ 7.729536] Mali: Mali device driver loader
第二方法:换Mali安装包
(4) libmali库的对应选择以及安装
libmali库是Chrome浏览器打开调用驱动底层的接口,没有对应可能打开会报上面的错误或者打不开浏览器 正常Mali驱动是r14或r18的版本 对应debian10才能跑起来。 Mali安装包在SDK debian/packages/armhf/libmali/libmali-midgard-t76x-r14p0-r* 板子里 debian/binary/packages/libmali 也可在这下载不同版本的Mail安装包 查看核心板使用的gpu型号确定使用的Mali安装包:
root@linaro-alip:/dev# cat /sys/devices/platform
查看目前板子里使用的Mali版本: 路径:/usr/lib/mali/
root@linaro-alip:/usr/lib/mali# ls -l
total 20128
lrwxrwxrwx 1 root root 11 Jul 29 2020 libEGL.so -> libEGL.so.1
-rw-r--r-- 1 root root 5372 Jul 29 2020 libEGL.so.1
lrwxrwxrwx 1 root root 17 Jul 29 2020 libGLESv1_CM.so -> libGLESv1_CM.so.1
-rw-r--r-- 1 root root 5372 Jul 29 2020 libGLESv1_CM.so.1
lrwxrwxrwx 1 root root 14 Jul 29 2020 libGLESv2.so -> libGLESv2.so.2
-rw-r--r-- 1 root root 5372 Jul 29 2020 libGLESv2.so.2
lrwxrwxrwx 1 root root 12 Jul 29 2020 libMali.so -> libMali.so.1
-rw-r--r-- 1 root root 5372 Jul 29 2020 libMali.so.1
lrwxrwxrwx 1 root root 18 Jul 29 2020 libMaliOpenCL.so -> libMaliOpenCL.so.1
-rw-r--r-- 1 root root 5372 Jul 29 2020 libMaliOpenCL.so.1
lrwxrwxrwx 1 root root 11 Jul 29 2020 libgbm.so -> libgbm.so.1
-rw-r--r-- 1 root root 5452 Jul 29 2020 libgbm.so.1
lrwxrwxrwx 1 root root 10 Jul 29 2020 libmali-midgard-t76x-r18p0-r1p0-x11.so -> libmali.so
lrwxrwxrwx 1 root root 12 Jul 29 2020 libmali.so -> libmali.so.1
lrwxrwxrwx 1 root root 16 Jul 29 2020 libmali.so.1 -> libmali.so.1.9.0
-rw-r--r-- 1 root root 20557292 Jul 29 2020 libmali.so.1.9.0
drwxr-xr-x 2 root root 4096 Feb 14 18:12 pkgconfig
使用的是libmali-midgard-t76x-r18p0-r1p0-x11_1.9-1_armhf.deb版本太高出现上面的报错 降低版本:libmali-midgard-t76x-r14p0-r1p0-x11_1.9-1_armhf.deb 安装log:
root@linaro-alip:~# dpkg -i libmali-midgard-t76x-r14p0-r1p0-x11_1.9-1_armhf.deb
Selecting previously unselected package libmali-midgard-t76x-r14p0-r1p0-x11.
dpkg: regarding libmali-midgard-t76x-r14p0-r1p0-x11_1.9-1_armhf.deb containing libmali-midgard-t76x-r14p0-r1p0-x11:
libmali-midgard-t76x-r14p0-r1p0-x11 conflicts with libmali-midgard-t76x-r18p0-r1p0-x11
libmali-midgard-t76x-r18p0-r1p0-x11 (version 1.9-1) is present and installed.
dpkg: error processing archive libmali-midgard-t76x-r14p0-r1p0-x11_1.9-1_armhf.deb (--install):
conflicting packages - not installing libmali-midgard-t76x-r14p0-r1p0-x11
Errors were encountered while processing:
libmali-midgard-t76x-r14p0-r1p0-x11_1.9-1_armhf.deb
root@linaro-alip:~# apt-get remove libmali-midgard-t76x-r18p0-r1p0-x11
..........
root@linaro-alip:~# dpkg -i libmali-midgard-t76x-r14p0-r1p0-x11_1.9-1_armhf.deb
(Reading database ... 72588 files and directories currently installed.)
Preparing to unpack libmali-midgard-t76x-r14p0-r1p0-x11_1.9-1_armhf.deb ...
Unpacking libmali-midgard-t76x-r14p0-r1p0-x11 (1.9-1) ...
Setting up libmali-midgard-t76x-r14p0-r1p0-x11 (1.9-1) ...
Processing triggers for libc-bin (2.28-10) ...
ldconfig: file /usr/lib/mali/libmali.so is truncated
ldconfig: file /usr/lib/mali/libmali.so.1 is truncated
ldconfig: file /usr/lib/mali/libmali.so.1.9.0 is truncated
ldconfig: file /usr/lib/mali/libmali-midgard-t76x-r14p0-r1p0-x11.so is truncated
ldconfig: /usr/lib/arm-linux-gnueabihf/libavformat.so.57.56.101 is not an ELF file - it has the wrong magic bytes at the start.
ldconfig: /usr/lib/arm-linux-gnueabihf/libavformat.so.57 is not an ELF file - it has the wrong magic bytes at the start.
ldconfig: file /usr/lib/libmali.so.1 is truncated
查看/usr/lib/mali/
root@linaro-alip:/usr/lib/mali# ls -l
total 18212
lrwxrwxrwx 1 root root 11 Jul 29 2020 libEGL.so -> libEGL.so.1
-rw-r--r-- 1 root root 5372 Jul 29 2020 libEGL.so.1
lrwxrwxrwx 1 root root 17 Jul 29 2020 libGLESv1_CM.so -> libGLESv1_CM.so.1
-rw-r--r-- 1 root root 5372 Jul 29 2020 libGLESv1_CM.so.1
lrwxrwxrwx 1 root root 14 Jul 29 2020 libGLESv2.so -> libGLESv2.so.2
-rw-r--r-- 1 root root 5372 Jul 29 2020 libGLESv2.so.2
lrwxrwxrwx 1 root root 12 Jul 29 2020 libMali.so -> libMali.so.1
-rw-r--r-- 1 root root 5372 Jul 29 2020 libMali.so.1
lrwxrwxrwx 1 root root 18 Jul 29 2020 libMaliOpenCL.so -> libMaliOpenCL.so.1
-rw-r--r-- 1 root root 5372 Jul 29 2020 libMaliOpenCL.so.1
lrwxrwxrwx 1 root root 11 Jul 29 2020 libgbm.so -> libgbm.so.1
-rw-r--r-- 1 root root 5452 Jul 29 2020 libgbm.so.1
lrwxrwxrwx 1 root root 10 Jul 29 2020 libmali-midgard-t76x-r14p0-r1p0-x11.so -> libmali.so
lrwxrwxrwx 1 root root 12 Jul 29 2020 libmali.so -> libmali.so.1
lrwxrwxrwx 1 root root 16 Jul 29 2020 libmali.so.1 -> libmali.so.1.9.0
-rw-r--r-- 1 root root 18587672 Jul 29 2020 libmali.so.1.9.0
drwxr-xr-x 2 root root 4096 Feb 14 18:15 pkgconfig
可以查出更改为libmali-midgard-t76x-r14p0-r1p0-x11.so版本
重新打开浏览器,chrome://gpu 敲入地址栏可以查看gpu 支持的情况。(硬件加速:WebGL:Hardware accelerated WebGL2:Hardware accelerated) OK!!
|