BPI-R2 Pro Ubuntu VPU Support Decode and Encode

Tested on 5.18-main, confirmed - works.

Next drivers additionally required:

CONFIG_VIDEO_HANTRO=m

CONFIG_VIDEO_HANTRO_ROCKCHIP=y

P.S. Additional v4l video player support might be required which is depends on distro.

P.P.S. Having troubles playing 4k videos, so need to make sure if HW decoding was actually used.

1 Like

added series + defconfig changes to 5.18-main tree, is this enough?

if yes i can add it to 5.19 and 6.0

For now I’m not sure if HW was actually used: 720p videos played smoothly with no frame drops, but 4k -not. As I understood for now mainline (+ patches) only supports hantro which is limited to 1080p, rkvdec2 (supports 4k) is not implemented.

But the CPU is likely enough to process 720p videos, so it might be a CPU decoding.

After loading hantro-vpu module i have:

[147814.541636] hantro_vpu: module is from the staging directory, the quality is unknown, you have been warned.
[147814.545292] hantro-vpu fdea0000.video-codec: registered rockchip,rk3568-vpu-dec as /dev/video0

Also i see device in interrupts:

bpi-r2pro / # cat /proc/interrupts | grep video
 29:          0          0          0          0     GICv3 171 Level     fdea0000.video-codec

But its count doesn’t raise on video playback. So for now it’s likely a CPU decoding.

Looks like this codec needs software support (GStreamer, etc)

I’m working on it, and I will post any updates here.

have added dts-changes and defconfig to this tree: https://github.com/frank-w/BPI-R2-4.14/commits/6.0-r2pro-multimedia

driver-changes were already there

Driver detects on 6.0-rc (i use both multimedia+pcie):

bpi-r2pro ~ # cat /proc/interrupts | grep video 29: 0 0 0 0 GICv3 171 Level fdea0000.video-codec

v4l2-compliance-out.txt (3.9 КБ)

1 Like

But all is “not supported” so it looks like something is missing

My bad, i accidently booted to the old kernel.

rebootet to new one:

USB keyb/mouse doesn’t work

HDMI: display sets to 1080 on 4k TV

/dev/video0 - not present.

I’ll double check ther config/dts

P.S. is there a DSA support in 6.0?

Where did you found it? Could you point please?

dsa-support is mainline since 6.0, also applied the speed fix.

do you use my defconfig or your one? make sure the hantro is enabled (i guess you ned to disable the CONFIG_MEDIA_SUPPORT_FILTER too). for usb-keyboard…it looks like my defconfig miss the driver

edit: INPUT_KEYBOARD and USB_HID should be enough

your log attached :wink: the ioctrls…do not know if they needed, but it looks like it is not complete working

Input ioctls:
        test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported)
        test VIDIOC_ENUMAUDIO: OK (Not Supported)
        test VIDIOC_G/S/ENUMINPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDIO: OK (Not Supported)
        Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
        test VIDIOC_G/S_MODULATOR: OK (Not Supported)
        test VIDIOC_G/S_FREQUENCY: OK (Not Supported)
        test VIDIOC_ENUMAUDOUT: OK (Not Supported)
        test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported)
        test VIDIOC_G/S_AUDOUT: OK (Not Supported)
        Outputs: 0 Audio Outputs: 0 Modulators: 0

Input is most likely for input devices: cameras/TV-tuners/capture cards/etc so it’s not a promlem.

Outputs - interesting… I suppose OK is better than FAIL but idk all these parameters meanings. Anyway it’s a driver internals. And if i’s supported by HW it might be not implemented in driver.

ok, input not needed makes sense…but codec-ioctrls maybe needed too…there is encoding and decoding commands :wink:

Ok using gstreamer vith gst-plugins-bad (built with -Dv4l2codecs=enabled)

I got interrupts on video decoder:

bpi-r2pro /usr/lib64/gstreamer-1.0 # cat /proc/interrupts | grep video
 29:       8271          0          0          0     GICv3 171 Level     fdea0000.video-codec

command to run:

gst-launch-1.0 playbin uri=file:///path/to/file_video.avi

The speed/cpu_usage/picture quality are the same as in vlc w/o interrupts(and HW accel?) (tested on 720p and 1080p)

I’ll continue tommorow.

Could you please point me how to use decoding in I also tried Armbian_22.08.0-trunk_Bananapir2pro_sid_edge_5.19.0_xfce_desktop.img

the decoder driver is loaded - it’s present in /proc/interrupts

But i couldn’t use th hw decoding using mpv - mp4 file, chrome/firefox - youtube

Or should i use an image with BSP kernel?

What and how do you check ? The best support for full - screen video playback is in LE . There is no HW in browsers yet, browser developers must add it, or you must assemble and configure all components manually.

LE - is it a player? I used mpv (the default one)

I guess LibreElec image :slight_smile:

Have you guys tried this fork of ffmpeg:

jernejsk/FFmpeg (v4l2-request-hwaccel-4.4)

LibreElec generates it’s patches from this source.

I’ve started experimenting with building kernel from LibreElec’s config and building this ffmpeg fork. Just finished building it, for my old RK3288 board, cause I do not have a RK3588 yet.

In case it was not a typo

R2pro is rk3568

Rk3588 does not have mainline support yet. I saw some basic support patches (clock,pinctrl,…),but no hdmi/gpu/hantro yet.

It is not a typo, I mean to buy one RK3588 when it is available. But for now, I only have a RK3288 (and a RK3399 chromebook tablet for only EUR 99 new, nice for later experiments)

But anyway, I guess you need to use v4l2-request for RK3288, RK3328, RK3399, RK3568 and RK3588. (I believe v4l2-m2m is not for any rockchip chipset)

That’s why I mentioned that fork of ffmpeg.

Yes. :slight_smile: LE = KODI

The latest version of LE for BPIR2pro already supports installation on eMMC and you can get a good home theater system.