• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17syntax = "proto2";
18
19package perfetto.protos;
20
21import "protos/perfetto/trace/android/surfaceflinger_common.proto";
22import "protos/perfetto/trace/android/graphics/rect.proto";
23
24// Message used by Winscope to process legacy trace files.
25// Represents a file full of surface flinger trace entries.
26// Encoded, it should start with 0x4c 0x59 0x52 0x54 0x52 0x41 0x43 0x45
27// (.LYRTRACE), such that they can be easily identified.
28message LayersTraceFileProto {
29  // constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 |
30  // MagicNumber.MAGIC_NUMBER_L (this is needed because enums have to be 32 bits
31  // and there's no nice way to put 64bit constants into .proto files.
32  enum MagicNumber {
33    INVALID = 0;
34    // LYRT (little-endian ASCII)
35    MAGIC_NUMBER_L = 0x5452594c;
36    // RACE (little-endian ASCII)
37    MAGIC_NUMBER_H = 0x45434152;
38  }
39
40  // Must be the first field, set to value in MagicNumber
41  optional fixed64 magic_number = 1;
42
43  repeated LayersSnapshotProto entry = 2;
44
45  // Offset between real-time clock and elapsed time clock in nanoseconds.
46  // Calculated as: systemTime(SYSTEM_TIME_REALTIME) -
47  // systemTime(SYSTEM_TIME_MONOTONIC)
48  optional fixed64 real_to_elapsed_time_offset_nanos = 3;
49}
50
51message LayersSnapshotProto {
52  // elapsed realtime in nanos since boot of when this entry was logged
53  optional sfixed64 elapsed_realtime_nanos = 1;
54
55  // SurfaceFlinger's stage where the snapshot was triggered.
56  // Currently either "visibleRegionsDirty" or "bufferLatched".
57  optional string where = 2;
58
59  optional LayersProto layers = 3;
60
61  // Blob for the current HWC information for all layers, reported by dumpsys.
62  // Example:
63  //   "maxDownScale: 4, maxFullWidth: 8192, HWState: 1, AssignedState: 3, ..."
64  optional string hwc_blob = 4;
65
66  // Excludes state sent during composition like visible region and composition
67  // type.
68  optional bool excludes_composition_state = 5;
69
70  // Number of missed entries since the last entry was recorded.
71  optional uint32 missed_entries = 6;
72
73  repeated DisplayProto displays = 7;
74
75  optional int64 vsync_id = 8;
76}
77
78// Contains a list of all layers.
79message LayersProto {
80  repeated LayerProto layers = 1;
81}
82
83message DisplayProto {
84  optional uint64 id = 1;
85  // Display descriptor, e.g. "Built-In Screen"
86  optional string name = 2;
87  optional uint32 layer_stack = 3;
88  optional SizeProto size = 4;
89  optional RectProto layer_stack_space_rect = 5;
90  optional TransformProto transform = 6;
91  optional bool is_virtual = 7;
92  optional double dpi_x = 8;
93  optional double dpi_y = 9;
94}
95
96// Must match definition in the IComposerClient HAL
97enum HwcCompositionType {
98  // Invalid composition type
99  HWC_TYPE_UNSPECIFIED = 0;
100  // Layer was composited by the client into the client target buffer
101  HWC_TYPE_CLIENT = 1;
102  // Layer was composited by the device through hardware overlays
103  HWC_TYPE_DEVICE = 2;
104  // Layer was composited by the device using a color
105  HWC_TYPE_SOLID_COLOR = 3;
106  // Similar to DEVICE, but the layer position may have been asynchronously set
107  // through setCursorPosition
108  HWC_TYPE_CURSOR = 4;
109  // Layer was composited by the device via a sideband stream
110  HWC_TYPE_SIDEBAND = 5;
111   // Layer was composited by hardware optimized for display decoration
112  HWC_TYPE_DISPLAY_DECORATION = 6;
113}
114
115// Information about each layer.
116message LayerProto {
117  // unique id per layer.
118  optional int32 id = 1;
119  // unique name per layer.
120  // Example: "Wallpaper".
121  optional string name = 2;
122  // list of children this layer may have. May be empty.
123  repeated int32 children = 3 [packed = true];
124  // list of layers that are z order relative to this layer.
125  repeated int32 relatives = 4 [packed = true];
126  // The type of layer.
127  // Examples: "ContainerLayer", "BufferStateLayer".
128  optional string type = 5;
129  optional RegionProto transparent_region = 6;
130  optional RegionProto visible_region = 7;
131  optional RegionProto damage_region = 8;
132  optional uint32 layer_stack = 9;
133  // The layer's z order. Can be z order in layer stack, relative to parent,
134  // or relative to another layer specified in zOrderRelative.
135  optional int32 z = 10;
136  // The layer's position on the display.
137  optional PositionProto position = 11;
138  // The layer's requested position.
139  optional PositionProto requested_position = 12;
140  // The layer's size.
141  optional SizeProto size = 13;
142  // The layer's crop in its own bounds.
143  optional RectProto crop = 14;
144  // The layer's crop in its parent's bounds.
145  optional RectProto final_crop = 15 [deprecated = true];
146  optional bool is_opaque = 16;
147  optional bool invalidate = 17;
148  // Composition states's dataspace.
149  // Examples: "STANDARD_BT709", "STANDARD_BT601_625".
150  // See full enum in
151  // frameworks/native/libs/nativewindow/include/android/data_space.h
152  optional string dataspace = 18;
153  // Buffer's pixel format
154  // Examples: "PIXEL_FORMAT_TRANSLUCENT", "PIXEL_FORMAT_RGBA_8888".
155  // See full enum in frameworks/native/libs/ui/include/ui/PixelFormat.h
156  optional string pixel_format = 19;
157  // The layer's actual color.
158  optional ColorProto color = 20;
159  // The layer's requested color.
160  optional ColorProto requested_color = 21;
161  // Can be any combination of
162  //    hidden = 0x01
163  //    opaque = 0x02,
164  //    secure = 0x80,
165  optional uint32 flags = 22;
166  // The layer's actual transform
167  optional TransformProto transform = 23;
168  // The layer's requested transform.
169  optional TransformProto requested_transform = 24;
170  // The parent layer. This value can be null if there is no parent.
171  optional int32 parent = 25;
172  // The layer that this layer has a z order relative to. This value can be
173  // null.
174  optional int32 z_order_relative_of = 26;
175  // This value can be null if there's nothing to draw.
176  optional ActiveBufferProto active_buffer = 27;
177  // The number of frames available.
178  optional int32 queued_frames = 28;
179  optional bool refresh_pending = 29;
180  // The layer's composer backend destination frame
181  optional RectProto hwc_frame = 30;
182  // The layer's composer backend source crop
183  optional FloatRectProto hwc_crop = 31;
184  // The layer's composer backend transform
185  optional int32 hwc_transform = 32;
186  optional int32 window_type = 33 [deprecated = true];
187  optional int32 app_id = 34 [deprecated = true];
188  // The layer's composition type
189  optional HwcCompositionType hwc_composition_type = 35;
190  // If it's a buffer layer, indicate if the content is protected
191  optional bool is_protected = 36;
192  // Current frame number being rendered.
193  optional uint64 curr_frame = 37;
194  // A list of barriers that the layer is waiting to update state.
195  repeated BarrierLayerProto barrier_layer = 38;
196  // If active_buffer is not null, record its transform.
197  optional TransformProto buffer_transform = 39;
198  optional int32 effective_scaling_mode = 40;
199  // Layer's corner radius.
200  optional float corner_radius = 41;
201  // Metadata map. May be empty.
202  map<int32, string> metadata = 42;
203
204  optional TransformProto effective_transform = 43;
205  optional FloatRectProto source_bounds = 44;
206  optional FloatRectProto bounds = 45;
207  optional FloatRectProto screen_bounds = 46;
208
209  optional InputWindowInfoProto input_window_info = 47;
210
211  // Crop used to draw the rounded corner.
212  optional FloatRectProto corner_radius_crop = 48;
213
214  // length of the shadow to draw around the layer, it may be set on the
215  // layer or set by a parent layer.
216  optional float shadow_radius = 49;
217  optional ColorTransformProto color_transform = 50;
218
219  optional bool is_relative_of = 51;
220  // Layer's background blur radius in pixels.
221  optional int32 background_blur_radius = 52;
222
223  optional uint32 owner_uid = 53;
224
225  // Regions of a layer, where blur should be applied.
226  repeated BlurRegion blur_regions = 54;
227
228  optional bool is_trusted_overlay = 55;
229
230  // Corner radius explicitly set on layer rather than inherited
231  optional float requested_corner_radius = 56;
232
233  optional RectProto destination_frame = 57;
234
235  optional uint32 original_id = 58;
236
237  optional TrustedOverlay trusted_overlay = 59;
238}
239
240message PositionProto {
241  optional float x = 1;
242  optional float y = 2;
243}
244
245message FloatRectProto {
246  optional float left = 1;
247  optional float top = 2;
248  optional float right = 3;
249  optional float bottom = 4;
250}
251
252message ActiveBufferProto {
253  optional uint32 width = 1;
254  optional uint32 height = 2;
255  optional uint32 stride = 3;
256  optional int32 format = 4;
257  optional uint64 usage = 5;
258}
259
260message BarrierLayerProto {
261  // layer id the barrier is waiting on.
262  optional int32 id = 1;
263  // frame number the barrier is waiting on.
264  optional uint64 frame_number = 2;
265}
266