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
成績對比
開啟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頻率後的成績對比
暫未完成