Compiling Kodi to make it have hardware decoding

Post Reply
User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Sat Apr 06, 2019 6:40 pm

This is a small howto what has to be done to compile Kodi on Ubuntu and get hardware decoding working.

First you would need small patch for Kodi itself (the parameter was moved from one module to another):

Code: Select all

diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
index 0a5c03ca29..a718817147 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/AMLCodec.cpp
@@ -1779,7 +1779,7 @@ bool CAMLCodec::OpenAmlVideo(const CDVDStreamInfo &hints)
   m_defaultVfmMap = GetVfmMap("default");
   SetVfmMap("default", "decoder ppmgr deinterlace amlvideo amvideo");

-  SysfsUtils::SetInt("/sys/module/amlvideodri/parameters/freerun_mode", 3);
+  SysfsUtils::SetInt("/sys/module/ionvideo/parameters/freerun_mode", 3);

   return true;
 }
diff --git a/xbmc/utils/AMLUtils.cpp b/xbmc/utils/AMLUtils.cpp
index fe1dae0a5c..bbe83af430 100644
--- a/xbmc/utils/AMLUtils.cpp
+++ b/xbmc/utils/AMLUtils.cpp
@@ -101,9 +101,9 @@ bool aml_permissions()
       CLog::Log(LOGERROR, "AML: no rw on /dev/video10");
       permissions_ok = 0;
     }
-    if (!SysfsUtils::HasRW("/sys/module/amlvideodri/parameters/freerun_mode"))
+    if (!SysfsUtils::HasRW("/sys/module/ionvideo/parameters/freerun_mode"))
     {
-      CLog::Log(LOGERROR, "AML: no rw on /sys/module/amlvideodri/parameters/freerun_mode");
+      CLog::Log(LOGERROR, "AML: no rw on /sys/module/ionvideo/parameters/freerun_mode");
       permissions_ok = 0;
     }
     if (!SysfsUtils::HasRW("/sys/class/video/freerun_mode"))
The second thing you need is another c2_aml_libs than shipped with N2 now. Right now the amlogic buildroot amlibs are shipped with ubuntu, but those are not the one that are actually used even by themselves. If you look closely to the amlogic buildroot you would find that actually libamcodec.so is being built as separate package from mdrjr repo from here: https://github.com/mdrjr/c2_aml_libs. Yes right in the amlogic buildroot library from Hardkernel is used, this is what they ship. So, you need libamcodec.so from that repo. Make sure you use that, because I spend quite some time banging my head what's not right until I've found the image already has the library shipped and it's wrong.
It is enough to compile only libamcodec.so and copy it over to /usr/lib/aarch64-linux-gnu/amlogic/
I'm honestly not sure is it something wrong with the library, or how Kodi uses it, but this one works.

Last thing you would need is to change boot.ini "no_console_suspend" only string to full correct parameters "no_console_suspend=1 consoleblank=0". That will prevent video plane from dissapearing in the void after 10 minutes. I guess this bug is going to be fixed soon anyway.

All in all after you run all these there are still some issues present:
- Video playback struggle from judder the worst I've seen with any product. Most of the time I really don't care, but here it is visible and present. And this is not some sync judder, it is present even Hz doesn't switch (playing 60Hz videos on 60Hz TV). It can be made much better by locking resolution to 1080p in boot.ini. Maybe it's related to my TV being 4k and Kodi constantly trying to adjust between 4k playback of 1080p videos and 1080p GUI that it choose according to log. I don't know. Since most of my content is 1080p I locked it to 1080p and I'm fine with that.

One the good side the quality is stunning, it's so much better than any board before. Maybe because of HDR, but it look so smooth and colourful, the difference is obvious to either N1 or C2 standing next to it. As a player this is huge leap forward in image quality.

User avatar
mad_ady
Posts: 5843
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 73 times
Been thanked: 42 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by mad_ady » Sat Apr 06, 2019 7:40 pm

Regarding HDR - does this require the media being played to be encoded in a specific way, or is it some processing done on all media?

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Sat Apr 06, 2019 7:54 pm

Seems this is the property of the output.
My TV always show "HDR" notifier, meaning the signal coming in is HDR. In the console, in GUI and in every video.
Obviously the content doesn't become "HDR" magically, but the board sends signal with HDR data in it. What is in that data, are there some automatic enhancements, is it just blank, but TV still enhance the display do to mode - I don't know. But the output is HDR all the time.

User avatar
mad_ady
Posts: 5843
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 73 times
Been thanked: 42 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by mad_ady » Sat Apr 06, 2019 10:57 pm

