blob: 9f4e7d2eb22a43365328a1f245b3fd12348c7358 [file] [log] [blame]
chaviw1d044282017-09-27 12:19:28 -07001// Definitions for SurfaceFlinger layers.
2
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -08003syntax = "proto3";
chaviw1d044282017-09-27 12:19:28 -07004option optimize_for = LITE_RUNTIME;
5package android.surfaceflinger;
6
7// Contains a list of all layers.
8message LayersProto {
9 repeated LayerProto layers = 1;
10}
11
Alec Mouri6b9e9912020-01-21 10:50:24 -080012// Must match definition in the IComposerClient HAL
13enum HwcCompositionType {
14 // Invalid composition type
15 INVALID = 0;
16 // Layer was composited by the client into the client target buffer
17 CLIENT = 1;
18 // Layer was composited by the device through hardware overlays
19 DEVICE = 2;
20 // Layer was composited by the device using a color
21 SOLID_COLOR = 3;
22 // Similar to DEVICE, but the layer position may have been asynchronously set
23 // through setCursorPosition
24 CURSOR = 4;
25 // Layer was composited by the device via a sideband stream.
26 SIDEBAND = 5;
27}
28
chaviw1d044282017-09-27 12:19:28 -070029// Information about each layer.
30message LayerProto {
31 // unique id per layer.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080032 int32 id = 1;
chaviw1d044282017-09-27 12:19:28 -070033 // unique name per layer.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080034 string name = 2;
chaviw1d044282017-09-27 12:19:28 -070035 // list of children this layer may have. May be empty.
36 repeated int32 children = 3;
37 // list of layers that are z order relative to this layer.
38 repeated int32 relatives = 4;
39 // The type of layer, ex Color, Layer
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080040 string type = 5;
41 RegionProto transparent_region = 6;
42 RegionProto visible_region = 7;
43 RegionProto damage_region = 8;
44 uint32 layer_stack = 9;
chaviw1d044282017-09-27 12:19:28 -070045 // The layer's z order. Can be z order in layer stack, relative to parent,
46 // or relative to another layer specified in zOrderRelative.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080047 int32 z = 10;
chaviw1d044282017-09-27 12:19:28 -070048 // The layer's position on the display.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080049 PositionProto position = 11;
chaviw1d044282017-09-27 12:19:28 -070050 // The layer's requested position.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080051 PositionProto requested_position = 12;
chaviw1d044282017-09-27 12:19:28 -070052 // The layer's size.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080053 SizeProto size = 13;
chaviw1d044282017-09-27 12:19:28 -070054 // The layer's crop in it's own bounds.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080055 RectProto crop = 14;
chaviw1d044282017-09-27 12:19:28 -070056 // The layer's crop in it's parent's bounds.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080057 RectProto final_crop = 15 [deprecated=true];
58 bool is_opaque = 16;
59 bool invalidate = 17;
60 string dataspace = 18;
61 string pixel_format = 19;
chaviw1d044282017-09-27 12:19:28 -070062 // The layer's actual color.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080063 ColorProto color = 20;
chaviw1d044282017-09-27 12:19:28 -070064 // The layer's requested color.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080065 ColorProto requested_color = 21;
chaviw1d044282017-09-27 12:19:28 -070066 // Can be any combination of
67 // hidden = 0x01
68 // opaque = 0x02,
69 // secure = 0x80,
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080070 uint32 flags = 22;
chaviw1d044282017-09-27 12:19:28 -070071 // The layer's actual transform
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080072 TransformProto transform = 23;
chaviw1d044282017-09-27 12:19:28 -070073 // The layer's requested transform.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080074 TransformProto requested_transform = 24;
chaviw1d044282017-09-27 12:19:28 -070075 // The parent layer. This value can be null if there is no parent.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080076 int32 parent = 25;
chaviw1d044282017-09-27 12:19:28 -070077 // The layer that this layer has a z order relative to. This value can be null.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080078 int32 z_order_relative_of = 26;
chaviw1d044282017-09-27 12:19:28 -070079 // This value can be null if there's nothing to draw.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080080 ActiveBufferProto active_buffer = 27;
chaviw1d044282017-09-27 12:19:28 -070081 // The number of frames available.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080082 int32 queued_frames = 28;
83 bool refresh_pending = 29;
Yiwei Zhang7124ad32018-02-21 13:02:45 -080084 // The layer's composer backend destination frame
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080085 RectProto hwc_frame = 30;
Yiwei Zhang7124ad32018-02-21 13:02:45 -080086 // The layer's composer backend source crop
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080087 FloatRectProto hwc_crop = 31;
Yiwei Zhang7124ad32018-02-21 13:02:45 -080088 // The layer's composer backend transform
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080089 int32 hwc_transform = 32;
90 int32 window_type = 33 [deprecated=true];
91 int32 app_id = 34 [deprecated=true];
Yiwei Zhang60d1a192018-03-07 14:52:28 -080092 // The layer's composition type
Alec Mouri6b9e9912020-01-21 10:50:24 -080093 HwcCompositionType hwc_composition_type = 35;
Yiwei Zhang60d1a192018-03-07 14:52:28 -080094 // If it's a buffer layer, indicate if the content is protected
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080095 bool is_protected = 36;
chaviwadc40c22018-07-10 16:57:27 -070096 // Current frame number being rendered.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080097 uint64 curr_frame = 37;
chaviwadc40c22018-07-10 16:57:27 -070098 // A list of barriers that the layer is waiting to update state.
Vishnu Nair9978b932018-08-22 09:11:49 -070099 repeated BarrierLayerProto barrier_layer = 38;
100 // If active_buffer is not null, record its transform.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800101 TransformProto buffer_transform = 39;
102 int32 effective_scaling_mode = 40;
Lucas Dupin1b6531c2018-07-05 17:18:21 -0700103 // Layer's corner radius.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800104 float corner_radius = 41;
Evan Rosky1f6d6d52018-12-06 10:47:26 -0800105 // Metadata map. May be empty.
106 map<int32, bytes> metadata = 42;
Vishnu Nair4351ad52019-02-11 14:13:02 -0800107
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800108 TransformProto effective_transform = 43;
109 FloatRectProto source_bounds = 44;
110 FloatRectProto bounds = 45;
111 FloatRectProto screen_bounds = 46;
Vishnu Nair9245d3b2019-03-22 13:38:56 -0700112
113 InputWindowInfoProto input_window_info = 47;
Vishnu Nair95a1ed42019-12-06 12:25:11 -0800114
115 // Crop used to draw the rounded corner.
116 FloatRectProto corner_radius_crop = 48;
117
118 // length of the shadow to draw around the layer, it may be set on the
119 // layer or set by a parent layer.
120 float shadow_radius = 49;
chaviwddeae262020-01-06 10:31:23 -0800121 ColorTransformProto color_transform = 50;
chaviw08f3cb22020-01-13 13:17:21 -0800122
123 bool is_relative_of = 51;
Lucas Dupin19c8f0e2019-11-25 17:55:44 -0800124 // Layer's background blur radius in pixels.
125 int32 background_blur_radius = 52;
chaviw250bcbb2020-08-05 11:17:54 -0700126
127 uint32 owner_uid = 53;
Lucas Dupinc3800b82020-10-02 16:24:48 -0700128
129 // Regions of a layer, where blur should be applied.
130 repeated BlurRegion blur_regions = 54;
Winson Chunga30f7c92021-06-29 15:42:56 -0700131
132 bool is_trusted_overlay = 55;
Pablo Gamitoabdf4da2021-08-10 09:55:42 +0000133
134 // Corner radius explicitly set on layer rather than inherited
135 float requested_corner_radius = 56;
chaviw1d044282017-09-27 12:19:28 -0700136}
137
138message PositionProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800139 float x = 1;
140 float y = 2;
chaviw1d044282017-09-27 12:19:28 -0700141}
142
143message SizeProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800144 int32 w = 1;
145 int32 h = 2;
chaviw1d044282017-09-27 12:19:28 -0700146}
147
148message TransformProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800149 float dsdx = 1;
150 float dtdx = 2;
151 float dsdy = 3;
152 float dtdy = 4;
Nataniel Borges797b0e42019-02-15 14:11:58 -0800153 int32 type = 5;
chaviw1d044282017-09-27 12:19:28 -0700154}
155
156message RegionProto {
Nataniel Borges1c0d91c2019-02-15 15:29:39 -0800157 reserved 1; // Previously: uint64 id
chaviw1d044282017-09-27 12:19:28 -0700158 repeated RectProto rect = 2;
159}
160
161message RectProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800162 int32 left = 1;
163 int32 top = 2;
164 int32 right = 3;
165 int32 bottom = 4;
chaviw1d044282017-09-27 12:19:28 -0700166}
167
Yiwei Zhang7124ad32018-02-21 13:02:45 -0800168message FloatRectProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800169 float left = 1;
170 float top = 2;
171 float right = 3;
172 float bottom = 4;
Yiwei Zhang7124ad32018-02-21 13:02:45 -0800173}
174
chaviw1d044282017-09-27 12:19:28 -0700175message ActiveBufferProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800176 uint32 width = 1;
177 uint32 height = 2;
178 uint32 stride = 3;
179 int32 format = 4;
chaviw1d044282017-09-27 12:19:28 -0700180}
181
182message ColorProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800183 float r = 1;
184 float g = 2;
185 float b = 3;
186 float a = 4;
Yiwei Zhang7124ad32018-02-21 13:02:45 -0800187}
chaviwadc40c22018-07-10 16:57:27 -0700188
189message BarrierLayerProto {
190 // layer id the barrier is waiting on.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800191 int32 id = 1;
chaviwadc40c22018-07-10 16:57:27 -0700192 // frame number the barrier is waiting on.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800193 uint64 frame_number = 2;
chaviwadc40c22018-07-10 16:57:27 -0700194}
Vishnu Nair9245d3b2019-03-22 13:38:56 -0700195
196message InputWindowInfoProto {
197 uint32 layout_params_flags = 1;
198 uint32 layout_params_type = 2;
199 RectProto frame = 3;
200 RegionProto touchable_region = 4;
201
202 uint32 surface_inset = 5;
203 bool visible = 6;
Vishnu Nair47074b82020-08-14 11:54:47 -0700204 bool can_receive_keys = 7 [deprecated=true];
205 bool focusable = 8;
Vishnu Nair9245d3b2019-03-22 13:38:56 -0700206 bool has_wallpaper = 9;
207
208 float global_scale_factor = 10;
chaviw1ff3d1e2020-07-01 15:53:47 -0700209 float window_x_scale = 11 [deprecated=true];
210 float window_y_scale = 12 [deprecated=true];
Vishnu Nair9245d3b2019-03-22 13:38:56 -0700211
212 uint32 crop_layer_id = 13;
213 bool replace_touchable_region_with_crop = 14;
214 RectProto touchable_region_crop = 15;
chaviw1ff3d1e2020-07-01 15:53:47 -0700215 TransformProto transform = 16;
Vishnu Nair9245d3b2019-03-22 13:38:56 -0700216}
chaviwddeae262020-01-06 10:31:23 -0800217
218message ColorTransformProto {
219 // This will be a 4x4 matrix of float values
220 repeated float val = 1;
Alec Mouri6b9e9912020-01-21 10:50:24 -0800221}
Lucas Dupinc3800b82020-10-02 16:24:48 -0700222
223message BlurRegion {
224 uint32 blur_radius = 1;
225 uint32 corner_radius_tl = 2;
226 uint32 corner_radius_tr = 3;
227 uint32 corner_radius_bl = 4;
228 float corner_radius_br = 5;
229 float alpha = 6;
230 int32 left = 7;
231 int32 top = 8;
232 int32 right = 9;
233 int32 bottom = 10;
Pablo Gamitoabdf4da2021-08-10 09:55:42 +0000234}