Ubuntu VPU Support Decode and Encode

Thanks for the tip. Is there a github repo we can see the source?

I think most users here are interested in a bit more OS, then ‘Just enough OS for Kodi’, since the bpir2pro RK3568 is part of a router.

The source code is intended for LE developers. Are you a LE developer ? What nickname \login do you have in the LE developer group?

What additional OS are we talking about ?

You wrote that you do not have BPIR2pro and you are not planning to buy it, why do you need the code for r2 pro?

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.