Kodi Community Forum
v19 Compiling Kodi 19 on RaspiOS RPI4 HW-decoding problems - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Raspberry Pi (https://forum.kodi.tv/forumdisplay.php?fid=166)
+---- Thread: v19 Compiling Kodi 19 on RaspiOS RPI4 HW-decoding problems (/showthread.php?tid=361928)



Compiling Kodi 19 on RaspiOS RPI4 HW-decoding problems - ElectricPim - 2021-04-06

Unfortunately kernel 5.10 caused major regressions for the default Kodi (18.7) on Raspberry Pi OS on a RPI4. The Kodi version that is shipped in the default repository.

HEVC files don't play and MPEG4 videos play jerky

I too experience files that don't play in the default Kodi and Kernel 5.10 on RaspiOS. They worked fine before in kernel 5.4 and they work fine in LibreElec 10 beta.

So I decided to build Kodi 19 on RaspiOS, to see if that helps.

Using this version from popcornmix:
https://github.com/popcornmix/xbmc/tree/gbm_matrix

bash:
wget https://github.com/popcornmix/xbmc/archive/gbm_matrix.zip
unzip gbm_matrix.zip

cd xbmc-gbm_matrix
mkdir kodi-build
cd kodi-build

// workaround drm_fourcc.h error
mkdir /usr/include/drm/
ln -s /usr/include/libdrm/drm_fourcc.h /usr/include/drm/drm_fourcc.h

bash:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=gbm -DAPP_RENDER_SYSTEM=gles -DENABLE_VAAPI=OFF -DENABLE_VDPAU=OFF -DENABLE_DEBUGFISSION=OFF -DENABLE_TESTING=OFF -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_INTERNAL_FFMPEG=ON -DENABLE_INTERNAL_SPDLOG=ON -DENABLE_INTERNAL_FMT=ON

bash:
cmake --build . -- VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN)

Building on a RPI400 takes around 2 hours.

Code:
// Changes config.txt
dtoverlay=vc4-kms-v3d,cma-512
dtoverlay=rpivid-v4l2

I end up with a build that does start, does have HW support, but crashes at the moment I play an HEVC file with HW acceleration enabled.


Code:
groups pi
pi : pi adm dialout cdrom sudo audio video plugdev games users input render netdev spi i2c gpio lpadmin

Code:

// kodi.log
CDVDVideoCodecDRMPRIME::AddData - send packet failed: Cannot allocate memory (-12)

// terminal
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_allo

I tried to follow the advises in this thread, but I guess I missed something.


RE: Compiling Kodi 19 on RaspiOS RPI4 HW-decoding problems - popcornmix - 2021-04-06

Have you increased cma allocation? Try with:
Code:
dtoverlay=vc4-kms-v3d,cma-512
and remove any gpu_mem setting.


RE: Compiling Kodi 19 on RaspiOS RPI4 HW-decoding problems - ElectricPim - 2021-04-06

(2021-04-06, 12:24)popcornmix Wrote: Have you increased cma allocation? Try with:
Code:
dtoverlay=vc4-kms-v3d,cma-512
and remove any gpu_mem setting.

Thank you, but that's exactly what I did, (quoted the config.txt settings in my OP)

I also tried with and without:
dtoverlay=rpivid-v4l2

I'm not sure if that is needed, but it doesn't make a difference.

Something with the ffmpeg version that is downloaded in the build process?




RE: Compiling Kodi 19 on RaspiOS RPI4 HW-decoding problems - ElectricPim - 2021-04-11

(2021-04-06, 12:24)popcornmix Wrote: Have you increased cma allocation? Try with:
Code:
dtoverlay=vc4-kms-v3d,cma-512
and remove any gpu_mem setting.

Yes I've done that, but I must be doing something wrong, tried it all over today with a fresh RaspiOS image.

Compile steps:
build script

Changes /boot/config.txt
/boot/config.txt

Still getting these errors:

Code:
INFO <general>: CDVDVideoCodecDRMPRIME::Open - using decoder V4L2 mem2mem HEVC decoder wrapper
INFO <general>: CDVDVideoCodecDRMPRIME::Open - unable to open codec
INFO <general>: CDVDVideoCodecDRMPRIME::Open - using decoder HEVC (High Efficiency Video Coding)

ERROR <general>: CDVDVideoCodecDRMPRIME::AddData - send packet failed: Cannot allocate memory (-12)
Log file

What's wrong?