4kp30 video on Orange Pi Lite and mainline hardware acceleration


Recommended Posts

I went up to step 19, but the board does not boot.
I suppose I failed around the copy of the files.

sudo cp linux-4.20.17/arch/arm/boot/zImage /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/boot/zImage-4.20.17
sudo cp linux-4.20.17/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dtb /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/boot/
sudo cp sunxi-cedar-mainline/boot.scr /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/boot/
sudo cp sunxi-cedar-mainline/sunxi_cedar.ko /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/lib/modules/
sudo cp -R modules/lib/modules/4.20.17 /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/lib/modules/

sudo cp linux-4.20.17/arch/arm/boot/zImage /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/boot/zImage-4.20.17
sudo cp linux-4.20.17/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dtb /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/boot/
sudo cp sunxi-cedar-mainline/boot.scr /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/boot/
sudo cp sunxi-cedar-mainline/sunxi_cedar.ko /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/lib/modules/
sudo cp -R modules/lib/modules/4.20.17 /media/techforum/1868e640-9660-423a-8dd3-de560bfb2298/lib/modules/

 

Link to post
Share on other sites
Donate and support the project!

that happens because of the kernel you're using.

be careful with the node:

reserved-memory {
		#address-cells = <1>;
		#size-cells = <1>;
		ranges;

		cma_pool: cma@43c00000 {
			compatible = "shared-dma-pool";
			reusable;
			reg = <0x43c00000 0x6000000>;
			linux,cma-default;
		};
	};

it should look like above.

to check everything is alright with the CMA, you should check CMA on kernel boot:

 dmesg | grep CMA
[    0.000000] Reserved memory: created CMA memory pool at 0x43c00000, size 96 MiB

it must look like above

good luck

Link to post
Share on other sites

Thanks @ubobrov,  tried but did not see dmesg reporting CMA,  do you think there is anything conflicted  

with the built-in Cedrus driver in menuconfig ?  my platform is nanopi-duo2 of 512M.  

 

--- Media staging drivers                                                 │ │

  │ │    [*]   Allwinner sunXi family Video Devices                                │ │

  │ │    <M>     Allwinner Cedrus VPU driver                                       │ │

  │ │          *** soc_camera sensor drivers ***

 

Also, may I know the reason cma change from cma@4a000000 to cma@43c00000 at kernel 5.4.

Link to post
Share on other sites

response my post , also to @ubobrov,

I found that node reserved-memory should be outside of SOC, 

after fixing it , the CMA creating works now.

But when installing the sunxi_cedar.ko, it reports 

"sunxi-cedar 1c0e000.video-engine: syscon failed..."

I found the syscon entry is different inside sun8i-h3.dtsi at kernel 5.4.16.

 

Link to post
Share on other sites

Decoding H264 and X11 rendering using vdpau_sunxi, libcedrus, kernel 4.20.17, mpv, vncserver and Armbian Bionic on Orange PI Zero

libvdpau: https://github.com/uboborov/libvdpau-sunxi-H3.git

libcedrus: https://github.com/uboborov/libcedrus-H3.git

cedar_dev: https://github.com/uboborov/sunxi-cedar-mainline.git

 

mpv, ffmpeg, x11 installed using apt

 

It works extremely slow but it's just a beginning  )

video: https://www.youtube.com/watch?v=9O7L_kaEDdk

UPD:

video on Orange PI One 1280x720 HDMI (works pretty fine)

https://www.youtube.com/watch?v=8qPyOG-yJIw

 

Link to post
Share on other sites
On 4/23/2020 at 5:46 AM, Werner said:

I think you can use armbian-config to switch kernel branch to dev and you should get an Linux 5.6.5 kernel which should have cedrus module shipped with.

When i try ti update kernel , i got this message

 

Test install failed. Can't change firmware

Link to post
Share on other sites
9 minutes ago, andydj said:

When i try ti update kernel , i got this message

 

Test install failed. Can't change firmware

I just noticed you don't even have to go to dev branch. In current it is enabled already. If your 5.4.x-current kernel is halfway up-to-date you should be able to modprobe cedrus.

Link to post
Share on other sites
15 hours ago, ubobrov said:

Decoding H264 and X11 rendering using vdpau_sunxi, libcedrus, kernel 4.20.17, mpv, vncserver and Armbian Bionic on Orange PI Zero

libvdpau: https://github.com/uboborov/libvdpau-sunxi-H3.git

libcedrus: https://github.com/uboborov/libcedrus-H3.git

cedar_dev: https://github.com/uboborov/sunxi-cedar-mainline.git

 

mpv, ffmpeg, x11 installed using apt

 

It works extremely slow but it's just a beginning  )

video: https://www.youtube.com/watch?v=9O7L_kaEDdk

 

 

you enable legacy driver in mainline kernel... great job.

Link to post
Share on other sites
30 minutes ago, Werner said:

