4.5.13. 2D GPU Performance Test
4.5.13.1. Test Principle
The 2D GPU performance test primarily evaluates performance in common operations involving 2D graphics acceleration, including bit-block transfer, rectangle fill and clear, transparency blending, and other key metrics.
The test logic is as follows:
Record the test start time
Execute the 2D GPU processing function in a loop for 100 times
Record the test end time
Calculate the average execution time and frame rate of the 2D GPU processing function based on the start time, end time, and number of executions
4.5.13.2. Test Preparation
The BSP image contains the executable test program by default. You can
cdto the following path to check:cd /app/platform_samples/chip_base_test/10_gpu_2d_test/ ls bin performance_test.sh
For custom images, you can copy the directory
app/samples/platform_samples/chip_base_test/10_gpu_2d_testfrom the BSP source code directory to the device.
4.5.13.3. Test Method
Run
performance_test.sh./performance_test.sh
The following results will be printed:
root@buildroot:10_gpu_2d_test# ./performance_test.sh
[Case copy ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1142191 us] [AverageConsume 11421 us] [FPS 87.6]
[Case multi_source_alphablend ] [Input 4*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 2046196 us] [AverageConsume 20461 us] [FPS 48.9]
[Case resize ] [Input 1*1920*1080] [Output 3840*2160] [TestTimes 100] [TotalConsume 1227924 us] [AverageConsume 12279 us] [FPS 81.4]
[Case resize ] [Input 1*1920*1080] [Output 960*540 ] [TestTimes 100] [TotalConsume 80673 us] [AverageConsume 806 us] [FPS 1239.6]
[Case stitch ] [Input 4*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1357203 us] [AverageConsume 13572 us] [FPS 73.7]
[Case stitch ] [Input 2*3840*2160] [Output 3840*1080] [TestTimes 100] [TotalConsume 688650 us] [AverageConsume 6886 us] [FPS 145.2]
[Case alphablend ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1146742 us] [AverageConsume 11467 us] [FPS 87.2]
[Case crop ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1141900 us] [AverageConsume 11419 us] [FPS 87.6]
[Case rectangle_fill ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1143476 us] [AverageConsume 11434 us] [FPS 87.5]
4.5.13.4. Test Metrics
Analysis of the printed results in the Test Method section is as follows:
| Test Case | FPS | Description |
|---|---|---|
| copy | 87.2 | Use 2D GPU to perform copy operation on an image with resolution 3840 * 2160 |
| multi_source_alphablend | 48.9 | Fuse 4 input images of 3840 * 2160 into one 3840 * 2160 image |
| resize | 81.4 | Enlarge an input image of 1920*1080 by 4x to output an image of 3840 * 2160 |
| resize (2nd) | 1239.6 | Shrink an input image of 1920 * 1080 by 4x to output an image of 960 * 540 |
| stitch | 73.7 | Stitch 4 input images of 3840 * 2160 into one 3840 * 2160 image (each input image is first scaled down by 2x in both width and height before stitching) |
| stitch (2nd) | 145.2 | Stitch 2 input images of 3840 * 2160 into one 3840*1080 image (each input image is first scaled down by 2x in both width and height, then stitched horizontally) |
| alphablend | 87.2 | Blend two input images of 3840 * 2160 with different background colors using alpha blending, producing one 3840 * 2160 output image |
| crop | 87.6 | Crop a 3840 * 2160 region starting from coordinate (0,0) of one input image of 3840 * 2160, outputting a 3840 * 2160 image (using cropping to simulate image copy) |
| rectangle_fill | 87.5 | Fill a red rectangle of the same size as the input image onto a black 3840 * 2160 image, producing a 3840 * 2160 output image |
Source code can be found in the BSP source directory: app/samples/platform_samples/sample_gpu_2d
4.5.13.5. Common Issues
Small differences between results from multiple runs
Issue Description: As shown in the two execution logs below, the measured frame rates differ. First execution log:
[Case copy ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1142191 us] [AverageConsume 11421 us] [FPS 87.6] [Case multi_source_alphablend ] [Input 4*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 2046196 us] [AverageConsume 20461 us] [FPS 48.9] [Case resize ] [Input 1*1920*1080] [Output 3840*2160] [TestTimes 100] [TotalConsume 1227924 us] [AverageConsume 12279 us] [FPS 81.4] [Case resize ] [Input 1*1920*1080] [Output 960*540 ] [TestTimes 100] [TotalConsume 80673 us] [AverageConsume 806 us] [FPS 1239.6] [Case stitch ] [Input 4*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1357203 us] [AverageConsume 13572 us] [FPS 73.7] [Case stitch ] [Input 2*3840*2160] [Output 3840*1080] [TestTimes 100] [TotalConsume 688650 us] [AverageConsume 6886 us] [FPS 145.2] [Case alphablend ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1146742 us] [AverageConsume 11467 us] [FPS 87.2] [Case crop ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1141900 us] [AverageConsume 11419 us] [FPS 87.6] [Case rectangle_fill ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1143476 us] [AverageConsume 11434 us] [FPS 87.5]
Second execution log:
[Case copy ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1160530 us] [AverageConsume 11605 us] [FPS 86.2] [Case multi_source_alphablend ] [Input 4*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 2069446 us] [AverageConsume 20694 us] [FPS 48.3] [Case resize ] [Input 1*1920*1080] [Output 3840*2160] [TestTimes 100] [TotalConsume 1243849 us] [AverageConsume 12438 us] [FPS 80.4] [Case resize ] [Input 1*1920*1080] [Output 960*540 ] [TestTimes 100] [TotalConsume 80530 us] [AverageConsume 805 us] [FPS 1241.8] [Case stitch ] [Input 4*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1371815 us] [AverageConsume 13718 us] [FPS 72.9] [Case stitch ] [Input 2*3840*2160] [Output 3840*1080] [TestTimes 100] [TotalConsume 695384 us] [AverageConsume 6953 us] [FPS 143.8] [Case alphablend ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1160516 us] [AverageConsume 11605 us] [FPS 86.2] [Case crop ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1160381 us] [AverageConsume 11603 us] [FPS 86.2] [Case rectangle_fill ] [Input 1*3840*2160] [Output 3840*2160] [TestTimes 100] [TotalConsume 1149800 us] [AverageConsume 11498 us] [FPS 87.0]
Issue Analysis: The performance test logic executes 100 iterations and calculates the average time, so deviations of around one frame are expected.
Solution: You can modify the number of execution iterations in the test script
performance_test.sh(default is 100, set to quickly produce test results).