linux tinydrm vs fbtft 性能对比测试

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:           armv6l
  Byte Order:           Little Endian
CPU(s):                 1
  On-line CPU(s) list:  0
Vendor ID:              ARM
  Model name:           ARM1176
    Model:              7
    Thread(s) per core: 1
    Core(s) per socket: 1
    Socket(s):          1
    Stepping:           r0p7
    CPU(s) scaling MHz: 70%
    CPU max MHz:        1000.0000
    CPU min MHz:        700.0000
    BogoMIPS:           697.95
    Flags:              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 syntax

start_file=start.elf
fixup_file=fixup.dat

kernel=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=100

enable_uart=1
dtoverlay=i2c1-overlay
arm_freq=1000
core_freq=500
sdram_freq=600
over_voltage=6

成绩对比

测试条件一 | cpu调度 powersave

设置cpu调度为省电模式(锁最低频率 700MHz)

echo powersave > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo 0 > /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

image

结论:在多个测试项目中,tinydrm 对比 fbtft 具有100%的性能提升。

在后面的测试项目中,随着计算复杂度的提升,tinydrm的领先幅度大幅下降,推测瓶颈可能来到cpu这边,暂未进行验证,需要更多数据支持该推测

测试条件二 | cpu调度 performance

设置cpu调度为性能模式(锁最高频率 1GHz)

echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo 0 > /sys/class/graphics/fbcon/cursor_blink # 关闭控制台光标闪烁

测试结果

fbtft tinydrm 提升幅度 单位
Rectangle 32x40 17.12 25.84 33.74% MPixels/second
Sierpinski 1024 1155.75 1701.89 32.09% Frames/second
Sierpinski 2048 586.88 900.29 34.81% Frames/second
Sierpinski 4096 319.47 464.54 31.22% Frames/second
Sierpinski 8192 159.61 236.52 32.51% Frames/second
Sierpinski 16384 88.58 118.88 25.48% Frames/second
Sierpinski 32768 49.63 59.97 22.24% Frames/second
Sierpinski 65536 25.15 30.08 16.38% Frames/second
Sierpinski 131072 12.50 15.08 17.10% Frames/second
Sierpinski 262144 7.65 7.65 0.00% Frames/second

结论:在提升cpu频率后,tinydrm的领先幅度相较于之前有所下降,fbtft的测试成绩有明显提升,这可能是fbtft框架过于依赖cpu能力导致的。

调整spi频率后的成绩对比

经测试,没有区别,这可能是由于分辨率较低的原因,瓶颈不在于SPI的传输速度。

posted @ 2024-07-03 00:46  IotaHydrae  阅读(45)  评论(0编辑  收藏  举报