• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 23
hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy)
#1
Allwinner video HW decoding on A10/A20 using VDPAU and GLES zero-copy support for Linux

There is (unofficial) support available for video HW decoding and embedding the video
zero-copy via GLES within Kodi using libvdpau-sunxi and VDPAU, i.e. unlike the kodi support from rella/empatzero/others the GLES layering (video overlays) do work completely in this implementation.
Additionally my driver implementation supports DivX/XVID/MS-MPEG and has sprite support for MPEG-4 over the official libvdpau-sunxi implementation.

Additionally there is HW JPEG decoding support available in Kodi too, e.g. watching photos these get
decoded via the Allwinner HW. (unluckily pic thumbnails are still done via software, since HW JPEG
encoding is not supported yet)

There are some precoditions/"what-you-should-know" for this stream:
- it is still a POC although it works quite well (for me)
- this implementation is intended for a set-top box, i.e. it uses only the framebuffer and not X. But can probably be improved to support X and Kodi within a window as well.
- Mali OpenGL driver is used in version Linux-r3p0-04rel0
- it has quite a lot of dependencies and requirements to/from other software
- it needs to be compiled by each and someone else who wants to use it, due to all of of dependencies
- It has been tested on Allwinner A10/A20 only (A20 has still a little problem of tearing when playing videos)

The dependencies are:
- Sunxi-kernel kernel extension for the UMP module (add CMA support)
https://github.com/mosterta/linux-sunxi/..._sunxi-3.4
- it needs an updated libUMP since some extensions are necessary (branch mosterta/master):
https://github.com/mosterta/libump/tree/mosterta/master
- it needs a special version of libvdpau (due to extension for DivX/XVID/MPEG4 sprite support)
https://github.com/mosterta/libvdpau
- it needs a special version of libvdpau-sunxi (due to using UMP + support for more video formats)
https://github.com/mosterta/libvdpau-sunxi
- it needs my version of kodi sources, still based on Kodi 14.2 (Helix)
https://github.com/mosterta/xbmc/tree/he...es_support
- for HW JPEG support in Kodi, which is optionally (it requires a compiled and installed libvdpau-sunxi):
https://github.com/mosterta/libcedarjpeg

- it needs a patched version of ffmpeg, the patch gets applied during kodi build.

Kernel build:
unfortunately there are different streams of the kernel depending on the board (e.g. bananapi/lemaker have their own stream). Therefore you need to apply these hashes/patches if you don't use my sunxi-3.4 kernel:
- https://github.com/mosterta/linux-sunxi/...5cbf7ee1c0
- https://github.com/mosterta/linux-sunxi/...9c1613da68

Additionlly in the kernel .config file the following options need to be set:
----------------------------------
CONFIG_CMA=y
# CONFIG_CMA_DEBUG is not set
#
# Default contiguous memory area size:
#
CONFIG_CMA_SIZE_MBYTES=192
CONFIG_CMA_SIZE_SEL_MBYTES=y
# CONFIG_CMA_SIZE_SEL_PERCENTAGE is not set
# CONFIG_CMA_SIZE_SEL_MIN is not set
# CONFIG_CMA_SIZE_SEL_MAX is not set
CONFIG_CMA_ALIGNMENT=8
CONFIG_CMA_AREAS=7
------------------------------------

CMA size can be reduced, but it does not really hurt, since the memory is only allocated when required.

libump build:
this is straight forward configure;make;make install

libvdpau build:
DRI2 must not be used: configure --disable-dri2; make; make install

libvdpau-sunxi build:
make; make install
will install the libs to /usr/lib and /usr/lib/vdpau

libcedarJpeg build (optionally):
make; make install

kodi build:

./configure --config-cache --prefix=/usr/local --disable-x11 --disable-sdl --disable-xrandr --disable-joystick --disable-gl --enable-vdpau --disable-vaapi --disable-openmax --enable-neon --enable-gles --disable-mysql --disable-airplay --disable-airtunes --enable-debug --disable-optimizations --with-ffmpeg=force --with-platform=allwinner-mali

install afterwards.

Afterwards Kodi shall be able to HW decode whatever videos libvdpau-sunxi supports.

Within Kodi settings the VDPAU mixer shall be switch off via the GUI. Also VDPAU de-interlacing is not supported right now. Please set the de-interlace mode to RENDER_BOB ( value 6 in guisettings.xml)
Reply
#2
Hi,

thanks mosterta for taking this task.
Using completely open source code (except the mali binaries) is imho the best and only posible way, to bring Kodi to Allwinner devices. Sadly it requires many patches for the other apps atm, but i think this could be manageable. I hope, many people will get interested in the way you did it and

*** drop the binary blobs or "so called open source" media codec from Allwinner. ***

I'm surely interested in this piece of code and will try it soon.

Regards
rellla
Reply
#3
Is there a compiled version?

Can you send me a compiled version of 14.2 for a tipical allwinner tablet?