I just noticed you don't even have to go to dev branch. In current it is enabled already. If your 5.4.x-current kernel is halfway up-to-date you should be able to modprobe cedrus.

Modulo cedrus not found in ...../5.4.28-sunxi64

 

I think i have to move in h6 board forum

Link to post
Share on other sites
5 minutes ago, andydj said:

Modulo cedrus not found in ...../5.4.28-sunxi64

 

 

Check apt-cache search linux-image | grep sunxi

I think there should be a newer image available. It is definitly enabled:https://github.com/armbian/build/blob/887ef462fc18a6b91050a1bb1dd46b0e6114087f/config/kernel/linux-sunxi-current.config#L5602

 

Quote

I think i have to move in h6 board forum

Not sure how the H6 forums would help in this case since the the OPi Lite is based on the H3.

Link to post
Share on other sites

Simple, LibreELEC heavily patches kernel and ffmpeg for better experience. Patches are slowly getting in kernel but ffmpeg patches will need far more time to be accepted (kernel must first declare this API stable which won't happen anytime soon). You also need Kodi master (e.g. Kodi 19 pre-alpha), because it has a lot of important improvements. Last but not least, only Kodi GBM (e.g no desktop environment) version really works well (zero copy playback) and soon wayland. X11 has no chances to work well.

 

TL;DR: LibreELEC uses features which are in development and not present in any stable version yet.

 

BTW, also 4K HEVC videos work well.

Link to post
Share on other sites
16 hours ago, jernej said:

Simple, LibreELEC heavily patches kernel and ffmpeg for better experience.

 

16 hours ago, jernej said:

Last but not least, only Kodi GBM (e.g no desktop environment) version really works well (zero copy playback) and soon wayland. X11 has no chances to work well.

sounds too hard for me lol. but thanks for explanation anyway!

Link to post
Share on other sites

@ubobrov Really big thanks, I have spend a lot of time to force Orange Pi Zero encode video with no luck. With you instruction I got a chance to make it works. Tried to do the same as you wrote step-by-step carefully, but kernel module fails with the error in `dmesg`:

```
[    0.000000] Reserved memory: created CMA memory pool at 0x4a000000, size 96 MiB
...
[ 1948.521206] sunxi_cedar: loading out-of-tree module taints kernel.
[ 1948.522324] sunxi cedar version 0.1 
[ 1948.522598] [cedar]: install start!!!
[ 1948.522768] cedar_ve: cedar-ve the get irq is 40
[ 1948.522798] sunxi-cedar 1c0e000.video-engine: assigned reserved memory node cma@4a000000
[ 1949.529005] alloc_contig_range: [4a100, 4f100) PFNs busy
[ 1949.531714] alloc_contig_range: [4a200, 4f200) PFNs busy
[ 1949.533825] alloc_contig_range: [4a200, 4f300) PFNs busy
[ 1949.535770] alloc_contig_range: [4a400, 4f400) PFNs busy
[ 1949.537915] alloc_contig_range: [4a400, 4f500) PFNs busy
[ 1949.540066] alloc_contig_range: [4a400, 4f600) PFNs busy
[ 1949.542753] alloc_contig_range: [4a400, 4f700) PFNs busy
[ 1949.544955] alloc_contig_range: [4a800, 4f800) PFNs busy
[ 1949.547059] alloc_contig_range: [4a800, 4f900) PFNs busy
[ 1949.549338] alloc_contig_range: [4a800, 4fa00) PFNs busy
[ 1949.563811] cma: cma_alloc: alloc failed, req-size: 20480 pages, ret: -16
[ 1949.563843] sunxi-cedar 1c0e000.video-engine: cedar: failed to allocate memory buffer
```

 

Could you please tell the direction in which to dig? Thanks.
 

Link to post
Share on other sites

Your problem is in Pi Zero's memory. To make driver loaded without errors you should load it on startup.

#! /bin/sh

### BEGIN INIT INFO
# Provides:          cedrus
# Required-Start:    $syslog
# Required-Stop:     $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

/sbin/insmod /lib/modules/sunxi_cedar.ko

exit 0

 

Link to post
Share on other sites
On 8/15/2020 at 4:19 AM, marine1988 said:

Hi there for a noob guy is it possible to install the armbian witth hw deconding working on kodi just like on raspberry or i need to do all this stuff? Im don´t know how to compile!

If you only want to use Kodi, take a look at LibreElec: https://forum.libreelec.tv/thread/17565-nightly-images-for-a20-a64-h3-h5-and-h6-boards/

It's got more hardware decoding features than mainline or Armbian thanks to various custom patches for both the kernel and Kodi, but it doesn't do anything other than run Kodi.

Link to post
Share on other sites

Note that ffmpeg patches for request API are important - without patched ffmpeg, all kernel patches have no meaning. Second important thing is that LibreELEC runs Kodi without X11 for ARM boards - this allows to use display more efficiently. On X11 it would be needed to render video through GPU which is less efficient. Note that I never actually tried that.

Link to post
Share on other sites

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...