raspberry-vanilla / android_local_manifest

105 stars 48 forks source link

CM4 will not boot with dt-blob.bin present #81

Closed jlange6648 closed 2 months ago

jlange6648 commented 2 months ago

I am attempting to use android-14.0.0_r22, on a rpi CM4 & CMIO board with a raspberry pi compliant DSI display on DISP1. If I boot the board without the required dt-blob.bin file present, it boots as expected (with no display). But the second I place the dt-blob.bin file on the boot partition, it fails with init crashing because surfaceflinger failed to start.

I'm using the dt-blob file directly from https://datasheets.raspberrypi.com/cmio/dt-blob-disp1-only.bin This same board and panel will work on KonstaKang 14 If I use the exact same dt-blob, and corresponding config.txt changes:

dtoverlay=vc4-kms-dsi-7inch
dtoverlay=rpi-backlight
deparam=i2c_arm=on

If there are additional changes needed to support this that are only implemented in KonstaKang, might you be able to share what that is?

Attached is the console output on boot up until a crash failure.dmesg.txt

KonstaT commented 2 months ago

Yes, using DSI display requires additional configuration. Please see the relevant wiki page. https://github.com/raspberry-vanilla/android_local_manifest/wiki/DSI-display

jlange6648 commented 2 months ago

Yes, I have made a build with those changes as well. But it did not make a difference. surface flinger will not start if I have the dt-blob present.

KonstaT commented 2 months ago

logcat?

jlange6648 commented 2 months ago

Here is the logcat output with the crashes, with the initial crash being

--------- beginning of crash
01-01 00:00:20.472   384   384 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 384 (surfaceflinger), pid 384 (surfaceflinger)
01-01 00:00:20.516     0     0 I dwc2 fe980000.usb: new device is high-speed
01-01 00:00:20.819   667   667 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
01-01 00:00:20.819   667   667 F DEBUG   : Build fingerprint: 'Raspberry/aosp_rpi4/rpi4:14/UQ1A.240205.002/eng.jeff_l.20240425.175419:userdebug/test-keys'
01-01 00:00:20.819   667   667 F DEBUG   : Revision: '0'
01-01 00:00:20.819   667   667 F DEBUG   : ABI: 'arm64'
01-01 00:00:20.819   667   667 F DEBUG   : Timestamp: 1970-01-01 00:00:20.571395524+0000
01-01 00:00:20.819   667   667 F DEBUG   : Process uptime: 4s
01-01 00:00:20.820   667   667 F DEBUG   : Cmdline: /system/bin/surfaceflinger
01-01 00:00:20.820   667   667 F DEBUG   : pid: 384, tid: 384, name: surfaceflinger  >>> /system/bin/surfaceflinger <<<
01-01 00:00:20.820   667   667 F DEBUG   : uid: 1000
01-01 00:00:20.820   667   667 F DEBUG   : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
01-01 00:00:20.820   667   667 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
01-01 00:00:20.820   667   667 F DEBUG   : Abort message: 'Missing HWC primary display'
01-01 00:00:20.820   667   667 F DEBUG   :     x0  0000000000000000  x1  0000000000000180  x2  0000000000000006  x3  0000007fc20df600
01-01 00:00:20.821   667   667 F DEBUG   :     x4  0000000000000010  x5  0000000000000010  x6  0000000000000010  x7  ff7f7f7f7f7f7f7f
01-01 00:00:20.821   667   667 F DEBUG   :     x8  00000000000000f0  x9  0000007466856090  x10 0000000000000001  x11 00000074668acf00
01-01 00:00:20.821   667   667 F DEBUG   :     x12 0000007fc20df5d0  x13 000000000000001c  x14 0000007fc20df7a0  x15 0000000044aa0c58
01-01 00:00:20.822   667   667 F DEBUG   :     x16 0000007466926d08  x17 00000074668f5810  x18 0000007470666000  x19 00000000000000ac
01-01 00:00:20.822   667   667 F DEBUG   :     x20 00000000000000b2  x21 0000000000000180  x22 0000000000000180  x23 00000000ffffffff
01-01 00:00:20.822   667   667 F DEBUG   :     x24 0000000000000004  x25 0000000000000000  x26 000000746fd97000  x27 0000007fc20dfcb0
01-01 00:00:20.822   667   667 F DEBUG   :     x28 0000000000000001  x29 0000007fc20df680
01-01 00:00:20.822   667   667 F DEBUG   :     lr  000000746689d414  sp  0000007fc20df5e0  pc  000000746689d444  pst 0000000000000000
01-01 00:00:20.822   667   667 F DEBUG   : 7 total frames
01-01 00:00:20.822   667   667 F DEBUG   : backtrace:
01-01 00:00:20.823   667   667 F DEBUG   :       #00 pc 0000000000069444  /apex/com.android.runtime/lib64/bionic/libc.so (abort+180) (BuildId: 218db69eb66aeb253a34d956906a8bba)
01-01 00:00:20.823   667   667 F DEBUG   :       #01 pc 00000000000113fc  /system/lib64/liblog.so (__android_log_default_aborter+12) (BuildId: b9f4d26a45036880d72976fcccca3703)
01-01 00:00:20.823   667   667 F DEBUG   :       #02 pc 0000000000011fd4  /system/lib64/liblog.so (__android_log_assert+308) (BuildId: b9f4d26a45036880d72976fcccca3703)
01-01 00:00:20.823   667   667 F DEBUG   :       #03 pc 0000000000185138  /system/bin/surfaceflinger (android::impl::HWComposer::getPrimaryDisplayId() const+248) (BuildId: 503b4c5f075729a9354c9084cdfe39d2)
01-01 00:00:20.823   667   667 F DEBUG   :       #04 pc 000000000021335c  /system/bin/surfaceflinger (android::SurfaceFlinger::init()+1420) (BuildId: 503b4c5f075729a9354c9084cdfe39d2)
01-01 00:00:20.823   667   667 F DEBUG   :       #05 pc 0000000000268798  /system/bin/surfaceflinger (main+1096) (BuildId: 503b4c5f075729a9354c9084cdfe39d2)
01-01 00:00:20.823   667   667 F DEBUG   :       #06 pc 0000000000061838  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+104) (BuildId: 218db69eb66aeb253a34d956906a8bba)