So - does the TV need to support HDR, or would any TV benefit from it?
Sorry, I'm a noob at this and trying to learn.
From wikipedia (https://en.m.wikipedia.org/wiki/High-dy ... ge_imaging) it would appear that the TV doesn't need to understand it...

I can understand how it would do HDR if it were rendering an image from a game, for example, where it can manipulate the lighting, but where does it get lighting information from "pre-rendered" media like a picture or a video?

Can you toggle HDR on and off on the N2, or adjust it like you would do contrast?

I remember reading on irc that @crashoverride was complaining that the output video driver had limited color range (e.g. RGB didn't go all the way to 255 and was limited to ~215). He made some tweaks and if I remember correctly made it work. Not sure if this is causing the improved effect you're seeing or not.

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Sat Apr 06, 2019 11:47 pm

I believe this is all coded in amlogic output driver. Including all the bugs that are there.
Amlogic style of code is huge pile of spaghetti and this is where it begins to shine with all its glory. I guess they add more and more funcitonality, like support HDR where it needs to be supported and doesn't where it shouldn't. Which causes all these issues - judder in unexpected places, limited RGB range and stuff.
As answer for your question, I guess right now driver negotiate what features TV supports and choose its mode to operate in. No, there is going to be no additional information regarding HDR if source (video file) doesn't have it, most probably TV will have no idea how to adjust light and "HDR" mode in this case is just useless. Although there could be some optimizations TV perform when it is in HDR mode, so maybe there is going to be some outcome in the end.
And of course all that is a must if the content is HDR encoded.

crashoverride
Posts: 4403
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 35 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by crashoverride » Mon Apr 08, 2019 2:05 am

mad_ady wrote:
Sat Apr 06, 2019 10:57 pm
I remember reading on irc that @crashoverride was complaining that the output video driver had limited color range (e.g. RGB didn't go all the way to 255 and was limited to ~215). He made some tweaks and if I remember correctly made it work. Not sure if this is causing the improved effect you're seeing or not.
I have never gotten correct color out of the N2. I posted an issue about it. If someone has the IRC logs, you will see that I researched and posted my findings regarding this. It appears the RGB framebuffer gets color converted to YUV and range limited. It then goes to the mixer where other planes are composited in the same YUV limited color space. It then goes to the HDMI TX where an additional color space conversion happens. Finally, the display (TV) performs an additional color space conversion due to the setting of the AVI InfoFrame.

The drivers seem to all have a special path for HDR. This may be why a HDR capable display produces the correct color. None of my displays are HDR capable.

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Mon Apr 08, 2019 2:11 am

It did produce fine picture on a monitor I was testing initially before switching it to TV. It was all fine as well.
Limited RGB range could be something related to EDID handshake and mode output driver chooses to work with the TV.
I know what I talk about because there is famous mac osx bug that makes output be limited RGB space and I was really struggling because of it until I've found a way to fake EDID data to the driver and finally forget about this nonsense. I still use static EDID for six years already, because this problem is random AF, on some displays you get normal output, on some it is always negotiated to be limited RGB.

elatllat
Posts: 1271
Joined: Tue Sep 01, 2015 8:54 am
languages_spoken: english
ODROIDs: XU4, N1
Has thanked: 1 time
Been thanked: 6 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by elatllat » Mon Apr 08, 2019 3:14 am

Color conversion from HDR is a problem on x86 ffmpeg, vlc, etc, so HDR implementations may be immature in general.

ZECK
Posts: 5
Joined: Tue Apr 09, 2019 9:05 pm
languages_spoken: english, german
ODROIDs: C2, N2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by ZECK » Tue Apr 09, 2019 9:34 pm

@OverSun: which version of kodi did you compile or how did you build it? I tried to build 18.1 like stated in the README of kodi but it says it cant find the pthread libraries ("undefined reference to 'pthread_create'" when running cmake).

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Wed Apr 10, 2019 1:22 am

I build from their git master. Which is almost 18.1. With very small additions, compared to difference to any other version.

rosenrot
Posts: 13
Joined: Wed Apr 10, 2019 2:37 am
languages_spoken: english
ODROIDs: n2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by rosenrot » Wed Apr 10, 2019 2:40 am

Thanks a lot for sharing your findings. I really would be interested to use the n2 as a ubuntu server that runs kodi for livetv. Could you give a little bit more details how to compile kodi with that patch you mentioned? Do you have any idea if the current problems like stuttering will be resolved anytime soon?

In short, I really would like to run ubuntu and install kodi on it instead of using coreelec for example.

Thanks a lot

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Wed Apr 10, 2019 3:17 am

Steps are pretty simple. I do that right on the device, it's the easiest way to do that, no need to bother with cross-compile and that huge smoking pile of rubbish that is required to come along with it for such complicated project.

1. Clone repo to local directory

Code: Select all

git clone https://github.com/xbmc/xbmc.git kodi
2. Save the patch provided earlier to file kodi.patch and put it next to the directory. Apply the patch.

Code: Select all

cd kodi && patch -p1 -i ../kodi.patch
2. Create build directory

Code: Select all

mkdir kodi-build && cd kodi-build
3. Configure the source

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=aml \
	-DENABLE_INTERNAL_FLATBUFFERS=ON \
	-DENABLE_ALSA=ON -DENABLE_AIRTUNES=ON -DENABLE_UPNP=ON \
	-DENABLE_INTERNAL_FMT=ON -DENABLE_INTERNAL_RapidJSON=ON \
	-DENABLE_OPENGLES=ON -DENABLE_OPENGL=OFF -DENABLE_X=OFF \
	-DVERBOSE=OFF -DENABLE_NEON=ON \
	-DWITH_CPU=cortex-a73.cortex-a53 -DWITH_ARCH=aarch64 \
	-DENABLE_PULSEAUDIO=OFF -DENABLE_CCACHE=ON \
	-DENABLE_INTERNAL_FFMPEG=ON \
	-DENABLE_APP_AUTONAME=OFF -DENABLE_DVDCSS=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_OPTICAL=OFF \
	-DENABLE_EVENTCLIENTS=ON -DENABLE_CAP=ON \
	-DENABLE_VDPAU=OFF \
	../kodi
You can play with options here, there could be things you need and things you don't need. Required one is CORE_PLATFORM_NAME.
On this stage most configuration will fail with something that cmake cannot find, you would need to read what it cannot find and most of the time install package by the same name with '-dev' on the end of the name. All '-dev' packages depends on their non-dev binaries, so it's fine to go straight for -dev, if the binary is missing it's going to install it.
4. Make the project

Code: Select all

make
And that would be mostly it. There could be some deviations from the process, but that depends really on what else do you need Kodi to support.
These users thanked the author OverSun for the post (total 2):
tobetter (Wed Apr 10, 2019 3:25 am) • ZECK (Wed Apr 10, 2019 8:47 pm)

rosenrot
Posts: 13
Joined: Wed Apr 10, 2019 2:37 am
languages_spoken: english
ODROIDs: n2
Has thanked: 0
Been thanked: 0
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by rosenrot » Wed Apr 10, 2019 4:49 am

Thanks! I'm running into this error now:

Code: Select all

root@odroid:~/xbmc/kodi-build# cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=aml -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_ALSA=ON -DENABLE_AIRTUNES=ON -DENABLE_UPNP=ON -DENABLE_INTERNAL_FMT=ON -DENABLE_INTERNAL_RapidJSON=ON -DENABLE_OPENGLES=ON -DENABLE_OPENGL=OFF -DENABLE_X=OFF -DVERBOSE=OFF -DENABLE_NEON=ON -DWITH_CPU=cortex-a73.cortex-a53 -DWITH_ARCH=aarch64 -DENABLE_PULSEAUDIO=OFF -DENABLE_CCACHE=ON -DENABLE_INTERNAL_FFMPEG=ON -DENABLE_APP_AUTONAME=OFF -DENABLE_DVDCSS=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_OPTICAL=OFF -DENABLE_EVENTCLIENTS=ON -DENABLE_CAP=ON -DENABLE_VDPAU=OFF ../xbmc
CMake Error at CMakeLists.txt:94 (core_add_library):
  Unknown CMake command "core_add_library".


CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 3.5)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!
See also "/root/xbmc/kodi-build/CMakeFiles/CMakeOutput.log".
root@odroid:~/xbmc/kodi-build#

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Wed Apr 10, 2019 5:22 am

This is really generic error about some basic compilation tools missing. Try to start with installing building environment needed like

Code: Select all

apt-get install cmake build-essential

efraimsangil
Posts: 71
Joined: Wed Jan 27, 2016 1:07 am
languages_spoken: english, spanish
ODROIDs: XU4
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by efraimsangil » Fri Apr 12, 2019 1:41 am

@OverSun I follow your instructions step by step and we have a lot of errors when I try to compile.

Some of these errors can be fixed installing these packages:

Code: Select all

sudo apt-get install liblzo2-dev libpng-dev libgif-dev libjpeg-dev libpcap-dev libcap-dev ccache
sudo apt-get install python2.7-dev 
sudo apt install libxml2-dev libxslt-dev libass-dev libcdio-dev libiso9660-10 libiso9660-dev
But now I have an error that I can't solve:

Code: Select all

odroid@odroid:~/kodi/kodi-build$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=aml -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_ALSA=ON -DENABLE_AIRTUNES=ON -DENABLE_UPNP=ON -DENABLE_INTERNAL_FMT=ON -DENABLE_INTERNAL_RapidJSON=ON -DENABLE_OPENGLES=ON -DENABLE_OPENGL=OFF -DENABLE_X=OFF -DVERBOSE=OFF -DENABLE_NEON=ON -DWITH_CPU=cortex-a73.cortex-a53 -DWITH_ARCH=aarch64 -DENABLE_PULSEAUDIO=OFF -DENABLE_CCACHE=ON -DENABLE_INTERNAL_FFMPEG=ON -DENABLE_APP_AUTONAME=OFF -DENABLE_DVDCSS=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_OPTICAL=OFF -DENABLE_EVENTCLIENTS=ON -DENABLE_CAP=ON -DENABLE_VDPAU=OFF /home/odroid/kodi/
-- Source directory: /home/odroid/kodi
-- Build directory: /home/odroid/kodi/kodi-build
-- Generator: Single-configuration: Release (Unix Makefiles)
-- CMake Version: 3.10.2
-- System type: Linux
-- Linker: GNU gold
-- Core system type: linux
-- Platform:
-- CPU: cortex-a73.cortex-a53, ARCH: aarch64
-- Cross-Compiling: FALSE
-- Execute build artefacts on host: TRUE
-- Depends based build:
-- Could not find hardware support for SSE (missing: _SSE_TRUE _SSE_OK)
-- Could not find hardware support for SSE2 (missing: _SSE2_TRUE _SSE2_OK)
-- Could not find hardware support for SSE3 (missing: _SSE3_TRUE _SSE3_OK)
-- Could not find hardware support for SSSE3 (missing: _SSSE3_TRUE _SSSE3_OK)
-- Could not find hardware support for SSE4.1 (missing: _SSE41_TRUE _SSE41_OK)
-- Could not find hardware support for SSE4.2 (missing: _SSE42_TRUE _SSE42_OK)
-- Could not find hardware support for AVX (missing: _AVX_TRUE _AVX_OK)
-- Could not find hardware support for AVX2 (missing: _AVX2_TRUE _AVX2_OK)
-- NEON optimization enabled
-- Could NOT find Avahi (missing: AVAHI_CLIENT_LIBRARY AVAHI_COMMON_LIBRARY AVAHI_CLIENT_INCLUDE_DIR AVAHI_COMMON_INCLUDE_DIR)
-- Could NOT find Bluetooth (missing: BLUETOOTH_LIBRARY BLUETOOTH_INCLUDE_DIR)
-- Could NOT find Bluray (missing: BLURAY_LIBRARY BLURAY_INCLUDE_DIR BLURAY_VERSION) (Required is at least version "0.9.3")
-- Could NOT find CEC (missing: CEC_LIBRARY CEC_INCLUDE_DIR) (Required is at least version "4.0.0")
-- Could NOT find LCMS2 (missing: LCMS2_LIBRARY LCMS2_INCLUDE_DIR)
-- Could NOT find LircClient (missing: LIRCCLIENT_LIBRARY LIRCCLIENT_INCLUDE_DIR)
-- Could NOT find MDNS (missing: MDNS_LIBRARY MDNS_INCLUDE_DIR)
-- Could NOT find MicroHttpd (missing: MICROHTTPD_LIBRARY MICROHTTPD_INCLUDE_DIR)
-- Could NOT find NFS (missing: NFS_LIBRARY NFS_INCLUDE_DIR)
-- Could NOT find SmbClient (missing: SMBCLIENT_LIBRARY SMBCLIENT_INCLUDE_DIR)
-- Could NOT find Plist (missing: PLIST_LIBRARY PLIST_INCLUDE_DIR)
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find CrossGUID (missing: CROSSGUID_LIBRARY CROSSGUID_INCLUDE_DIR)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  cmake/modules/FindCrossGUID.cmake:61 (find_package_handle_standard_args)
  cmake/scripts/common/Macros.cmake:366 (find_package)
  cmake/scripts/common/Macros.cmake:380 (find_package_with_ver)
  CMakeLists.txt:172 (core_require_dep)


-- Configuring incomplete, errors occurred!
See also "/home/odroid/kodi/kodi-build/CMakeFiles/CMakeOutput.log".
See also "/home/odroid/kodi/kodi-build/CMakeFiles/CMakeError.log".
I am still investigating how to do that.

Raybuntu
Posts: 1363
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 12 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by Raybuntu » Fri Apr 12, 2019 2:26 am

You have lots of dependencies missing.

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Fri Apr 12, 2019 2:46 am

you need 'libcrossguid-dev', and this is probably not the last one you need. this is what I've said are going to be failures of configuration process that you would need to mitigate reading what is the error and installing -dev packages for it.

ZECK
Posts: 5
Joined: Tue Apr 09, 2019 9:05 pm
languages_spoken: english, german
ODROIDs: C2, N2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by ZECK » Fri Apr 12, 2019 4:25 am

Thanks but i still have a problem with pthreads. Even on a fresh install either using stable 18.1 or the newest commit of Kodi I get the error:

Code: Select all

CMakeFiles/cmTC_eccbe.dir/CheckFunctionExists.c.o:CheckFunctionExists.c:function main: error: undefined reference to 'pthread_create'
which is caused by checking if pthread is present by a small piece of code in cmake like seen here right before the above error occurs:

Code: Select all

File /home/odroid/kodi/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/odroid/kodi/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_eccbe/fast"
/usr/bin/make -f CMakeFiles/cmTC_eccbe.dir/build.make CMakeFiles/cmTC_eccbe.dir/build
make[1]: Entering directory '/home/odroid/kodi/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_eccbe.dir/CheckFunctionExists.c.o
/usr/bin/cc   -DMESA_EGL_NO_X11_HEADERS -Wall -DCHECK_FUNCTION_EXISTS=pthread_create   -o CMakeFiles/cmTC_eccbe.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.10/Modules/CheckFunctionExists.c
Linking C executable cmTC_eccbe
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_eccbe.dir/link.txt --verbose=1
/usr/bin/cc -DMESA_EGL_NO_X11_HEADERS -Wall -DCHECK_FUNCTION_EXISTS=pthread_create   -fuse-ld=gold  CMakeFiles/cmTC_eccbe.dir/CheckFunctionExists.c.o  -o cmTC_eccbe -lpthreads
/usr/bin/ld.gold: error: cannot find -lpthreads
CMakeFiles/cmTC_eccbe.dir/CheckFunctionExists.c.o:CheckFunctionExists.c:function main: error: undefined reference to 'pthread_create'
Had someone the same problem? I checked that pthreads are actually present by running a test program with gcc -pthread and this works.

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Fri Apr 12, 2019 4:54 am

the problem you have is generic build env problem, it's not related to kodi at all. why do you test it with 'gcc -pthread' while it clearly says that '/usr/bin/ld.gold: error: cannot find -lpthreads'?
what about you give us output of 'ldconfig --print-cache | grep pthread'?

ZECK
Posts: 5
Joined: Tue Apr 09, 2019 9:05 pm
languages_spoken: english, german
ODROIDs: C2, N2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by ZECK » Fri Apr 12, 2019 5:04 am

The output of ldconfig gives me

Code: Select all

libpthread.so.0 (libc6,AArch64, OS ABI: Linux 3.7.0) => /lib/aarch64-linux-gnu/libpthread.so.0
Yeah you're right it can not find -lpthreads. But imho this is either delivered by build-essential or libc6-dev (which are installed)?
What package do i need for lpthreads?

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Fri Apr 12, 2019 5:12 am

lpthreads is being searched for through ldconfig. if ldconfig prints the path to it, then it can be found by linker. what I would suggest is to replace ld.gold with good old ld for a start.
Either by an option to kodi cmake, or some env variable. I have no idea how this can be done, but should be.

ZECK
Posts: 5
Joined: Tue Apr 09, 2019 9:05 pm
languages_spoken: english, german
ODROIDs: C2, N2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by ZECK » Fri Apr 12, 2019 6:13 am

Thank you I got it now! It seems that an old build made the problem, cleaning all up and doing from scratch again now starts to build. I hope it works from now on.

Thanks again for your infos.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Mon Apr 15, 2019 6:21 pm

I had a chance to build it today.

Installed some(many?) packages.

Code: Select all

apt update
apt upgrade
apt install git cmake build-essential liblzo2-dev libpng-dev libgif-dev libjpeg-dev libpcap-dev libcap-dev ccache python2.7-dev libxml2-dev libxslt1-dev libass-dev libcdio-dev 
apt install libiso9660-10 libiso9660-dev libcrossguid-dev uuid-dev libcurl4-openssl-dev libfstrcmp-dev libssl-dev libsqlite3-dev libtag1-dev libtinyxml-dev
Tried to download and apply Oversun's patch.

Code: Select all

mkdir kodi
cd kodi
git clone --depth 1 https://github.com/xbmc/xbmc.git kodi
#Create a kodi.patch file.
cd kodi
patch -p1 -i ../kodi.patch
mkdir kodi-build
When I tried to configure it, I met an error. :(

Code: Select all

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=aml \
	-DENABLE_INTERNAL_FLATBUFFERS=ON \
	-DENABLE_ALSA=ON -DENABLE_AIRTUNES=ON -DENABLE_UPNP=ON \
	-DENABLE_INTERNAL_FMT=ON -DENABLE_INTERNAL_RapidJSON=ON \
	-DENABLE_OPENGLES=ON -DENABLE_OPENGL=OFF -DENABLE_X=OFF \
	-DVERBOSE=OFF -DENABLE_NEON=ON \
	-DWITH_CPU=cortex-a73.cortex-a53 -DWITH_ARCH=aarch64 \
	-DENABLE_PULSEAUDIO=OFF -DENABLE_CCACHE=ON \
	-DENABLE_INTERNAL_FFMPEG=ON \
	-DENABLE_APP_AUTONAME=OFF -DENABLE_DVDCSS=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_OPTICAL=OFF \
	-DENABLE_EVENTCLIENTS=ON -DENABLE_CAP=ON \
	-DENABLE_VDPAU=OFF \
	../kodi
Can you please tell me which package I should install to go further? Sorry for my very basic question.

Code: Select all

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):                                                       
  Could NOT find OpenGLES (missing: OPENGLES_INCLUDE_DIR)     

Raybuntu
Posts: 1363
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 12 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by Raybuntu » Mon Apr 15, 2019 6:30 pm

Looks like the opengl-meson include dir is missing: https://github.com/hardkernel/buildroot ... er/include

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Mon Apr 15, 2019 6:38 pm

yeah, gles headers are kind of tricky one.
issue here is that needed GLES headers (the ones that kodi check for) are contained in packages libegl1-mesa-dev, and libgles2-mesa-dev and there is one more related package I cannot check now which. And those packages depend on mesa packages, and mesa packages all conflict with mali-fbdev package (which is obvious). So what I had to do is to install all mesa packages, then extract mali-fbdev package and overwrite its contents to the system. Not the most solid decision, but this is the only way to do it now, because mali-fbdev package doesn't provide GLES2/gl2.h kodi searches for.

There are different ways to resolve this, default khronos headers could be installed, mesa headers could be installed, but the correct way to solve that would be mali-dev package with all EGL/GLES2/GLES3 headers mali-fbdev was build with that replaces libegl1-mesa-dev and libgles2-mesa-dev.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Mon Apr 15, 2019 6:54 pm

Thanks!
I had to install three more packages for the GLES header.

Code: Select all

apt install libglvnd-dev libegl1-mesa-dev libgles2-mesa-dev
And downloaded our mali-fbdev package and extracted manually. I've checked the mali gpu functionality with glmark2-es2-fbdev after manual installation.

Code: Select all

apt download mali-fbdev
dpkg -x mali-fbdev_0.1-1_arm64.deb /tmp/out
cd /tmp/out
cp -r * /
cd /root/kodi/kodi
And I could go further. :D

Code: Select all

CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):                                                       
  Could NOT find AML (missing: AML_INCLUDE_DIR) 
I will try it tomorrow if there is any hint to resolve that AML stuff issue. ;)

