GloDroid / glodroid_manifest

Android port that aims to bring both user- and developer-friendly experience in using AOSP with a set of single-board computers (SBC), phones and other devices.
472 stars 66 forks source link

Hardware information apps crash on Pi 4 #160

Closed KonstaT closed 3 years ago

KonstaT commented 3 years ago

@rsglobal Hi Roman. Great job on the GloDroid v0.7.0 release!

I wanted to report a regression on Mesa related to switching to the Meson build system. Not sure if you want this here or Mesa issue tracker.

I can reproduce this on GloDroid v0.7.0 and my LineageOS builds as well. Launching any(?) system/hardware information application will shortly crash with following log:

10-08 11:30:04.479  3072  3072 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-08 11:30:04.479  3072  3072 F DEBUG   : Build fingerprint: 'RaspberryPI/rpi4/rpi4:12/SP1A.210812.016/eng.roman.20211005.170921:userdebug/test-keys'
10-08 11:30:04.479  3072  3072 F DEBUG   : Revision: '1.0'
10-08 11:30:04.480  3072  3072 F DEBUG   : ABI: 'arm64'
10-08 11:30:04.480  3072  3072 F DEBUG   : Timestamp: 2021-10-08 11:30:03.001342134+0000
10-08 11:30:04.480  3072  3072 F DEBUG   : Process uptime: 5s
10-08 11:30:04.481  3072  3072 F DEBUG   : Cmdline: com.finalwire.aida64
10-08 11:30:04.481  3072  3072 F DEBUG   : pid: 2915, tid: 3043, name: GLThread 83  >>> com.finalwire.aida64 <<<
10-08 11:30:04.481  3072  3072 F DEBUG   : uid: 10075
10-08 11:30:04.481  3072  3072 F DEBUG   : tagged_addr_ctrl: 0000000000000001
10-08 11:30:04.482  3072  3072 F DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
10-08 11:30:04.482  3072  3072 F DEBUG   : Abort message: 'Scudo ERROR: invalid chunk state when deallocating address 0x200007cf39e3110
10-08 11:30:04.482  3072  3072 F DEBUG   : '
10-08 11:30:04.482  3072  3072 F DEBUG   :     x0  0000000000000000  x1  0000000000000be3  x2  0000000000000006  x3  0000007c058539e0
10-08 11:30:04.483  3072  3072 F DEBUG   :     x4  0000000000808080  x5  0000000000808080  x6  0000000000808080  x7  8080800000000000
10-08 11:30:04.483  3072  3072 F DEBUG   :     x8  00000000000000f0  x9  0000007f6eb060b0  x10 ffffff00fffffbdf  x11 0000000000000001
10-08 11:30:04.483  3072  3072 F DEBUG   :     x12 0101010101010101  x13 0000000000000030  x14 0000000000000000  x15 0000000000000070
10-08 11:30:04.484  3072  3072 F DEBUG   :     x16 0000007f6eba6050  x17 0000007f6eb82700  x18 0000007c047e4000  x19 00000000000000ac
10-08 11:30:04.484  3072  3072 F DEBUG   :     x20 0000000000000b63  x21 00000000000000b2  x22 0000000000000be3  x23 00000000ffffffff
10-08 11:30:04.484  3072  3072 F DEBUG   :     x24 0000007c05853cb0  x25 0000007c05853cb0  x26 0000007c05853ff8  x27 000000000010a000
10-08 11:30:04.484  3072  3072 F DEBUG   :     x28 0000000000108000  x29 0000007c05853a60
10-08 11:30:04.485  3072  3072 F DEBUG   :     lr  0000007f6eb33efc  sp  0000007c058539c0  pc  0000007f6eb33f2c  pst 0000000000000000
10-08 11:30:04.485  3072  3072 F DEBUG   : backtrace:
10-08 11:30:04.485  3072  3072 F DEBUG   :       #00 pc 000000000004ff2c  /apex/com.android.runtime/lib64/bionic/libc.so (abort+180) (BuildId: ac3d0baaacdc7c6cdebcc4f2fe5705dd)
10-08 11:30:04.486  3072  3072 F DEBUG   :       #01 pc 0000000000040430  /apex/com.android.runtime/lib64/bionic/libc.so (scudo::die()+8) (BuildId: ac3d0baaacdc7c6cdebcc4f2fe5705dd)
10-08 11:30:04.486  3072  3072 F DEBUG   :       #02 pc 0000000000040c08  /apex/com.android.runtime/lib64/bionic/libc.so (scudo::ScopedErrorReport::~ScopedErrorReport()+32) (BuildId: ac3d0baaacdc7c6cdebcc4f2fe57
05dd)
10-08 11:30:04.486  3072  3072 F DEBUG   :       #03 pc 0000000000040e44  /apex/com.android.runtime/lib64/bionic/libc.so (scudo::reportInvalidChunkState(scudo::AllocatorAction, void*)+76) (BuildId: ac3d0baaacdc7
c6cdebcc4f2fe5705dd)
10-08 11:30:04.487  3072  3072 F DEBUG   :       #04 pc 0000000000042464  /apex/com.android.runtime/lib64/bionic/libc.so (scudo::Allocator<scudo::AndroidConfig, &(scudo_malloc_postinit)>::deallocate(void*, scudo
::Chunk::Origin, unsigned long, unsigned long)+308) (BuildId: ac3d0baaacdc7c6cdebcc4f2fe5705dd)
10-08 11:30:04.487  3072  3072 F DEBUG   :       #05 pc 000000000001844c  /vendor/lib64/egl/libEGL_mesa.so (BuildId: d9ef3557a41fde917808c1f16247ef3d)
10-08 11:30:04.487  3072  3072 F DEBUG   :       #06 pc 000000000001245c  /vendor/lib64/egl/libEGL_mesa.so (eglReleaseThread+20) (BuildId: d9ef3557a41fde917808c1f16247ef3d)
10-08 11:30:04.487  3072  3072 F DEBUG   :       #07 pc 00000000000204ac  /system/lib64/libEGL.so (android::eglReleaseThreadImpl()+36) (BuildId: e162bdb7137f5a71946fd1b9cf5c1810)
10-08 11:30:04.488  3072  3072 F DEBUG   :       #08 pc 0000000000014080  /system/lib64/libEGL.so (android::egl_tls_t::destructTLSData(void*)+32) (BuildId: e162bdb7137f5a71946fd1b9cf5c1810)
10-08 11:30:04.488  3072  3072 F DEBUG   :       #09 pc 00000000000b3e24  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_key_clean_all()+132) (BuildId: ac3d0baaacdc7c6cdebcc4f2fe5705dd)
10-08 11:30:04.488  3072  3072 F DEBUG   :       #10 pc 00000000000b35b0  /apex/com.android.runtime/lib64/bionic/libc.so (pthread_exit+72) (BuildId: ac3d0baaacdc7c6cdebcc4f2fe5705dd)
10-08 11:30:04.489  3072  3072 F DEBUG   :       #11 pc 00000000000b343c  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+268) (BuildId: ac3d0baaacdc7c6cdebcc4f2fe5705dd)
10-08 11:30:04.489  3072  3072 F DEBUG   :       #12 pc 00000000000517c8  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: ac3d0baaacdc7c6cdebcc4f2fe5705dd)

