Android Graphics Path - Chis Simmonds
Android Graphics Path - Chis Simmonds
in depth
• Share Alike: if you alter, transform, or build upon this work, you may distribute
the resulting work only under a license identical to this one (i.e. include this
page exactly as it is)
• For any reuse or distribution, you must make clear to others the license terms of
this work
https://uk.linkedin.com/in/chrisdsimmonds/
https://google.com/+chrissimmonds
BufferQueue
Window Activity
SurfaceFlinger
Manager Manager
Activity
HWUI Canvas
OpenGL ES Skia
Vendor Open GL
GPU driver
Surface
Activity
OpenGL ES
Surface
SurfaceFlinger
Wallpaper
Launcher
createSurface() getDataChannel()
createConnection() destroySurface()
createDisplayEventConnection()
SurfaceFlinger
• ISurfaceComposerClient
• This interface has two methods:
• IDisplayEventConnection
• This interface passes vsync event information from
SurfaceFlinger to the client
• setVsyncRate() sets the vsync event delivery rate:
value of 1 returns all events, 0 returns none
• requestNextVsync() schedules the next vsync event:
has no effect if the vsync rate is non zero
• getDataChannel() returns a BitTube which can be
used to receive events
IGraphicBufferConsumer:: IGraphicBufferProducer::
releaseBuffer() FREE dequeueBuffer()
IGraphicBufferProducer::
cancelBuffer()
ACQUIRED DEQUEUED
frameworks/native/include/ui/GraphicBuffer.h
• visibleRegion
• crop region
• set()
• Passes the list of layers for HWComposer to handle
frameworks/native/include/ui/PixelFormat.h
PIXEL_FORMAT_RGBA_8888 4x8-bit RGBA
PIXEL_FORMAT_RGBX_8888 4x8-bit RGB0
PIXEL_FORMAT_RGB_888 3x8-bit RGB
PIXEL_FORMAT_RGB_565 16-bit RGB
PIXEL_FORMAT_BGRA_8888 4x8-bit BGRA
• /system/lib/libGLESv1_CM.so
• /system/lib/libGLESv2.so
• EGLNativeWindowType is defined in
system/core/include/system/window.h
• Timeline
• Per-device (display, GPU, camera, ...)
• Fence
• A collection of one or more sync points, possibly from
different timelines
• Represented by a file descriptor so an application can
wait using poll()
• Two fences can be merged to create a new fence that
depends on all the sync points of the original pair
FB
timeline
Sync pt
Sync
Fence
Sync pt
GPU
timeline
• ION_HEAP_TYPE_SYSTEM
• memory allocated via vmalloc
• ION_HEAP_TYPE_SYSTEM_CONTIG
• memory allocated via kmalloc
• ION_HEAP_TYPE_CARVEOUT
• memory allocated from a pre reserved carveout heap
• ION_FLAG_CACHED
• mappings of this buffer should be cached, ION will do
cache maintenance when the buffer is mapped for
DMA
• ION_FLAG_CACHED_NEEDS_SYNC
• Cache must be managed manually, e.g. using
ION_IOC_SYNC