Please please please
Reply
#4
whise,
a compiled version of Kodi is not enough, since you also need an updated kernel and the kernel is unfortunately hardware specific as long as Allwinner (or the community) does not provide an generic kernel (and even then the device tree file is specific for each hardware).

What I can provide and will do in near future is to provide an root file system with all the changes and adaptions, but also with the root file system everyone has his/her own preferences. my root file system is currently based on opensuse, not everyone is in favor of this distribution.

May I ask what you want to do with this release on your tablet? As I have written in my first post in this thread my main focus was on set-top boxes, e.g. the current focus was not on running this kodi version in parallel to other programs or using the X window system. Therefore it may not be suitable when you use the tablet in the "normal" tablet scenarios. Also are you running Android on your tablet? Because my implementation only works on linux, not on android.

Regards,
Martin
Reply
#5
Oh sorry i didnt know this was for linux. I am running android unfortunatly.

Thanks anyway... bad luck for me.
Reply
#6
So in theory is posible to build a OpenElec image right?

Just use your git as source for the pendencies (kodi, kernel, ect), tweak the make files and add the x server like the generic builds... ¿right?

--EDIT---
Opps X is no longer required for libvdpau-sunxi?
Reply
#7
I don't see any reason why a OpenElec build shouldn't be possible, if all requirements to this kodi build can be fullfilled.

an X server is not required, the libvdpau/libvdpau-sunxi has been changed to remove any usage of the libX library. But you need the framebuffer version of the libMALI.so OpenGLES stack.
Reply
#8
@mostera did somebody propose vdpau-GLES-interop to freedesktop.org?
Reply
#9
@mostera Is HDMI-CEC supported in Kodi (using your modified kernel ?)
Reply
#10
(2016-01-09, 20:44)FernetMenta Wrote: @mostera did somebody propose vdpau-GLES-interop to freedesktop.org?

The vdpau-GLES-interop is not related to libvdpau on freedesktop.org, vdpau-GLES-interop is specified from NVIDIA as an official OpenGL extension. There are just minor adapations due to the fact that this extension should but implemented within the OpenGL(ES) stack, which is not the case for the Mali OpenGL stack, so I added it as an extra layer between VDPAU and OpenGL(ES).

The changes regarding libvdpau on freedesktop.org is because of the extension of supported video formats, e.g. libvdpau only supports a subset of the MPEG4 header parameters and some important parameters are missing; e.g. with the current supported MPEG4 parameters it is not possible to decode sprites within an MPEG4 stream. Other formats not supported are e.g. DIVX/XVID..
Currently I did not propose any extension of libvdpau on freedesktop.org, it may be possible for the MPEG4 parameter extension, but it may be more difficult for the DIVX/XVID extension.
Reply
#11
(2016-01-15, 10:46)alossek Wrote: @mostera Is HDMI-CEC supported in Kodi (using your modified kernel ?)

No, HDMI-CEC is currently not supported by my kernel. It would be interesting for me, but I haven't had time to integrate and test the patches which are around..
Reply
#12
Hi there,

I am trying to compile your Kodi version, but I think that some files are missing. Configure is fine, but make says:

Code:
Makefile:2: tools/a10/depends/depends.mk: No such file or directory
make: *** No rule to make target 'tools/a10/depends/depends.mk'.  Stop.

The tools/a10 directory doesn't exist in your source tree, can I just copy it from rellla's xbmca10 tree?

Thanks
tom
Reply
#13
(2016-01-16, 17:40)tom81 Wrote: Hi there,

I am trying to compile your Kodi version, but I think that some files are missing. Configure is fine, but make says:

Code:
Makefile:2: tools/a10/depends/depends.mk: No such file or directory
make: *** No rule to make target 'tools/a10/depends/depends.mk'.  Stop.

The tools/a10 directory doesn't exist in your source tree, can I just copy it from rellla's xbmca10 tree?

Thanks
tom

Hi Tom,
you can just copy the file from rellla's tree, that should fix the issue in the simple way. But actually I think that this include is not required anymore. It is just a relict from rellla's tree, which was the base when I started.
I will check whether I just can remove the include to this file

Regards,
mosterta
Reply
#14
Okay, I copied the files and build started.
But now I get this error:

Code:
make[1]: Leaving directory '/media/sda1/CT-PKGBUILD/kodi_sunxi_vdpau/src/xbmc-14.2-Helix/lib/libdvd'
CPP     xbmc/cores/dvdplayer/DVDCodecs/Video/VDPAU.o
VDPAU.cpp: In static member function 'static void VDPAU::CDecoder::FFReleaseBuffer(void*, uint8_t*)':
VDPAU.cpp:1133:25: warning: unused variable 'ctx' [-Wunused-variable]
   CDVDVideoCodecFFmpeg* ctx        = (CDVDVideoCodecFFmpeg*)opaque;
                         ^