This can be reproduced with AIDA64 (https://www.apkmirror.com/apk/finalwire-ltd/aida64/) and Droid Hardware Info (https://www.apkmirror.com/apk/inkwired/droid-hardware-info/) at least.

I've found that this is clearly something related to the Mesa Meson build. This issue is not present on Mesa 21.1 that still uses Android.mk to build. I've ported the Meson build patches to Mesa 21.1 and I can reproduce this with Mesa 21.1 as well after building it with Meson. Also happens with both gbm and minigbm grallocs. Any idea what could be the problem?

And another somewhat related question. Have you looked into building the Broadcom Vulkan Mesa driver? Would it be only a matter of building it as Android HAL as on other platforms (e.g. https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/amd/vulkan/radv_android.c, https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/freedreno/vulkan/tu_android.c) or would this require something on gralloc/hwcomposer as well? All the Vulkan test apps I've found also crash this same way. android-rpi has Vulkan implemented and it's just a wrapper that opens the Mesa Vulkan lib as Android HAL (https://github.com/android-rpi/hardware_arpi/tree/arpi-12/graphics/vulkan).

rsglobal commented 3 years ago

I'll look into it tomorrow.

KonstaT commented 3 years ago

Yes, I can keep up. It's at f3cb18c so it's there.

Thanks for all your help so far. Made some real progress today. :)

rsglobal commented 3 years ago

I just recalled that rpis codecs has special tiling modifiers. So I'm not sure it can produce linear buffers.

KonstaT commented 3 years ago

Ok, is that something that can be sorted or only linear buffers will work?

BTW, just tested this with 5.4 kernel and it doesn't work so it's 5.10 only.

rsglobal commented 3 years ago

Ok, is that something that can be sorted or only linear buffers will work?

I'll look into it after I finish with the camera.

BTW, I've got picture today using CSI camera + ISP using libcamera. It still has artifacts and stream starts not every time.

rsglobal commented 3 years ago

1636457691590

KonstaT commented 3 years ago

Thanks, this is certainly an area where we need your expertise on.

Great progress with libcamera as well. :)