blob: 2c4eb101e619014c386028d4357076c2285da85c [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;
Vishnu Nair6b591152021-10-08 11:45:14 -0700103}
104
105// Keep insync with layer_state_t
106message LayerState {
Vishnu Nair81750622023-03-08 15:02:06 -0800107 uint32 layer_id = 1;
Vishnu Nair6b591152021-10-08 11:45:14 -0700108 // Changes are split into ChangesLsb and ChangesMsb. First 32 bits are in ChangesLsb
109 // and the next 32 bits are in ChangesMsb. This is needed because enums have to be
110 // 32 bits and there's no nice way to put 64bit constants into .proto files.
111 enum ChangesLsb {
112 eChangesLsbNone = 0;
113 ePositionChanged = 0x00000001;
114 eLayerChanged = 0x00000002;
Vishnu Nairea04b6f2022-08-19 21:28:17 +0000115 // unused = 0x00000004;
Vishnu Nair6b591152021-10-08 11:45:14 -0700116 eAlphaChanged = 0x00000008;
Vishnu Naird37343b2022-01-12 16:18:56 -0800117
Vishnu Nair6b591152021-10-08 11:45:14 -0700118 eMatrixChanged = 0x00000010;
119 eTransparentRegionChanged = 0x00000020;
120 eFlagsChanged = 0x00000040;
121 eLayerStackChanged = 0x00000080;
Vishnu Naird37343b2022-01-12 16:18:56 -0800122
Vishnu Nair6b591152021-10-08 11:45:14 -0700123 eReleaseBufferListenerChanged = 0x00000400;
124 eShadowRadiusChanged = 0x00000800;
Vishnu Naird37343b2022-01-12 16:18:56 -0800125
Vishnu Nair6b591152021-10-08 11:45:14 -0700126 eBufferCropChanged = 0x00002000;
127 eRelativeLayerChanged = 0x00004000;
128 eReparent = 0x00008000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800129
Vishnu Nair6b591152021-10-08 11:45:14 -0700130 eColorChanged = 0x00010000;
Vishnu Nairbbceb462022-10-10 04:52:13 +0000131 eBufferTransformChanged = 0x00040000;
Vishnu Nair6b591152021-10-08 11:45:14 -0700132 eTransformToDisplayInverseChanged = 0x00080000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800133
Vishnu Nair6b591152021-10-08 11:45:14 -0700134 eCropChanged = 0x00100000;
135 eBufferChanged = 0x00200000;
136 eAcquireFenceChanged = 0x00400000;
137 eDataspaceChanged = 0x00800000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800138
Vishnu Nair6b591152021-10-08 11:45:14 -0700139 eHdrMetadataChanged = 0x01000000;
140 eSurfaceDamageRegionChanged = 0x02000000;
141 eApiChanged = 0x04000000;
142 eSidebandStreamChanged = 0x08000000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800143
Vishnu Nair6b591152021-10-08 11:45:14 -0700144 eColorTransformChanged = 0x10000000;
145 eHasListenerCallbacksChanged = 0x20000000;
146 eInputInfoChanged = 0x40000000;
147 eCornerRadiusChanged = -2147483648; // 0x80000000; (proto stores enums as signed int)
148 };
149 enum ChangesMsb {
150 eChangesMsbNone = 0;
151 eDestinationFrameChanged = 0x1;
152 eCachedBufferChanged = 0x2;
153 eBackgroundColorChanged = 0x4;
154 eMetadataChanged = 0x8;
155 eColorSpaceAgnosticChanged = 0x10;
156 eFrameRateSelectionPriority = 0x20;
157 eFrameRateChanged = 0x40;
158 eBackgroundBlurRadiusChanged = 0x80;
159 eProducerDisconnect = 0x100;
160 eFixedTransformHintChanged = 0x200;
161 eFrameNumberChanged = 0x400;
162 eBlurRegionsChanged = 0x800;
163 eAutoRefreshChanged = 0x1000;
164 eStretchChanged = 0x2000;
165 eTrustedOverlayChanged = 0x4000;
166 eDropInputModeChanged = 0x8000;
167 };
168 uint64 what = 2;
169 float x = 3;
170 float y = 4;
171 int32 z = 5;
172 uint32 w = 6;
173 uint32 h = 7;
174 uint32 layer_stack = 8;
175
176 enum Flags {
177 eFlagsNone = 0;
178 eLayerHidden = 0x01;
179 eLayerOpaque = 0x02;
180 eLayerSkipScreenshot = 0x40;
181 eLayerSecure = 0x80;
182 eEnableBackpressure = 0x100;
Leon Scroggins III55030882022-01-13 14:28:52 -0500183 eLayerIsDisplayDecoration = 0x200;
Vishnu Nair6b591152021-10-08 11:45:14 -0700184 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800185 uint32 flags = 9;
186 uint32 mask = 10;
Vishnu Nair6b591152021-10-08 11:45:14 -0700187
188 message Matrix22 {
189 float dsdx = 1;
190 float dtdx = 2;
191 float dtdy = 3;
192 float dsdy = 4;
193 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800194 Matrix22 matrix = 11;
195 float corner_radius = 12;
196 uint32 background_blur_radius = 13;
Vishnu Nair81750622023-03-08 15:02:06 -0800197 uint32 parent_id = 14;
198 uint32 relative_parent_id = 15;
Vishnu Nair6b591152021-10-08 11:45:14 -0700199
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800200 float alpha = 16;
Vishnu Nair6b591152021-10-08 11:45:14 -0700201 message Color3 {
202 float r = 1;
203 float g = 2;
204 float b = 3;
205 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800206 Color3 color = 17;
207 RegionProto transparent_region = 18;
208 uint32 transform = 19;
209 bool transform_to_display_inverse = 20;
210 RectProto crop = 21;
Vishnu Nair6b591152021-10-08 11:45:14 -0700211
212 message BufferData {
213 uint64 buffer_id = 1;
214 uint32 width = 2;
215 uint32 height = 3;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800216 uint64 frame_number = 4;
Vishnu Nair6b591152021-10-08 11:45:14 -0700217
218 enum BufferDataChange {
219 BufferDataChangeNone = 0;
220 fenceChanged = 0x01;
221 frameNumberChanged = 0x02;
222 cachedBufferChanged = 0x04;
223 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800224 uint32 flags = 5;
225 uint64 cached_buffer_id = 6;
Vishnu Naird37343b2022-01-12 16:18:56 -0800226
227 enum PixelFormat {
228 PIXEL_FORMAT_UNKNOWN = 0;
229 PIXEL_FORMAT_CUSTOM = -4;
230 PIXEL_FORMAT_TRANSLUCENT = -3;
231 PIXEL_FORMAT_TRANSPARENT = -2;
232 PIXEL_FORMAT_OPAQUE = -1;
233 PIXEL_FORMAT_RGBA_8888 = 1;
234 PIXEL_FORMAT_RGBX_8888 = 2;
235 PIXEL_FORMAT_RGB_888 = 3;
236 PIXEL_FORMAT_RGB_565 = 4;
237 PIXEL_FORMAT_BGRA_8888 = 5;
238 PIXEL_FORMAT_RGBA_5551 = 6;
239 PIXEL_FORMAT_RGBA_4444 = 7;
240 PIXEL_FORMAT_RGBA_FP16 = 22;
241 PIXEL_FORMAT_RGBA_1010102 = 43;
242 PIXEL_FORMAT_R_8 = 0x38;
243 }
244 PixelFormat pixel_format = 7;
245 uint64 usage = 8;
Vishnu Nair6b591152021-10-08 11:45:14 -0700246 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800247 BufferData buffer_data = 22;
248 int32 api = 23;
249 bool has_sideband_stream = 24;
250 ColorTransformProto color_transform = 25;
251 repeated BlurRegion blur_regions = 26;
Vishnu Nair6b591152021-10-08 11:45:14 -0700252
Vishnu Nair6b591152021-10-08 11:45:14 -0700253 message WindowInfo {
254 uint32 layout_params_flags = 1;
255 int32 layout_params_type = 2;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800256 RegionProto touchable_region = 3;
257 int32 surface_inset = 4;
258 bool focusable = 5;
259 bool has_wallpaper = 6;
260 float global_scale_factor = 7;
Vishnu Nair81750622023-03-08 15:02:06 -0800261 uint32 crop_layer_id = 8;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800262 bool replace_touchable_region_with_crop = 9;
263 RectProto touchable_region_crop = 10;
264 Transform transform = 11;
Vishnu Nair6b591152021-10-08 11:45:14 -0700265 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800266 WindowInfo window_info_handle = 27;
267 float bg_color_alpha = 28;
268 int32 bg_color_dataspace = 29;
269 bool color_space_agnostic = 30;
270 float shadow_radius = 31;
271 int32 frame_rate_selection_priority = 32;
272 float frame_rate = 33;
273 int32 frame_rate_compatibility = 34;
274 int32 change_frame_rate_strategy = 35;
275 uint32 fixed_transform_hint = 36;
276 uint64 frame_number = 37;
277 bool auto_refresh = 38;
278 bool is_trusted_overlay = 39;
279 RectProto buffer_crop = 40;
280 RectProto destination_frame = 41;
Vishnu Nair6b591152021-10-08 11:45:14 -0700281
282 enum DropInputMode {
283 NONE = 0;
284 ALL = 1;
285 OBSCURED = 2;
286 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800287 DropInputMode drop_input_mode = 42;
Vishnu Nair6b591152021-10-08 11:45:14 -0700288}
289
290message DisplayState {
291 enum Changes {
292 eChangesNone = 0;
293 eSurfaceChanged = 0x01;
294 eLayerStackChanged = 0x02;
295 eDisplayProjectionChanged = 0x04;
296 eDisplaySizeChanged = 0x08;
297 eFlagsChanged = 0x10;
298 };
299 int32 id = 1;
300 uint32 what = 2;
301 uint32 flags = 3;
302 uint32 layer_stack = 4;
303 uint32 orientation = 5;
304 RectProto layer_stack_space_rect = 6;
305 RectProto oriented_display_space_rect = 7;
306 uint32 width = 8;
307 uint32 height = 9;
308}