瑞芯微显示和GPU配置
1.显示加速方案介绍
瑞芯微平台rk356x/rk3588分别对应arm gpu的G52和G610的显卡,另外rockchip携带对应的2d加速模块。如果采用的是xorg的显示方案的话,其实加速方案有以下几种:
第一种:通过2d模块也就是rga模块(rga2/rga3)进行加速,其中瑞芯微提供两种方式一种是xorg的exa加速方案(在2d加速模块使用主推),另外一种就是pixman通过rga进行加速,可以参考rockchip的作者jeffycn的pixman的加速方案(实际我这边并未测试过该方案)。
第二种:通过arm的mali的闭源驱动的gpu进行加速,典型的代表就是通过对应的glamor的加速方案,rockchip推荐使用该gpu加速的方案,该方案支持的是opengles2,对于某些需要使用opengl的应用程序来说有性能瓶颈。
第三种:采用mesa的开源方案进行opengl的加速,主要参考底层panfrost+mesa的方案实现(有个逆向的小姐姐专门做gpu的逆向工作,大家有兴趣可以去了解下,逆向有一个专门的工作去抓取显示流去做逆向工作),https://github.com/ChisBread/rk3588-gaming-step-by-step这个网站有部分开源方案的介绍,这个主要好处其实就是支持了opengl,对于应用来说是比较友好的。
对于rk来说他们实现了第一和第二种加速方案,实际只需要进行下面的配置即可达到要求exa(rga)/glamor(gpu):
cat ./etc/X11/xorg.conf.d/20-modesetting.conf
Section "Device"
Identifier "Rockchip Graphics"
Driver "modesetting"
### Use Rockchip RGA 2D HW accel
# Option "AccelMethod" "exa"
### Use GPU HW accel
Option "AccelMethod" "glamor"
Option "DRI" "2"
### Set to "always" to avoid tearing, could lead to up 50% performance loss
Option "FlipFB" "none"
### Limit flip rate and drop frames for "FlipFB" to reduce performance lost
# Option "MaxFlipRate" "25"
Option "NoEDID" "true"
EndSection
Section "Screen"
Identifier "Default Screen"
Device "Rockchip Graphics"
Monitor "Default Monitor"
EndSection
### Valid values for rotation are "normal", "left", "right"
Section "Monitor"
Identifier "Default Monitor"
Option "Rotate" "normal"
EndSection
2.浏览器通过gpu加速渲染配置
参考:https://t.rock-chips.com/forum.php?mod=viewthread&tid=4808
2.1 webgl测试网站
https://thorium.rocks/media/blobs/blobs.html
2.2 浏览器gpu开启webgl
检查方法:
1.通过浏览器中输入URL:chrome://gpu
2.直接执行chromium命令实际成功的话会有如下打印信息:
[8881:1105/030346.504965:ERROR:gpu_init.cc(521)] Passthrough is not supported, GL is egl, ANGLE is
使能方法:
1.chrome://flags/#ignore-gpu-blocklist
2.将「Override software rendering list」设置为「Enable」启用状态。
3.点击「Relaunch」重启 Chrome 浏览器。
参考:https://www.sysgeek.cn/chrome-hardware-acceleration/
另外一种方法:
通过在执行chromium 传入对应的参数,之前子啊chromium的cefclient版本尝试过传入是有效果的,大概信息如下所示(实际笔者并没有实际去测试验证看看是否有用???):
–no-sandbox --disable-es3-gl-context --ignore-gpu-blacklist --ignore-gpu-blocklist --enable-accelerated-video-decode
2.3 qt的gpu加速相关配置
~/work/rk3568/debian/overlay$ cat etc/profile.d/qtwebengine.sh
export QTWEBENGINE_CHROMIUM_FLAGS="--no-sandbox --disable-es3-gl-context --ignore-gpu-blacklist --ignore-gpu-blocklist --enable-accelerated-video-decode"