blob: b0cee9b39817bf8c6b0dadcc562b9f87b595d5c4 [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;
Kean Mariottic44fdaf2022-07-29 14:20:39 +000039
40 /* offset between real-time clock and elapsed time clock in nanoseconds.
41 Calculated as: systemTime(SYSTEM_TIME_REALTIME) - systemTime(SYSTEM_TIME_MONOTONIC) */
42 fixed64 real_to_elapsed_time_offset_nanos = 3;
Vishnu Nair81750622023-03-08 15:02:06 -080043 uint32 version = 4;
Vishnu Nair6b591152021-10-08 11:45:14 -070044}
45
46message TransactionTraceEntry {
Vishnu Nair68dee2b2021-11-08 18:52:12 -080047 int64 elapsed_realtime_nanos = 1;
Vishnu Nair6b591152021-10-08 11:45:14 -070048 int64 vsync_id = 2;
49 repeated TransactionState transactions = 3;
Vishnu Nair0cc69e12021-11-18 09:05:49 -080050 repeated LayerCreationArgs added_layers = 4;
Vishnu Nair81750622023-03-08 15:02:06 -080051 repeated uint32 destroyed_layers = 5;
Vishnu Nair0cc69e12021-11-18 09:05:49 -080052 repeated DisplayState added_displays = 6;
53 repeated int32 removed_displays = 7;
Vishnu Nair81750622023-03-08 15:02:06 -080054 repeated uint32 destroyed_layer_handles = 8;
55 bool displays_changed = 9;
56 repeated DisplayInfo displays = 10;
57}
58
59message DisplayInfo {
60 uint32 layer_stack = 1;
61 int32 display_id = 2;
62 int32 logical_width = 3;
63 int32 logical_height = 4;
64 Transform transform_inverse = 5;
65 Transform transform = 6;
66 bool receives_input = 7;
67 bool is_secure = 8;
68 bool is_primary = 9;
69 bool is_virtual = 10;
70 int32 rotation_flags = 11;
71 int32 transform_hint = 12;
72
Vishnu Nair68dee2b2021-11-08 18:52:12 -080073}
74
75message LayerCreationArgs {
Vishnu Nair81750622023-03-08 15:02:06 -080076 uint32 layer_id = 1;
Vishnu Nair68dee2b2021-11-08 18:52:12 -080077 string name = 2;
78 uint32 flags = 3;
Vishnu Nair81750622023-03-08 15:02:06 -080079 uint32 parent_id = 4;
80 uint32 mirror_from_id = 5;
81 bool add_to_root = 6;
82 uint32 layer_stack_to_mirror = 7;
83}
84
85message Transform {
86 float dsdx = 1;
87 float dtdx = 2;
88 float dtdy = 3;
89 float dsdy = 4;
90 float tx = 5;
91 float ty = 6;
Vishnu Nair6b591152021-10-08 11:45:14 -070092}
93
94message TransactionState {
Vishnu Nair68dee2b2021-11-08 18:52:12 -080095 int32 pid = 1;
96 int32 uid = 2;
97 int64 vsync_id = 3;
98 int32 input_event_id = 4;
99 int64 post_time = 5;
Vishnu Naird37343b2022-01-12 16:18:56 -0800100 uint64 transaction_id = 6;
101 repeated LayerState layer_changes = 7;
102 repeated DisplayState display_changes = 8;
Pablo Gamito23780be2023-04-18 08:30:00 +0000103 repeated uint64 merged_transaction_ids = 9;
Vishnu Nair6b591152021-10-08 11:45:14 -0700104}
105
106// Keep insync with layer_state_t
107message LayerState {
Vishnu Nair81750622023-03-08 15:02:06 -0800108 uint32 layer_id = 1;
Vishnu Nair6b591152021-10-08 11:45:14 -0700109 // Changes are split into ChangesLsb and ChangesMsb. First 32 bits are in ChangesLsb
110 // and the next 32 bits are in ChangesMsb. This is needed because enums have to be
111 // 32 bits and there's no nice way to put 64bit constants into .proto files.
112 enum ChangesLsb {
113 eChangesLsbNone = 0;
114 ePositionChanged = 0x00000001;
115 eLayerChanged = 0x00000002;
Vishnu Nairea04b6f2022-08-19 21:28:17 +0000116 // unused = 0x00000004;
Vishnu Nair6b591152021-10-08 11:45:14 -0700117 eAlphaChanged = 0x00000008;
Vishnu Naird37343b2022-01-12 16:18:56 -0800118
Vishnu Nair6b591152021-10-08 11:45:14 -0700119 eMatrixChanged = 0x00000010;
120 eTransparentRegionChanged = 0x00000020;
121 eFlagsChanged = 0x00000040;
122 eLayerStackChanged = 0x00000080;
Vishnu Naird37343b2022-01-12 16:18:56 -0800123
Vishnu Nair6b591152021-10-08 11:45:14 -0700124 eReleaseBufferListenerChanged = 0x00000400;
125 eShadowRadiusChanged = 0x00000800;
Vishnu Naird37343b2022-01-12 16:18:56 -0800126
Vishnu Nair6b591152021-10-08 11:45:14 -0700127 eBufferCropChanged = 0x00002000;
128 eRelativeLayerChanged = 0x00004000;
129 eReparent = 0x00008000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800130
Vishnu Nair6b591152021-10-08 11:45:14 -0700131 eColorChanged = 0x00010000;
Vishnu Nairbbceb462022-10-10 04:52:13 +0000132 eBufferTransformChanged = 0x00040000;
Vishnu Nair6b591152021-10-08 11:45:14 -0700133 eTransformToDisplayInverseChanged = 0x00080000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800134
Vishnu Nair6b591152021-10-08 11:45:14 -0700135 eCropChanged = 0x00100000;
136 eBufferChanged = 0x00200000;
137 eAcquireFenceChanged = 0x00400000;
138 eDataspaceChanged = 0x00800000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800139
Vishnu Nair6b591152021-10-08 11:45:14 -0700140 eHdrMetadataChanged = 0x01000000;
141 eSurfaceDamageRegionChanged = 0x02000000;
142 eApiChanged = 0x04000000;
143 eSidebandStreamChanged = 0x08000000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800144
Vishnu Nair6b591152021-10-08 11:45:14 -0700145 eColorTransformChanged = 0x10000000;
146 eHasListenerCallbacksChanged = 0x20000000;
147 eInputInfoChanged = 0x40000000;
148 eCornerRadiusChanged = -2147483648; // 0x80000000; (proto stores enums as signed int)
149 };
150 enum ChangesMsb {
151 eChangesMsbNone = 0;
152 eDestinationFrameChanged = 0x1;
153 eCachedBufferChanged = 0x2;
154 eBackgroundColorChanged = 0x4;
155 eMetadataChanged = 0x8;
156 eColorSpaceAgnosticChanged = 0x10;
157 eFrameRateSelectionPriority = 0x20;
158 eFrameRateChanged = 0x40;
159 eBackgroundBlurRadiusChanged = 0x80;
160 eProducerDisconnect = 0x100;
161 eFixedTransformHintChanged = 0x200;
162 eFrameNumberChanged = 0x400;
163 eBlurRegionsChanged = 0x800;
164 eAutoRefreshChanged = 0x1000;
165 eStretchChanged = 0x2000;
166 eTrustedOverlayChanged = 0x4000;
167 eDropInputModeChanged = 0x8000;
168 };
169 uint64 what = 2;
170 float x = 3;
171 float y = 4;
172 int32 z = 5;
173 uint32 w = 6;
174 uint32 h = 7;
175 uint32 layer_stack = 8;
176
177 enum Flags {
178 eFlagsNone = 0;
179 eLayerHidden = 0x01;
180 eLayerOpaque = 0x02;
181 eLayerSkipScreenshot = 0x40;
182 eLayerSecure = 0x80;
183 eEnableBackpressure = 0x100;
Leon Scroggins III55030882022-01-13 14:28:52 -0500184 eLayerIsDisplayDecoration = 0x200;
Vishnu Nair6b591152021-10-08 11:45:14 -0700185 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800186 uint32 flags = 9;
187 uint32 mask = 10;
Vishnu Nair6b591152021-10-08 11:45:14 -0700188
189 message Matrix22 {
190 float dsdx = 1;
191 float dtdx = 2;
192 float dtdy = 3;
193 float dsdy = 4;
194 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800195 Matrix22 matrix = 11;
196 float corner_radius = 12;
197 uint32 background_blur_radius = 13;
Vishnu Nair81750622023-03-08 15:02:06 -0800198 uint32 parent_id = 14;
199 uint32 relative_parent_id = 15;
Vishnu Nair6b591152021-10-08 11:45:14 -0700200
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800201 float alpha = 16;
Vishnu Nair6b591152021-10-08 11:45:14 -0700202 message Color3 {
203 float r = 1;
204 float g = 2;
205 float b = 3;
206 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800207 Color3 color = 17;
208 RegionProto transparent_region = 18;
209 uint32 transform = 19;
210 bool transform_to_display_inverse = 20;
211 RectProto crop = 21;
Vishnu Nair6b591152021-10-08 11:45:14 -0700212
213 message BufferData {
214 uint64 buffer_id = 1;
215 uint32 width = 2;
216 uint32 height = 3;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800217 uint64 frame_number = 4;
Vishnu Nair6b591152021-10-08 11:45:14 -0700218
219 enum BufferDataChange {
220 BufferDataChangeNone = 0;
221 fenceChanged = 0x01;
222 frameNumberChanged = 0x02;
223 cachedBufferChanged = 0x04;
224 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800225 uint32 flags = 5;
226 uint64 cached_buffer_id = 6;
Vishnu Naird37343b2022-01-12 16:18:56 -0800227
228 enum PixelFormat {
229 PIXEL_FORMAT_UNKNOWN = 0;
230 PIXEL_FORMAT_CUSTOM = -4;
231 PIXEL_FORMAT_TRANSLUCENT = -3;
232 PIXEL_FORMAT_TRANSPARENT = -2;
233 PIXEL_FORMAT_OPAQUE = -1;
234 PIXEL_FORMAT_RGBA_8888 = 1;
235 PIXEL_FORMAT_RGBX_8888 = 2;
236 PIXEL_FORMAT_RGB_888 = 3;
237 PIXEL_FORMAT_RGB_565 = 4;
238 PIXEL_FORMAT_BGRA_8888 = 5;
239 PIXEL_FORMAT_RGBA_5551 = 6;
240 PIXEL_FORMAT_RGBA_4444 = 7;
241 PIXEL_FORMAT_RGBA_FP16 = 22;
242 PIXEL_FORMAT_RGBA_1010102 = 43;
243 PIXEL_FORMAT_R_8 = 0x38;
244 }
245 PixelFormat pixel_format = 7;
246 uint64 usage = 8;
Vishnu Nair6b591152021-10-08 11:45:14 -0700247 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800248 BufferData buffer_data = 22;
249 int32 api = 23;
250 bool has_sideband_stream = 24;
251 ColorTransformProto color_transform = 25;
252 repeated BlurRegion blur_regions = 26;
Vishnu Nair6b591152021-10-08 11:45:14 -0700253
Vishnu Nair6b591152021-10-08 11:45:14 -0700254 message WindowInfo {
255 uint32 layout_params_flags = 1;
256 int32 layout_params_type = 2;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800257 RegionProto touchable_region = 3;
258 int32 surface_inset = 4;
259 bool focusable = 5;
260 bool has_wallpaper = 6;
261 float global_scale_factor = 7;
Vishnu Nair81750622023-03-08 15:02:06 -0800262 uint32 crop_layer_id = 8;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800263 bool replace_touchable_region_with_crop = 9;
264 RectProto touchable_region_crop = 10;
265 Transform transform = 11;
Vishnu Nair6b591152021-10-08 11:45:14 -0700266 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800267 WindowInfo window_info_handle = 27;
268 float bg_color_alpha = 28;
269 int32 bg_color_dataspace = 29;
270 bool color_space_agnostic = 30;
271 float shadow_radius = 31;
272 int32 frame_rate_selection_priority = 32;
273 float frame_rate = 33;
274 int32 frame_rate_compatibility = 34;
275 int32 change_frame_rate_strategy = 35;
276 uint32 fixed_transform_hint = 36;
277 uint64 frame_number = 37;
278 bool auto_refresh = 38;
279 bool is_trusted_overlay = 39;
280 RectProto buffer_crop = 40;
281 RectProto destination_frame = 41;
Vishnu Nair6b591152021-10-08 11:45:14 -0700282
283 enum DropInputMode {
284 NONE = 0;
285 ALL = 1;
286 OBSCURED = 2;
287 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800288 DropInputMode drop_input_mode = 42;
Vishnu Nair6b591152021-10-08 11:45:14 -0700289}
290
291message DisplayState {
292 enum Changes {
293 eChangesNone = 0;
294 eSurfaceChanged = 0x01;
295 eLayerStackChanged = 0x02;
296 eDisplayProjectionChanged = 0x04;
297 eDisplaySizeChanged = 0x08;
298 eFlagsChanged = 0x10;
299 };
300 int32 id = 1;
301 uint32 what = 2;
302 uint32 flags = 3;
303 uint32 layer_stack = 4;
304 uint32 orientation = 5;
305 RectProto layer_stack_space_rect = 6;
306 RectProto oriented_display_space_rect = 7;
307 uint32 width = 8;
308 uint32 height = 9;
309}