Raybuntu
Posts: 1363
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 12 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by Raybuntu » Mon Apr 15, 2019 7:15 pm

Thats the include dir of libamcodec :). Also missing :)

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Mon Apr 15, 2019 7:50 pm

yup. don't forget you need aml_libs from https://github.com/mdrjr/c2_aml_libs
I would suggest remove aml-libs dpkg from the system (because it contains wrong library that produces black screen) and install that one from source.
That would cover both things, installing the correct library and putting headers to the system.

Also there is insane issue with GL libraries as I remember, there is a name hardcoded in the libEGL.so.1 mesa library that makes it overwrite symbolic links every time ldconfig is run. So you would probably need not only overwrite mali-fbdev over to the system, but also remove binaries libEGL.so.1, libGLESv2.so.1 and so on of mesa.
I know this sounds already too complicated, but that's the issue we face due to no headers package of mali-fbdev, and need to toss files over back and forward. I think it was always like this, it's just previous Kodi versions didn't check for the gles2.h file, they were checking for something that was in the system and passing it, and it's only because now check is for more specific files this all blew up.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Tue Apr 16, 2019 9:08 am

I had to install many more packages to complete the build configuration.

Code: Select all

apt install libcec-dev libbluetooth-dev libmicrohttpd-dev liblircclient-dev libsmbclient-dev libnfs-dev libinput-dev libxkbcommon-dev default-jre swig
apt install libavahi-client-dev libbluray-dev libmysqlclient-dev  liblcms2-dev libsndio-dev libcwiid-dev libplist-dev
I still have some questions. Please be patient since this is my first attempt to build the Kodi by myself. :oops:

