Jump to content

Recommended Posts

Posted

Rockchip has released bsp kernel 5.10 for rk356x and rk3588. Since multimedia support is not fully supported by mainline kernel, a legacy kernel would be good if you want h264/hevc hardware decode.

To make kodi support hardware decoding, you need:

1, ffmpeg supporting rkmpp. I've packaged it in my ppa: https://launchpad.net/~liujianfeng1994/+archive/ubuntu/rockchip-multimedia, which is based on the patch from https://github.com/JeffyCN/FFmpeg/.

2, kodi built with gles render system, which is also in my ppa

3, a gpu driver supporting gles. For rk356x you can use mainline panfrost driver. For rk3588 you can use panfork-mesa from my ppa: https://launchpad.net/~liujianfeng1994/+archive/ubuntu/panfork-mesa

 

I've tested that kodi can support hardware decoding on both 3568 and 3588. Here is the steps for rock5b to install kodi:

1, download the image I build with panfork-mesa and malig610 firmware: https://github.com/amazingfate/armbian-rock5b-images, and install it on your rock5b.

2, add my rockchip multimedia ppa: https://launchpad.net/~liujianfeng1994/+archive/ubuntu/rockchip-multimedia

    sudo add-apt-repository ppa:liujianfeng1994/rockchip-multimedia

3, create a udev rule to enable the permission ofrockchip's mpp device:

    

KERNEL=="mpp_service", MODE="0660", GROUP="video"
KERNEL=="rga", MODE="0660", GROUP="video"
KERNEL=="system-dma32", MODE="0666", GROUP="video"
KERNEL=="system-uncached-dma32", MODE="0666", GROUP="video" RUN+="/usr/bin/chmod a+rw /dev/dma_heap"

    wirte the above rules to /etc/udev/rules.d/11-rockchip-multimedia.rules

4, install kodi:

    sudo apt install kodi

5, move kodi from xsession to wayland-session:

    sudo mv /usr/share/xsessions/kodi.desktop /usr/share/wayland-sessions/kodi-wayland.desktop

6, reboot the board:

    sudo reboot

7, in the lightdm greeter, select kodi and login

8, After starting kodi, in Settings -> Player -> Videos, enable "Allow using DRM PRIME decoder" and "Allow hardware acceleration with DRM PRIME". And set "PRIME Render Method" to "Direct To Plane"

9, Then you can play h264/h265 8 bit/10bit videos up to 4K.

 

============Updated on 20230206===================

rockchip-multimedia has become a universal ppa for rockchip legacy kernel. Here is the introduction: https://forum.radxa.com/t/introduction-to-rockchip-multimedia-ppa-for-ubuntu-jammy/14537
I provide a new package rockchip-multimedia-config to do all the system configs such as udev rules, chromium v4l2 devices creation. Just install this package and reboot, you are good to go.

Posted

I've created an issue about 10 bit videos not playable on kodi: https://github.com/xbmc/xbmc/issues/22202.

Here is the debug log of kodi: https://paste.ubuntu.com/p/C29gywz4Tg/. We can see "CEGLImage::SupportsFormat - format not supported: NA12". NA12 should come from ffmpeg: https://github.com/JeffyCN/FFmpeg/blob/master/libavcodec/rkmppdec.c#L48. What I concern is why the support list of dma buf format doesn't have NV15, the yuv420 10bit drm format, which should be supported by the rockchip's drm driver: https://github.com/friendlyarm/kernel-rockchip/blob/nanopi5-v5.10.y_opt/include/uapi/drm/drm_fourcc.h#L244. Kodi uses eglQueryDmaBufFormatsEXT to get the supported dma buf format: https://github.com/xbmc/xbmc/blob/master/xbmc/utils/EGLImage.cpp#L225.

Anyone knows why egl doesn't support 10 bit drm format NV15?

@jernej@Kwiboo@balbes150

Posted

NV15, although sounds standard, it's not. It's RK invention and used only (AFAIK) on their chips. So I would presume not many mesa developers are aware of it and even less care about it. Note, EGL has nothing to do with DRM planes. EGL lists format supported for GPU rendering and DRM planes lists formats supported by Direct to plane rendering. There is catch, though. ffmpeg must provide proper mapping to DRM descriptor. I have no idea if that's done for NV15 in ffmpeg rkmpp module. If that's not done, direct to plane method won't work.

 

Note that I don't care about vendor solutions and I'm only indirectly involved with RK platforms, so I can't help you more.

Posted

I tried your image for the rock pi 3a and followed all other instructions to get ffmpeg. I get the following when running this:

 

