Initial Support for Freedreno on Android

I now have Android-x86 running Freedreno on my IFC6410 \o/!

Freedreno on Android

The setup:

on an IFC6410 (A320 GPU) with an ancient CRT


The gralloc module carries two responsibilities: providing an interface to /dev/graphics/fb0 for creating FrameBufferNativeWindow-s and, handling buffer requests that come in through a singleton system wide GraphicBufferAllocator object. Each request is stamped with a usage flag to help gralloc decide how to provide it.

Current setup uses the default eglSwapBuffers() based HWC, i.e. all-GPU composition for now:

$ dumpsys SurfaceFlinger
[...]
numHwLayers=3, flags=00000000
type    |  handle  |   hints  |   flags  | tr | blend |  format  |          source crop            |           frame           name
------------+----------+----------+----------+----+-------+----------+---------------------------------+--------------------------------
GLES | 2a2a31e0 | 00000000 | 00000000 | 00 | 00100 | 00000005 | [      0,     13,   1024,    744] | [    0,   13, 1024,  744] com.example.android.home/com.example.android.home.Home
GLES | 2a060ad8 | 00000000 | 00000000 | 00 | 00105 | 00000005 | [      0,      0,   1024,     13] | [    0,    0, 1024,   13] StatusBar
GLES | 2a0614d8 | 00000000 | 00000000 | 00 | 00105 | 00000005 | [      0,      0,   1024,     24] | [    0,  744, 1024,  768] NavigationBar

Shortlog of issues faced:

I started with getting bare kitkat-x86 up on the IFC6410 with an ARM build setup. Fast forward multiple tries figuring out the build system and setting up the board-specific init scripts, I added Mesa to the build. The default HWC doesn’t implement blank(), which took some time to realize and fix a segfault. With all parts in place, I had the boot logo, with two boot flows due to a race condition. Disabling GPU authentication was another hack that needed to be put in.

Finally, I had Skia causing trouble while starting the UI. This turned out to be a simple fix to drm_gralloc, but had me looking everywhere through the sources and mistaking it to be a NEON specific issue with Skia.

Quirks:

Currently, Android only renders a few windows before SurfaceFlinger crashes while gralloc::unregisterBuffer() and restarts. Also, dexopt dies causing app installation failure, so not many apps to play around with.

TODOs:

  • Add a KMS based Hardware Composer.
  • GBM for drm_gralloc

Here is my trello board: https://trello.com/b/bIXu6QL6/freedreno-android

Thanks Rob, Emil, #freedreno, #android-x86 and #linaro!


Advertisements

2 thoughts on “Initial Support for Freedreno on Android”

  1. Btw, on topic of gbm, someone (Emil?) brought up the point that mesa gbm drags in dependency on all of mesa, which might be a bit heavy in terms of dependencies for gralloc. One option to consider is something like minigbm:

    https://chromium.googlesource.com/chromiumos/platform/minigbm/+/master

    Which implements the same gbm interface in a more minimalistic way. It would of course need freedreno/msm support, but that looks like it would be fairly straightforward (ie. more or less one ~50 line .c file). I guess from the drm_gralloc code, it shouldn’t matter one way or another, since both gbm’s implement the same interface.

    Other than that, I think dri3 support for android would be a pretty good thing.. since it would avoid the need for auth hack.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s