Downloaded and built aml_libs

Code: Select all

git clone https://github.com/mdrjr/c2_aml_libs aml_libs
cd aml_libs/
make
make install
While building aml_libs, I met a compile error in example player.

Code: Select all

make[1]: Entering directory '/root/kodi/aml_libs/example'                                 
cc -I/root/kodi/aml_libs/example -pthread -O2   -c -o esplayer.o esplayer.c               
esplayer.c:12:10: fatal error: codec.h: No such file or directory                         
 #include <codec.h>  
I ignored it and installed.
But I have no idea how to remove the preinstalled aml_libs dpkg first?

Which EGL/GLES files must be removed? There are too many soft-link entries. :shock: I had to manually extracted/copied mali-fbdev deb package frequently after configuring/compiling.

Code: Select all

root@odroid:~# ls /usr/lib/aarch64-linux-gnu/libEGL* -alp
lrwxrwxrwx 1 root root     11 Apr 16 02:14 /usr/lib/aarch64-linux-gnu/libEGL.so -> libEGL.so.1
lrwxrwxrwx 1 root root     15 Apr 16 02:43 /usr/lib/aarch64-linux-gnu/libEGL.so.1 -> libEGL.so.1.0.0
-rw-r--r-- 1 root root  68024 Aug 15  2018 /usr/lib/aarch64-linux-gnu/libEGL.so.1.0.0
lrwxrwxrwx 1 root root     10 Apr 16 02:14 /usr/lib/aarch64-linux-gnu/libEGL.so.1.4 -> libMali.so
lrwxrwxrwx 1 root root     20 Feb  8 22:02 /usr/lib/aarch64-linux-gnu/libEGL_mesa.so.0 -> libEGL_mesa.so.0.0.0
-rw-r--r-- 1 root root 213816 Feb  8 22:02 /usr/lib/aarch64-linux-gnu/libEGL_mesa.so.0.0.0

