Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | syntax = "proto3"; |
| 18 | option optimize_for = LITE_RUNTIME; |
| 19 | |
| 20 | import "frameworks/native/services/surfaceflinger/layerproto/common.proto"; |
| 21 | |
| 22 | package 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. */ |
| 27 | message 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 Mariotti | c44fdaf | 2022-07-29 14:20:39 +0000 | [diff] [blame^] | 39 | |
| 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 Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | message TransactionTraceEntry { |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 46 | int64 elapsed_realtime_nanos = 1; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 47 | int64 vsync_id = 2; |
| 48 | repeated TransactionState transactions = 3; |
Vishnu Nair | 0cc69e1 | 2021-11-18 09:05:49 -0800 | [diff] [blame] | 49 | repeated LayerCreationArgs added_layers = 4; |
| 50 | repeated int32 removed_layers = 5; |
| 51 | repeated DisplayState added_displays = 6; |
| 52 | repeated int32 removed_displays = 7; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 53 | repeated int32 removed_layer_handles = 8; |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 54 | } |
| 55 | |
| 56 | message LayerCreationArgs { |
| 57 | int32 layer_id = 1; |
| 58 | string name = 2; |
| 59 | uint32 flags = 3; |
| 60 | int32 parent_id = 4; |
Vishnu Nair | 84125ac | 2021-12-02 08:47:48 -0800 | [diff] [blame] | 61 | int32 mirror_from_id = 5; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | message TransactionState { |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 65 | int32 pid = 1; |
| 66 | int32 uid = 2; |
| 67 | int64 vsync_id = 3; |
| 68 | int32 input_event_id = 4; |
| 69 | int64 post_time = 5; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 70 | uint64 transaction_id = 6; |
| 71 | repeated LayerState layer_changes = 7; |
| 72 | repeated DisplayState display_changes = 8; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | // Keep insync with layer_state_t |
| 76 | message LayerState { |
Robert Carr | a63d52a | 2022-03-03 08:03:37 -0800 | [diff] [blame] | 77 | int64 layer_id = 1; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 78 | // 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; |
| 85 | eSizeChanged = 0x00000004; |
| 86 | eAlphaChanged = 0x00000008; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 87 | |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 88 | eMatrixChanged = 0x00000010; |
| 89 | eTransparentRegionChanged = 0x00000020; |
| 90 | eFlagsChanged = 0x00000040; |
| 91 | eLayerStackChanged = 0x00000080; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 92 | |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 93 | eReleaseBufferListenerChanged = 0x00000400; |
| 94 | eShadowRadiusChanged = 0x00000800; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 95 | |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 96 | eBufferCropChanged = 0x00002000; |
| 97 | eRelativeLayerChanged = 0x00004000; |
| 98 | eReparent = 0x00008000; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 99 | |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 100 | eColorChanged = 0x00010000; |
| 101 | eDestroySurface = 0x00020000; |
| 102 | eTransformChanged = 0x00040000; |
| 103 | eTransformToDisplayInverseChanged = 0x00080000; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 104 | |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 105 | eCropChanged = 0x00100000; |
| 106 | eBufferChanged = 0x00200000; |
| 107 | eAcquireFenceChanged = 0x00400000; |
| 108 | eDataspaceChanged = 0x00800000; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 109 | |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 110 | eHdrMetadataChanged = 0x01000000; |
| 111 | eSurfaceDamageRegionChanged = 0x02000000; |
| 112 | eApiChanged = 0x04000000; |
| 113 | eSidebandStreamChanged = 0x08000000; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 114 | |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 115 | eColorTransformChanged = 0x10000000; |
| 116 | eHasListenerCallbacksChanged = 0x20000000; |
| 117 | eInputInfoChanged = 0x40000000; |
| 118 | eCornerRadiusChanged = -2147483648; // 0x80000000; (proto stores enums as signed int) |
| 119 | }; |
| 120 | enum ChangesMsb { |
| 121 | eChangesMsbNone = 0; |
| 122 | eDestinationFrameChanged = 0x1; |
| 123 | eCachedBufferChanged = 0x2; |
| 124 | eBackgroundColorChanged = 0x4; |
| 125 | eMetadataChanged = 0x8; |
| 126 | eColorSpaceAgnosticChanged = 0x10; |
| 127 | eFrameRateSelectionPriority = 0x20; |
| 128 | eFrameRateChanged = 0x40; |
| 129 | eBackgroundBlurRadiusChanged = 0x80; |
| 130 | eProducerDisconnect = 0x100; |
| 131 | eFixedTransformHintChanged = 0x200; |
| 132 | eFrameNumberChanged = 0x400; |
| 133 | eBlurRegionsChanged = 0x800; |
| 134 | eAutoRefreshChanged = 0x1000; |
| 135 | eStretchChanged = 0x2000; |
| 136 | eTrustedOverlayChanged = 0x4000; |
| 137 | eDropInputModeChanged = 0x8000; |
| 138 | }; |
| 139 | uint64 what = 2; |
| 140 | float x = 3; |
| 141 | float y = 4; |
| 142 | int32 z = 5; |
| 143 | uint32 w = 6; |
| 144 | uint32 h = 7; |
| 145 | uint32 layer_stack = 8; |
| 146 | |
| 147 | enum Flags { |
| 148 | eFlagsNone = 0; |
| 149 | eLayerHidden = 0x01; |
| 150 | eLayerOpaque = 0x02; |
| 151 | eLayerSkipScreenshot = 0x40; |
| 152 | eLayerSecure = 0x80; |
| 153 | eEnableBackpressure = 0x100; |
Leon Scroggins III | 5503088 | 2022-01-13 14:28:52 -0500 | [diff] [blame] | 154 | eLayerIsDisplayDecoration = 0x200; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 155 | }; |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 156 | uint32 flags = 9; |
| 157 | uint32 mask = 10; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 158 | |
| 159 | message Matrix22 { |
| 160 | float dsdx = 1; |
| 161 | float dtdx = 2; |
| 162 | float dtdy = 3; |
| 163 | float dsdy = 4; |
| 164 | }; |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 165 | Matrix22 matrix = 11; |
| 166 | float corner_radius = 12; |
| 167 | uint32 background_blur_radius = 13; |
Robert Carr | a63d52a | 2022-03-03 08:03:37 -0800 | [diff] [blame] | 168 | int64 parent_id = 14; |
| 169 | int64 relative_parent_id = 15; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 170 | |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 171 | float alpha = 16; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 172 | message Color3 { |
| 173 | float r = 1; |
| 174 | float g = 2; |
| 175 | float b = 3; |
| 176 | } |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 177 | Color3 color = 17; |
| 178 | RegionProto transparent_region = 18; |
| 179 | uint32 transform = 19; |
| 180 | bool transform_to_display_inverse = 20; |
| 181 | RectProto crop = 21; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 182 | |
| 183 | message BufferData { |
| 184 | uint64 buffer_id = 1; |
| 185 | uint32 width = 2; |
| 186 | uint32 height = 3; |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 187 | uint64 frame_number = 4; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 188 | |
| 189 | enum BufferDataChange { |
| 190 | BufferDataChangeNone = 0; |
| 191 | fenceChanged = 0x01; |
| 192 | frameNumberChanged = 0x02; |
| 193 | cachedBufferChanged = 0x04; |
| 194 | } |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 195 | uint32 flags = 5; |
| 196 | uint64 cached_buffer_id = 6; |
Vishnu Nair | d37343b | 2022-01-12 16:18:56 -0800 | [diff] [blame] | 197 | |
| 198 | enum PixelFormat { |
| 199 | PIXEL_FORMAT_UNKNOWN = 0; |
| 200 | PIXEL_FORMAT_CUSTOM = -4; |
| 201 | PIXEL_FORMAT_TRANSLUCENT = -3; |
| 202 | PIXEL_FORMAT_TRANSPARENT = -2; |
| 203 | PIXEL_FORMAT_OPAQUE = -1; |
| 204 | PIXEL_FORMAT_RGBA_8888 = 1; |
| 205 | PIXEL_FORMAT_RGBX_8888 = 2; |
| 206 | PIXEL_FORMAT_RGB_888 = 3; |
| 207 | PIXEL_FORMAT_RGB_565 = 4; |
| 208 | PIXEL_FORMAT_BGRA_8888 = 5; |
| 209 | PIXEL_FORMAT_RGBA_5551 = 6; |
| 210 | PIXEL_FORMAT_RGBA_4444 = 7; |
| 211 | PIXEL_FORMAT_RGBA_FP16 = 22; |
| 212 | PIXEL_FORMAT_RGBA_1010102 = 43; |
| 213 | PIXEL_FORMAT_R_8 = 0x38; |
| 214 | } |
| 215 | PixelFormat pixel_format = 7; |
| 216 | uint64 usage = 8; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 217 | } |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 218 | BufferData buffer_data = 22; |
| 219 | int32 api = 23; |
| 220 | bool has_sideband_stream = 24; |
| 221 | ColorTransformProto color_transform = 25; |
| 222 | repeated BlurRegion blur_regions = 26; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 223 | |
| 224 | message Transform { |
| 225 | float dsdx = 1; |
| 226 | float dtdx = 2; |
| 227 | float dtdy = 3; |
| 228 | float dsdy = 4; |
| 229 | float tx = 5; |
| 230 | float ty = 6; |
| 231 | } |
| 232 | message WindowInfo { |
| 233 | uint32 layout_params_flags = 1; |
| 234 | int32 layout_params_type = 2; |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 235 | RegionProto touchable_region = 3; |
| 236 | int32 surface_inset = 4; |
| 237 | bool focusable = 5; |
| 238 | bool has_wallpaper = 6; |
| 239 | float global_scale_factor = 7; |
Robert Carr | a63d52a | 2022-03-03 08:03:37 -0800 | [diff] [blame] | 240 | int64 crop_layer_id = 8; |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 241 | bool replace_touchable_region_with_crop = 9; |
| 242 | RectProto touchable_region_crop = 10; |
| 243 | Transform transform = 11; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 244 | } |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 245 | WindowInfo window_info_handle = 27; |
| 246 | float bg_color_alpha = 28; |
| 247 | int32 bg_color_dataspace = 29; |
| 248 | bool color_space_agnostic = 30; |
| 249 | float shadow_radius = 31; |
| 250 | int32 frame_rate_selection_priority = 32; |
| 251 | float frame_rate = 33; |
| 252 | int32 frame_rate_compatibility = 34; |
| 253 | int32 change_frame_rate_strategy = 35; |
| 254 | uint32 fixed_transform_hint = 36; |
| 255 | uint64 frame_number = 37; |
| 256 | bool auto_refresh = 38; |
| 257 | bool is_trusted_overlay = 39; |
| 258 | RectProto buffer_crop = 40; |
| 259 | RectProto destination_frame = 41; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 260 | |
| 261 | enum DropInputMode { |
| 262 | NONE = 0; |
| 263 | ALL = 1; |
| 264 | OBSCURED = 2; |
| 265 | }; |
Vishnu Nair | 68dee2b | 2021-11-08 18:52:12 -0800 | [diff] [blame] | 266 | DropInputMode drop_input_mode = 42; |
Vishnu Nair | 6b59115 | 2021-10-08 11:45:14 -0700 | [diff] [blame] | 267 | } |
| 268 | |
| 269 | message DisplayState { |
| 270 | enum Changes { |
| 271 | eChangesNone = 0; |
| 272 | eSurfaceChanged = 0x01; |
| 273 | eLayerStackChanged = 0x02; |
| 274 | eDisplayProjectionChanged = 0x04; |
| 275 | eDisplaySizeChanged = 0x08; |
| 276 | eFlagsChanged = 0x10; |
| 277 | }; |
| 278 | int32 id = 1; |
| 279 | uint32 what = 2; |
| 280 | uint32 flags = 3; |
| 281 | uint32 layer_stack = 4; |
| 282 | uint32 orientation = 5; |
| 283 | RectProto layer_stack_space_rect = 6; |
| 284 | RectProto oriented_display_space_rect = 7; |
| 285 | uint32 width = 8; |
| 286 | uint32 height = 9; |
| 287 | } |