hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Android Pie on RPi 3B(+) with hardware acceleration

Sat Jan 26, 2019 4:50 pm

With several months hardware, The Raspberry Pi 3B and 3B+ can finally run Android 9 pie system.

Features:
1. Bootloader: u-boot as AndroidThings on RPi 3B v.1.0.4, run on 64-bit mode
2. Kernel: v.4.14.71 run on 64-bit mode
3. Display: 720p(1280×720) @ 60Hz through on board HDMI port
4. Audio: analog, 2 channel through on board audio jack
5. WiFi: 2.4G (RPi 3B & 3B+), 5G (RPi 3B+)
6. Bluetooth: HCI over UART(ttyAMA0), RPi 3B: 921600bps no flow control; RPi 3B+: 3000000bps with flow control with a2dp and bt-pan(no test yet) support.
7. Ethernet: both work, and IP from DHCP
8. OpenGL render: based on mesa3d vc4 driver.
9. Hardware composer based on drm_hwcomposer (overlay has been disabled due to mis-compose in some satuation)

Knowing issue:
1. Enable `Debug GPU overdraw’ in system settings will make app crash
2. Enable `Debug non-retangular clip operations’ in system settings will make app crash
3. Do not disable `Disable HW overlays’ in system settings
4. Audio over HDMI not support
5. Can not play video

You can check the demo video on youtube at https://youtu.be/tJJetgz53OI (Normal record speed)
The performance is quite acceptable

The image can be download from https://www.brobwind.com/wp-content/upl ... f2b.bin.gz

Thanks

Konsta
Posts: 67
Joined: Thu Aug 16, 2018 3:55 pm
Location: Finland
Contact: Website Twitter

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Jan 27, 2019 7:09 am

Awesome, great work! Thanks for sharing this. :D

Can you tell more about the hardware accelerated graphics? I see you're using latest MESA 19. Are you using mainline drm_hwcomposer and drm_gralloc as well? Getting the mainline graphics working with VC4 would be a huge win. Are you planning on open sourcing you efforts?

I see you've also got bluetooth working on Pi 3 B+. :)
KonstaKANG.com

code_exec
Posts: 271
Joined: Sun Sep 30, 2018 12:25 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Jan 27, 2019 5:24 pm

How does Android Pie run on the Pi 3? Is it usable?
Ubuntu 18.04 LTS desktop images for the Raspberry Pi 3.

https://github.com/CodeExecution/Ubuntu-ARM64-RPi

hippy
Posts: 5942
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Jan 27, 2019 8:06 pm

code_exec wrote:
Sun Jan 27, 2019 5:24 pm
How does Android Pie run on the Pi 3?
On my Pi 3B (non-plus) it was a mixed bag, but I'd call it "sluggish" over-all, "very sluggish" at times. I kept getting "App not responding" alerts, and eventually it just froze.
code_exec wrote:
Sun Jan 27, 2019 5:24 pm
Is it usable?
IMO; not on my Pi 3B, unless one were only using it for running signage apps or similar.

Konsta's Linneage OS 14 build ( Android 7.1.2 ) has been the most responsive I have found in trying various Androids for the Pi.

selvapsk
Posts: 1
Joined: Thu Jan 31, 2019 7:25 am

Re: Android Pie on RPi 3B(+) with hardware acceleration

Thu Jan 31, 2019 7:31 am

Good Job. I tried the image on RPi3 and it works well.

I would like to build it from source. Pls. share link for the source.
hzak wrote:
Sat Jan 26, 2019 4:50 pm
With several months hardware, The Raspberry Pi 3B and 3B+ can finally run Android 9 pie system.

Features:
1. Bootloader: u-boot as AndroidThings on RPi 3B v.1.0.4, run on 64-bit mode
2. Kernel: v.4.14.71 run on 64-bit mode
3. Display: 720p(1280×720) @ 60Hz through on board HDMI port
4. Audio: analog, 2 channel through on board audio jack
5. WiFi: 2.4G (RPi 3B & 3B+), 5G (RPi 3B+)
6. Bluetooth: HCI over UART(ttyAMA0), RPi 3B: 921600bps no flow control; RPi 3B+: 3000000bps with flow control with a2dp and bt-pan(no test yet) support.
7. Ethernet: both work, and IP from DHCP
8. OpenGL render: based on mesa3d vc4 driver.
9. Hardware composer based on drm_hwcomposer (overlay has been disabled due to mis-compose in some satuation)

Knowing issue:
1. Enable `Debug GPU overdraw’ in system settings will make app crash
2. Enable `Debug non-retangular clip operations’ in system settings will make app crash
3. Do not disable `Disable HW overlays’ in system settings
4. Audio over HDMI not support
5. Can not play video