root@odroid:~# ls /usr/lib/aarch64-linux-gnu/libGLES* -alp
lrwxrwxrwx 1 root root     17 Apr 16 02:14 /usr/lib/aarch64-linux-gnu/libGLESv1_CM.so -> libGLESv1_CM.so.1
lrwxrwxrwx 1 root root     21 Apr 16 02:43 /usr/lib/aarch64-linux-gnu/libGLESv1_CM.so.1 -> libGLESv1_CM.so.1.0.0
-rw-r--r-- 1 root root 141472 Aug 15  2018 /usr/lib/aarch64-linux-gnu/libGLESv1_CM.so.1.0.0
lrwxrwxrwx 1 root root     10 Apr 16 02:14 /usr/lib/aarch64-linux-gnu/libGLESv1_CM.so.1.1 -> libMali.so
lrwxrwxrwx 1 root root     14 Apr 16 02:14 /usr/lib/aarch64-linux-gnu/libGLESv2.so -> libGLESv2.so.2
lrwxrwxrwx 1 root root     18 Apr 16 02:43 /usr/lib/aarch64-linux-gnu/libGLESv2.so.2 -> libGLESv2.so.2.0.0
lrwxrwxrwx 1 root root     10 Apr 16 02:14 /usr/lib/aarch64-linux-gnu/libGLESv2.so.2.0 -> libMali.so
-rw-r--r-- 1 root root 153760 Aug 15  2018 /usr/lib/aarch64-linux-gnu/libGLESv2.so.2.0.0

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Tue Apr 16, 2019 10:23 am

