欢迎您访问365答案网,请分享给你的朋友!
生活常识 学习资料

[LinuxRKDebian10]chrome浏览器开启GPU硬件加速|CSDN创作打卡

时间:2023-07-29

platform:RK
OS:Linux
Kernel: 4.4.143
filesystem:debian10

文章目录

简易查看GPU硬件加速开启GPU硬件加速

(1) 启动桌面的浏览器加速配置脚本(2) 查看启动信息以及相关LOG(3) 开启RGA(4) libmali库的对应选择以及安装 简易查看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,rk3288-rga";//reg = <0x0 0xff920000 0x0 0x180>;//interrupts = ;//clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA>;//clock-names = "aclk", "hclk", "sclk";//power-domains = <&power RK3288_PD_VIO>;//resets = <&cru SRST_RGA_CORE>, <&cru SRST_RGA_AXI>, <&cru SRST_RGA_AHB>;//reset-names = "core", "axi", "ahb";//status = "disabled";//};rga: rga@ff920000 {compatible = "rockchip,rga2";reg = <0x0 0xff920000 0x0 0x180>;interrupts = ;resets = <&cru SRST_RGA_CORE>, <&cru SRST_RGA_AXI>, <&cruSRST_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 rgacrw-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/*gpu/gpuinfoMali-T76x 4 cores r1p0 0x0750

查看目前板子里使用的Mali版本:
路径:/usr/lib/mali/

root@linaro-alip:/usr/lib/mali# ls -ltotal 20128lrwxrwxrwx 1 root root 11 Jul 29 2020 libEGL.so -> libEGL.so.1-rw-r--r-- 1 root root 5372 Jul 29 2020 libEGL.so.1lrwxrwxrwx 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.1lrwxrwxrwx 1 root root 14 Jul 29 2020 libGLESv2.so -> libGLESv2.so.2-rw-r--r-- 1 root root 5372 Jul 29 2020 libGLESv2.so.2lrwxrwxrwx 1 root root 12 Jul 29 2020 libMali.so -> libMali.so.1-rw-r--r-- 1 root root 5372 Jul 29 2020 libMali.so.1lrwxrwxrwx 1 root root 18 Jul 29 2020 libMaliOpenCL.so -> libMaliOpenCL.so.1-rw-r--r-- 1 root root 5372 Jul 29 2020 libMaliOpenCL.so.1lrwxrwxrwx 1 root root 11 Jul 29 2020 libgbm.so -> libgbm.so.1-rw-r--r-- 1 root root 5452 Jul 29 2020 libgbm.so.1lrwxrwxrwx 1 root root 10 Jul 29 2020 libmali-midgard-t76x-r18p0-r1p0-x11.so -> libmali.solrwxrwxrwx 1 root root 12 Jul 29 2020 libmali.so -> libmali.so.1lrwxrwxrwx 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.0drwxr-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.debSelecting 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-x11Errors 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 truncatedldconfig: file /usr/lib/mali/libmali.so.1 is truncatedldconfig: file /usr/lib/mali/libmali.so.1.9.0 is truncatedldconfig: file /usr/lib/mali/libmali-midgard-t76x-r14p0-r1p0-x11.so is truncatedldconfig: /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 -ltotal 18212lrwxrwxrwx 1 root root 11 Jul 29 2020 libEGL.so -> libEGL.so.1-rw-r--r-- 1 root root 5372 Jul 29 2020 libEGL.so.1lrwxrwxrwx 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.1lrwxrwxrwx 1 root root 14 Jul 29 2020 libGLESv2.so -> libGLESv2.so.2-rw-r--r-- 1 root root 5372 Jul 29 2020 libGLESv2.so.2lrwxrwxrwx 1 root root 12 Jul 29 2020 libMali.so -> libMali.so.1-rw-r--r-- 1 root root 5372 Jul 29 2020 libMali.so.1lrwxrwxrwx 1 root root 18 Jul 29 2020 libMaliOpenCL.so -> libMaliOpenCL.so.1-rw-r--r-- 1 root root 5372 Jul 29 2020 libMaliOpenCL.so.1lrwxrwxrwx 1 root root 11 Jul 29 2020 libgbm.so -> libgbm.so.1-rw-r--r-- 1 root root 5452 Jul 29 2020 libgbm.so.1lrwxrwxrwx 1 root root 10 Jul 29 2020 libmali-midgard-t76x-r14p0-r1p0-x11.so -> libmali.solrwxrwxrwx 1 root root 12 Jul 29 2020 libmali.so -> libmali.so.1lrwxrwxrwx 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.0drwxr-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!!

Copyright © 2016-2020 www.365daan.com All Rights Reserved. 365答案网 版权所有 备案号:

部分内容来自互联网,版权归原作者所有,如有冒犯请联系我们,我们将在三个工作时内妥善处理。