blob: e7fb1806be052152812a4827b5e8796e9dc7782c [file] [log] [blame]
Vishnu Nair6b591152021-10-08 11:45:14 -07001/*
2 * Copyright (C) 2021 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 = "proto3";
18option optimize_for = LITE_RUNTIME;
19
20import "frameworks/native/services/surfaceflinger/layerproto/common.proto";
21
22package android.surfaceflinger.proto;
23
24/* Represents a file full of surface flinger transactions.
25 Encoded, it should start with 0x54 0x4E 0x58 0x54 0x52 0x41 0x43 0x45 (.TNXTRACE), such
26 that they can be easily identified. */
27message TransactionTraceFile {
28 /* constant; MAGIC_NUMBER = (long) MAGIC_NUMBER_H << 32 | MagicNumber.MAGIC_NUMBER_L
29 (this is needed because enums have to be 32 bits and there's no nice way to put 64bit
30 constants into .proto files. */
31 enum MagicNumber {
32 INVALID = 0;
33 MAGIC_NUMBER_L = 0x54584E54; /* TNXT (little-endian ASCII) */
34 MAGIC_NUMBER_H = 0x45434152; /* RACE (little-endian ASCII) */
35 }
36
37 fixed64 magic_number = 1; /* Must be the first field, set to value in MagicNumber */
38 repeated TransactionTraceEntry entry = 2;
39}
40
41message TransactionTraceEntry {
42 int64 elapsed_time = 1;
43 int64 vsync_id = 2;
44 repeated TransactionState transactions = 3;
45}
46
47message TransactionState {
48 string tag = 2;
49 int32 pid = 3;
50 int32 uid = 4;
51 int64 vsync_id = 5;
52 int32 input_event_id = 6;
53 int64 post_time = 7;
54 repeated LayerState layer_changes = 9;
55 repeated DisplayState new_displays = 10;
56 repeated DisplayState display_changes = 11;
57}
58
59// Keep insync with layer_state_t
60message LayerState {
61 int32 layer_id = 1;
62 // Changes are split into ChangesLsb and ChangesMsb. First 32 bits are in ChangesLsb
63 // and the next 32 bits are in ChangesMsb. This is needed because enums have to be
64 // 32 bits and there's no nice way to put 64bit constants into .proto files.
65 enum ChangesLsb {
66 eChangesLsbNone = 0;
67 ePositionChanged = 0x00000001;
68 eLayerChanged = 0x00000002;
69 eSizeChanged = 0x00000004;
70 eAlphaChanged = 0x00000008;
71 eMatrixChanged = 0x00000010;
72 eTransparentRegionChanged = 0x00000020;
73 eFlagsChanged = 0x00000040;
74 eLayerStackChanged = 0x00000080;
75 eReleaseBufferListenerChanged = 0x00000400;
76 eShadowRadiusChanged = 0x00000800;
77 eLayerCreated = 0x00001000;
78 eBufferCropChanged = 0x00002000;
79 eRelativeLayerChanged = 0x00004000;
80 eReparent = 0x00008000;
81 eColorChanged = 0x00010000;
82 eDestroySurface = 0x00020000;
83 eTransformChanged = 0x00040000;
84 eTransformToDisplayInverseChanged = 0x00080000;
85 eCropChanged = 0x00100000;
86 eBufferChanged = 0x00200000;
87 eAcquireFenceChanged = 0x00400000;
88 eDataspaceChanged = 0x00800000;
89 eHdrMetadataChanged = 0x01000000;
90 eSurfaceDamageRegionChanged = 0x02000000;
91 eApiChanged = 0x04000000;
92 eSidebandStreamChanged = 0x08000000;
93 eColorTransformChanged = 0x10000000;
94 eHasListenerCallbacksChanged = 0x20000000;
95 eInputInfoChanged = 0x40000000;
96 eCornerRadiusChanged = -2147483648; // 0x80000000; (proto stores enums as signed int)
97 };
98 enum ChangesMsb {
99 eChangesMsbNone = 0;
100 eDestinationFrameChanged = 0x1;
101 eCachedBufferChanged = 0x2;
102 eBackgroundColorChanged = 0x4;
103 eMetadataChanged = 0x8;
104 eColorSpaceAgnosticChanged = 0x10;
105 eFrameRateSelectionPriority = 0x20;
106 eFrameRateChanged = 0x40;
107 eBackgroundBlurRadiusChanged = 0x80;
108 eProducerDisconnect = 0x100;
109 eFixedTransformHintChanged = 0x200;
110 eFrameNumberChanged = 0x400;
111 eBlurRegionsChanged = 0x800;
112 eAutoRefreshChanged = 0x1000;
113 eStretchChanged = 0x2000;
114 eTrustedOverlayChanged = 0x4000;
115 eDropInputModeChanged = 0x8000;
116 };
117 uint64 what = 2;
118 float x = 3;
119 float y = 4;
120 int32 z = 5;
121 uint32 w = 6;
122 uint32 h = 7;
123 uint32 layer_stack = 8;
124
125 enum Flags {
126 eFlagsNone = 0;
127 eLayerHidden = 0x01;
128 eLayerOpaque = 0x02;
129 eLayerSkipScreenshot = 0x40;
130 eLayerSecure = 0x80;
131 eEnableBackpressure = 0x100;
132 };
133 uint32 flags = 10;
134 uint32 mask = 11;
135
136 message Matrix22 {
137 float dsdx = 1;
138 float dtdx = 2;
139 float dtdy = 3;
140 float dsdy = 4;
141 };
142 Matrix22 matrix = 12;
143 float corner_radius = 13;
144 uint32 background_blur_radius = 14;
145 int32 parent_id = 15;
146 int32 relative_parent_id = 16;
147
148 float alpha = 50;
149 message Color3 {
150 float r = 1;
151 float g = 2;
152 float b = 3;
153 }
154 Color3 color = 18;
155 RegionProto transparent_region = 19;
156 uint32 transform = 20;
157 bool transform_to_display_inverse = 21;
158 RectProto crop = 49;
159
160 message BufferData {
161 uint64 buffer_id = 1;
162 uint32 width = 2;
163 uint32 height = 3;
164 uint64 frame_number = 5;
165
166 enum BufferDataChange {
167 BufferDataChangeNone = 0;
168 fenceChanged = 0x01;
169 frameNumberChanged = 0x02;
170 cachedBufferChanged = 0x04;
171 }
172 uint32 flags = 6;
173 uint64 cached_buffer_id = 7;
174 }
175 BufferData buffer_data = 23;
176 int32 api = 24;
177 bool has_sideband_stream = 25;
178 ColorTransformProto color_transform = 26;
179 repeated BlurRegion blur_regions = 27;
180
181 message Transform {
182 float dsdx = 1;
183 float dtdx = 2;
184 float dtdy = 3;
185 float dsdy = 4;
186 float tx = 5;
187 float ty = 6;
188 }
189 message WindowInfo {
190 uint32 layout_params_flags = 1;
191 int32 layout_params_type = 2;
192 RegionProto touchable_region = 4;
193 int32 surface_inset = 5;
194 bool focusable = 8;
195 bool has_wallpaper = 9;
196 float global_scale_factor = 10;
197 int32 crop_layer_id = 13;
198 bool replace_touchable_region_with_crop = 14;
199 RectProto touchable_region_crop = 15;
200 Transform transform = 16;
201 }
202 WindowInfo window_info_handle = 28;
203 float bg_color_alpha = 31;
204 int32 bg_color_dataspace = 32;
205 bool color_space_agnostic = 33;
206 float shadow_radius = 34;
207 int32 frame_rate_selection_priority = 35;
208 float frame_rate = 36;
209 int32 frame_rate_compatibility = 37;
210 int32 change_frame_rate_strategy = 38;
211 uint32 fixed_transform_hint = 39;
212 uint64 frame_number = 40;
213 bool auto_refresh = 41;
214 bool is_trusted_overlay = 42;
215 RectProto buffer_crop = 44;
216 RectProto destination_frame = 45;
217
218 enum DropInputMode {
219 NONE = 0;
220 ALL = 1;
221 OBSCURED = 2;
222 };
223 DropInputMode drop_input_mode = 48;
224}
225
226message DisplayState {
227 enum Changes {
228 eChangesNone = 0;
229 eSurfaceChanged = 0x01;
230 eLayerStackChanged = 0x02;
231 eDisplayProjectionChanged = 0x04;
232 eDisplaySizeChanged = 0x08;
233 eFlagsChanged = 0x10;
234 };
235 int32 id = 1;
236 uint32 what = 2;
237 uint32 flags = 3;
238 uint32 layer_stack = 4;
239 uint32 orientation = 5;
240 RectProto layer_stack_space_rect = 6;
241 RectProto oriented_display_space_rect = 7;
242 uint32 width = 8;
243 uint32 height = 9;
244}