I had to use 4GB model. Compiling needed up to 3GB sometimes when I ran make -j6 to build Kodi. I wasted time and replaced my 2G board with 4G one.
Finally, I could build it on a 4G board and Compiling took around 1 hour.

Code: Select all

root@odroid:~/kodi/kodi# ./kodi.bin --version                                             
18.2-RC1 Git:20190413-73b6095-dirty Media Center Kodi                                     
Copyright (C) 2005-2018 Team Kodi - http://kodi.tv 
kodi.bin runs but the HDMI fbdev resolution changes to 480p from 1080p automatically once I start kodi.bin.
And kodi GUI is too much corrupted.

Code: Select all

[   38.236053] vout: new mode 480p60hz set ok                                             
[   38.236065] fb: current vmode=480p60hz, cmd: 0x20000                                   
[   38.236078] fb: osd_update_disp_axis_hw:pan_data(0,0,1919,1079)                        
[   38.236083] fb: osd_update_disp_axis_hw:dispdata(0,0,719,479)                          
[   38.248539] fb: osd_update_disp_axis_hw:pan_data(0,0,31,31)                            
[   38.248545] fb: osd_update_disp_axis_hw:dispdata(0,0,31,31) 
I think I had to uninstall the preinstalled aml_libs first. :(
Or, is there any wrong dependencies to the preinstalled SDL for PPSSPP?
c2play can playback 4K videos and PPSSPPSDL and glmark2-es2-fbdev are working fine.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Tue Apr 16, 2019 11:38 am

I don't know why but it works after running kodi.bin --debug.
It works now even without "debug" option. Really weird as always. :mrgreen:

Anyway, 4K 60fps H265 big-buck-bunny sample video plays smoothly on Kodi 18. 8-)
fbgrab can't capture the video layer though.
n2_kodi_4k_1.png
n2_kodi_4k_1.png (144.3 KiB) Viewed 2520 times
n2_kodi_4k_4.png
n2_kodi_4k_4.png (1.54 MiB) Viewed 2520 times
n2_kodi_4k_6.png
n2_kodi_4k_6.png (1.52 MiB) Viewed 2520 times
P.S
If you want to skip the annoying login process in Ubuntu minimal image and disable the screen saver(screen blank), this guide is must be useful.
https://wiki.odroid.com/odroid-n2/ubunt ... uick_guide

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Tue Apr 16, 2019 3:14 pm

libEGL.so.1.0.0, libGLESv1_CM.so.1.0.0, libGLESv2.so.2.0.0 are the ones that need to be deleted.
They have "name" for example "libEGL.so.1" in them, so every time ldconfig is run, symlink libEGL.so.1 -> libMali.so is overwritten to libEGL.so.1 -> libEGL.so.1.0.0 maximally annoying behaviour.
mali packages are really pain in the back to coexists in the system with everything else especially for development. It would be great if prblems with dependancies and what replace what would be solved.

As for Kodi, yesterday I go first fractional fps clip, and it seem that all the fractional fps movies are playerd smooth, compared to 30/50/60 fps ones. And here you have the interface at 59.94 as well. It could be that this is a workaround (I bet AML is not going to fix shit) to hell of a judder I have.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Tue Apr 16, 2019 3:42 pm

Thank you for the confirmation. I've deleted those three files.

I will try "Adjust display refresh rate" in Kodi option to check whether it works with a dynamic refresh rate capable TV or not.
I think we may need to change the HDMI device driver configuration to enable the dynamic refresh rate.
I'm curious how it works on CoreELE.
@Raybunty, can you tell me about that?