You can check the demo video on youtube at https://youtu.be/tJJetgz53OI (Normal record speed)
The performance is quite acceptable

The image can be download from https://www.brobwind.com/wp-content/upl ... f2b.bin.gz

Thanks

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Feb 03, 2019 3:29 pm

Konsta wrote:
Sun Jan 27, 2019 7:09 am
Awesome, great work! Thanks for sharing this. :D

Can you tell more about the hardware accelerated graphics? I see you're using latest MESA 19. Are you using mainline drm_hwcomposer and drm_gralloc as well? Getting the mainline graphics working with VC4 would be a huge win. Are you planning on open sourcing you efforts?

I see you've also got bluetooth working on Pi 3 B+. :)
Yes, I use the mainline drm_hwcomposer with a little modification to make it work, but I do not use the drm_gralloc (don't how to make it work), I use the minigbm for gralloc from chromium project (also needs a little modification) and it works pretty well with the latest mesa 3d source code.

The source code will be public at the end of this month and hope someone can fix these problems and make it better.

Thanks

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Feb 03, 2019 3:30 pm

code_exec wrote:
Sun Jan 27, 2019 5:24 pm
How does Android Pie run on the Pi 3? Is it usable?
Yes, both Model B and B+

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Feb 03, 2019 3:38 pm

hippy wrote:
Sun Jan 27, 2019 8:06 pm
code_exec wrote:
Sun Jan 27, 2019 5:24 pm
How does Android Pie run on the Pi 3?
On my Pi 3B (non-plus) it was a mixed bag, but I'd call it "sluggish" over-all, "very sluggish" at times. I kept getting "App not responding" alerts, and eventually it just froze.
code_exec wrote:
Sun Jan 27, 2019 5:24 pm
Is it usable?
IMO; not on my Pi 3B, unless one were only using it for running signage apps or similar.

Konsta's Linneage OS 14 build ( Android 7.1.2 ) has been the most responsive I have found in trying various Androids for the Pi.
I will try the image later.(due to problem in download file from androidfilehost in my country).
Due to the hardware composer(HW overlay) has been disabled, I think this will great impact the system performance.
Please try to enable the hw overlay as I mentioned in the first post and check the performance.

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Feb 03, 2019 3:42 pm

selvapsk wrote:
Thu Jan 31, 2019 7:31 am
Good Job. I tried the image on RPi3 and it works well.

I would like to build it from source. Pls. share link for the source.
hzak wrote:
Sat Jan 26, 2019 4:50 pm
With several months hardware, The Raspberry Pi 3B and 3B+ can finally run Android 9 pie system.

Features:
1. Bootloader: u-boot as AndroidThings on RPi 3B v.1.0.4, run on 64-bit mode
2. Kernel: v.4.14.71 run on 64-bit mode
3. Display: 720p(1280×720) @ 60Hz through on board HDMI port
4. Audio: analog, 2 channel through on board audio jack
5. WiFi: 2.4G (RPi 3B & 3B+), 5G (RPi 3B+)
6. Bluetooth: HCI over UART(ttyAMA0), RPi 3B: 921600bps no flow control; RPi 3B+: 3000000bps with flow control with a2dp and bt-pan(no test yet) support.
7. Ethernet: both work, and IP from DHCP
8. OpenGL render: based on mesa3d vc4 driver.
9. Hardware composer based on drm_hwcomposer (overlay has been disabled due to mis-compose in some satuation)

Knowing issue:
1. Enable `Debug GPU overdraw’ in system settings will make app crash
2. Enable `Debug non-retangular clip operations’ in system settings will make app crash
3. Do not disable `Disable HW overlays’ in system settings
4. Audio over HDMI not support
5. Can not play video

You can check the demo video on youtube at https://youtu.be/tJJetgz53OI (Normal record speed)
The performance is quite acceptable

The image can be download from https://www.brobwind.com/wp-content/upl ... f2b.bin.gz

Thanks
Yes, The source code will be available at the end of this month.
Thanks

hippy
Posts: 5942
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Feb 03, 2019 6:26 pm

hzak wrote:
Sun Feb 03, 2019 3:38 pm
Due to the hardware composer(HW overlay) has been disabled, I think this will great impact the system performance.
Please try to enable the hw overlay as I mentioned in the first post and check the performance.
All I can see in the first post is "3. Do not disable `Disable HW overlays’ in system settings"; not quite the same as make sure it's enabled. I used it as it came but will check that is enabled next time I boot up Android Pie.

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Mon Feb 04, 2019 2:14 pm

hippy wrote:
Sun Feb 03, 2019 6:26 pm
hzak wrote:
Sun Feb 03, 2019 3:38 pm
Due to the hardware composer(HW overlay) has been disabled, I think this will great impact the system performance.
Please try to enable the hw overlay as I mentioned in the first post and check the performance.
All I can see in the first post is "3. Do not disable `Disable HW overlays’ in system settings"; not quite the same as make sure it's enabled. I used it as it came but will check that is enabled next time I boot up Android Pie.
In order to minimize the modification of the Android source code, I create a simple App to do this job (locate in /system/priv-app/RPiTool).
It will disable HW overlays when system booted.
You can either uncheck the HW overlays options (It will take effect immediately) or remove the app and reboot the system.
Then verify it by go to system settings -> Sound -> Phone ringtone, try to select a ringtone, then you will find the cursor is under the Phone ringtone dialog (drm hwcomposer miscompose the layers).

adb connect <your ip>
adb shell dumpsys SurfaceFlinger
In the `Display 0 HWC layers' section, If the Comp Type is Device, the layer is using hardware composer, it will save about 16ms to display on the screen compared to the Client type. (When disable HW overlays, all layers' Comp Type is Client, using GPU to compose the layer, it will take longer)

Konsta
Posts: 67
Joined: Thu Aug 16, 2018 3:55 pm
Location: Finland
Contact: Website Twitter

Re: Android Pie on RPi 3B(+) with hardware acceleration

Tue Feb 05, 2019 5:21 pm

hzak wrote:
Sun Feb 03, 2019 3:29 pm
Yes, I use the mainline drm_hwcomposer with a little modification to make it work, but I do not use the drm_gralloc (don't how to make it work), I use the minigbm for gralloc from chromium project (also needs a little modification) and it works pretty well with the latest mesa 3d source code.

The source code will be public at the end of this month and hope someone can fix these problems and make it better.
Great, thanks for the info. I tested AOSP version of minigbm with drm_hwcomposer and MESA at some point. Also tested drm_gralloc and gbm_gralloc but unfortunately didn't have much luck with any of these.

Yeah, hopefully Android community on Raspberry Pi can help you sort out the remaining issues once the source code is available. :)
KonstaKANG.com

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Feb 10, 2019 6:10 am

Some source code has been upload to github: https://github.com/brobwind/pie-device-brobwind-rpi3
You can build it from source code now.

Thanks

Konsta
Posts: 67
Joined: Thu Aug 16, 2018 3:55 pm
Location: Finland
Contact: Website Twitter

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Feb 10, 2019 8:37 am

hzak wrote:
Sun Feb 10, 2019 6:10 am
Some source code has been upload to github: https://github.com/brobwind/pie-device-brobwind-rpi3
You can build it from source code now.

Thanks
I see display HALs and MESA are in binary form which unfortunately doesn't help open source development (nor anyone can help you fix the remaining issues). Are you planning on releasing the source code?

Linux kernel and U-Boot are licensed under GPLv2 (https://www.gnu.org/licenses/old-licens ... .0.en.html) which obligates you to provide source code matching the binaries you're distributing. There's no source code available for those parts (just binaries) which is not in compliance with the license.
KonstaKANG.com

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Feb 10, 2019 10:37 am

Konsta wrote:
Sun Feb 10, 2019 8:37 am
hzak wrote:
Sun Feb 10, 2019 6:10 am
Some source code has been upload to github: https://github.com/brobwind/pie-device-brobwind-rpi3
You can build it from source code now.

Thanks
I see display HALs and MESA are in binary form which unfortunately doesn't help open source development (nor anyone can help you fix the remaining issues). Are you planning on releasing the source code?

Linux kernel and U-Boot are licensed under GPLv2 (https://www.gnu.org/licenses/old-licens ... .0.en.html) which obligates you to provide source code matching the binaries you're distributing. There's no source code available for those parts (just binaries) which is not in compliance with the license.
Yes, all will be open source soon.

Konsta
Posts: 67
Joined: Thu Aug 16, 2018 3:55 pm
Location: Finland
Contact: Website Twitter

Re: Android Pie on RPi 3B(+) with hardware acceleration

Sun Feb 10, 2019 11:00 am

hzak wrote:
Sun Feb 10, 2019 10:37 am
Konsta wrote:
Sun Feb 10, 2019 8:37 am
hzak wrote:
Sun Feb 10, 2019 6:10 am
Some source code has been upload to github: https://github.com/brobwind/pie-device-brobwind-rpi3
You can build it from source code now.

Thanks
I see display HALs and MESA are in binary form which unfortunately doesn't help open source development (nor anyone can help you fix the remaining issues). Are you planning on releasing the source code?

Linux kernel and U-Boot are licensed under GPLv2 (https://www.gnu.org/licenses/old-licens ... .0.en.html) which obligates you to provide source code matching the binaries you're distributing. There's no source code available for those parts (just binaries) which is not in compliance with the license.
Yes, all will be open source soon.
Great, good to hear. :)
KonstaKANG.com

Mister_Ed
Posts: 9
Joined: Wed Feb 06, 2019 9:44 am

Re: Android Pie on RPi 3B(+) with hardware acceleration

Thu Feb 14, 2019 9:02 am

Tested it here on Rpi 3b.

It runs very smoothly. :D

Nice job. I hope this will continue.

Mister_Ed
Posts: 9
Joined: Wed Feb 06, 2019 9:44 am

Re: Android Pie on RPi 3B(+) with hardware acceleration

Fri Feb 15, 2019 8:53 am

hzak wrote:
Sun Feb 10, 2019 6:10 am
Some source code has been upload to github: https://github.com/brobwind/pie-device-brobwind-rpi3
You can build it from source code now.

Thanks
I builded it from the source per as you described.

Now I have the images boot.img, rpiboot.img system.img, vendor.img and userdata.img.

Can you please describe how to write the images to a sdcard?
I have tried making partitions manually and writing the data from the images to it but it doesn't boot.


Thanks.

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Fri Feb 15, 2019 5:50 pm

Mister_Ed wrote:
Fri Feb 15, 2019 8:53 am
hzak wrote:
Sun Feb 10, 2019 6:10 am
Some source code has been upload to github: https://github.com/brobwind/pie-device-brobwind-rpi3
You can build it from source code now.

Thanks
I builded it from the source per as you described.

Now I have the images boot.img, rpiboot.img system.img, vendor.img and userdata.img.

Can you please describe how to write the images to a sdcard?
I have tried making partitions manually and writing the data from the images to it but it doesn't boot.


Thanks.
The instructions can be found here: https://github.com/brobwind/pie-device- ... /README.md
I will upload a script to create partition later.

Thanks.

imelsom
Posts: 2
Joined: Tue Feb 19, 2019 7:27 am

Re: Android Pie on RPi 3B(+) with hardware acceleration

Tue Feb 19, 2019 7:38 am

Hi.
Awesome job!

Some questions about screen resolution:

Is your resolution of 1024x720 hard coded? I'm trying to get this screen to behave: https://www.waveshare.com/wiki/7inch_HDMI_LCD_(B), but modifying config.txt with the reccomended settings (settings from code block below) from the user manual do nothing.

Code: Select all

max_usb_current=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
hdmi_drive=1
I plugged my pi 3 B+ into an ordinary computer monitor that can handle higher resolutions, but I couldn't find anywhere to define screen resolution in the android settings.

So how do I define the correct resolution for that screen in your android version?

I also would like to ask how I can access a bootloader so that I can add things like GAPPS?

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Tue Feb 19, 2019 4:48 pm

imelsom wrote:
Tue Feb 19, 2019 7:38 am
Hi.
Awesome job!

Some questions about screen resolution:

Is your resolution of 1024x720 hard coded? I'm trying to get this screen to behave: https://www.waveshare.com/wiki/7inch_HDMI_LCD_(B), but modifying config.txt with the reccomended settings (settings from code block below) from the user manual do nothing.

Code: Select all

max_usb_current=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
hdmi_drive=1
I plugged my pi 3 B+ into an ordinary computer monitor that can handle higher resolutions, but I couldn't find anywhere to define screen resolution in the android settings.

So how do I define the correct resolution for that screen in your android version?
Yes, the screen resolution is 1280x720 and hard code in cmdline.txt as kernel parameter: drm_kms_helper.edid_firmware=edid/1280x720.bin
Please try to remove the kernel parameter and check if it can work or not.
I also would like to ask how I can access a bootloader so that I can add things like GAPPS?
You can refer this: https://developer.android.com/things/ha ... al-console
or https://github.com/brobwind/pie-device- ... /README.md
to flash your own system images.
Or you can use adb command to install apps.

imelsom
Posts: 2
Joined: Tue Feb 19, 2019 7:27 am

Re: Android Pie on RPi 3B(+) with hardware acceleration

Tue Feb 19, 2019 9:10 pm

Thank you very much for your reply and your help :)

Mister_Ed
Posts: 9
Joined: Wed Feb 06, 2019 9:44 am

Re: Android Pie on RPi 3B(+) with hardware acceleration

Mon Feb 25, 2019 2:23 pm

Yes, the screen resolution is 1280x720 and hard code in cmdline.txt as kernel parameter: drm_kms_helper.edid_firmware=edid/1280x720.bin
Please try to remove the kernel parameter and check if it can work or not.
I've tried several options but it's not working when I change anything in cmdline.txt and/or config.txt.


Is there some other solution?


My 1080p TV at home will refuse the current 720p settings, as soon the Pi boots the screen freezes.


Thank you.

hzak
Posts: 37
Joined: Sat Jan 26, 2019 4:32 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Mon Feb 25, 2019 9:22 pm

Mister_Ed wrote:
Mon Feb 25, 2019 2:23 pm
Yes, the screen resolution is 1280x720 and hard code in cmdline.txt as kernel parameter: drm_kms_helper.edid_firmware=edid/1280x720.bin
Please try to remove the kernel parameter and check if it can work or not.
I've tried several options but it's not working when I change anything in cmdline.txt and/or config.txt.


Is there some other solution?


My 1080p TV at home will refuse the current 720p settings, as soon the Pi boots the screen freezes.


Thank you.
Reasons for fixed the screen resolution to 720p:
1. The vc4/v3d GPU limited the texture size to 2048x2048.
2. And the original Android framework will require to create a max(width, height) * 2 texture.
I changed the texture size to max(width, height) * 1.4, so the maximum screen width or height should not exceed to 2048/1.4 = 1462.
(https://github.com/brobwind/pie-device- ... -framework)
3. Larger screen size/resolution will take more GPU/CMA memory and impact system performance.
4. 720p resolution is one of the most widely used.

EDID/HDMI debugging:
You can follow this document to check why your changes not take effect: https://github.com/raspberrypi/document ... /README.md
After that, you should disable the debug mode or the bluetooth will not work (both uses the PL011 ?)
(Apply HDMI related parameters in config.txt will not take effect, that's why I apply it on kernel?)

Kernel and EDID binary:
I have already uploaded the my kernel source code to https://github.com/brobwind/pie-device- ... rnel-v4.14
The kernel built-in support EDID could be found in drivers/gpu/drm/drm_edid_load.c.
720p EDID binary that I used locate at firmware/edid folder.
You can follow this guide to make EDID binary: Documentation/EDID/HOWTO.txt.
And place the binary to firmware/edid folder(the kernel configuration file .config may also need to update).

licux
Posts: 2
Joined: Wed Feb 27, 2019 12:08 pm

Re: Android Pie on RPi 3B(+) with hardware acceleration

Wed Feb 27, 2019 12:18 pm

hzak wrote:
Fri Feb 15, 2019 5:50 pm
Mister_Ed wrote:
Fri Feb 15, 2019 8:53 am
hzak wrote:
Sun Feb 10, 2019 6:10 am
Some source code has been upload to github: https://github.com/brobwind/pie-device-brobwind-rpi3
You can build it from source code now.

Thanks
I builded it from the source per as you described.

Now I have the images boot.img, rpiboot.img system.img, vendor.img and userdata.img.

Can you please describe how to write the images to a sdcard?
I have tried making partitions manually and writing the data from the images to it but it doesn't boot.


Thanks.
The instructions can be found here: https://github.com/brobwind/pie-device- ... /README.md
I will upload a script to create partition later.

Thanks.
Hi,

I want to know how to launch u-boot to write Android images on Raspberry Pi.
I think it is necessary to write some files including u-boot.bin to SD card.

Is detail procudere described somewhere except for below page?
https://github.com/brobwind/pie-device- ... /README.md

Thanks.

Return to “Android”