Sunday, August 16, 2009

Android Graphic Subsystem

http://linux.chinaunix.net/techdoc/develop/2009/06/20/1119467.shtml
http://www.linuxgraphics.cn/android/graphics_system.html

Java level is Surface/View concept. But in c++ level, the flow is as follows:

1. JNI call "new SurfaceComposerClient" in SurfaceSession_init
2. SurfaceComposerClient will get surfaceflinger service by asking servicemanager
3. call createConnection and get SurfaceFlingerClient, SufaceFlinger keeps its own "Client" map
4. call (BnSurfaceFlingerClient/BClient)SurfaceFlinger::createSurface, to create layer, and get LayerBaseClient::Surface, and casting to Surface
5. The following operation in JNI is to triggered SufaceComposerClient/Surface function



When app get the surface, it can start drawing. The SurfaceFlinger is a thread(SurfaceFlinger::threadLoop) that wait for drawing event. When event comes, it drawing all surface in Z-order and send it to framebuffer(hw.flip).

No comments:

Related Posts Plugin for WordPress, Blogger...