VAAPI throughput lower than expected on Renoir/VCN2 due to SoC clock speed
System information
- OS: Manjaro Linux
- CPU: Ryzen 7 5700G (AGESA 1.2.0.7)
- GPU: Renoir/Cezanne (1002:1638)
- Kernel version: 5.15 LTS, 6.1, 6.2-rc8
- Mesa version: 22.3.5, 23.0.0-rc, 23.1.0-devel
Describe the issue
The VAAPI decoding throughput is lower than expected unless I stress the VCN with VAAPI encoding at the same time to increase the socclk
to the maximum 975Mhz.
cat /sys/class/drm/card0/device/pp_dpm_socclk
0: 400Mhz
1: 445Mhz
2: 520Mhz
3: 600Mhz
4: 678Mhz
5: 780Mhz
6: 866Mhz
7: 975Mhz *
If I don't stress the VCN with another encoding session, the socclk
will stay at only 400Mhz. And the H264/HEVC 1080p decoding speed is capped at 120~190fps, but Renoir/VCN2 is actually capable of hitting 480fps at the max soc clock.
Test VAAPI decoding speed:
ffmpeg -stream_loop -1 -init_hw_device vaapi=va:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -i any_h264_hevc_1080p.mp4 -an -sn -vframes 10000 -f null -
Stress VCN with another VAAPI encoding session:
ffmpeg -stream_loop -1 -init_hw_device vaapi=va:/dev/dri/renderD128 -filter_hw_device va -f lavfi -i nullsrc,format=nv12 -vf hwupload -c:v h264_vaapi -b:v 2M -maxrate 2M -f null -
This issue happens in VAAPI transcoding too. In this case VCN can keep the max clock 975Mhz for a few seconds and then drop to the minimum 400Mhz. Thus the transcoding speed will be lowered from 170fps to 80fps or even worse.
Test VAAPI transcoding speed:
ffmpeg -stream_loop -1 -init_hw_device vaapi=va:/dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -i any_h264_hevc_1080p.mp4 -an -sn -vf scale_vaapi=format=nv12 -c:v h264_vaapi -b:v 8M -maxrate 8M -vframes 10000 -f null -
Watch the VCN socclk:
watch -n .5 cat /sys/class/drm/card0/device/pp_dpm_socclk
Regression
Not a regression. The issue starts from Renoir. Now I upgraded to Cezanne/5700G and the issue is still there. Both have the same VCN2.
There are two Power Modes in system settings: "Balanced" and "Power Saver", but it doesn't help even if I set it to "Balanced".
This power policy issue doesn't occur on Windows. I watched with GPU-Z tool.