Analysis of android's hwc [transfer]

https://blog.csdn.net/alien75/article/details/39290109

Note: This document is analyzed based on kk, focusing on the precise definition of concepts and the evolution of version history

1. Introduction to hwc

In a broad sense, it refers to the function (capability) of using hardware to combine and display image data. In a narrow sense, it refers to Hwcomposer HAL.


1. From a broad perspective, there are several concepts that need to be precisely defined (note the difference between upper and lower case letters)

(1) hwc: Use hardware to complete the function (capability) of combining and displaying image data. Specifically, at the code level, it is a function (capability) that is coordinated by multiple classes such as SurfaceFlinger, HWComposer, and DisplayDevice.
(2) HWComposer: The hardware composition abstraction layer is between SurfaceFlinger and HAL. Specifically, it is a class at the code level, which encapsulates the use of Hwcomposer HAL and Gralloc HAL. According to the official introduction, Hwcomposer HAL has multiple versions such as 1.0, 1.1, 1.2, 1.3, etc. When it is 1.1 and later, HWComposer no longer needs to use Gralloc HAL.
(3) Hwcomposer: The specific code level is Hwcomposer HAL
(4) hw composer: The specific platform hardware level is the composer hardware, such as BE.

 


2. From a narrow perspective,

Hwcomposer HAL is introduced from Honeycomb (3.0), replacing the Overlay implementation of 2.3 (but not required) to reduce the difficulty of code implementation and maintenance. Its implementation version has undergone the evolution from 1.0 to 1.3. In the 1.1 version implemented by Jellybean MR1 (4.2), the concept of hardware composition abstraction layer (HWComposer) was introduced, and the platform display hardware characteristics were completely hidden from SurfaceFlinger, and the working method was also modified. The official description is as follows: ( 1)SurfaceFlinger provides the HWC
with a full list of layers, and asks, "how do you want to handle this?" HWC responds by marking each layer as "overlay" or "GLES composition" HWComposer decides whether to use hardware layer compositor or GPU composition based on hardware performance (3) SurfaceFlinger takes care of any GLES composition, passing the output buffer to HWC, and lets HWC handle the rest SurfaceFlinger processes the soft layers that need to be synthesized by GPU, and submits the results to HWComposer for display (through Hwcomposer HAL), and the soft layers that need to be synthesized by hardware layer compositor are processed by HWComposer itself (through Hwcomposer HAL) for analysis: like this The advantage of the design is that it can give full play to the hardware performance while reducing the coupling between SurfaceFlinger and the hardware platform (easy to port)







 

3. The general evolution of Hwcomposer HAL

(1) pre-1.1
only supports one Display
(2) 1.1 (example: exynos5)
does not need Gralloc HAL
to support Multiple Display ,
supports hotplug
and adds HWC_FRAMEBUFFER_TARGET synthesis type
(3) 1.2 (example: msm8960, msm8x26)
supports Alpha operation (setPlaneAlpha), Previously completed by GPU
(4) 1.3 (example: msm8974)
supports Virtual Display layer composition, previously completed by GPU to
support crop (cropping)

 


4. Terminal display support

Since JellyBean (4.2), multiple screens are supported. Screen types:
Primary Display: The screen that comes with the device, managed by SurfaceFlinger
External Display: Connected via HDMI, SurfaceFlinger monitors and manages
Virtual Display: This method is added in 4.2 ( Such as Mircast based on Wifi Direct technology), which is monitored and managed by DisplayManagerService. Virtual Display can select all or part of the layers for composition. Before KitKat, Hwcomposer could only manage the composition of Primary Display, while Virtual Display used GLES for composition. Starting from KitKat, Hwcomposer can also participate in the composition of Virtual Display. The display data of Virtual Display is also processed by BufferQueue

 

5. What HWC can do

(1)Full-screen games in portrait and landscape mode
(2)Full-screen video with closed captioning and playback control
(3)The home screen(compositing the status bar, system bar, application window, and live wallpapers)
(4)Protected video playback
(5)Multiple display support

 

2. Citation

http://source.anddroid.com/devices/graphics.htmlhttp://blog.csdn.net/jinzhuojun/article/details/17427491

http://www.cnblogs.com/samchen2009/p/3364327.html

http://blog.csdn.net/brucexu1978/article/details/8976781



The Android graphics path, in depth.pdf
Android Graphics And Android EGL.pdf

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325472976&siteId=291194637