linux tinydrm vs fbtft 性能对比测试
本文将通过若干组对照试验,然后根据实验得出的数据,计算在使用fbdev的情况下,tinydrm
相较于fbtft
的提升幅度。
免责声明:本人时间、精力有限,实验中的测试数据量较小,所以不建议将本文中的数据用于比较严谨的场景。
测试环境
开发板 | 树莓派1代B型号 Raspberrypi Model B |
CPU | BCM2835 armv6l ARM1176@1GHz 已超频,详细参数见下方config.txt |
屏幕 | 128x160 st7735r 4-wire spi@12MHz |
cpuinfo
Architecture: armv6lByte Order: Little Endian
CPU(s): 1On-line CPU(s) list: 0
Vendor ID: ARMModel name: ARM1176Model: 7Thread(s) per core: 1Core(s) per socket: 1Socket(s): 1Stepping: r0p7CPU(s) scaling MHz: 70%CPU max MHz: 1000.0000CPU min MHz: 700.0000BogoMIPS: 697.95Flags: half thumb fastmult vfp edsp java tls
测试用例
Linux Framebuffer Benchmark : https://github.com/caramelli/fbmark
编译选项 : -g -O2
-
fb_rectangle
-
fb_sierpinski
工具链信息
❯ /opt/cross-pi-gcc/bin/arm-linux-gnueabihf-gcc -v
Using built-in specs.
COLLECT_GCC=/opt/cross-pi-gcc/bin/arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/opt/cross-pi-gcc/libexec/gcc/arm-linux-gnueabihf/12.2.0/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: ../gcc-12.2.0/configure --prefix=/opt/cross-pi-gcc --target=arm-linux-gnueabihf --enable-languages=c,c++,fortran --with-arch=armv6 --with-fpu=vfp --with-float=hard --disable-multilib --includedir=/usr/arm-linux-gnueabihf/include
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC)
自建工具链方法参考:https://solarianprogrammer.com/2018/05/06/building-gcc-cross-compiler-raspberry-pi/ (此文中的编译选项不针对于树莓派1b。我修改了一些编译选项以及其他参数,方才可以使用,目前正在整理中,尚未发布。)
一般情况下,您不需要自建交叉编译工具链,使用apt或buildroot提供的工具链进行编译即可。
config.txt
# Please note that this is only a sample, we recommend you to change it to fit
# your needs.
# You should override this file using BR2_PACKAGE_RPI_FIRMWARE_CONFIG_FILE.
# See http://buildroot.org/manual.html#rootfs-custom
# and http://elinux.org/RPiconfig for a description of config.txt syntaxstart_file=start.elf
fixup_file=fixup.datkernel=zImage# To use an external initramfs file
#initramfs rootfs.cpio.gz# Disable overscan assuming the display supports displaying the full resolution
# If the text shown on the screen disappears off the edge, comment this out
disable_overscan=1# How much memory in MB to assign to the GPU on Pi models having
# 256, 512 or 1024 MB total memory
gpu_mem_256=100
gpu_mem_512=100
gpu_mem_1024=100enable_uart=1
dtoverlay=i2c1-overlay
arm_freq=1000
core_freq=500
sdram_freq=600
over_voltage=6
成绩对比
开启fbcon cursor_blink
echo 1 > /sys/class/graphics/fbcon/cursor_blink
fbtft | tinydrm | 提升幅度 | 单位 | |
---|---|---|---|---|
Rectangle 32x40 | 8.55 | 17.54 | 51.26% | MPixels/second |
Sierpinski 1024 | 529.41 | 1138.67 | 53.51% | Frames/second |
Sierpinski 2048 | 295.23 | 605.58 | 51.25% | Frames/second |
Sierpinski 4096 | 156.19 | 314.06 | 50.27% | Frames/second |
Sierpinski 8192 | 80.00 | 160.37 | 50.12% | Frames/second |
Sierpinski 16384 | 42.86 | 80.83 | 46.98% | Frames/second |
Sierpinski 32768 | 23.81 | 41.01 | 41.95% | Frames/second |
Sierpinski 65536 | 14.28 | 20.76 | 31.21% | Frames/second |
Sierpinski 131072 | 9.53 | 10.42 | 8.54% | Frames/second |
Sierpinski 262144 | 5.30 | 5.30 | 0.00% | Frames/second |
结论:在多个测试项目中,tinydrm 对比 fbtft 具有100%的性能提升。
在后面的测试项目中,随着计算复杂度的提升,tinydrm的领先幅度大幅下降,推测瓶颈可能来到cpu这边,暂未进行验证,需要更多数据支持该推测。
关闭fbcon cursor_blink
echo 0 > /sys/class/graphics/fbcon/cursor_blink
fbtft | tinydrm | 单位 | |
---|---|---|---|
Rectangle 32x40 | 9.04 | 17.61 | MPixels/second |
Sierpinski 1024 | 586.80 | 1142.07 | Frames/second |
Sierpinski 2048 | 314.59 | 608.69 | Frames/second |
Sierpinski 4096 | 165.51 | 314.93 | Frames/second |
Sierpinski 8192 | 82.88 | 160.95 | Frames/second |
Sierpinski 16384 | 43.46 | 81.07 | Frames/second |
Sierpinski 32768 | 27.63 | 41.17 | Frames/second |
Sierpinski 65536 | 17.76 | 20.84 | Frames/second |
Sierpinski 131072 | 9.23 | 10.46 | Frames/second |
Sierpinski 262144 | 5.31 | 5.31 | Frames/second |
结论:该功能对于性能有一定的影响
闪烁的光标将导致驱动程序会对闪烁区域进行多次绘制,提升了工作量,推荐在运行gui程序时将其关闭。
调整spi频率后的成绩对比
暂未完成