How to make sense of dumpsys SurfaceFlinger

给你一囗甜甜゛ 提交于 2019-11-30 07:30:30

Ok, I have enough figured out to answer my own question, but if anyone has any additional input, please leave them in the comments. There's some additional stuff encountered which I'll note below that still isn't clear.

First, the link below helps explain a few things about how image rendering and compositing happens through SurfaceFlinger: http://source.android.com/devices/graphics.html

If you noticed in the link, there are two ways images are sent to the display. One is to process images with the GPU before sending them to the display, and the other is to use hardware overlays of the display to bypass the GPU and send images directly to the display. The latter method performs better, but you are limited to a certain number of layers/overlays (usually 4). If you have more layers, things have to get processed by the GPU.

The part of dumpsys SurfaceFlinger which was at the center of my question shows you how many layers there are at the moment dumpsys was called, and if those layers are being handled by the Hardware Composer (HWC) or the GPU (GLES). This explains what HWC and GLES mean. Also, numHwLayers is how many overlays the display supports (usually 4).

Also, there are "source crop" and "frame" coordinates. The source crop is the section of an image that will be displayed. For example, if it's a wallpaper that spans multiple display screens (think about what you see on the home screen when you swipe across screens), then at a given moment you will only need a subsection of that larger wallpaper image to display. This means that source crop is just telling you what section of that overall image you are using at the moment. The frame part of it is where that section of the source image is going to actually be display on the screen.

The code for this section of the dumpsys SurfaceFlinger command is located here: \frameworks\native\services\surfaceflinger\DisplayHardware\HWComposer.cpp

It's in a function called "HWComposer::dump"

The above answers my original question, but below are some additional things I noticed:

It looks like there are more composition types than HWC and GLES. In the code noted above, I see a "BACKGROUND" and a "FB TARGET" composite type. FB TARGET seems to always be present when you type "dumpsys SurfaceFlinger" in adb. I think FB Target is simply the frame buffer the complete image will be written to (someone please confirm this). Even if the device is asleep you see this FB TARGET. What I don't understand is, what is this BACKGROUND type? I can't even take a guess on that one. Please leave a comment if you know what this is.

Thanks!

I can add something to he above comment. As in the dumpsys output we can see type is GLES for imagewallpaper, luncher, status bar, navigation bar which means these layer buffers handled by surface flinger and composite and rendered into FB target.

Thanks!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!