blob: 4529905566a219db04ae80f1492e5854aa1dc6d0 [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;
chaviw0a398992021-08-13 10:13:01 -05005
6import "frameworks/native/services/surfaceflinger/layerproto/common.proto";
7
chaviw1d044282017-09-27 12:19:28 -07008package android.surfaceflinger;
9
10// Contains a list of all layers.
11message LayersProto {
12 repeated LayerProto layers = 1;
13}
14
Alec Mouri6b9e9912020-01-21 10:50:24 -080015// Must match definition in the IComposerClient HAL
16enum HwcCompositionType {
17 // Invalid composition type
18 INVALID = 0;
19 // Layer was composited by the client into the client target buffer
20 CLIENT = 1;
21 // Layer was composited by the device through hardware overlays
22 DEVICE = 2;
23 // Layer was composited by the device using a color
24 SOLID_COLOR = 3;
25 // Similar to DEVICE, but the layer position may have been asynchronously set
26 // through setCursorPosition
27 CURSOR = 4;
28 // Layer was composited by the device via a sideband stream.
29 SIDEBAND = 5;
30}
31
chaviw1d044282017-09-27 12:19:28 -070032// Information about each layer.
33message LayerProto {
34 // unique id per layer.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080035 int32 id = 1;
chaviw1d044282017-09-27 12:19:28 -070036 // unique name per layer.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080037 string name = 2;
chaviw1d044282017-09-27 12:19:28 -070038 // list of children this layer may have. May be empty.
39 repeated int32 children = 3;
40 // list of layers that are z order relative to this layer.
41 repeated int32 relatives = 4;
42 // The type of layer, ex Color, Layer
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080043 string type = 5;
44 RegionProto transparent_region = 6;
45 RegionProto visible_region = 7;
46 RegionProto damage_region = 8;
47 uint32 layer_stack = 9;
chaviw1d044282017-09-27 12:19:28 -070048 // The layer's z order. Can be z order in layer stack, relative to parent,
49 // or relative to another layer specified in zOrderRelative.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080050 int32 z = 10;
chaviw1d044282017-09-27 12:19:28 -070051 // The layer's position on the display.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080052 PositionProto position = 11;
chaviw1d044282017-09-27 12:19:28 -070053 // The layer's requested position.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080054 PositionProto requested_position = 12;
chaviw1d044282017-09-27 12:19:28 -070055 // The layer's size.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080056 SizeProto size = 13;
chaviw1d044282017-09-27 12:19:28 -070057 // The layer's crop in it's own bounds.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080058 RectProto crop = 14;
chaviw1d044282017-09-27 12:19:28 -070059 // The layer's crop in it's parent's bounds.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080060 RectProto final_crop = 15 [deprecated=true];
61 bool is_opaque = 16;
62 bool invalidate = 17;
63 string dataspace = 18;
64 string pixel_format = 19;
chaviw1d044282017-09-27 12:19:28 -070065 // The layer's actual color.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080066 ColorProto color = 20;
chaviw1d044282017-09-27 12:19:28 -070067 // The layer's requested color.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080068 ColorProto requested_color = 21;
chaviw1d044282017-09-27 12:19:28 -070069 // Can be any combination of
70 // hidden = 0x01
71 // opaque = 0x02,
72 // secure = 0x80,
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080073 uint32 flags = 22;
chaviw1d044282017-09-27 12:19:28 -070074 // The layer's actual transform
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080075 TransformProto transform = 23;
chaviw1d044282017-09-27 12:19:28 -070076 // The layer's requested transform.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080077 TransformProto requested_transform = 24;
chaviw1d044282017-09-27 12:19:28 -070078 // The parent layer. This value can be null if there is no parent.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080079 int32 parent = 25;
chaviw1d044282017-09-27 12:19:28 -070080 // The layer that this layer has a z order relative to. This value can be null.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080081 int32 z_order_relative_of = 26;
chaviw1d044282017-09-27 12:19:28 -070082 // This value can be null if there's nothing to draw.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080083 ActiveBufferProto active_buffer = 27;
chaviw1d044282017-09-27 12:19:28 -070084 // The number of frames available.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080085 int32 queued_frames = 28;
86 bool refresh_pending = 29;
Yiwei Zhang7124ad32018-02-21 13:02:45 -080087 // The layer's composer backend destination frame
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080088 RectProto hwc_frame = 30;
Yiwei Zhang7124ad32018-02-21 13:02:45 -080089 // The layer's composer backend source crop
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080090 FloatRectProto hwc_crop = 31;
Yiwei Zhang7124ad32018-02-21 13:02:45 -080091 // The layer's composer backend transform
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080092 int32 hwc_transform = 32;
93 int32 window_type = 33 [deprecated=true];
94 int32 app_id = 34 [deprecated=true];
Yiwei Zhang60d1a192018-03-07 14:52:28 -080095 // The layer's composition type
Alec Mouri6b9e9912020-01-21 10:50:24 -080096 HwcCompositionType hwc_composition_type = 35;
Yiwei Zhang60d1a192018-03-07 14:52:28 -080097 // If it's a buffer layer, indicate if the content is protected
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -080098 bool is_protected = 36;
chaviwadc40c22018-07-10 16:57:27 -070099 // Current frame number being rendered.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800100 uint64 curr_frame = 37;
chaviwadc40c22018-07-10 16:57:27 -0700101 // A list of barriers that the layer is waiting to update state.
Vishnu Nair9978b932018-08-22 09:11:49 -0700102 repeated BarrierLayerProto barrier_layer = 38;
103 // If active_buffer is not null, record its transform.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800104 TransformProto buffer_transform = 39;
105 int32 effective_scaling_mode = 40;
Lucas Dupin1b6531c2018-07-05 17:18:21 -0700106 // Layer's corner radius.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800107 float corner_radius = 41;
Evan Rosky1f6d6d52018-12-06 10:47:26 -0800108 // Metadata map. May be empty.
109 map<int32, bytes> metadata = 42;
Vishnu Nair4351ad52019-02-11 14:13:02 -0800110
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800111 TransformProto effective_transform = 43;
112 FloatRectProto source_bounds = 44;
113 FloatRectProto bounds = 45;
114 FloatRectProto screen_bounds = 46;
Vishnu Nair9245d3b2019-03-22 13:38:56 -0700115
116 InputWindowInfoProto input_window_info = 47;
Vishnu Nair95a1ed42019-12-06 12:25:11 -0800117
118 // Crop used to draw the rounded corner.
119 FloatRectProto corner_radius_crop = 48;
120
121 // length of the shadow to draw around the layer, it may be set on the
122 // layer or set by a parent layer.
123 float shadow_radius = 49;
chaviwddeae262020-01-06 10:31:23 -0800124 ColorTransformProto color_transform = 50;
chaviw08f3cb22020-01-13 13:17:21 -0800125
126 bool is_relative_of = 51;
Lucas Dupin19c8f0e2019-11-25 17:55:44 -0800127 // Layer's background blur radius in pixels.
128 int32 background_blur_radius = 52;
chaviw250bcbb2020-08-05 11:17:54 -0700129
130 uint32 owner_uid = 53;
Lucas Dupinc3800b82020-10-02 16:24:48 -0700131
132 // Regions of a layer, where blur should be applied.
133 repeated BlurRegion blur_regions = 54;
Winson Chunga30f7c92021-06-29 15:42:56 -0700134
135 bool is_trusted_overlay = 55;
Pablo Gamitoabdf4da2021-08-10 09:55:42 +0000136
137 // Corner radius explicitly set on layer rather than inherited
138 float requested_corner_radius = 56;
chaviw1d044282017-09-27 12:19:28 -0700139}
140
141message PositionProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800142 float x = 1;
143 float y = 2;
chaviw1d044282017-09-27 12:19:28 -0700144}
145
Yiwei Zhang7124ad32018-02-21 13:02:45 -0800146message FloatRectProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800147 float left = 1;
148 float top = 2;
149 float right = 3;
150 float bottom = 4;
Yiwei Zhang7124ad32018-02-21 13:02:45 -0800151}
152
chaviw1d044282017-09-27 12:19:28 -0700153message ActiveBufferProto {
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800154 uint32 width = 1;
155 uint32 height = 2;
156 uint32 stride = 3;
157 int32 format = 4;
chaviw1d044282017-09-27 12:19:28 -0700158}
159
chaviwadc40c22018-07-10 16:57:27 -0700160message BarrierLayerProto {
161 // layer id the barrier is waiting on.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800162 int32 id = 1;
chaviwadc40c22018-07-10 16:57:27 -0700163 // frame number the barrier is waiting on.
Nataniel Borgesdcc0bab2019-02-15 13:22:03 -0800164 uint64 frame_number = 2;
chaviwadc40c22018-07-10 16:57:27 -0700165}
Vishnu Nair9245d3b2019-03-22 13:38:56 -0700166