I wrote an article "introduce my work" earlier. I used an example-a simple implementation of HTML5 canvas to introduce my work content, this article attempts to describe the hierarchy of a complete knowledge system required by the work content (see for details) and briefly introduces it.
Browser app
Develop complete browser applications based on the system GUI framework.
Android GUI framework
- Understand the view system mechanism of Android;
- Android 3.0 supports using layer as the view's backing store to accelerate animations;
- Understand Java encapsulation and implementation details related to Android window surface;
- Canvas is the main object for 2D plotting on the android Java layer;
WebKit
WebKit can be divided into WebCore and WebKit port. In WebCore, rendering-related objects mainly include renderlayer, renderobject, graphicscontext, image, and imagebuffer, webKit port is responsible for the design and implementation of the entire rendering architecture. It must consider:
- What is used as backing store, vector, bitmap, texture, or surface );
- Support does not support layer rendering (layered rendering requires that accelerated compositing be enabled for WebCore), and does not support tile rendering (Block rendering );
- The multi-threaded (single-process) Rendering architecture is also a multi-process rendering architecture like webkit2 or chrome;
Android graphics stack (client)
The drawing stack of Android on the client usually includes:
- Skia, a drawing library that uses CPU for 2D drawing;
- OpenGL ES, which uses GPU for 3D and 2D plotting APIs (for example, the hwui module after Android 3.0 uses gles to replace skia for 2D plotting to achieve GPU-accelerated 2D plotting );
- EGL, linking the Adaptation Layer of gles and the native Window System of the system;
- Surface (native window), you can use a stub of the surface interface to control remote Native Windows. In addition, after Android 4.0, the application can also create its own native window and take charge of its hybrid;
Android graphics stack (server)
Surfaceflinger is a system service that android uses to manage display and window composite, and outputs the display window of an application to display.
Android drivers (HAL)
The driver layer of Android runs in user space through the Hal (Hardware Abstraction Layer) Mechanism of Android. Rendering-related features include:
- Hwcomposer. If the hardware supports this function, surfaceflinger can request hwcomposer to do window mixing without having to do it by itself. This will increase the efficiency and reduce the occupation of GPU resources;
- Gralloc, used to manage the allocation of graphics buffer and the framebuffer of the management system;
- Copybit: In the early days, when the GPU does not support the complete GL ES1, the internal software version of GL ES1 can use copybit to accelerate texture operations (in fact, acceleration window mixing ), hwcomposer is removed after it appears;
- Gles/EGL driver;
Linux Kernel and drivers
In addition to the standard Linux kernel and driver (for example, FB is a framebuffer driver), the hardware vendor's own drivers, Android's own patches:
- Ashmem, asynchronous shared memory, is used to share a memory area between processes, and allows the system to recycle unlocked memory blocks when resources are insufficient;
- Pmem, used to allocate contiguous memory blocks of physical addresses. It is generally allocated from reserved memory areas and mainly used as graphics buffer, but after 4.0, gradually replaced by a more complete memory manager ion;
- Binder, efficient inter-process communication mechanism;
- Sync, used to block callers and force synchronization with the refresh of the monitor;
Hardware
CPU, GPU, VPU (video process unit), and memory.
Although the current work is mainly concentrated on the WebKit layer, it connects each layer from top to bottom to better expand its work scope and have the ability to challenge more difficult tasks, it is indeed very important to produce high-quality results. It should be said that at present, I just put together the shelf of the above knowledge system to draw a more complete outline. Many parts only understand some simple concepts, in particular, the underlying layers have little knowledge about the principles and implementation details. In the next two to three years, the most important thing to do is to constantly expand and supplement and improve the above knowledge system, in order to reach an early stage of "restoring itself to the edge will have room for you.