对于很多Android的显示问题,我们需要使用adb shell dumpsys SurfaceFlinger命令来获取SurfaceFlinger的dump信息,这对于我们分析问题有很大的帮助,因此记录一下我常用的信息。
用法:连接手机执行命令:adb shell dunpsys SurfaceFlinger >sf.log
找到并打开日志文件
关键字:HWC layers
HWC的dump从这句话开始:
h/w composer state:
h/w composer present and enabled
后面是HWComposer的dump函数:
- 首先打印的是hwc的版本,目前更多的是0103和0104;
- mDebugForceFakeVSync的值源自属性debug.sf.no_hw_vsync,打开之后会使用纯软件模拟VSync信号.
- type表示合成类型,可取的值包括以下几种: "GLES","HWC","BKGND", "FB TARGET","SIDEBAND","HWC_CURSOR","FB_BLIT","UNKNOWN".(更详细的一些解释可以参见hwcomposer.h)
- handle是个标识符,可以跟某个buffer的handle对应.(Handle of buffer to compose. This handle is guaranteed to have been allocated from gralloc using the GRALLOC_USAGE_HW_COMPOSER usage flag. If the layer's handle is unchanged across two consecutive prepare calls and the HWC_GEOMETRY_CHANGED flag is not set for the second call then the HWComposer implementation may assume that the contents of the buffer have not changed. )
-
hint is bit mask set by the HWC implementation during (prepare)().It is preserved between (prepare)() calls, unless the HWC_GEOMETRY_CHANGED flag is set, in which case it is reset to 0.
结果:图层信息,带有包名、进程号和分辨率等等信息,带*的表示当前显示的图层,由上到下为顶到底的
关系。