ffmpeg -i rtsp://... -f webm -r 20 -s 640x400 -vcodec vp8 clip1.webm

 

[h264_rkmpp @ 0xaaab1b1af850] Failed to initialize MPP context (code = -1).
[h264_rkmpp @ 0xaaab1b1af850] Failed to initialize RKMPP decoder.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_rkmpp) -> vp8 (libvpx))
  Stream #0:1 -> #0:1 (pcm_alaw (native) -> opus (libopus))
Error while opening decoder for input stream #0:0 : Unknown error occurred

 

 

 

Do you have any idea where I am doing something wrong?

Posted

okay thanks already I thought that because you posted in the rock 3a forum it would be available for rock 3a as well. Please let me know if you have made it available I would be happy to help you test.

Posted

hi amazingfate, you know, i have problems with my android tv H96 max v58 (rk3588) to decode h265 1080p 10 bit video files (8bit perfect). I ve tested with a lots of videos and only with that specification presents a green screen and glitches when decode with kodi's (or vlc's) hardware acceleration. The most weird of all its that i don't have any glitch with 2160p 10bit video files, it's very strange, You have any solution for this? thanks

Posted

I have flashed your image to SD card using Etcher. The blue LED is blinking and it looks like the board is doing something. But there is no signal on the HDMI port, nor can I access the board via SSH. I have specially connected a strong power supply and did not use NVMe. What else could it be? I could boot a "standard" Debian 11 (CLI, without a desktop).
What can this be?

Posted

I solved the booting problem by using a weak 5V 2A power supply!

 

Then I installed everything according to your instructions. In KODI itself there are not the described options in the VIDEO Settings (Settings -> Player -> Videos, enable "Allow using DRM PRIME decoder" and "Allow hardware acceleration with DRM PRIME"). Also not around "Expert" mode.
What am I missing here?

Posted

So once again switched to Wayland and...: The settings are visible!
All settings made according to amazingfate!
Then downloaded a sample video (h.264 UHD + another sample in 1080p) and added it to the MOVIE library.

 

-> For both videos neither picture nor tone! The progress bar is visible and the screen is gray.

 

(Oh, I have now (re-)changed the power supply for an ANKER 30W, runs well)

Posted (edited)

@amazingfate Hi,  Thank you very much for your work.

Цитата

2, add my rockchip multimedia ppa: https://launchpad.net/~liujianfeng1994/+archive/ubuntu/rockchip-multimedia: 

    sudo add-apt-repository ppa:liujianfeng1994/rockchip-multimedia

 

I'm having trouble installing a ppa.

Err:18 https://ppa.launchpadcontent.net/liujianfeng1994/rockchip-multimedia/ubuntu kinetic Release
  404  Not Found [IP: 2620:2d:4000:1::3e 443]
Reading package lists... Done
E: The repository 'https://ppa.launchpadcontent.net/liujianfeng1994/rockchip-multimedia/ubuntu kinetic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.

 

Share a link to the repository with Makefile , for a self-build kodi with mpp. 

 

https://github.com/amazingfate/armbian-compile-action/blob/main/action.yml

It is also not clear what prevents you from pouring your patches for the kernel into the main armbian branch?

 

I noticed some of your patches

https://github.com/armbian/build/pull/4540

Edited by whitefox
Posted

kodi successfully decodes UHD (4K) and FullHD (1080p, 720p) video. But there are some problems with non-standard dimensions like 720x396 - green frames are displayed.

"ffplay -vcodec h264_rkmpp" successfully plays such video.

Posted (edited)

OK, I dealt with my problem.

If kodi started from Gnome Ubuntu session then no "PRIME Render Method" option available.

So kodi must be started as standalone session, then non-standard dimension video is displayed properly.

Also if kodi-standalone started from ssh, then video is played properly. But if kodi-standalone started from terminal in Gnome session then again the same problem (and no "PRIME Render Method" option).

Edited by sergei_gagarin
Posted

@whitefox 

My ppa only supports jammy.

By now the not-upstreams patches are some unofficially supported boards such as h68k and h88k and a kernel backport patch for rk356x 5.10 kernel. For rk3588 there should be no difference. 

Posted
Quote

rock3a is not supported by now because my image hasn't get legacy kernel 5.10 support. But I've just supported another rk3568 board hinlink h68k: https://github.com/amazingfate/armbian-h68k-images. I will make support for rock3a someday in the future.

Is the only difference device tree? Could I use h68k image on rock 3a but replace the dtb before booting it? If so get dtb from one of radxa images of 5.10?

Posted

Hi @amazingfate

 

