aarch64_to_arm_userspace HOOK with Mali450
Closed this issue · 9 comments
continuing from https://discourse.coreelec.org/t/retroarch-kodi-add-on-for-coreelec/17482/27?u=boogiepop
[INFO] [Config]: Loading config from: "/storage/.config/retroarch/retroarcha64.cfg".
[WARN] [GameMode]: GameMode cannot be enabled on this system ("dlopen failed - libgamemode.so: cannot open shared object file: No such file or directory.") https://github.com/FeralInteractive/gamemode needs to be installed.
[WARN] [Config]: GameMode unsupported - disabling...
[INFO] RetroArch 1.10.1 (Git 621f51394b)
[INFO] === Build =======================================
[INFO] Capabilities: ASIMD
[INFO] Built: Mar 12 2022
[INFO] Version: 1.10.1
[INFO] Git: 621f51394b
[INFO] =================================================
[INFO] [Input]: Found input driver: "udev".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: fullscreen.
[INFO] [Video]: Starting threaded video driver ...
[INFO] [EGL] Falling back to eglGetDisplay
[ERROR] [EGL]: Couldn't get EGL display.
[ERROR] [EGL]: #0x3000, EGL_SUCCESS
[INFO] FRONTEND_FORK_RESTART
[INFO] [GL]: Found GL context: "null".
[INFO] [GL]: Detecting screen resolution: 320x240.
[INFO] [GL]: Vendor: (null), Renderer: (null).
[INFO] [GL]: Version: (null).
Unfortunately when aarch64 hook is linked against https://github.com/CoreELEC/opengl-meson/tree/aml64_buildroot_master/lib/arm64/m450/r7p0/fbdev, retroarch builds, runs but on the runtime gives the above error.
I have checked the chekcsums the libmali.so that the box using against the one in the repo, it r7p0 version. So definetely the same version is used for aarch64. I dont know what could be the issue though.
Here is the dailts of lib64 folder
drwxrwxr-x 2 root root 3072 Mar 12 03:41 .
drwxrwxr-x 5 root root 1024 Mar 12 03:41 ..
-rwxr-xr-x 1 root root 1409384 Mar 12 03:41 ld-2.29.so
lrwxrwxrwx 1 root root 10 Mar 12 03:41 ld-linux-aarch64.so.1 -> ld-2.29.so
lrwxrwxrwx 1 root root 15 Mar 12 03:41 libEGL.so -> libmali.m450.so
lrwxrwxrwx 1 root root 15 Mar 12 03:41 libGLESv2.so -> libmali.m450.so
lrwxrwxrwx 1 root root 18 Mar 12 03:41 libasound.so.2 -> libasound.so.2.0.0
-rwxr-xr-x 1 root root 990560 Mar 12 03:41 libasound.so.2.0.0
lrwxrwxrwx 1 root root 15 Mar 12 03:41 libass.so.9 -> libass.so.9.0.2
-rwxr-xr-x 1 root root 248352 Mar 12 03:41 libass.so.9.0.2
lrwxrwxrwx 1 root root 23 Mar 12 03:41 libavcodec.so.58 -> libavcodec.so.58.18.100
-rwxr-xr-x 1 root root 9570656 Mar 12 03:41 libavcodec.so.58.18.100
lrwxrwxrwx 1 root root 24 Mar 12 03:41 libavformat.so.58 -> libavformat.so.58.12.100
-rwxr-xr-x 1 root root 1747792 Mar 12 03:41 libavformat.so.58.12.100
lrwxrwxrwx 1 root root 22 Mar 12 03:41 libavutil.so.56 -> libavutil.so.56.14.100
-rwxr-xr-x 1 root root 375264 Mar 12 03:41 libavutil.so.56.14.100
lrwxrwxrwx 1 root root 15 Mar 12 03:41 libbz2.so.1.0 -> libbz2.so.1.0.8
-rwxr-xr-x 1 root root 61576 Mar 12 03:41 libbz2.so.1.0.8
-rwxr-xr-x 1 root root 17621896 Mar 12 03:41 libc-2.29.so
lrwxrwxrwx 1 root root 12 Mar 12 03:41 libc.so.6 -> libc-2.29.so
lrwxrwxrwx 1 root root 15 Mar 12 03:41 libcec.so -> libcec.so.6.0.2
lrwxrwxrwx 1 root root 15 Mar 12 03:41 libcec.so.6 -> libcec.so.6.0.2
-rwxr-xr-x 1 root root 538288 Mar 12 03:41 libcec.so.6.0.2
-rwxr-xr-x 1 root root 2700384 Mar 12 03:41 libcrypto.so.1.1
lrwxrwxrwx 1 root root 17 Mar 12 03:41 libdav1d.so.1 -> libdav1d.so.1.1.0
-rwxr-xr-x 1 root root 583040 Mar 12 03:41 libdav1d.so.1.1.0
lrwxrwxrwx 1 root root 19 Mar 12 03:41 libdbus-1.so.3 -> libdbus-1.so.3.26.0
-rwxr-xr-x 1 root root 415128 Mar 12 03:41 libdbus-1.so.3.26.0
-rwxr-xr-x 1 root root 232120 Mar 12 03:41 libdl-2.29.so
lrwxrwxrwx 1 root root 13 Mar 12 03:41 libdl.so.2 -> libdl-2.29.so
lrwxrwxrwx 1 root root 17 Mar 12 03:41 libexpat.so.1 -> libexpat.so.1.6.7
-rwxr-xr-x 1 root root 152240 Mar 12 03:41 libexpat.so.1.6.7
lrwxrwxrwx 1 root root 23 Mar 12 03:41 libfontconfig.so.1 -> libfontconfig.so.1.12.0
-rwxr-xr-x 1 root root 327120 Mar 12 03:41 libfontconfig.so.1.12.0
lrwxrwxrwx 1 root root 21 Mar 12 03:41 libfreetype.so.6 -> libfreetype.so.6.17.0
-rwxr-xr-x 1 root root 902136 Mar 12 03:41 libfreetype.so.6.17.0
-rwxr-xr-x 1 root root 80072 Mar 12 03:41 libgcc_s.so.1
-rwxr-xr-x 1 root root 2996536 Mar 12 03:41 libm-2.29.so
lrwxrwxrwx 1 root root 12 Mar 12 03:41 libm.so.6 -> libm-2.29.so
-rwxr-xr-x 1 root root 1492376 Mar 12 03:41 libmali.m450.so
-rwxr-xr-x 1 root root 2814216 Mar 12 03:41 libpthread-2.29.so
lrwxrwxrwx 1 root root 18 Mar 12 03:41 libpthread.so.0 -> libpthread-2.29.so
lrwxrwxrwx 1 root root 18 Mar 12 03:41 libpulse.so.0 -> libpulse.so.0.23.0
-rwxr-xr-x 1 root root 411560 Mar 12 03:41 libpulse.so.0.23.0
-rwxr-xr-x 1 root root 1052672 Mar 12 03:41 libpulsecommon-14.2.so
-rwxr-xr-x 1 root root 401304 Mar 12 03:41 librt-2.29.so
lrwxrwxrwx 1 root root 13 Mar 12 03:41 librt.so.1 -> librt-2.29.so
lrwxrwxrwx 1 root root 17 Mar 12 03:41 libspeex.so.1 -> libspeex.so.1.5.1
-rwxr-xr-x 1 root root 94808 Mar 12 03:41 libspeex.so.1.5.1
-rwxr-xr-x 1 root root 632160 Mar 12 03:41 libssl.so.1.1
lrwxrwxrwx 1 root root 19 Mar 12 03:41 libstdc++.so.6 -> libstdc++.so.6.0.28
-rwxr-xr-x 1 root root 1866352 Mar 12 03:41 libstdc++.so.6.0.28
lrwxrwxrwx 1 root root 24 Mar 12 03:41 libswresample.so.3 -> libswresample.so.3.1.100
-rwxr-xr-x 1 root root 88192 Mar 12 03:41 libswresample.so.3.1.100
lrwxrwxrwx 1 root root 21 Mar 12 03:41 libswscale.so.5 -> libswscale.so.5.1.100
-rwxr-xr-x 1 root root 387160 Mar 12 03:41 libswscale.so.5.1.100
lrwxrwxrwx 1 root root 20 Mar 12 03:41 libsystemd.so.0 -> libsystemd.so.0.26.0
-rwxr-xr-x 1 root root 851736 Mar 12 03:41 libsystemd.so.0.26.0
lrwxrwxrwx 1 root root 17 Mar 12 03:41 libudev.so.1 -> libudev.so.1.6.14
-rwxr-xr-x 1 root root 273136 Mar 12 03:41 libudev.so.1.6.14
lrwxrwxrwx 1 root root 19 Mar 12 03:41 libusb-0.1.so.4 -> libusb-0.1.so.4.4.4
-rwxr-xr-x 1 root root 35984 Mar 12 03:41 libusb-0.1.so.4.4.4
lrwxrwxrwx 1 root root 19 Mar 12 03:41 libusb-1.0.so.0 -> libusb-1.0.so.0.1.0
-rwxr-xr-x 1 root root 85848 Mar 12 03:41 libusb-1.0.so.0.1.0
-rwxr-xr-x 1 root root 45184 Mar 12 03:41 libutil-2.29.so
lrwxrwxrwx 1 root root 15 Mar 12 03:41 libutil.so.1 -> libutil-2.29.so
lrwxrwxrwx 1 root root 16 Mar 12 03:41 libuuid.so.1 -> libuuid.so.1.3.0
-rwxr-xr-x 1 root root 75152 Mar 12 03:41 libuuid.so.1.3.0
lrwxrwxrwx 1 root root 21 Mar 12 03:41 libxkbcommon.so.0 -> libxkbcommon.so.0.0.0
-rwxr-xr-x 1 root root 293312 Mar 12 03:41 libxkbcommon.so.0.0.0
lrwxrwxrwx 1 root root 14 Mar 12 03:41 libz.so.1 -> libz.so.1.2.11
-rwxr-xr-x 1 root root 144088 Mar 12 03:41 libz.so.1.2.11
can you set video_threaded = "false"
in retroarch.cfg
and see what's the log?
exactly the same error. I am cursious if the build time ld link to a different version of libGLES.so would cause a problem. Because from the build system to my udnerstanding, the patching of the libmali.so is happenning after the compilation ended. I might be complety talking nonsense though.
Do you still have [INFO] [Video]: Starting threaded video driver ...
row in the output?
From standalone retroarch point of view there should not be such issue, as at build time the same video context driver is used (mali_fbdev) regardless from the libmali type/version.
If that was not the case, the regular arm addon build would not work as well.
Can you double check the version of mali kernel module with modinfo mali_kbase | grep ^version
nope, except that threaded part
[INFO] [Config]: Loading config from: "/storage/.config/retroarch/retroarcha64.cfg".
[WARN] [GameMode]: GameMode cannot be enabled on this system ("dlopen failed - libgamemode.so: cannot open shared object file: No such file or directory.") https://github.com/FeralInteractive/gamemode needs to be installed.
[WARN] [Config]: GameMode unsupported - disabling...
[INFO] RetroArch 1.10.1 (Git 621f51394b)
[INFO] === Build =======================================
[INFO] Capabilities: ASIMD
[INFO] Built: Mar 12 2022
[INFO] Version: 1.10.1
[INFO] Git: 621f51394b
[INFO] =================================================
[INFO] [Input]: Found input driver: "udev".
[INFO] [Environ]: SET_PIXEL_FORMAT: RGB565.
[INFO] [Core]: Version of libretro API: 1, Compiled against API: 1
[INFO] [Audio]: Set audio input rate to: 48000.00 Hz.
[INFO] [Video]: Set video size to: fullscreen.
[INFO] [EGL] Falling back to eglGetDisplay
[ERROR] [EGL]: Couldn't get EGL display.
[ERROR] [EGL]: #0x3000, EGL_SUCCESS
[INFO] [GL]: Found GL context: "null".
[INFO] [GL]: Detecting screen resolution: 320x240.
[INFO] [GL]: Vendor: (null), Renderer: (null).
[INFO] [GL]: Version: (null).
[ERROR] [Video]: Cannot open video driver ... Exiting ...
[ERROR] Fatal error received in: "video_driver_init_internal()"
[INFO] [Core]: Content ran for a total of: 00 hours, 00 minutes, 00 seconds.
[INFO] [Core]: Unloading core..
[INFO] [Core]: Unloading core symbols..
kernel driver info:
filename: /lib/modules/4.9.269/extra/midgard/mali_kbase.ko
version: r12p0-01rel0 (UK version 11.7)
license: GPL
srcversion: 533BB7E5866E52F63B9ACCB
alias: of:N*T*Carm,mali-midgardC*
alias: of:N*T*Carm,mali-midgard
alias: of:N*T*Carm,malit6xxC*
alias: of:N*T*Carm,malit6xx
depends:
vermagic: 4.9.269 SMP preempt mod_unload aarch64
parm: scaling_dbg_level:scaling debug level (uint)
parm: gpu_dbg_level:gpu debug level (uint)
That confused me little bit though. Kernel driver states r12p0, where only gondul version has this revision: https://github.com/CoreELEC/opengl-meson/tree/aml64_buildroot_master/lib/arm64/gondul/r12p0
But the device is definetely m450, i checked this with md5chceksums. And the symlink points to m450 variants as well.
CoreELEC:~ # ls -la /var/lib/
total 0
drwxr-xr-x 7 root root 200 Mar 12 17:03 .
drwxr-xr-x 11 root root 260 Mar 12 17:03 ..
drwxr-xr-x 2 root root 60 Aug 6 2021 dbus
lrwxrwxrwx 1 root root 63 Mar 12 17:03 docker -> /storage/.kodi/userdata/addon_data/service.system.docker/docker
lrwxrwxrwx 1 root root 24 Aug 6 2021 libMali.so -> /usr/lib/libMali.m450.so
lrwxrwxrwx 1 root root 24 Mar 12 17:03 libcec.so.6 -> /usr/lib/libcec.so.6.0.2
drwx------ 2 root root 40 Aug 6 2021 private
drwx------ 2 root root 40 Aug 6 2021 pulse
drwxr-xr-x 2 root root 120 Mar 12 17:03 samba
drwxr-xr-x 5 root root 100 Aug 6 2021 systemd
Maybe user space drivers and kernel space drivers has different versioning but who does that??
I see in opengl-meson repo there is a 450-X version, not sure that is your userspace driver instead of m450.
You can just copy libMali.so
in the lib64
folder, rename it for convenience and symlink libEGL.so
and libGLESv2.so
to the new so file, no need to rebuild the entire package.
Similarly you can try with the other r12p0 version drivers (dvalin/gondul) to be 100% sure.
I think the kernel space driver is already open source and already on r12p0 version, thats the reason the kernel module reports r12p0. And i think the user space driver version is independant than kernel driver version and they somehow an ABI in between to cooperate.
https://developer.arm.com/tools-and-software/graphics-and-gaming/mali-drivers/utgard-kernel
The clear it up, device is actually m450, and armhf user space driver is on r7p0. Those are %100 correct. I just in case tried all other available binary in the repo dvalin/gondul/m450 out of desperation but as you might guess it does not work, raises runtime error that no GL context is found (same error).
The 450-x is linked against X11 and wayland is against wayland, so those are not options since CE is not using neither, only fbdev.
Just to report, no progress or anything. stuck here.
So with all the 3 libraries you get [ERROR] [EGL]: Couldn't get EGL display. [ERROR] [EGL]: #0x3000, EGL_SUCCESS
?
With no library at all in lib64 you got regular missing library error or again the same log above?
Just to try everything, this is the symlink list you may link to the m450 library in lib64 to mimic the original coreelec lib structure (even if the hook is working as it is for S905X3):
libMali.so
libmali.so
libmali.so.0
libEGL.so
libEGL.so.1
libEGL.so.1.0.0
libGLES_CM.so.1
libGLESv1_CM.so
libGLESv1_CM.so.1
libGLESv1_CM.so.1.0.1
libGLESv1_CM.so.1.1
libGLESv2.so
libGLESv2.so.2
libGLESv2.so.2.0
libGLESv2.so.2.0.0
libGLESv3.so
libGLESv3.so.3
libGLESv3.so.3.0
libGLESv3.so.3.0.0
Also as said it should not matter for the standalone retroarch build itself, but as a last try you could modify the build script to point to AMLGX here instead of AMLG12.
Actually with current script configuration the build environment considers AMLG12 headers and libraries (g31/g52); you may try building with AMLGX (450/t820), but if that made any difference I guess the regular addon arm version would not run as well.
Of course if you want to try you will need to rebuild the entire thing from scratch...
If none of the above works, maybe there are issues with the aarch64 version of the m450 driver, I have no evidence that it's working properly. If that is the case I guess there is no way to fix this.
i had tried AMLGX build at the first time when i build the first time but the thing is, Lakka uses Lima for AMLGX + X11, which means another kernel module and actually upstream kernel and tons of other issues.
I think i am done with this adventure, i had my fun :) thanks for your support during the way, hope this issue can be usefull for someone else who tries such an approach.
My outcome is,"i have no idea why m450 aarch64 variant is not working" and i am fine with it as long as arm is ok with their binary blob junks:).
aarch64_to_arm_userspace
hook has been removed, issue is no more applicable.