Improvise CPU Performance on mxc_v4l2_vpu_test Application

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Improvise CPU Performance on mxc_v4l2_vpu_test Application

452 Views
Ankit_siddhapura
Contributor II

Hi,

I am working on i.mx8qxpc0 CPU-based custom board.

It is running LF5.10.35_2.0.0 yocto build.

I am working on VPU encoding part.

My processor is in governor mode as per ,
$ echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Here I have used gstreamer pipline for encoding and have observations as per below,
$ gst-launch-1.0 -v v4l2src device=/dev/video3 io-mode=dmabuf-import ! 'video/x-raw,format=(string)NV12,width=1280,height=720,framerate=(fraction)30/1' ! queue ! v4l2h264enc output-io-mode=dmabuf ! filesink location=test.h264

Obersevation(gst):-
- 30FPS and have CPU load it is 5-7% (from top utlitiy)
- In dmesg logs I can see logs of windsor driver (encoder)

Now I have moved to application part where I have got mxc_v4l2_vpu_enc.out application and using it as per below,
$ ./mxc_v4l2_vpu_enc.out camera --key 0 --device /dev/video3 --size 1280 720 --u 4 --fmt nv12 --framerate 30 --framenum 90000 encoder --key 1 --source 0 --size 1280 720 --framerate 30 --bitrate 4194304 --lowlatency 0 ofile --key 2 --source 1 --name camera.h264

Obervations(with app):-
- 30FPS and have CPU load it is 100% (from top utlitiy)
- In logs I can see logs of windsor driver (encoder)


VPU LOGS:
---------
start : output.camera.h264.2
Loop run
[ 539.692676] [VPU Encoder] [0:0][ 0], length : 408, ts : 0
[ 539.701962] [VPU Encoder] [0:0][ 1], length : 17560, ts : 0
[ 539.725587] [VPU Encoder] [0:0][ 2], length : 17559, ts : 0
[ 539.751603] [VPU Encoder] [0:0][ 3], length : 85311, ts : 0
[ 539.784112] [VPU Encoder] [0:0][ 4], length : 4623, ts : 0
[ 539.817450] [VPU Encoder] [0:0][ 5], length : 360, ts : 0
[ 539.850815] [VPU Encoder] [0:0][ 6], length : 88, ts : 0
[ 539.884952] [VPU Encoder] [0:0][ 7], length : 67992, ts : 0
[ 539.917697] [VPU Encoder] [0:0][ 8], length : 4784, ts : 0


So now the queries are,
1. Why there is a diffrence in CPU% utlisation in the case of GST Vs. Application ?
2. How can I improvise mxc_v4l2_vpu test app to lower down CPU usage

I have seen in the source that it uses V4L2_MEMORY_USERPTR so changing this to V4L2_MEMORY_DMABUF (as in the case of GST) will help ?

Can you advice ?

Any help would be greatly appreciable.


---

Thanks

0 Kudos
1 Reply

432 Views
joanxie
NXP TechSupport
NXP TechSupport

in gstreamer pipeline, you use zero-copy method, vpu test is just direct encoding, you can see the difference as below:

Type of encode          Average CPU usage
Direct encode           102%
Encode with Dmabuf 15%

I don't find such patch for unit test, which is just for testing vpu performance, you can keep using gstreamer since this pipeline has lower cpu cost

 

0 Kudos