mpv don't use hardware acceleration for decoding

Started by fivuf, April 20, 2020, 07:26:23 PM

Previous topic - Next topic

fivuf

Hi,

I have two issues on the A20-OLinuXino-LIME2 rev g.

On libreelec nightly version (https://test.libreelec.tv/) which is using lima, the open source driver for mali400, i can view 1080p x264 video without issue.

On Bionic desktop image provided by olimex, mpv doesn't use hardware decoding by default, so the video is very low framerate and when i asked it to use vdpau, it doesn't find the libvdpau_nvidia.so.

I'v set VDPAU_DRIVER=sunxi

mpv --vo=vdpau --hwdec=vdpau --hwdec-codecs=all test.mkv
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file:No such file or directory


When using the debian build from github olimex/build repository (which is final setup i want, the other two was to compare with).
 with:
-mainline kernel
-minimal console interface
- options to get encrypted system

and upgrade the buster to testing to get the new version of mesa including lima, following the documentation of debian.
https://wiki.debian.org/MaliGraphics

i get the same error than the bionic image at the exception the file is name vdpau-sun4i-dri.so

The second problem is only with the debian build, when using dwm, the gui is very laggy, contrary of the bionic image. I think the two problem can be linked, as it seems in both case that the cpu is used instead of the gpu.

Here's the output of dmesg, lsmod, mpv with verbose
https://pastebin.com/zhSC8rht
https://pastebin.com/S5ZhpQn3
https://pastebin.com/zNhEhDyJ

I searched for a while, but it's hard to find something up to date. With kernel 5.4 and mesa 19.3, lima should work out of the box. You can see that in lsmod lima is here. It seems i need to install something to get the .so, but i don't know what. apt-file search doesn't find anything, so it's not on the repo on debian.


LubOlimex

What you wrote is true. The things currently are like that:

Our software developers couldn't enable hardware decoding in the latest mainline Ubuntu/Debian images. Decoding video with higher resolution and bit rate would probably lag.

The libreelec images have hardware decoding enabled.

The other option for hardware decoding is using the older sunxi images, kernel 3.4.x.

Technical support and documentation manager at Olimex

fivuf

Thanks for your answer.

The legacy kernel with OLIMEX/build is using the 4.19 kernel, so i presume this one will also not be able to use hardware decoding ?

This one would be good ?
ftp://staging.olimex.com/Allwinner_Images/A20-OLinuXino-LIME2/Debian/sd/a20-lime2_mainline_uboot_sunxi_kernel_3.4.103_jessie_NAND_rel_13.img.7z

The libreelec image use the 5.6.0 kernel and openGL ES 2.0 mesa 20.0.4. What is the order of magnitude of work to support hardware acceleration in olimex build with mainline kernel ?

LubOlimex

Yes, if your LIME2 board has NAND memory use that image.

QuoteWhat is the order of magnitude of work to support hardware acceleration in olimex build with mainline kernel ?

According to our developers impossible in foreseeable future.
Technical support and documentation manager at Olimex

fivuf

Some more questions:

Do the proprietary binary driver of Mali can be used with hardware acceleration with the olimex build mainline kernel ?

Libreelec know how to use hw acceleration with free driver and mainline kernel but it's not debian based. Is the issue reside only in debian based distribution ?

JohnS

What did the debian guys say?  Obviously you will have asked them...

John

LubOlimex

Quote from: undefinedDo the proprietary binary driver of Mali can be used with hardware acceleration with the olimex build mainline kernel ?

No. If it was we would have provided a way to enable it if it was possible.

Quote from: undefinedLibreelec know how to use hw acceleration with free driver and mainline kernel but it's not debian based. Is the issue reside only in debian based distribution ?

I am not sure but a month ago I asked the developers the same thing, "can't we just get the video acceleration stuff from Libreelec images and put it in the Ubuntu or Debian images". The answer was "no, we can't",
Technical support and documentation manager at Olimex

fivuf

#7
I asked on forum of libreelec and here's an interesting anwser.

https://forum.libreelec.tv/thread/17565-nightly-images-for-a20-a64-h3-h5-and-h6-boards/?postID=139427#post139427

QuoteIs it possible to get this working on another distribution like debian or gentoo ?

Sure, "just" pick patches from LE build system. Note, Kodi on LE does HW video decoding with patched ffmpeg and proper use of it. This probably won't work with random video player. I think that mpv needs only one small patch but I didn't try it in a long time. There is also an effort to make proper VAAPI layer which would be useful for most players but it currently doesn't work with latest kernel and wouldn't work with HW decoding improvements from LE without modifications. That's because kernel API for this kind of VPU HW is not yet stable and changes from kernel to kernel.

I'll try to test, but i'm not very confident to know exactly how to do that.

fivuf

for reference, an active thread on armbian forum which talk about what i want to do:

https://forum.armbian.com/topic/13622-mainline-vpu

Chris

Quote from: fivuf on May 13, 2020, 01:10:19 PMI'll try to test, but i'm not very confident to know exactly how to do that.

I am struggeling with the same problem... Did you test anything in the meantime?