BPI-R2 Pro Ubuntu VPU Support Decode and Encode

Too bad the code is not open, I just would like to learn more about it. It is a hobby for me founding out how it all works and implement it on my hardware at home, and sharing my findings in a script.

AFAIK LE has it’s own git and instructions/scripts to build the image. So it is opensource. The main issue for non-officially supported board is the kernel (or bootloader+kernel). @balbes150 do you use the same kernel for LE as for armbian? If so then it should be not a big problem to build it (of course it might be tricky if you had no such experience)

If i understand correctly, i need to follow for LE forum thread named " Unofficial LE for RK356x RK3328\RK3399 3288\3188" right?

If so where should i search next? I see regular announcements and eventual links to Yandex disk. But i didn’t found any images for r2pro

Yes

No. See the topic (the link I gave) on this forum.

I’ve tested it, runs nice and smooth, but i can’t mount a sata hdd, is it supported? Also is the wifi supported too, and whith cards?

I haven’t tested SATA, maybe @frank-w knows what state the SATA support is in.

What kind of cards are we talking about ?

Wifi cards - a typo , sorry my bad.

I have/use MT7615/mt9715/mt7921/intel AX210

i have merged SATA-Support in mainline after combphy-support was in…so if it is not working make sure you have all drivers in.

Anyway,

A little progress, on RK3288. Have to specify -hwaccel drm to use the v4l2-request decoder

So running:

ffmpeg  -loglevel debug -hwaccel drm -i ~/journaal.ts -f null /dev/null

I can clearly see there is some v4l2-request action. Even on unpatched mainline kernel 5.19.

Is it with patched ffmpeg?

this one?

Yes it is. Also with kernel config of libreelec, with those config_video_xxx enabled.

So for rk3568 you would need roughly the same setup.

Succes!

In kernel including configs:

CONFIG_VIDEO_HANTRO=m
CONFIG_VIDEO_HANTRO_ROCKCHIP=y
CONFIG_VIDEO_ROCKCHIP_VDEC=m

FFmpeg, you will need something like:

git clone https://github.com/jernejsk/FFmpeg
git checkout v4l2-request-hwaccel-4.4
git merge --no-edit origin/v4l2-drmprime-v6

Merging the two branches v4l2-request-hwaccel-4.4 and v4l2-drmprime-v6 as you will need drmprime for HW play in Kodi.

Build FFmpeg with options including:

    --enable-libudev \
    --enable-libdrm \
    --enable-libv4l2 \
    --enable-v4l2_m2m \
    --enable-v4l2-request \

Then build the latest kodi from github, with options including:

-DENABLE_INTERNAL_FFMPEG=OFF
-DAPP_RENDER_SYSTEM=gles
-DCORE_PLATFORM_NAME="gbm"

Then run kodi in standalone mode, see kodi-standalone-service.

When running with gles you can enable DRM_PRIME hardware acceleration in Kodi.

And Succes! Pressing key O it shows HW instead of SW. Playing h264 on RK3288 with only about 20% CPU usage on ArchLinuxARM :slight_smile:

Guess RK3568 and later even RK3588 will need about the same approach.

3 Likes

It actually already works with stock linux-armv7 Arch-Linux kernel.

So on Arch-Linux no need to build a custom kernel.

I published a version of my install script for RockChip devices on github. Currently it only supports RK3288, as I only have one of those. Maybe later I could add other socs and devices.

It has all of the above installed in pre-build packages.

1 Like

Hi @ericwoud

What is Your build environment?

I got a error on build attempt:

ffmpeg_build_error.txt (28.0 Kb)

UPD: the same is with the https://github.com/jernejsk/FFmpeg

I build on Arch Linux Arm, on the board itself; no need for cross-compiling. There you would need to install the package linux-api-headers. It is not as recent as the linux-aarch64, but it is new enough that it would compile.

I have had similar errors before and they looked the same. At that time the headers were too old.

Even if it does compile, the headers may still be too old for HVEC support, it was added even later.

So in short: you are missing the correct headers with some recent V4L2 definitions.

1 Like

I finally have a RK3588 shipping to me. I want to use it also for encoding. As far as I can tell, then my only option is to use MPP instead of v4l2-request.

This will be my next project for the coming weeks.

Expecting my rk3588 in about a week :slight_smile:

The same for me - compiling on the board itself, but I use Gentoo. After updating linux-headers to 6.0. the FFmpeg has passed pfrevious files, but i got another one.

ffmpeg_build_error_v2.txt (4.2 КБ)

Can you check what version of linux-headers do yo have? Thx

UPD:

Downgraded linux-headers to 5.19… building… so far so good - already passed all v4l source files.

UPD2: Successfully build it.

looks like it works:

image

Works with vlc and mpv (both built with ffmpeg support) (libavcodec is always on top)

But I’m not 100 sure (despite the videos playing smoothly) if v4l is used: only by perf top

Do you know any method to make sure if hw codec is used?

Thx

UPD3:

ffmpeg  -loglevel debug -hwaccel drm -i ~/<myfile> -f null /dev/null

Ok, when running it with one of my files i see interrupt counter for video-codec:

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

No such behavior when playing.

In Kodi it is simple, just press the O key.

The CPU usage is a very good indication and this is ultimately why you use hwaccel…

There should be a lot of v4l2-request info in the debug output.

At the moment I cannot try myself to check my output

Try something like this:

ffmpeg -loglevel debug -hwaccel drm -hwaccel_output_format drm_prime -i journal.ts -f null /dev/null

I think I remember you also need to add -hwaccel_output_format to enable v4l2-request.

Edit:

Does it work now?