I managed after long struggle to get GPU video decoding to work on a Rock 5b with Kodi. However I came to the same problem with HEVC (H265) when using 10bit. Black image and the errors in Kodi Log:

 

2023-02-20 14:29:51.144 T:5166     INFO <general>: Creating InputStream
2023-02-20 14:29:51.352 T:5166     INFO <general>: Creating Demuxer
2023-02-20 14:29:51.528 T:5166     INFO <general>: Opening stream: 0 source: 256
2023-02-20 14:29:51.528 T:5166     INFO <general>: Creating video codec with codec id: 173
2023-02-20 14:29:51.528 T:5166     INFO <general>: CDVDVideoCodecDRMPRIME::Open - using decoder hevc (rkmpp)
2023-02-20 14:29:51.529 T:5166     INFO <general>: Creating video thread
2023-02-20 14:29:51.529 T:5173     INFO <general>: running thread: video_thread
2023-02-20 14:29:51.530 T:5166     INFO <general>: Opening stream: 1 source: 256
2023-02-20 14:29:51.530 T:5166     INFO <general>: Finding audio codec for: 86060
2023-02-20 14:29:51.530 T:5166     INFO <general>: CDVDAudioCodecFFmpeg::Open() Successful opened audio decoder truehd
2023-02-20 14:29:51.530 T:5166     INFO <general>: Creating audio thread
2023-02-20 14:29:51.530 T:5174     INFO <general>: running thread: CVideoPlayerAudio::Process()
2023-02-20 14:29:51.530 T:5166     INFO <general>: Opening stream: 4 source: 256
2023-02-20 14:29:51.541 T:5174     INFO <general>: Creating audio stream (codec id: 86060, channels: 8, sample rate: 48000, no pass-through)
2023-02-20 14:29:51.541 T:1874     INFO <general>: CActiveAESink::OpenSink - initialize sink
2023-02-20 14:29:51.563 T:1859    ERROR <general>: CEGLImage::SupportsFormat - supported formats:
2023-02-20 14:29:51.563 T:1859    ERROR <general>: CEGLImage::SupportsFormat -   AB4H
...
2023-02-20 14:29:51.564 T:1859    ERROR <general>: CEGLImage::SupportsFormat -   NV12
...
2023-02-20 14:29:51.564 T:1859    ERROR <general>: CEGLImage::SupportsFormat -   NV16
...
2023-02-20 14:29:51.564 T:1859    ERROR <general>: CEGLImage::SupportsFormat -   Y210
2023-02-20 14:29:51.564 T:1859    ERROR <general>: CEGLImage::SupportsFormat -   Y212
2023-02-20 14:29:51.564 T:1859    ERROR <general>: CEGLImage::SupportsFormat -   Y216
2023-02-20 14:29:51.564 T:1859     INFO <general>: GLES: Selecting single pass rendering
2023-02-20 14:29:51.564 T:1859     INFO <general>: GLES: Selecting YUV 2 RGB shader
2023-02-20 14:29:51.564 T:1859    ERROR <general>: CBaseRenderer::GetShaderFormat - unsupported format 181
2023-02-20 14:29:51.564 T:1859    ERROR <general>: GLES: BaseYUV2RGBGLSLShader - unsupported format 0
2023-02-20 14:29:51.606 T:1859     INFO <general>: Skipped 1 duplicate messages..
2023-02-20 14:29:52.220 T:1874     INFO <general>: PulseAudio: Opened device Default in pcm mode with Buffersize 199 ms Periodsize 50 ms

 

I did see on your Github Issue that you fexed it, but I didn't find how. Or maybe that's something else? 

Posted
On 1/28/2023 at 3:49 PM, amazingfate said:

For rk3588

Hi @amazingfate

Does your ppa:liujianfeng1994/rockchip-multimedia repo widevinecdm still work? 

I'm running Armbian 23.08.0 Jammy with Linux 5.10.160-rk35xx on Opi5+
I installed your rockchip-multimedia-config, and  kodi kodi-inputstream-adaptive libnss3
I'm trying to get some NZ streaming services to work on Kodi, but inputstream.adaptive errors with 'Unable to load widevine shared library (/home/kschwar3/.kodi/cdm/libwidevinecdm.so)'.  The libwidevinecdm.so file from your repo exists in that location.

The Chromium browser also fails on these streaming services. I tried reinstalling chromium-browser, libc-bin and libc6 from your repo.

Posted
19 hours ago, schwar3kat said:

Hopefully Kodi will also be a simple fix.

It turns out that the slyguy plugins for the NZ services replaced the widevinecdm.so with apparently the same version but it had a different size.
I replaced it and it now works.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines