blob: 9b076bd2822463fb20a97ad40a2729cf24cd3d92 [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 {
Vishnu Nair68dee2b2021-11-08 18:52:12 -080042 int64 elapsed_realtime_nanos = 1;
Vishnu Nair6b591152021-10-08 11:45:14 -070043 int64 vsync_id = 2;
44 repeated TransactionState transactions = 3;
Vishnu Nair0cc69e12021-11-18 09:05:49 -080045 repeated LayerCreationArgs added_layers = 4;
46 repeated int32 removed_layers = 5;
47 repeated DisplayState added_displays = 6;
48 repeated int32 removed_displays = 7;
Vishnu Naird37343b2022-01-12 16:18:56 -080049 repeated int32 removed_layer_handles = 8;
Vishnu Nair68dee2b2021-11-08 18:52:12 -080050}
51
52message LayerCreationArgs {
53 int32 layer_id = 1;
54 string name = 2;
55 uint32 flags = 3;
56 int32 parent_id = 4;
Vishnu Nair84125ac2021-12-02 08:47:48 -080057 int32 mirror_from_id = 5;
Vishnu Nair6b591152021-10-08 11:45:14 -070058}
59
60message TransactionState {
Vishnu Nair68dee2b2021-11-08 18:52:12 -080061 int32 pid = 1;
62 int32 uid = 2;
63 int64 vsync_id = 3;
64 int32 input_event_id = 4;
65 int64 post_time = 5;
Vishnu Naird37343b2022-01-12 16:18:56 -080066 uint64 transaction_id = 6;
67 repeated LayerState layer_changes = 7;
68 repeated DisplayState display_changes = 8;
Vishnu Nair6b591152021-10-08 11:45:14 -070069}
70
71// Keep insync with layer_state_t
72message LayerState {
73 int32 layer_id = 1;
74 // Changes are split into ChangesLsb and ChangesMsb. First 32 bits are in ChangesLsb
75 // and the next 32 bits are in ChangesMsb. This is needed because enums have to be
76 // 32 bits and there's no nice way to put 64bit constants into .proto files.
77 enum ChangesLsb {
78 eChangesLsbNone = 0;
79 ePositionChanged = 0x00000001;
80 eLayerChanged = 0x00000002;
81 eSizeChanged = 0x00000004;
82 eAlphaChanged = 0x00000008;
Vishnu Naird37343b2022-01-12 16:18:56 -080083
Vishnu Nair6b591152021-10-08 11:45:14 -070084 eMatrixChanged = 0x00000010;
85 eTransparentRegionChanged = 0x00000020;
86 eFlagsChanged = 0x00000040;
87 eLayerStackChanged = 0x00000080;
Vishnu Naird37343b2022-01-12 16:18:56 -080088
Vishnu Nair6b591152021-10-08 11:45:14 -070089 eReleaseBufferListenerChanged = 0x00000400;
90 eShadowRadiusChanged = 0x00000800;
Vishnu Naird37343b2022-01-12 16:18:56 -080091
Vishnu Nair6b591152021-10-08 11:45:14 -070092 eLayerCreated = 0x00001000;
93 eBufferCropChanged = 0x00002000;
94 eRelativeLayerChanged = 0x00004000;
95 eReparent = 0x00008000;
Vishnu Naird37343b2022-01-12 16:18:56 -080096
Vishnu Nair6b591152021-10-08 11:45:14 -070097 eColorChanged = 0x00010000;
98 eDestroySurface = 0x00020000;
99 eTransformChanged = 0x00040000;
100 eTransformToDisplayInverseChanged = 0x00080000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800101
Vishnu Nair6b591152021-10-08 11:45:14 -0700102 eCropChanged = 0x00100000;
103 eBufferChanged = 0x00200000;
104 eAcquireFenceChanged = 0x00400000;
105 eDataspaceChanged = 0x00800000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800106
Vishnu Nair6b591152021-10-08 11:45:14 -0700107 eHdrMetadataChanged = 0x01000000;
108 eSurfaceDamageRegionChanged = 0x02000000;
109 eApiChanged = 0x04000000;
110 eSidebandStreamChanged = 0x08000000;
Vishnu Naird37343b2022-01-12 16:18:56 -0800111
Vishnu Nair6b591152021-10-08 11:45:14 -0700112 eColorTransformChanged = 0x10000000;
113 eHasListenerCallbacksChanged = 0x20000000;
114 eInputInfoChanged = 0x40000000;
115 eCornerRadiusChanged = -2147483648; // 0x80000000; (proto stores enums as signed int)
116 };
117 enum ChangesMsb {
118 eChangesMsbNone = 0;
119 eDestinationFrameChanged = 0x1;
120 eCachedBufferChanged = 0x2;
121 eBackgroundColorChanged = 0x4;
122 eMetadataChanged = 0x8;
123 eColorSpaceAgnosticChanged = 0x10;
124 eFrameRateSelectionPriority = 0x20;
125 eFrameRateChanged = 0x40;
126 eBackgroundBlurRadiusChanged = 0x80;
127 eProducerDisconnect = 0x100;
128 eFixedTransformHintChanged = 0x200;
129 eFrameNumberChanged = 0x400;
130 eBlurRegionsChanged = 0x800;
131 eAutoRefreshChanged = 0x1000;
132 eStretchChanged = 0x2000;
133 eTrustedOverlayChanged = 0x4000;
134 eDropInputModeChanged = 0x8000;
135 };
136 uint64 what = 2;
137 float x = 3;
138 float y = 4;
139 int32 z = 5;
140 uint32 w = 6;
141 uint32 h = 7;
142 uint32 layer_stack = 8;
143
144 enum Flags {
145 eFlagsNone = 0;
146 eLayerHidden = 0x01;
147 eLayerOpaque = 0x02;
148 eLayerSkipScreenshot = 0x40;
149 eLayerSecure = 0x80;
150 eEnableBackpressure = 0x100;
Leon Scroggins III55030882022-01-13 14:28:52 -0500151 eLayerIsDisplayDecoration = 0x200;
Vishnu Nair6b591152021-10-08 11:45:14 -0700152 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800153 uint32 flags = 9;
154 uint32 mask = 10;
Vishnu Nair6b591152021-10-08 11:45:14 -0700155
156 message Matrix22 {
157 float dsdx = 1;
158 float dtdx = 2;
159 float dtdy = 3;
160 float dsdy = 4;
161 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800162 Matrix22 matrix = 11;
163 float corner_radius = 12;
164 uint32 background_blur_radius = 13;
165 int32 parent_id = 14;
166 int32 relative_parent_id = 15;
Vishnu Nair6b591152021-10-08 11:45:14 -0700167
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800168 float alpha = 16;
Vishnu Nair6b591152021-10-08 11:45:14 -0700169 message Color3 {
170 float r = 1;
171 float g = 2;
172 float b = 3;
173 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800174 Color3 color = 17;
175 RegionProto transparent_region = 18;
176 uint32 transform = 19;
177 bool transform_to_display_inverse = 20;
178 RectProto crop = 21;
Vishnu Nair6b591152021-10-08 11:45:14 -0700179
180 message BufferData {
181 uint64 buffer_id = 1;
182 uint32 width = 2;
183 uint32 height = 3;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800184 uint64 frame_number = 4;
Vishnu Nair6b591152021-10-08 11:45:14 -0700185
186 enum BufferDataChange {
187 BufferDataChangeNone = 0;
188 fenceChanged = 0x01;
189 frameNumberChanged = 0x02;
190 cachedBufferChanged = 0x04;
191 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800192 uint32 flags = 5;
193 uint64 cached_buffer_id = 6;
Vishnu Naird37343b2022-01-12 16:18:56 -0800194
195 enum PixelFormat {
196 PIXEL_FORMAT_UNKNOWN = 0;
197 PIXEL_FORMAT_CUSTOM = -4;
198 PIXEL_FORMAT_TRANSLUCENT = -3;
199 PIXEL_FORMAT_TRANSPARENT = -2;
200 PIXEL_FORMAT_OPAQUE = -1;
201 PIXEL_FORMAT_RGBA_8888 = 1;
202 PIXEL_FORMAT_RGBX_8888 = 2;
203 PIXEL_FORMAT_RGB_888 = 3;
204 PIXEL_FORMAT_RGB_565 = 4;
205 PIXEL_FORMAT_BGRA_8888 = 5;
206 PIXEL_FORMAT_RGBA_5551 = 6;
207 PIXEL_FORMAT_RGBA_4444 = 7;
208 PIXEL_FORMAT_RGBA_FP16 = 22;
209 PIXEL_FORMAT_RGBA_1010102 = 43;
210 PIXEL_FORMAT_R_8 = 0x38;
211 }
212 PixelFormat pixel_format = 7;
213 uint64 usage = 8;
Vishnu Nair6b591152021-10-08 11:45:14 -0700214 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800215 BufferData buffer_data = 22;
216 int32 api = 23;
217 bool has_sideband_stream = 24;
218 ColorTransformProto color_transform = 25;
219 repeated BlurRegion blur_regions = 26;
Vishnu Nair6b591152021-10-08 11:45:14 -0700220
221 message Transform {
222 float dsdx = 1;
223 float dtdx = 2;
224 float dtdy = 3;
225 float dsdy = 4;
226 float tx = 5;
227 float ty = 6;
228 }
229 message WindowInfo {
230 uint32 layout_params_flags = 1;
231 int32 layout_params_type = 2;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800232 RegionProto touchable_region = 3;
233 int32 surface_inset = 4;
234 bool focusable = 5;
235 bool has_wallpaper = 6;
236 float global_scale_factor = 7;
237 int32 crop_layer_id = 8;
238 bool replace_touchable_region_with_crop = 9;
239 RectProto touchable_region_crop = 10;
240 Transform transform = 11;
Vishnu Nair6b591152021-10-08 11:45:14 -0700241 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800242 WindowInfo window_info_handle = 27;
243 float bg_color_alpha = 28;
244 int32 bg_color_dataspace = 29;
245 bool color_space_agnostic = 30;
246 float shadow_radius = 31;
247 int32 frame_rate_selection_priority = 32;
248 float frame_rate = 33;
249 int32 frame_rate_compatibility = 34;
250 int32 change_frame_rate_strategy = 35;
251 uint32 fixed_transform_hint = 36;
252 uint64 frame_number = 37;
253 bool auto_refresh = 38;
254 bool is_trusted_overlay = 39;
255 RectProto buffer_crop = 40;
256 RectProto destination_frame = 41;
Vishnu Nair6b591152021-10-08 11:45:14 -0700257
258 enum DropInputMode {
259 NONE = 0;
260 ALL = 1;
261 OBSCURED = 2;
262 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800263 DropInputMode drop_input_mode = 42;
Vishnu Nair6b591152021-10-08 11:45:14 -0700264}
265
266message DisplayState {
267 enum Changes {
268 eChangesNone = 0;
269 eSurfaceChanged = 0x01;
270 eLayerStackChanged = 0x02;
271 eDisplayProjectionChanged = 0x04;
272 eDisplaySizeChanged = 0x08;
273 eFlagsChanged = 0x10;
274 };
275 int32 id = 1;
276 uint32 what = 2;
277 uint32 flags = 3;
278 uint32 layer_stack = 4;
279 uint32 orientation = 5;
280 RectProto layer_stack_space_rect = 6;
281 RectProto oriented_display_space_rect = 7;
282 uint32 width = 8;
283 uint32 height = 9;
284}