UNDERSTANDING ANDROID GRAPHICS INTERNALS – SURFACEFLINGER (I)

from: https://charleszblog.wordpress.com/2014/02/22/understanding-android-internals-surfaceflinger-i/

Let’s recapture what we have known of SurfaceFlinger from previous posts on Android Graphics.
1. it is a native service implementing BnSurfaceComposer;
2. SurfaceFlinger administrates Surface and Graphic Buffer creation for all graphic clients;
3. Periodically, SurfaceFlinger composes surface layers to the back frame buffer in the frame buffer to the abstraction frame buffer device, and submit layers marked for hardware composition to hwcomposer hardware abstraction module for rendering in case of
4. SurfaceFlinger enforces vsync and triple buffering;
5. Supports snapshot of screen display;
6. Supports HDMI display and virtual display (e.g. Wireless Display);
7. It heavily relies on GLES and EGL.
With these knowledge in mind, we proceed to make some conjectures on it design.
1. To run surface composition, it has to own a dedicated thread;
2. It must maintain a context for each individual surface layer
This is done with Layer structure which tracks orientation, cropping, geometric parameters, color scheme, visible region, etc.
3. It must distinguish between the drawing state (front) and currently rendering state (back) for each layer
This is done with the Layer::State structure.
4. It must quarantine the set of currently active rendering layers from layers newly removed and added
This is done with SurfaceFlinger::state structure
5. vsync event is asynchronous of surface composition, we may need a thread somewhere to monitor vsync event

In next post, we will discuss vsync. In my view, vsync was the main force to drive the redesign of SurfaceFlinger in Jelly Bean.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值