RGA (Raster Graphic Acceleration Unit)是一个独立的2D硬件加速器,可用于加速点/线绘制,执行图像缩放、旋转、bitBlt、alpha混合等常见的2D图形操作。
编译环境:x86_64 ubuntu22.04 主机
SDK 中有rga的编译工具和库,现整理为rga_Projects供客户使用。
客户可以直接在SDK中编译demo,也可以使用我们提供的rga_Projects。
资料下载,点击跳转
# 解压之后得到rga_Projects
$ unzip rga_Projects.zip
# 进入项目目录
$ cd rga_Projects
# 修改一下文件路径(将第一行的路径改为你实际的绝对路径)
$ vim rga_Projects/linux-rga/toolchains/toolchain_linux.cmake
SET(TOOLCHAIN_HOME "/home/youyeetoo/shareDir/rga_Projects/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu")
SET(TOOLCHAIN_NAME "aarch64-rockchip1031-linux-gnu")
...
# 设置环境变量
$ chmod +x yyt-rga_env_set.sh
$ source yyt-rga_env_set.sh
# 编译
$ chmod +x cmake-linux.sh
$ ./cmake-linux.sh
# demo路径
编译好的demo 在 `rga_Projects/linux-rga/build/build_linux/samples/im2d_api_demo/rgaImDemo`
项目里面有提前编译好的demo
# 将demo 推送到板端
# 验证(出现下面的打印信息,说明板端环境正常)
$ chmod +x rgaImDemo
$ ./rgaImDemo --querystring
Start selecting mode 0
im2d querystring ..
RGA demo mode = 0x0
rga_api version 1.10.1_[0]
RGA vendor : Rockchip Electronics Co.,Ltd.
RGA_api version : v1.10.1_[0]
RGA version : RGA_2_Enhance RGA_3
Max input : 8192x8192
Max output : 8128x8128
Byte stride : 16 byte
Scale limit : 0.0625 ~ 16
Input support format : RGBA/ARGB_8888 RGB_888 RGB_565 ARGB_4444 ARGB_5551 YUV420_sp_8bit YUV420_sp_10bit YUV420_p_8bit YUV420_p_10bit YUV422_sp_8bit YUV422_sp_10bit YUV422_p_8bit YUV422_p_10bit YUYV422 YUV400
output support format : RGBA/ARGB_8888 RGB_888 RGB_565 ARGB_4444 ARGB_5551 RGBA_4444 RGBA_5551 YUV420_sp_8bit YUV420_sp_10bit YUV420_p_8bit YUV422_sp_8bit YUV422_sp_10bit YUV422_p_8bit YUYV420 YUYV422 YUV400 Y4
RGA feature : color_fill color_palette ROP quantize src1_r2y_csc dst_full_csc FBC_mode blend_in_YUV BT.2020
expected performance : max 4 pixel/cycle
# 使用demo
1. 首先将 rga_Projects/linux-rga/samples/sample_file下面两个demo 照片推送到板端路径 /data下面
2. 使用下面命令即可验证rga功能
$ ./rgaImDemo --resize=up # 放大
$ ./rgaImDemo --resize=down # 缩小
$ ./rgaImDemo --rotate=90 # 旋转
3.实操(转换后图片路径/data)
$ ./rgaImDemo --resize=up
Start selecting mode 0
im2d resize ..
up resize ...
RGA demo mode = 0x2
"/dev/dma_heap/system-uncached-dma32" does not exist, so use malloc.
rga_api version 1.10.1_[0]
resizing .... cost time 3910 us
open /data/out0w1920-h1080-rgba8888.bin and write ok
$ ./rgaImDemo --resize=down
Start selecting mode 0
im2d resize ..
down resize ...
RGA demo mode = 0x2
"/dev/dma_heap/system-uncached-dma32" does not exist, so use malloc.
rga_api version 1.10.1_[0]
resizing .... cost time 2196 us
open /data/out0w720-h480-rgba8888.bin and write ok
$ ./rgaImDemo --rotate=90
Start selecting mode 0
im2d rotate ..
rotation 90 ...
RGA demo mode = 0x4
"/dev/dma_heap/system-uncached-dma32" does not exist, so use malloc.
rga_api version 1.10.1_[0]
rotating .... cost time 3112 us
open /data/out0w1280-h720-rgba8888.bin and write ok
root@linaro-alip:/#