blob: e31b502efca8bc1528366bfee07eac776c801ede [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 Nair68dee2b2021-11-08 18:52:12 -080049}
50
51message LayerCreationArgs {
52 int32 layer_id = 1;
53 string name = 2;
54 uint32 flags = 3;
55 int32 parent_id = 4;
Vishnu Nair84125ac2021-12-02 08:47:48 -080056 int32 mirror_from_id = 5;
Vishnu Nair6b591152021-10-08 11:45:14 -070057}
58
59message TransactionState {
Vishnu Nair68dee2b2021-11-08 18:52:12 -080060 int32 pid = 1;
61 int32 uid = 2;
62 int64 vsync_id = 3;
63 int32 input_event_id = 4;
64 int64 post_time = 5;
65 repeated LayerState layer_changes = 6;
66 repeated DisplayState display_changes = 7;
Vishnu Nair6b591152021-10-08 11:45:14 -070067}
68
69// Keep insync with layer_state_t
70message LayerState {
71 int32 layer_id = 1;
72 // Changes are split into ChangesLsb and ChangesMsb. First 32 bits are in ChangesLsb
73 // and the next 32 bits are in ChangesMsb. This is needed because enums have to be
74 // 32 bits and there's no nice way to put 64bit constants into .proto files.
75 enum ChangesLsb {
76 eChangesLsbNone = 0;
77 ePositionChanged = 0x00000001;
78 eLayerChanged = 0x00000002;
79 eSizeChanged = 0x00000004;
80 eAlphaChanged = 0x00000008;
81 eMatrixChanged = 0x00000010;
82 eTransparentRegionChanged = 0x00000020;
83 eFlagsChanged = 0x00000040;
84 eLayerStackChanged = 0x00000080;
85 eReleaseBufferListenerChanged = 0x00000400;
86 eShadowRadiusChanged = 0x00000800;
87 eLayerCreated = 0x00001000;
88 eBufferCropChanged = 0x00002000;
89 eRelativeLayerChanged = 0x00004000;
90 eReparent = 0x00008000;
91 eColorChanged = 0x00010000;
92 eDestroySurface = 0x00020000;
93 eTransformChanged = 0x00040000;
94 eTransformToDisplayInverseChanged = 0x00080000;
95 eCropChanged = 0x00100000;
96 eBufferChanged = 0x00200000;
97 eAcquireFenceChanged = 0x00400000;
98 eDataspaceChanged = 0x00800000;
99 eHdrMetadataChanged = 0x01000000;
100 eSurfaceDamageRegionChanged = 0x02000000;
101 eApiChanged = 0x04000000;
102 eSidebandStreamChanged = 0x08000000;
103 eColorTransformChanged = 0x10000000;
104 eHasListenerCallbacksChanged = 0x20000000;
105 eInputInfoChanged = 0x40000000;
106 eCornerRadiusChanged = -2147483648; // 0x80000000; (proto stores enums as signed int)
107 };
108 enum ChangesMsb {
109 eChangesMsbNone = 0;
110 eDestinationFrameChanged = 0x1;
111 eCachedBufferChanged = 0x2;
112 eBackgroundColorChanged = 0x4;
113 eMetadataChanged = 0x8;
114 eColorSpaceAgnosticChanged = 0x10;
115 eFrameRateSelectionPriority = 0x20;
116 eFrameRateChanged = 0x40;
117 eBackgroundBlurRadiusChanged = 0x80;
118 eProducerDisconnect = 0x100;
119 eFixedTransformHintChanged = 0x200;
120 eFrameNumberChanged = 0x400;
121 eBlurRegionsChanged = 0x800;
122 eAutoRefreshChanged = 0x1000;
123 eStretchChanged = 0x2000;
124 eTrustedOverlayChanged = 0x4000;
125 eDropInputModeChanged = 0x8000;
126 };
127 uint64 what = 2;
128 float x = 3;
129 float y = 4;
130 int32 z = 5;
131 uint32 w = 6;
132 uint32 h = 7;
133 uint32 layer_stack = 8;
134
135 enum Flags {
136 eFlagsNone = 0;
137 eLayerHidden = 0x01;
138 eLayerOpaque = 0x02;
139 eLayerSkipScreenshot = 0x40;
140 eLayerSecure = 0x80;
141 eEnableBackpressure = 0x100;
142 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800143 uint32 flags = 9;
144 uint32 mask = 10;
Vishnu Nair6b591152021-10-08 11:45:14 -0700145
146 message Matrix22 {
147 float dsdx = 1;
148 float dtdx = 2;
149 float dtdy = 3;
150 float dsdy = 4;
151 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800152 Matrix22 matrix = 11;
153 float corner_radius = 12;
154 uint32 background_blur_radius = 13;
155 int32 parent_id = 14;
156 int32 relative_parent_id = 15;
Vishnu Nair6b591152021-10-08 11:45:14 -0700157
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800158 float alpha = 16;
Vishnu Nair6b591152021-10-08 11:45:14 -0700159 message Color3 {
160 float r = 1;
161 float g = 2;
162 float b = 3;
163 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800164 Color3 color = 17;
165 RegionProto transparent_region = 18;
166 uint32 transform = 19;
167 bool transform_to_display_inverse = 20;
168 RectProto crop = 21;
Vishnu Nair6b591152021-10-08 11:45:14 -0700169
170 message BufferData {
171 uint64 buffer_id = 1;
172 uint32 width = 2;
173 uint32 height = 3;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800174 uint64 frame_number = 4;
Vishnu Nair6b591152021-10-08 11:45:14 -0700175
176 enum BufferDataChange {
177 BufferDataChangeNone = 0;
178 fenceChanged = 0x01;
179 frameNumberChanged = 0x02;
180 cachedBufferChanged = 0x04;
181 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800182 uint32 flags = 5;
183 uint64 cached_buffer_id = 6;
Vishnu Nair6b591152021-10-08 11:45:14 -0700184 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800185 BufferData buffer_data = 22;
186 int32 api = 23;
187 bool has_sideband_stream = 24;
188 ColorTransformProto color_transform = 25;
189 repeated BlurRegion blur_regions = 26;
Vishnu Nair6b591152021-10-08 11:45:14 -0700190
191 message Transform {
192 float dsdx = 1;
193 float dtdx = 2;
194 float dtdy = 3;
195 float dsdy = 4;
196 float tx = 5;
197 float ty = 6;
198 }
199 message WindowInfo {
200 uint32 layout_params_flags = 1;
201 int32 layout_params_type = 2;
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800202 RegionProto touchable_region = 3;
203 int32 surface_inset = 4;
204 bool focusable = 5;
205 bool has_wallpaper = 6;
206 float global_scale_factor = 7;
207 int32 crop_layer_id = 8;
208 bool replace_touchable_region_with_crop = 9;
209 RectProto touchable_region_crop = 10;
210 Transform transform = 11;
Vishnu Nair6b591152021-10-08 11:45:14 -0700211 }
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800212 WindowInfo window_info_handle = 27;
213 float bg_color_alpha = 28;
214 int32 bg_color_dataspace = 29;
215 bool color_space_agnostic = 30;
216 float shadow_radius = 31;
217 int32 frame_rate_selection_priority = 32;
218 float frame_rate = 33;
219 int32 frame_rate_compatibility = 34;
220 int32 change_frame_rate_strategy = 35;
221 uint32 fixed_transform_hint = 36;
222 uint64 frame_number = 37;
223 bool auto_refresh = 38;
224 bool is_trusted_overlay = 39;
225 RectProto buffer_crop = 40;
226 RectProto destination_frame = 41;
Vishnu Nair6b591152021-10-08 11:45:14 -0700227
228 enum DropInputMode {
229 NONE = 0;
230 ALL = 1;
231 OBSCURED = 2;
232 };
Vishnu Nair68dee2b2021-11-08 18:52:12 -0800233 DropInputMode drop_input_mode = 42;
Vishnu Nair6b591152021-10-08 11:45:14 -0700234}
235
236message DisplayState {
237 enum Changes {
238 eChangesNone = 0;
239 eSurfaceChanged = 0x01;
240 eLayerStackChanged = 0x02;
241 eDisplayProjectionChanged = 0x04;
242 eDisplaySizeChanged = 0x08;
243 eFlagsChanged = 0x10;
244 };
245 int32 id = 1;
246 uint32 what = 2;
247 uint32 flags = 3;
248 uint32 layer_stack = 4;
249 uint32 orientation = 5;
250 RectProto layer_stack_space_rect = 6;
251 RectProto oriented_display_space_rect = 7;
252 uint32 width = 8;
253 uint32 height = 9;
254}