I also see the following related the framebuffer, and the mipi

01-01 00:00:00.774     0     0 I simple-framebuffer 3ea3f000.framebuffer: format=a8r8g8b8, mode=800x480x32, linelength=3200
01-01 00:00:00.774     0     0 I simple-framebuffer 3ea3f000.framebuffer: fb0: simplefb registered!
01-01 00:00:00.780     0     0 I Serial  : 8250/16550 driver, 1 ports, IRQ sharing enabled
01-01 00:00:00.782     0     0 I iproc-rng200 fe104000.rng: hwrng registered
01-01 00:00:00.782     0     0 I vc-mem  : phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
01-01 00:00:00.783     0     0 I rpi-gpiomem fe200000.gpiomem: window base 0xfe200000 size 0x00001000
01-01 00:00:00.783     0     0 I rpi-gpiomem fe200000.gpiomem: initialised 1 regions as /dev/gpiomem
01-01 00:00:00.785     0     0 I mipi-dsi fe700000.dsi.0: Fixed dependency cycle(s) with /soc/dsi@7e700000/port/endpoint
01-01 00:00:00.785     0     0 I mipi-dsi fe700000.dsi.0: Fixed dependency cycle(s) with /panel_disp@1/port/endpoint

I'm not sure if those last 2 messages are errors or not.

logcat.txt

KonstaT commented 2 months ago

This same board and panel will work on KonstaKang 14 If I use the exact same dt-blob, and corresponding config.txt changes:

With the above changes this wouldn't work on my personal builds either (i.e. https://konstakang.com/devices/rpi4/AOSP14/ if that's what you meant). You would also need to remove /boot/resolution.txt or change it to read 800x480.

System -> Raspberry Pi settings -> Touchscreen (as documented on the FAQ) on my personal builds does exactly the same as https://github.com/raspberry-vanilla/android_local_manifest/wiki/DSI-display here. /boot/resolution.txt relates to what is set in debug.drm.mode.force property.

I don't have any DSI display to test but I doubt anything has gotten broken in this regard since the latest release (20240104). If you want to bisect, you can try the 6.1.65 kernel (https://github.com/raspberry-vanilla/android_device_brcm_rpi4-kernel/tree/037056e0fef57d9bfea8a1dc5b10323bc063b283) with your own current build. Or the current 6.1.78 kernel (https://github.com/raspberry-vanilla/android_device_brcm_rpi4-kernel/tree/bdffb08cc0955bb78e46d702459546ef349aa17b) with my build from January. Replace the existing files on the boot partition of the OS image.

I still assume this is just due to forcing the wrong resolution for the display.

jlange6648 commented 2 months ago

After inspecting the log messages further, I decided to try forcing the display to have a refresh rate as well using the value that was printed out in the log message hwc-drm-connector: supported mode 800x480@60.049290 for display in connector DSI-1

using: debug.drm.mode.force=800x480@60.049290

This fixed it! I still can't explain how the konstakang build works when setting the resolution.txt to just 800x480, do you append a refresh rate to that property when initializing?

Either way, this now works for me. Perhaps there should be a line in the wiki on the DSI page saying that you may need to add the panel refresh rate to that property.

Thanks!

KonstaT commented 2 months ago

You can specify refresh rate but it's not mandatory. If no refresh rate is forced with the property, it uses the first one reported by the display (https://github.com/raspberry-vanilla/android_external_drm_hwcomposer/commit/428277ea14abd82f459b81939c251203f5a325f1). The relevant code for the display resolution/refresh rate forcing is here (https://github.com/raspberry-vanilla/android_external_drm_hwcomposer/commit/ddee2e3d869c1f4f812a07745fabb8b2a0230360). It doesn't parse floats so AFAICT in practice debug.drm.mode.force=800x480@60.049290 equals to debug.drm.mode.force= as it can't be parsed (i.e. same as just removing /boot/resolution.txt in my personal builds).

I still suspect debug.drm.mode.force=800x480 as documented in the wiki was not set in the first place. Closing as resolved in any case.