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