1. Android Display System framework
Android Graphic UI with GPU Hardware acceleration
https://community.nxp.com/docs/DOC-93612
A. The principle and improvement of display drive framebuffer
There is only one framebuffer disadvantage:
(1) If the app writes FB slowly, the LCD image changes slowly
(2) If the app write FB speed is not slow, LCD image will blink
Therefore, to make improvements based on the use of only one FB, use multiple FB to improve:
(1) Displaycontroller using FB0
(2) App Write FB1
(3) Displaycontroller using FB1
(4) App Write FB0
(5) Repeat the above steps
Most drawing picture aspect: Previously in Linux is to draw the entire space in the FB data, if need to draw the phone interface, the steps are as follows: The status bar, the navigation bar, the background, the icon, each interface needs above four steps
Introduce the concept of layer in Android: the status bar and navigation bar is a layer, the background is a layer, the picture is a layer, and finally the drawing layer is merged, combined with Hardwarecomposer
HWC called hardware consolidation
Driver Support HWC: each layer corresponding to a driver/dev/fbx,app operation of a layer, directly write the corresponding framebuffer, the hardware will automatically merge them (for example, our 4412 fb0~fb4 is the corresponding LCD)
B. Multi-tasking system display: there must be a display manager
The app does not have direct access to the LCD driver, there is a manager called Surfaceflinger (Unified operation display device), its functions:
(1) Surfaceflinger gives the app a buffer to store the app's interface (so there's no need to transfer buffer between apps and Surfaceflinger)
A, Surfaceflinger through the Gralloc module (HAL) to the Ashmem (drive layer) Request for memory
b, get an FD, use this file handle to describe the requested buffer
C. Use binder to pass FD to app
D, the app directly accesses buffer after mmap (FD)
(2) App1/app 2/APP3 the respective interface to Surfaceflinger, it is based on the level, the size of the composite display;
A, according to the z-value of each interface (height, relative xy coordinate understanding) to determine the order, Z-value must be determined by Windowmanagerservice
b, these sorted buffer passed to the Hardwarecomposer module, if the hardware does not support the module or the number of layers exceeds the limits of the module, with software GL (graphiclibrary) processing
(3) When Hardwarecomposer cannot process (no hardware/hardware support Max layers), use GL to process
The Android system uses libegl.so to load the hardware GL library or the Software GL Library (the PIN GL library may be access to the GPU), and the app can libegl.so libraries to use the GL Library, in addition to the Surfaceflinger can load the GL library via libegl.so.
11.1 Android Display System frame _framebuffer principle and improvement