[app] Kodi on armbian with hardware accelerating decode

The hantro g1 support for rk3568 is already merged in linux-next: https://patchwork.kernel.org/project/linux-rockchip/patch/20220214212955.1178947-1-piotr.oniszczuk@gmail.com/. And armbian has this patch applied in edge kernel 5.18. And my armbian image also supports it: https://github.com/amazingfate/armbian-rock3a-images/. I use my armbian jammy gnome image to test kodi.

Video hardware decode is only support in kodi gbm mode now, but still not working out of box because of 2 reasons:
1, mesa is compiled with swrast support, so kodi gbm will start in software rendering, which doesn’t support gpu rendering. I’ve confirmed that mesa has nothing to do with kodi hardware acceleration.
2, kodi from debian is build with -DAPP_RENDER_SYSTEM=gl, but we need gles instead.

So I’ve rebuild mesa without swrast and kodi with gles render system. After install missing font packages fonts-noto-core fonts-roboto-hinted fonts-noto-mono, I can start kodi gbm by running command kodi-standalone --windowing=gbm. At first my screen is black with no video input, replugging the HDMI would help showing the kodi window.

In Settings -> Player -> Videos, enable Allow using DRM PRIME decoder and Allow hardware acceleration with DRM PRIME, you can now play h264 video up to 1080p@60fps with hardware decode. I can play bbb_sunflower_1080p_60fps_normal.mp4 with cpu load less than 40%.

Here is the mesa kodi and ffmpeg debs I’ve built for armbian jammy: https://drive.google.com/drive/folders/1Qq7bALtY02He3jPM1gLuX1hz2vrLYXTl?usp=sharing. You can use apt to install on your armbian jammy, for example:

sudo apt install ./kodi_19.4+dfsg1-2_arm64.deb ./kodi-bin_19.4+dfsg1-2_arm64.deb ./kodi-data_19.4+dfsg1-2_all.deb --reinstall
sudo apt install ./ffmpeg_4.4.1-3ubuntu9_arm64.deb ./libavcodec-dev_4.4.1-3ubuntu9_arm64.deb ./libavcodec58_4.4.1-3ubuntu9_arm64.deb ./libavdevice-dev_4.4.1-3ubuntu9_arm64.deb ./libavdevice58_4.4.1-3ubuntu9_arm64.deb ./libavfilter-dev_4.4.1-3ubuntu9_arm64.deb ./libavfilter7_4.4.1-3ubuntu9_arm64.deb ./libavformat-dev_4.4.1-3ubuntu9_arm64.deb ./libavformat58_4.4.1-3ubuntu9_arm64.deb ./libavutil-dev_4.4.1-3ubuntu9_arm64.deb ./libavutil56_4.4.1-3ubuntu9_arm64.deb ./libpostproc-dev_4.4.1-3ubuntu9_arm64.deb ./libpostproc55_4.4.1-3ubuntu9_arm64.deb ./libswresample-dev_4.4.1-3ubuntu9_arm64.deb ./libswresample3_4.4.1-3ubuntu9_arm64.deb ./libswscale-dev_4.4.1-3ubuntu9_arm64.deb ./libswscale5_4.4.1-3ubuntu9_arm64.deb --reinstall

Update: wayland also support hardware decode, setting the same options as gbm above will make it.


For wayland, just install the ffmpeg and kodi, then you can use drm prime hardware acceleration.

1 Like



Can you also build Chromium or Firefox with hardware decode or 3D support?

Kodi, ffmpeg could also work for Armbian Jammy on RockPi 4, right or other changes needed?
Do you have Armbian Jammy for RockPi 4 with these patches perhaps - https://github.com/armbian/build/pull/3893

Chromium from this ppa: https://launchpad.net/~saiarcot895/+archive/ubuntu/chromium-beta has panfrost support. Hardware decode is not well supported by chromium, but people are working on it: https://bugzilla.redhat.com/show_bug.cgi?id=2071126. I tried to build a verion of chromium with patch https://chromium-review.googlesource.com/c/chromium/src/+/3380426/4, but hardware decode doesn’t work.
The patches you mentioned add the support for HEVC 10-bit HDR, which is not supported by rk3568 mainline kernel by now, so I don’t care about it. My kodi and ffmpeg should work on rockpi4 without other changes. To get HEVC 10-bit HDR support you have to wait for the pull request getting merged and install the new kernel with those patches.

Can you also build mpv video player with video hardware decoding support?

No need to build mpv because mpv use ffmpeg. I can use the vpu using mpv option --hwdec=drm-copy, but the video is not played smoothly.

moonlight 是否可以用这个支持 硬件解码的ffmpeg 构建

Moonlight add drmprime and v4l2-request patches from libreELEC since v3.1.0:https://newreleases.io/project/github/moonlight-stream/moonlight-qt/release/v3.1.0.
It should work but I didn’t test.