User avatar
mad_ady
Posts: 5843
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, N1, H2, N2
Location: Bucharest, Romania
Has thanked: 73 times
Been thanked: 42 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by mad_ady » Tue Apr 16, 2019 3:53 pm

@OverSun: a way around the problem would be to make the symlinks immutable (chattr +i file). That way no processes can write to them/change them:
https://www.rootusers.com/prevent-file- ... ing-linux/

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Tue Apr 16, 2019 5:59 pm

The way to address that would be mali-fbdev package that replaces all libmesa-* packages, and mali-dev package that replaces all libmesa-*-dev with all necessary files
Everything else is ugly hack

Raybuntu
Posts: 1363
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 12 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by Raybuntu » Wed Apr 17, 2019 3:45 am

I suggest you look into CoreELEC kernel and xbmc repo on GitHub. We fixed a lot of playback issues. You can probably cherry pick a few commits

https://github.com/CoreELEC/linux-amlog ... c-4.9-next

https://github.com/CoreELEC/xbmc/commits/amlogic-4.9

All framerates including fractional ones are working. Currently waiting for Colorspace and Colordepth autoswitching.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Wed Apr 17, 2019 8:58 am

@OverSun,
I have to agree the EGL/GLES soft-links are very annoying. But we can live with your guide. :)
Really appreciate your help. I had a great fun experience while compiling Kodi from scratch.
Once Kodi 18.2 final is released, we will make a deb package for normal users to minimize their pains. ;)

@Raybuntu,
Thank you for the links. We will try it.

Raybuntu
Posts: 1363
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 12 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by Raybuntu » Wed Apr 17, 2019 1:44 pm

odroid wrote:
Wed Apr 17, 2019 8:58 am
@OverSun,
I have to agree the EGL/GLES soft-links are very annoying. But we can live with your guide. :)
Really appreciate your help. I had a great fun experience while compiling Kodi from scratch.
Once Kodi 18.2 final is released, we will make a deb package for normal users to minimize their pains. ;)

@Raybuntu,
Thank you for the links. We will try it.
We can also PR some stuff. It's just a lot of changes and some might be specific to CE. Problem might be that we entirely focus on Kodi and literally don't care about anything else. Just wanted to point to them in case someone wants to have something specific fixed because we do fix Amlogic drivers especially video kernel code.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Wed Apr 17, 2019 1:47 pm

Yes! Please! PR always makes our life easier. ;)

Raybuntu
Posts: 1363
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 12 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by Raybuntu » Wed Apr 17, 2019 2:08 pm

The problem is that some of the kernel changes. Especially for video playback require changes in kodi. If you'd run vanilla kodi you'd actually see regressions with some videos. It's a bit complicated sometimes.
Also video is still a work in progress because we have to fix a few other stuff. Kodi changes come with the burden of running out of tree changes with the chance of merge chaos.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Wed Apr 17, 2019 2:15 pm

Well understood.

zupet
Posts: 19
Joined: Tue Dec 26, 2017 11:13 pm
languages_spoken: korean,english
ODROIDs: HC1
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by zupet » Sun Apr 21, 2019 12:57 am

Here is build steps using fresh ubuntu-18.04.2-4.9-minimal-odroid-n2-20190329.img.

Code: Select all

apt update
apt upgrade
reboot now
Update and upgrade. first thing to do with fresh install.

Code: Select all

apt install git ccache default-jre swig liblzo2-dev libpng-dev libgif-dev libjpeg-dev libpcap-dev libcap-dev python2.7-dev  libxml2-dev libxslt1-dev libass-dev libcdio-dev libiso9660-10 libiso9660-dev libcrossguid-dev uuid-dev libcurl4-openssl-dev libfstrcmp-dev libssl-dev libsqlite3-dev libtag1-dev libtinyxml-dev libcec-dev libbluetooth-dev libmicrohttpd-dev liblircclient-dev libsmbclient-dev libnfs-dev libinput-dev libxkbcommon-dev  libavahi-client-dev libbluray-dev libmysqlclient-dev  liblcms2-dev libsndio-dev libcwiid-dev libplist-dev
Install lot's of libraries.

Code: Select all

apt purge mali-fbdev 
apt install mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev 
apt download mali-fbdev 
dpkg -x mali-fbdev*.deb /tmp/out
cd /tmp/out
cp -r * /
Some libraries have dependency problems.
Mali-fbdev causese depecency conflict with libglvnd-dev.
Remove it and extract file and overwrite some library files.

Code: Select all

git clone https://github.com/mdrjr/c2_aml_libs aml_libs
cd aml_libs/
make
make install
Build and install amlogic libraries.

Code: Select all

cd ~
vi kodi.patch
#paste contents
#save as kodi.patch and quit
Create kodi.patch file (check first article)

Code: Select all

cd ~
git clone https://github.com/xbmc/xbmc.git kodi
cd kodi
git checkout tags/18.1-Leia
patch -p1 -i ../kodi.patch
Download source codes from github.
Checkout 18-1-Leia to use stable version. (you can skip checkout if you want to use 19.0 ALPHA)

Code: Select all

cd ~
mkdir kodi-build
cd kodi-build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=aml \
	-DENABLE_INTERNAL_FLATBUFFERS=ON \
	-DENABLE_ALSA=ON -DENABLE_AIRTUNES=ON -DENABLE_UPNP=ON \
	-DENABLE_INTERNAL_FMT=ON -DENABLE_INTERNAL_RapidJSON=ON \
	-DENABLE_OPENGLES=ON -DENABLE_OPENGL=OFF -DENABLE_X=OFF \
	-DVERBOSE=OFF -DENABLE_NEON=ON \
	-DWITH_CPU=cortex-a73.cortex-a53 -DWITH_ARCH=aarch64 \
	-DENABLE_PULSEAUDIO=OFF -DENABLE_CCACHE=ON \
	-DENABLE_INTERNAL_FFMPEG=ON \
	-DENABLE_APP_AUTONAME=OFF -DENABLE_DVDCSS=OFF -DENABLE_INTERNAL_CROSSGUID=OFF -DENABLE_OPTICAL=OFF \
	-DENABLE_EVENTCLIENTS=ON -DENABLE_CAP=ON \
	-DENABLE_VDPAU=OFF \
	../kodi
