Android surfaceflinger RenderEngine explained

/

SurfaceFlinger uses RenderEngine to compose client buffers. RenderEngine abstracts several drawing libraries and provides interface function drawLayers(). There are four types of RenderEngine defined on AOSP.

  • THREADED
  • SKIA_GL
  • SKIA_GL_THREADED
  • GLES

On Android13, `SKIA_GL_THREADED is used by default. This choice can be override by debug.renderengine.backend property.

Type debug.renderengine.backend Description
THREADED "threaded" Threaded RenderEngine with GLES Backend
SKIA_GL "skiagl" RenderEngine with SkiaGL Backend
SKIA_GL_THREADED "skiaglthreaded" Threaded RenderEngine with SkiaGL Backend
GLES "gles" RenderEngine with GLES Backend

Two series of graphics API (GLES/SkiaGL) are wrapped by threaded version and normal version. Threaded variant for each graphics API just offload the processing of drawLayers() into separated thread so that caller of RenderEngine (SurfaceFlinger) will not be blocked. Details of GLES/Skia is written on official website:

benchmark

AOSP implements composition benchmark. Now it is only for skiaglthreaded.

PRODUCT_PACKAGES += "librenderengine_bench"

will install /data/benchmarktest64/librenderengine_bench/librenderengine_bench into target.

Reference