blob: 4c6a9cf85bb1c6c69c7b62ed649358e86bed44f7 [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 Nair6b591152021-10-08 11:45:14 -070043}
44
45message TransactionTraceEntry {
Vishnu Nair68dee2b2021-11-08 18:52:12 -080046 int64 elapsed_realtime_nanos = 1;
Vishnu Nair6b591152021-10-08 11:45:14 -070047 int64 vsync_id = 2;
48 repeated TransactionState transactions = 3;
Vishnu Nair0cc69e12021-11-18 09:05:49 -080049 repeated LayerCreationArgs added_layers = 4;
50 repeated int32 removed_layers = 5;
51 repeated DisplayState added_displays = 6;
52 repeated int32 removed_displays = 7;
Vishnu Naird37343b2022-01-12 16:18:56 -080053 repeated int32 removed_layer_handles = 8;
Vishnu Nair68dee2b2021-11-08 18:52:12 -080054}
55
56message LayerCreationArgs {
57 int32 layer_id = 1;
58 string name = 2;
59 uint32 flags = 3;
60 int32 parent_id = 4;
Vishnu Nair84125ac2021-12-02 08:47:48 -080061 int32 mirror_from_id = 5;
Vishnu Nair6b591152021-10-08 11:45:14 -070062}
63
64message TransactionState {
Vishnu Nair68dee2b2021-11-08 18:52:12 -080065 int32 pid = 1;
66 int32 uid = 2;
67 int64 vsync_id = 3;
68 int32 input_event_id = 4;
69 int64 post_time = 5;
Vishnu Naird37343b2022-01-12 16:18:56 -080070 uint64 transaction_id = 6;
71 repeated LayerState layer_changes = 7;
72 repeated DisplayState display_changes = 8;
Vishnu Nair6b591152021-10-08 11:45:14 -070073}
74
75// Keep insync with layer_state_t
76message LayerState {
Robert Carra63d52a2022-03-03 08:03:37 -080077 int64 layer_id = 1;
Vishnu Nair6b591152021-10-08 11:45:14 -070078 // Changes are split into ChangesLsb and ChangesMsb. First 32 bits are in ChangesLsb
79 // and the next 32 bits are in ChangesMsb. This is needed because enums have to be
80 // 32 bits and there's no nice way to put 64bit constants into .proto files.
81 enum ChangesLsb {
82 eChangesLsbNone = 0;
83 ePositionChanged = 0x00000001;
84 eLayerChanged = 0x00000002;
Vishnu Nairea04b6f2022-08-19 21:28:17 +000085 // unused = 0x00000004;
Vishnu Nair6b591152021-10-08 11:45:14 -070086 eAlphaChanged = 0x00000008;
Vishnu Naird37343b2022-01-12 16:18:56 -080087
Vishnu Nair6b591152021-10-08 11:45:14 -070088 eMatrixChanged = 0x00000010;
89 eTransparentRegionChanged = 0x00000020;
90 eFlagsChanged = 0x00000040;
91 eLayerStackChanged = 0x00000080;
Vishnu Naird37343b2022-01-12 16:18:56 -080092
Vishnu Nair6b591152021-10-08 11:45:14 -070093 eReleaseBufferListenerChanged = 0x00000400;
94 eShadowRadiusChanged = 0x00000800;
Vishnu Naird37343b2022-01-12 16:18:56 -080095
Vishnu Nair6b591152021-10-08 11:45:14 -070096 eBufferCropChanged = 0x00002000;
97 eRelativeLayerChanged = 0x00004000;
98 eReparent = 0x00008000;
Vishnu Naird37343b2022-01-12 16:18:56 -080099
Vishnu Nair6b591152021-10-08 11:45:14 -0700100 eColorChanged = 0x00010000;
Vishnu Nairbbceb462022-10-10 04:52:13 +0000101 eBufferTransformChanged = 0x00040000;
Vishnu Nair6b591152021-10-08 11:45:14 -0700102 eTransformToDisplayInverseChanged = 0x00080000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800103
Vishnu Nair6b591152021-10-08 11:45:14 -0700104 eCropChanged = 0x00100000;
105 eBufferChanged = 0x00200000;
106 eAcquireFenceChanged = 0x00400000;
107 eDataspaceChanged = 0x00800000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800108
Vishnu Nair6b591152021-10-08 11:45:14 -0700109 eHdrMetadataChanged = 0x01000000;
110 eSurfaceDamageRegionChanged = 0x02000000;
111 eApiChanged = 0x04000000;
112 eSidebandStreamChanged = 0x08000000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800113
Vishnu Nair6b591152021-10-08 11:45:14 -0700114 eColorTransformChanged = 0x10000000;
115 eHasListenerCallbacksChanged = 0x20000000;
116 eInputInfoChanged = 0x40000000;
117 eCornerRadiusChanged = -2147483648; // 0x80000000; (proto stores enums as signed int)
118 };
119 enum ChangesMsb {
120 eChangesMsbNone = 0;
121 eDestinationFrameChanged = 0x1;
122 eCachedBufferChanged = 0x2;
123 eBackgroundColorChanged = 0x4;
124 eMetadataChanged = 0x8;
125 eColorSpaceAgnosticChanged = 0x10;
126 eFrameRateSelectionPriority = 0x20;
127 eFrameRateChanged = 0x40;
128 eBackgroundBlurRadiusChanged = 0x80;
129 eProducerDisconnect = 0x100;
130 eFixedTransformHintChanged = 0x200;
131 eFrameNumberChanged = 0x400;
132 eBlurRegionsChanged = 0x800;
133 eAutoRefreshChanged = 0x1000;
134 eStretchChanged = 0x2000;
135 eTrustedOverlayChanged = 0x4000;
136 eDropInputModeChanged = 0x8000;
137 };
138 uint64 what = 2;
139 float x = 3;
140 float y = 4;
141 int32 z = 5;
142 uint32 w = 6;
143 uint32 h = 7;
144 uint32 layer_stack = 8;
145
146 enum Flags {
147 eFlagsNone = 0;
148 eLayerHidden = 0x01;
149 eLayerOpaque = 0x02;
150 eLayerSkipScreenshot = 0x40;
151 eLayerSecure = 0x80;
152 eEnableBackpressure = 0x100;
Leon Scroggins III55030882022-01-13 14:28:52 -0500153 eLayerIsDisplayDecoration = 0x200;
Vishnu Nair6b591152021-10-08 11:45:14 -0700154 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800155 uint32 flags = 9;
156 uint32 mask = 10;
Vishnu Nair6b591152021-10-08 11:45:14 -0700157
158 message Matrix22 {
159 float dsdx = 1;
160 float dtdx = 2;
161 float dtdy = 3;
162 float dsdy = 4;
163 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800164 Matrix22 matrix = 11;
165 float corner_radius = 12;
166 uint32 background_blur_radius = 13;
Robert Carra63d52a2022-03-03 08:03:37 -0800167 int64 parent_id = 14;
168 int64 relative_parent_id = 15;
Vishnu Nair6b591152021-10-08 11:45:14 -0700169
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800170 float alpha = 16;
Vishnu Nair6b591152021-10-08 11:45:14 -0700171 message Color3 {
172 float r = 1;
173 float g = 2;
174 float b = 3;
175 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800176 Color3 color = 17;
177 RegionProto transparent_region = 18;
178 uint32 transform = 19;
179 bool transform_to_display_inverse = 20;
180 RectProto crop = 21;
Vishnu Nair6b591152021-10-08 11:45:14 -0700181
182 message BufferData {
183 uint64 buffer_id = 1;
184 uint32 width = 2;
185 uint32 height = 3;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800186 uint64 frame_number = 4;
Vishnu Nair6b591152021-10-08 11:45:14 -0700187
188 enum BufferDataChange {
189 BufferDataChangeNone = 0;
190 fenceChanged = 0x01;
191 frameNumberChanged = 0x02;
192 cachedBufferChanged = 0x04;
193 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800194 uint32 flags = 5;
195 uint64 cached_buffer_id = 6;
Vishnu Naird37343b2022-01-12 16:18:56 -0800196
197 enum PixelFormat {
198 PIXEL_FORMAT_UNKNOWN = 0;
199 PIXEL_FORMAT_CUSTOM = -4;
200 PIXEL_FORMAT_TRANSLUCENT = -3;
201 PIXEL_FORMAT_TRANSPARENT = -2;
202 PIXEL_FORMAT_OPAQUE = -1;
203 PIXEL_FORMAT_RGBA_8888 = 1;
204 PIXEL_FORMAT_RGBX_8888 = 2;
205 PIXEL_FORMAT_RGB_888 = 3;
206 PIXEL_FORMAT_RGB_565 = 4;
207 PIXEL_FORMAT_BGRA_8888 = 5;
208 PIXEL_FORMAT_RGBA_5551 = 6;
209 PIXEL_FORMAT_RGBA_4444 = 7;
210 PIXEL_FORMAT_RGBA_FP16 = 22;
211 PIXEL_FORMAT_RGBA_1010102 = 43;
212 PIXEL_FORMAT_R_8 = 0x38;
213 }
214 PixelFormat pixel_format = 7;
215 uint64 usage = 8;
Vishnu Nair6b591152021-10-08 11:45:14 -0700216 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800217 BufferData buffer_data = 22;
218 int32 api = 23;
219 bool has_sideband_stream = 24;
220 ColorTransformProto color_transform = 25;
221 repeated BlurRegion blur_regions = 26;
Vishnu Nair6b591152021-10-08 11:45:14 -0700222
223 message Transform {
224 float dsdx = 1;
225 float dtdx = 2;
226 float dtdy = 3;
227 float dsdy = 4;
228 float tx = 5;
229 float ty = 6;
230 }
231 message WindowInfo {
232 uint32 layout_params_flags = 1;
233 int32 layout_params_type = 2;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800234 RegionProto touchable_region = 3;
235 int32 surface_inset = 4;
236 bool focusable = 5;
237 bool has_wallpaper = 6;
238 float global_scale_factor = 7;
Robert Carra63d52a2022-03-03 08:03:37 -0800239 int64 crop_layer_id = 8;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800240 bool replace_touchable_region_with_crop = 9;
241 RectProto touchable_region_crop = 10;
242 Transform transform = 11;
Vishnu Nair6b591152021-10-08 11:45:14 -0700243 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800244 WindowInfo window_info_handle = 27;
245 float bg_color_alpha = 28;
246 int32 bg_color_dataspace = 29;
247 bool color_space_agnostic = 30;
248 float shadow_radius = 31;
249 int32 frame_rate_selection_priority = 32;
250 float frame_rate = 33;
251 int32 frame_rate_compatibility = 34;
252 int32 change_frame_rate_strategy = 35;
253 uint32 fixed_transform_hint = 36;
254 uint64 frame_number = 37;
255 bool auto_refresh = 38;
256 bool is_trusted_overlay = 39;
257 RectProto buffer_crop = 40;
258 RectProto destination_frame = 41;
Vishnu Nair6b591152021-10-08 11:45:14 -0700259
260 enum DropInputMode {
261 NONE = 0;
262 ALL = 1;
263 OBSCURED = 2;
264 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800265 DropInputMode drop_input_mode = 42;
Vishnu Nair6b591152021-10-08 11:45:14 -0700266}
267
268message DisplayState {
269 enum Changes {
270 eChangesNone = 0;
271 eSurfaceChanged = 0x01;
272 eLayerStackChanged = 0x02;
273 eDisplayProjectionChanged = 0x04;
274 eDisplaySizeChanged = 0x08;
275 eFlagsChanged = 0x10;
276 };
277 int32 id = 1;
278 uint32 what = 2;
279 uint32 flags = 3;
280 uint32 layer_stack = 4;
281 uint32 orientation = 5;
282 RectProto layer_stack_space_rect = 6;
283 RectProto oriented_display_space_rect = 7;
284 uint32 width = 8;
285 uint32 height = 9;
286}