libmali and recent kodi: missing symbols

  • I'm trying to build libreelec for the Bananapi M2 Zero, an Allwinner H2-plus device with 512 MB RAM and mali-400 gpu. I know, unsupported. I managed to get the device booting by downgrading to older u-boot, and with some firmware changes wifi and bluetooth seem fine too. I think I have enough kernel patches for the device tree to get kodi supported with mesa. However, mesa / limadriver appears to be too slow, so I changed my build to use libmali instead. Here's where I run into problems. Kodi never starts. If I log into my device over ssh and start kodi from there, it complains that libgbm.so.1 is missing. So I linked /usr/lib/libgbm.so to /storage/libgbm.so.1 and started kodi with LD_LIBRARY_PATH=/storage. It complained of a missing symbol: gbm_surface_create_with_modifiers.

    Now, when I look through the libmali sources in the libreelec git repo, it appears that they include sources for a libgbm.so that wraps the binary libmali blobs and adds a couple of recent gbm symbols, such as gbm_surface_create_with_modifiers. However, the build just includes /usr/lib/libgbm.so as a symlink to the binary libmali, without the wrapper. I don't know how to work cmake and ninja to make them build that libgbm.so.1 wrapper library. Does anyone here have any suggestions?

  • ^ as long as these are set in device options you shouldn't need to change anything else in the build-system *BUT* you will need to make a clean build (remove the entire build.LibreELEC* folder) to ensure the kernel is not build with lima and that all userspace symlinking and compile-linking against EGL and GBM libraries is handled correctly. Your description makes me think you've built with a mesa configuration and then done the switch to mali without doing a clean build after?

    NB: It's also worth bumping to mesa HEAD to pick-up all the improvements made since 20.0.x .. lima is still under very active development with small incremental improvements on a weekly basis. It would be a shame to go back to blobs.

  • I did build after doing make distclean. Still the same result:

    Code
    $ find build.LibreELEC-H2.arm-9.80-devel/image -name *gbm*so* -exec file {} \;
    build.LibreELEC-H2.arm-9.80-devel/image/system/usr/lib/libmali-utgard-400-r7p0-gbm.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=f56d0ce5a4ff4d39df6963e01a0a84d8a0905c25, stripped
    build.LibreELEC-H2.arm-9.80-devel/image/system/usr/lib/libgbm.so: symbolic link to libmali.so
    
    $ find build.LibreELEC-H2.arm-9.80-devel/image -name libmali.so -exec file {} \;
    build.LibreELEC-H2.arm-9.80-devel/image/system/usr/lib/libmali.so: symbolic link to libmali-utgard-400-r7p0-gbm.so

    Clearly, the gbm wrapper library isn't built... Is this also happening for other projects? There still seem to be a number that use the mali binary blobs. It would seem to me that something's missing in the makefile for libmali...

    In the meantime, I could use mesa, but my previous experiences were not so good... Although, perhaps that was because of missing wireless and bluetooth firmware.

    *** EDIT ***

    ... maybe someone can point me to how to clean up / build a single package? That way at least I could start doing some experiments :)

    Edited once, last by PJBrs: Add final question (March 29, 2020 at 5:28 PM).

  • Oops! Nevermind, I should have actually tried my new build. It works fine. Except I don't seem to have sunxi-cedrus. Video player says that my codec is ffmpeg-sw. ... Taking baby steps here :)