android display pipeline

https://lwn.net/Articles/809545/

  • software and hardware cooperating
  • in the advancement of the application’s execution — 推进

question

skia vs opengl?

graphic overview

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

draw images to the screen in three ways:

  • canvas
    • Canvas APIs provide a software implementation for drawing directly on a surface
      • with hardware-acceleration support
  • opengl es
  • vulkan — like opengl es
    • reductions in CPU onverhead
    • support for the SPIR-V Binary Intermediate language

surface

  • everything is rendered onto a surface
  • every window backed by a surface
  • producer:surface
    • surface produce a buffer queue
      consumer:surfaceflinger

bufferqueue in three mode:

  • synchronous-like mode
    • no buffer is discarded
    • if producer is too fast, block and wait free buffers
  • non-blocking mode
    • generates an error rather than waiting
  • discard mode
    • discard old buffers rather than generate errors

high-level component

  • SurfaceView and GLSurfaceView
    • surface combine a surface and a view
    • composited by SurfaceFlinger not the app
      • enabling rendering from a separate thread/process
    • GLSurfaceView provides helper classes to manage EGL contexts
  • SurfaceTexture
    • combines a surface and GLES texture to create a BufferQueue
      • app is the consumer
  • TextureView
    • combines a view with a surfacetexture