RGA (Raster Graphic Acceleration Unit) is an independent 2D hardware accelerator that can be used to accelerate point/line drawing, perform common 2D graphics operations such as image scaling, rotation, bitBlt, alpha blending, etc.
Compilation environment: x86_64 ubuntu22.04 host
The SDK has rga compilation tools and libraries, which are now organized as rga_Projects for customers to use.
Customers can compile demos directly in the SDK, or use the rga_Projects we provide.
Download data, click to jump
# Unzip to get rga_Projects
$ unzip rga_Projects.zip
# Enter the project directory
$ cd rga_Projects
# Modify the file path (change the path in the first line to your actual absolute path)
$ 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")
...
# Set environment variables
$ chmod +x yyt-rga_env_set.sh
$ source yyt-rga_env_set.sh
# Compile
$ chmod +x cmake-linux.sh
$ ./cmake-linux.sh
# Demo path
The compiled demo is in `rga_Projects/linux-rga/build/build_linux/samples/im2d_api_demo/rgaImDemo`
The project has a pre-compiled demo
# Push demo to the board
# Verify (the following print information appears, indicating that the board environment is normal)
$ 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 bytes 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 # Use demo 1. First place The following two demo photos are pushed to the board path /data
2. Use the following command to verify the rga function
$ ./rgaImDemo --resize=up # zoom
$ ./rgaImDemo --resize=down # zoom
$ ./rgaImDemo --rotate=90 # rotate
3. Practical operation (converted image path /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:/#