Panfrost for Bifrost GPUs - Big improvements

Panfrost has nothing to do with video playback…

Noted. So the hardware decoding is either v4l2m2m-copy or v4l2m2m?

Hardware decoding is done by the video decoder, which is either Cedrus (Allwinner A64), Hantro/RKVDec (rockchip) or meson-vdec (amlogic).

I’ve got smooth playing with Panfrost with no dropped frames at all. I think it’s because cpus can handle decoding with easy. However rendering needs acceleration for the gpu, maybe video overlay is necessary. Panfrost allows for this and without it dropped frames are the rule.

Do you have sound with 5.9.13.1? I don’t

In my case the CPU resource usage is reasonably low but have high dropped frames according “Paused) AV: 00:02:30 / 00:03:13 (78%) A-V: 0.000 ct: 21.084 Dropped: 6046 Cach”.

I have sound with kernel-5.9.13-1.

Did you make something to get sound?

Thanks. In my case it will be meson-vdec (amlogic).

Not really, it works out of the box or at most “systemctl enable sound —now”.
Which Panfrost driver are you using?

I have bifrost G31 with mesa-git 21.0 and dropped frames are zero for decoding and zero for output, playing 1080p video.

Here my test with your video

[root@inuyasha jon]# mpv Wolverine Adamantium Scene | X-Men Origins Wolverine (2009) Movie Clip - YouTube
(+) Video --vid=1 () (h264 1280x720 60.000fps)
(+) Audio --aid=1 --alang=eng (
) (opus 2ch 48000Hz)
Subs --sid=1 --slang=de ‘vtt’ (webvtt) (external)
Subs --sid=2 --slang=en ‘vtt’ (webvtt) (external)
Subs --sid=3 --slang=en-GB ‘vtt’ (webvtt) (external)
Subs --sid=4 --slang=es-419 ‘vtt’ (webvtt) (external)
Subs --sid=5 --slang=fr-CH ‘vtt’ (webvtt) (external)
Subs --sid=6 --slang=it ‘vtt’ (webvtt) (external)
Subs --sid=7 --slang=ru ‘vtt’ (webvtt) (external)
Subs --sid=8 --slang=zh-CN ‘vtt’ (webvtt) (external)
error: XDG_RUNTIME_DIR not set in the environment.
AO: [alsa] 48000Hz stereo 2ch float
VO: [gpu] 1280x720 yuv420p
AV: 00:01:19 / 00:03:13 (41%) A-V: 0.001 Dropped: 365 Cache: 90s/29MB
[ffmpeg] tls: Error in the pull function.
[ffmpeg] https: Will reconnect at 2719728 in 0 second(s), error=Input/output error.
AV: 00:03:04 / 00:03:13 (95%) A-V: 0.003 Dropped: 658 Cache: 9.4s/622KB

GTKPro has S922X SOC with Bifrost G52. Panfrost and meson_vdec seems to support Bifrost-G31 way better than G52 at the moment.

Have we now got hardware video decoding? I have now half cpu usage with mpv - - hwdec=auto-copy and reports is using v4l2m2m-copy hardware decoding.

Kernel linux-vim 5.11.4… 1

1 Like

I doubt that unless you’re using ffmpeg-m2m pkg which i have built from chewitts ffmpeg source which have v4l2_m2m support for amlogic vdec which can handle mpeg2 , h264 and vp8. Seeking is a bit of hit and miss though.

I have noticed that h264 and h265 takes very less cpu load i think that must be coz of gpu load got offloaded from cpu.

I will try this mpv - - hwdec=auto-copy and get back to you.
Thanks for reporting

1 Like

I am on XFCE linux-vim 5.11.4-1 with mesa-git (Panfrost) and tried mpv video file and mpv --hwdec=v4l2m2m-copy. mpv hwdec=v4l2m2m-copy does seems to reduce the cpu usage a bit (can’t quantify) but the CPU temp does drop around 4C.

jfl@MNJROGTKPro ~]$ mpv --hwdec=v4l2m2m-copy Wolverine Adamantium Scene | X-Men Origins Wolverine (2009) Movie Clip - YouTube

 (+) Video --vid=1 (*) (h264 1280x720 60.000fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 44100Hz)
     Subs  --sid=1 --slang=de 'vtt' (webvtt) (external)
     Subs  --sid=2 --slang=en 'vtt' (webvtt) (external)
     Subs  --sid=3 --slang=en-GB 'vtt' (webvtt) (external)
     Subs  --sid=4 --slang=es-419 'vtt' (webvtt) (external)
     Subs  --sid=5 --slang=fr-CH 'vtt' (webvtt) (external)
     Subs  --sid=6 --slang=it 'vtt' (webvtt) (external)
     Subs  --sid=7 --slang=ru 'vtt' (webvtt) (external)
     Subs  --sid=8 --slang=zh-CN 'vtt' (webvtt) (external)
AO: [pulse] 44100Hz stereo 2ch float
Using hardware decoding (v4l2m2m-copy).
VO: [gpu] 1280x720 nv12
(Paused) AV: 00:03:06 / 00:03:13 (96%) A-V:  0.000 Dropped: 136 Cache: 6.6s/543K

Similarly on a [jfl@MNJROGTKPro ~]$ mpv --hwdec=v4l2m2m Unity Engine Demo Short Film (1440p) - YouTube. 1440p/30 VP9, CPU usage is also lower.

mpv --hwdec=v4l2m2m-copy does not seems to work with 1440p/30 video file.

@spikerguy, Looking forward to your ffmpeg-m2m pkg.

I understand you notice less cpu usage as well. I used a 1080p youtube video but mpv reported libva and vdpau errors, but you don’t have any error. Have you installed anything more than these libraries?

The decoding is done without any loss but output has some (136 for you) so the copy is not very good. This is something reported in archlinux-wiki, and software decoding remains better but is good to see hardware support is getting better.

If I use mpv --hwdec=auto-copy I have the same libva and vdpau errors. I use mpv --hwdec=v4l2m2m-copy for 720p/60 and mpv --hwdec=v4l2m2m for 1440p/30. The dropped frames usually get worse it you move the mouse. This is more obvious if you stream video on Firefox and move the mouse, immediately you will notice frame drops if Panfrost is enabled.

Hopefully, Spikerguy is successful in getting ffmpeg-m2m pkg to work.

1 Like

Hi @spikerguy where can I get your ffmpeg-m2m pkg?
If I install it will it work with kodi?

Here
I have not uploaded it to repo as I couldn’t really find if it was working or not.

No Kodi that I have been maintaining is using kodi-ffmpeg version from their branch first if I could get ffmpeg-m2m to actually show me that it is hw acc then I can look into the kodi side atleast.

1 Like

Ok @spikerguy thanks I’m going to try it

I have the pkg at home, Let me see if I can get it for you now.