46

I haven't found a clear explanation on how the Android graphics system works, specifically, does it use a display server, is it based on DirectFB or X11, etc.

From what I've managed to piece together, Android depends on the Linux frame buffer. I haven't found much on what sort of display server or window manager Android uses to multiplex access to the framebuffer though, so any pointers would be much appreciated!

Finally, from what I understand the ARM instruction set provides instructions to accelerate OpenGL, but how this integrates with the display server isn't clear, ie. do client applications negotiate a shared memory buffer into which the client writes directly?

Are the OpenGL libraries for the platform accelerator open source? I've found some references suggesting they're closed source binaries. Again, any pointers would be appreciated.

RzR
  • 3,068
  • 29
  • 26
naasking
  • 2,514
  • 1
  • 27
  • 32
  • 1
    +1. Very useful for people like me who are suddenly given issues related to display.. :) could you please modify the link of linux frame buffer. It got changed and no more supported it seems. Thanks in advance.. – Sandeep May 22 '13 at 04:13

4 Answers4

47

There are two core pieces to Android graphics: SurfaceFlinger and Skia. SurfaceFlinger is Android's compositor, used by the window manager to create and display windows (actually called surfaces.) SurfaceFlinger is implemented on top of OpenGL ES 1.x currently and can also use other hardware acceleration techniques when available (MDP, a 2D blitter on the T-Mobile G1, or hardware overlays on the Xoom.)

Each application renders into its windows (or surfaces) using primarily Skia. Skia is Android's 2D graphics library. You can also use OpenGL ES 1.x and 2.0 to render into a surface.

Android doesn't use DirectFB or X11 or any other existing Linux solution.

Romain Guy
  • 97,993
  • 18
  • 219
  • 200
  • 1
    And the window manager is a distinguished process shared by all programs, similar a traditional display server? It owns exclusive access to the display device, etc. – naasking Feb 15 '11 at 19:06
  • 1
    The window manager lives in system_process but SurfaceFlinger owns the display device, not the window manager. – Romain Guy Feb 15 '11 at 20:31
  • 1
    I'm curious about your comment on DirectFB. If you look at the presentation at [Jim Huang's presentation](http://www.slideshare.net/jserv/design-and-concepts-of-android-graphics) you will notice a reference to framebuffers on slides 30 and 31. How do those differ from DirectFB? – CyberFonic Jul 20 '12 at 06:01
  • 1
    @Romain Guy could you please answer to my comment posted above under the question? Also if possible please have a look at this : http://stackoverflow.com/questions/16331775/android-display-user-space-kernel-space-interaction – Sandeep May 22 '13 at 04:16
  • 1
    A detailed description of the architecture is now available here: http://source.android.com/devices/graphics/architecture.html – fadden May 05 '14 at 20:45
  • 1
    @RomainGuy why wasn't x11 used for android? Any insights? – Sudip Bhandari May 16 '17 at 11:20
  • 1
    @SudipBhandari X11 is a terrible archaic piece when it comes to windowing systems and the modern desktop, it just makes sense to rip it out altogether when you are re-inventing a GUI stack from scratch on top the linux core. I am happy to learn that X11 is not part of Android. – matanster Apr 05 '21 at 15:52
11

There is a brief introduction presentation about Android Graphics: http://www.slideshare.net/jserv/design-and-concepts-of-android-graphics

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
jserv
  • 195
  • 1
  • 5
  • 1
    Just a caution: the latest versions are changed to a considerable extent. The information contained in the slides may be outdated.. – Sandeep May 22 '13 at 04:18
6

Romain Guy was definitely right. But thing changed since Android 3.0. Skia is not that important anymore , most 2D drawing are accelerated using openGL, a.k.a HWUI component.

pierrotlefou
  • 39,805
  • 37
  • 135
  • 175
  • 1
    What could be good starting point to learn Android graphics stack ? – proton Feb 08 '14 at 08:54
  • 2
    @ppu a shameless promotion of my blog http://pierrchen.blogspot.com/, which talked quite a lot about android graphic internal – pierrotlefou Jul 14 '14 at 02:42
  • 2
    I want to debug HWUI but I don't know how to do it. Any log can't put out.(PS:You are a Chinese and me too. so please give a hand.) – kangear Aug 10 '14 at 09:11
  • 1
    @pierrotlefou this is super useful, thank you for sharing your knowledge. – wukong Apr 28 '20 at 03:21
3

All the information about android graphics can be found here:

https://source.android.com/devices/graphics/

juanmorschrott
  • 573
  • 5
  • 25
  • 1
    I wonder how much that's still current for current day versions, but looks like it's still an official page – matanster Apr 05 '21 at 17:09