Android的Graphic System

Android gfx system的核心是一个生产者消费者模型:生产者消费者分别存在于不同的进程,消费者对应SurfaceFlinger,生产者对应application或者其他service。在生产者消费者之间流动的是用来显示的数据。

1. GFX ARCH

1.1 总体结构

1.2 数据流模型

Android的Graphic System_第1张图片
The diagram above depicts the flow of SurfaceFlinger and BufferQueue. During frame:
1.red buffer fills up, then slides into BufferQueue
2.after red buffer leaves app, blue buffer slides in, replacing it
3.green buffer and systemUI* shadow-slide into HWC (showing that SurfaceFlinger still has the buffers, but now HWC has prepared them for display via overlay on the next VSYNC).

The blue buffer is referenced by both the display and the BufferQueue. The app is not allowed to render to it until the associated sync fence signals.

On VSYNC, all of these happen at once:
•red buffer leaps into SurfaceFlinger, replacing green buffer
•green buffer leaps into Display, replacing blue buffer, and a dotted-line green twin appears in the BufferQueue
•the blue buffer’s fence is signaled, and the blue buffer in App empties**
•display rect changes from

你可能感兴趣的:(android)