VDPAU.cpp: In member function 'void VDPAU::CVdpauRenderPicture::Sync()':
VDPAU.cpp:1556:62: error: 'EGL_SYNC_TYPE_KHR' was not declared in this scope
      eglGetSyncAttribKHR(g_Windowing.GetEGLDisplay(), fence, EGL_SYNC_TYPE_KHR, &value);
                                                              ^
VDPAU.cpp:1556:87: error: 'eglGetSyncAttribKHR' was not declared in this scope
      eglGetSyncAttribKHR(g_Windowing.GetEGLDisplay(), fence, EGL_SYNC_TYPE_KHR, &value);
                                                                                       ^
VDPAU.cpp:1557:18: error: 'EGL_SYNC_FENCE_KHR' was not declared in this scope
      if(value == EGL_SYNC_FENCE_KHR)
                  ^
VDPAU.cpp:1559:61: error: 'eglDestroySyncKHR' was not declared in this scope
         eglDestroySyncKHR(g_Windowing.GetEGLDisplay(), fence);
                                                             ^
VDPAU.cpp:1562:83: error: 'eglCreateSyncKHR' was not declared in this scope
      fence = eglCreateSyncKHR(g_Windowing.GetEGLDisplay(), EGL_SYNC_TYPE_KHR, NULL);
                                                                                   ^
VDPAU.cpp: In member function 'bool VDPAU::COutput::ProcessSyncPicture()':
VDPAU.cpp:3686:69: error: 'EGL_SYNC_TYPE_KHR' was not declared in this scope
        eglGetSyncAttribKHR(g_Windowing.GetEGLDisplay(), pic->fence, EGL_SYNC_TYPE_KHR, &value);
                                                                     ^
VDPAU.cpp:3686:94: error: 'eglGetSyncAttribKHR' was not declared in this scope
        eglGetSyncAttribKHR(g_Windowing.GetEGLDisplay(), pic->fence, EGL_SYNC_TYPE_KHR, &value);
                                                                                              ^
VDPAU.cpp:3687:20: error: 'EGL_SYNC_FENCE_KHR' was not declared in this scope
        if(value == EGL_SYNC_FENCE_KHR)
                    ^
VDPAU.cpp:3691:31: error: 'EGL_SYNC_STATUS_KHR' was not declared in this scope
                               EGL_SYNC_STATUS_KHR, &state);
                               ^
VDPAU.cpp:3692:23: error: 'EGL_SIGNALED_KHR' was not declared in this scope
           if(state == EGL_SIGNALED_KHR)
                       ^
VDPAU.cpp:3694:71: error: 'eglDestroySyncKHR' was not declared in this scope
              eglDestroySyncKHR(g_Windowing.GetEGLDisplay(), pic->fence);
                                                                       ^
VDPAU.cpp: In member function 'void VDPAU::COutput::ReleaseBufferPool()':
VDPAU.cpp:3860:68: error: 'EGL_SYNC_TYPE_KHR' was not declared in this scope
       eglGetSyncAttribKHR(g_Windowing.GetEGLDisplay(), pic->fence, EGL_SYNC_TYPE_KHR, &value);
                                                                    ^
VDPAU.cpp:3860:93: error: 'eglGetSyncAttribKHR' was not declared in this scope
       eglGetSyncAttribKHR(g_Windowing.GetEGLDisplay(), pic->fence, EGL_SYNC_TYPE_KHR, &value);
                                                                                             ^
VDPAU.cpp:3861:23: error: 'EGL_SYNC_FENCE_KHR' was not declared in this scope
       while (value == EGL_SYNC_FENCE_KHR)
                       ^
VDPAU.cpp:3865:30: error: 'EGL_SYNC_STATUS_KHR' was not declared in this scope
                              EGL_SYNC_STATUS_KHR, &state);
                              ^
VDPAU.cpp:3866:22: error: 'EGL_SIGNALED_KHR' was not declared in this scope
          if(state == EGL_SIGNALED_KHR || timeout.IsTimePast())
                      ^
VDPAU.cpp:3868:70: error: 'eglDestroySyncKHR' was not declared in this scope
             eglDestroySyncKHR(g_Windowing.GetEGLDisplay(), pic->fence);
                                                                      ^
/media/sda1/CT-PKGBUILD/kodi_sunxi_vdpau/src/xbmc-14.2-Helix/Makefile.include:93: recipe for target 'VDPAU.o' failed
make[1]: *** [VDPAU.o] Error 1
Makefile:516: recipe for target 'xbmc/cores/dvdplayer/DVDCodecs/Video/Video.a' failed
make: *** [xbmc/cores/dvdplayer/DVDCodecs/Video/Video.a] Error 2

Looks like a problem with the EGL headers I am using (from sunxi repo). Which headers do you use?
Reply
#15
which include file EGL/eglext.h are you using? is it the correct one?
There should be a EGL_SYNC_FENCE_KHR/etc defined in there.
Reply
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 23

Logout Mark Read Team Forum Stats Members Help
hardware acceleration on allwinner A10/A20 with vdpau and OpenGLES (zero-copy)2