make -j6
make install
Build kodi and install.

Code: Select all

kodi
Run kodi.

Still lot problems, but we can compile.
Last edited by zupet on Tue Apr 23, 2019 12:11 pm, edited 4 times in total.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Mon Apr 22, 2019 8:58 am

@zupet
Thank you for the very well documented instruction.

zupet
Posts: 19
Joined: Tue Dec 26, 2017 11:13 pm
languages_spoken: korean,english
ODROIDs: HC1
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by zupet » Tue Apr 23, 2019 1:30 am

20190423_012014(1).jpg
20190423_012014(1).jpg (470.19 KiB) Viewed 1798 times
(4k movie sample file from official kodi site)

I got hw video playback.

"mesa-common-dev libegl1-mesa-dev libgles2-mesa-dev" libraries have to be installed with dependancies.
I updated build precudure to install those libraries and then overwrite mali-fbdev files.

Debug logs from aml_libs are interfering video/gui while playback.
Removing #define CODEC_DEBUG from amcodec/codec/codec_h_ctrl.h reduced some but some are still left.

Some permission problems when running kodi with user account.
~/.kodi/temp/kodi.log has list of video/decoder error logs that cannot accessed without root privilege.
These users thanked the author zupet for the post:
mad_ady (Tue Apr 23, 2019 2:27 am)

User avatar
OverSun
Posts: 1459
Joined: Mon Apr 29, 2013 5:12 pm
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by OverSun » Mon Apr 29, 2019 6:54 am

was anyone able to make c2play work on n2?
so far I'm trying to narrow down the reason of judder, and for that I need to figure out what part produces it, kernel driver, libamcodec.so, userspace code or kodi itself.
switching to sw decoding eliminates the judder completely, so it's not kodi. now if I would be able to have c2play working I could experiment with libamcodec or kernel drivers more freely.

User avatar
odroid
Site Admin
Posts: 30716
Joined: Fri Feb 22, 2013 11:14 pm
languages_spoken: English
ODROIDs: ODROID
Has thanked: 15 times
Been thanked: 100 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by odroid » Mon Apr 29, 2019 8:52 am

When I freshly flashed Ubuntu minimal (20190329) image, c2play worked out of the box.

ZECK
Posts: 5
Joined: Tue Apr 09, 2019 9:05 pm
languages_spoken: english, german
ODROIDs: C2, N2
Has thanked: 1 time
Been thanked: 0
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by ZECK » Thu May 02, 2019 12:55 am

A little bit OT regarding the images: Are the images merged to the same level via updates in future, so that the mate image also gets HW acceleration? Or should we use the minimal and install mate if needed?

And far more into the future, is it planned to be able to update to the announced wayland driver from one of those images?

crashoverride
Posts: 4403
Joined: Tue Dec 30, 2014 8:42 pm
languages_spoken: english
ODROIDs: C1
Has thanked: 0
Been thanked: 35 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by crashoverride » Thu May 02, 2019 8:35 am

OverSun wrote:
Mon Apr 29, 2019 6:54 am
so far I'm trying to narrow down the reason of judder, and for that I need to figure out what part produces it, kernel driver, libamcodec.so, userspace code or kodi itself.
I have observed this behavior in c2play. Since c2play shares no code with Kodi and libamcodec is not used, it isolates the problem space to kernel/drivers.

Soleil
Posts: 32
Joined: Tue Apr 30, 2019 9:20 am
languages_spoken: english
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Compiling Kodi to make it have hardware decoding

Unread post by Soleil » Tue May 07, 2019 5:38 pm

Hi Guys,

First of all great thanks to @zupet for great instructions on how to compile.

Big thanks to @odroid team for making such great board and all their help to have it useful.
Odroid confirmed plan to release kodi-fbdev package within a few days and sounds like it should solve the problem behind need to compile kodi ourselves (viewtopic.php?f=177&t=34766#p254992).

Community is all about sharing and I would like to share approach and additional details to simplify it for others, the impatient ones who prefer to compile within a dedicated system vs messing fs with dev libraries.
Approach I've taken was to setup Docker with basic Ubuntu image.
On top of zupet instructions, below had to be added to get kodi compiled:

Code: Select all

# questionable as there's error/warning about cutils.h
#apt install android-libcutils-dev # this was installed as first shot and then followed by below, due to rush/night hasn't been removed hence commented out should it be really needed - would be surprised as is for android, but left here in case if... further search shows that cutils-dev points to this one.
apt install cutils-dev

apt install cmake libasound2-dev dh-autoreconf
For records, the cutils-dev is in fact pointer to the android library

Code: Select all

apt search [b]cutils-dev[/b]
Sorting... Done
Full Text Search... Done
[b]android-libcutils-dev[/b]/bionic-updates,bionic-security,now 1:8.1.0+r23-5~18.04 arm64 [installed]
  Android utils library for C - Development files
Update: the way I've approached mali-fbdev and manual overwrite of files was to remove libgles2 (required by kodi) and install mali-fbdev still to be confirmed if it will work :)
Update2: confirmed - it works and Kodi works smoothly now. drives CPU between 19-100% but just one and is ok.

Happy to share binary package as license shouldn't stop it. :) If anyone needs it.

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 3 guests