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