SurfaceFlinger dumps provide a snapshot of SurfaceFlinger at a specific time. SurfaceFlinger traces feature a chronological sequence of states that provide valuable insights into how a window appears on screen and determines which window receives touch responses at specific locations. This information is essential for troubleshooting issues such as the app isn't responding to my touch or I experienced flickering while watching a video.
Winscope's SurfaceFlinger viewer displays this information for traces collected using either the active mode or generated from the transactions trace when taking a bug report (by default, the Droidfood configuration), as well as for dumps.
See SurfaceFlinger (layers) for more information about trace collection.
Figure 1. SurfaceFlinger trace analysis.
The left side of the screen features a 3D view of the layers. The rects view considers layer bounds, z-order, opacity, relative Z, and rounded corners.
Hierarchy chips
The tab's central segment shows the layer hierarchy with chips for more information, such as the parent-child relationships between layers, as follows:
- V: Identifies visible layers.
- RelZParent: Identifies layers with a RelZ child.
- RelZ: Identifies layers with a RelZParent and drawn in z-order as their hierarchy.
- HWC: Identifies layers composed by the Hardware Composer.
- GPU: Identifies layers composed by the GPU.
The right side of the screen features a list of curated properties, as well as a proto dump of all available layer properties. For more information about the features of the proto dump section see Properties.
Curated properties
To make debugging easier, the SurfaceFlinger viewer provides a curated list of properties, presenting the most commonly used information in a more organized format:
Figure 2. SurfaceFlinger properties.
This list includes the following categories.
Visibility
This block contains information about the layer visibility and an explanation to why it isn't visible. It includes:
Flags: These control visibility, for example, HIDDEN
and OPAQUE
.
Invisibility reason: An explanation for why the layer or surface is invisible on the screen if applicable, for example, hidden by itself or its parent, or have no buffer to draw.
Occluded, Partially occluded, or Covered:
- Occluded: The current layer is calculated as visible, but another
opaque layer is drawn on top of it, making the current layer invisible. The
layer above the Occluded layer is opaque, that is, either its
OPAQUE
flag is set, or the pixel format doesn't contain alpha or no alpha is set on the layer. - Partially Occluded: The current layer is partially visible as the opaque
layer drawn on top of it doesn't entirely cover it. The layer above the
Partially Occluded layer is opaque, that is, the
OPAQUE
flag is set, or the pixel format doesn't contain alpha or no alpha is set on the layer. Covered: The current layer is covered, either entirely or partially, by a non opaque layer and may still be visible on screen. The layer above the Covered layer isn't opaque, that is, the
OPAQUE
flag isn't set or the pixel format contains alpha or alpha is set on the layer. However, for SurfaceFlinger traces, a Covered layer is shown as visible, for layers below SurfaceFlinger:Figure 3. Covered layer on SurfaceFlinger.
Geometry and Effects
This section describes the requested and computed geometry and effects for the current layer.
The Requested section shows the properties being set on the layer. In contrast, the Calculated section displays the properties that are being applied to the layer. This distinction is because geometry and effects are passed down the hierarchy and inherited from parent elements.
In Figure 2, the layer requests the Corner Radius to be set to 0 px. However, one of its parent layers sets the Corner Radius to be 97.419 px, which is the applied value:
Buffer
The following properties display information about whether the layer has a buffer, its size, and transform.
- Frame Number: Incremental number starting when an app is created.
- Destination Frame: Used to scale the buffer to the bounds defined by destination frame.
Hierarchy
The following properties describe how the hierarchy of layers is determined:
- z-order: In the hierarchy of layers, the z-ordering determines the relative positioning of a layer in relation to its siblings. A layer with a z-value of 0 is positioned above its parent. If multiple layers share the same z-value, the layer with the higher layer ID is placed on top.
- relative parent: Indicates the relative parent layer in the z-order. The child doesn't inherit any properties from its relative parent except for the hidden flag.
Input
The following properties contain information about touchable region and focus:
- Crop touch region with item: Use layer bounds to crop the touchable region.
- Replace touch region with crop: Use current layers crop as its touchable region.