terminology description
compositor 合成器
composer 作曲家;作家,著作者;设计者,XX编辑器
surface represents the producer side of a buffer queue that is often consumed by SurfaceFlinger.
VSync stands for Vertical Synchronization
tearing a phenomenon that gives a disjointed image

Vsync&tearing

https://stackoverflow.com/questions/4576909/understanding-canvas-and-surface-concepts#answers
https://www.mail-archive.com/android-framework@googlegroups.com/msg01901.html

Gralloc

The graphics memory allocator

HAL

the graphics hardware abstraction layer

Android 4.0

enabled hardware-accelerated Canvas by default

developers render graphics in 2 ways

1.canvas

In Android, hardware acceleration for Canvas APIs is accomplished with a drawing library called OpenGLRenderer that translates Canvas operations to OpenGL operations so they can execute on the GPU.

2.OpenGL ES render to a surface

main components: Image Stream Producers, Image Stream Consumers, Window Manager, Hardware Composer

Image Stream Producers

  • OpenGL ES
  • Canvas 2D
  • mediaserver vidwo decoders

Image Stream Consumers

  • SurfaceFlinger -most common consumer
  • OpenGL ES apps,ex.camera
  • Non-GL applications, ex.ImageReader

Window Manager

send window metadata to SurfaceFlinger,
window metadata:

  • lifecycles
  • input
  • focus events
  • screen orientation
  • transitions
  • animations
  • position
  • transforms
  • z-order

Hardware Composer

Gralloc


BufferQueue

  • provide the glue between the Android graphics components
  • contains the logic that ties image stream producers and image stream consumers together
  • work in three mode

BufferQueue mode

1. Synchronous-like mode

BufferQueue default mode, no buffer is ever discarded, if producer is too fast would block and wait for free buffers

2. Non-blocking mode

No buffer is ever discarded, generate an error when waiting for a buffer

3. Discard mode

discard old buffers rather than generate errors or wait