1// Definitions for SurfaceFlinger layers.
2
3syntax = "proto3";
4option optimize_for = LITE_RUNTIME;
5package android.surfaceflinger;
6
7// Contains a list of all layers.
8message LayersProto {
9  repeated LayerProto layers = 1;
10}
11
12// 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
29// Information about each layer.
30message LayerProto {
31  // unique id per layer.
32  int32 id = 1;
33  // unique name per layer.
34  string name = 2;
35  // 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
40  string type = 5;
41  RegionProto transparent_region = 6;
42  RegionProto visible_region = 7;
43  RegionProto damage_region = 8;
44  uint32 layer_stack = 9;
45  // The layer's z order. Can be z order in layer stack, relative to parent,
46  // or relative to another layer specified in zOrderRelative.
47  int32 z = 10;
48  // The layer's position on the display.
49  PositionProto position = 11;
50  // The layer's requested position.
51  PositionProto requested_position = 12;
52  // The layer's size.
53  SizeProto size = 13;
54  // The layer's crop in it's own bounds.
55  RectProto crop = 14;
56  // The layer's crop in it's parent's bounds.
57  RectProto final_crop = 15 [deprecated=true];
58  bool is_opaque = 16;
59  bool invalidate = 17;
60  string dataspace = 18;
61  string pixel_format = 19;
62  // The layer's actual color.
63  ColorProto color = 20;
64  // The layer's requested color.
65  ColorProto requested_color = 21;
66  // Can be any combination of
67  //    hidden = 0x01
68  //    opaque = 0x02,
69  //    secure = 0x80,
70  uint32 flags = 22;
71  // The layer's actual transform
72  TransformProto transform = 23;
73  // The layer's requested transform.
74  TransformProto requested_transform = 24;
75  // The parent layer. This value can be null if there is no parent.
76  int32 parent = 25;
77  // The layer that this layer has a z order relative to. This value can be null.
78  int32 z_order_relative_of = 26;
79  // This value can be null if there's nothing to draw.
80  ActiveBufferProto active_buffer = 27;
81  // The number of frames available.
82  int32 queued_frames = 28;
83  bool refresh_pending = 29;
84  // The layer's composer backend destination frame
85  RectProto hwc_frame = 30;
86  // The layer's composer backend source crop
87  FloatRectProto hwc_crop = 31;
88  // The layer's composer backend transform
89  int32 hwc_transform = 32;
90  int32 window_type = 33 [deprecated=true];
91  int32 app_id = 34 [deprecated=true];
92  // The layer's composition type
93  HwcCompositionType hwc_composition_type = 35;
94  // If it's a buffer layer, indicate if the content is protected
95  bool is_protected = 36;
96  // Current frame number being rendered.
97  uint64 curr_frame = 37;
98  // A list of barriers that the layer is waiting to update state.
99  repeated BarrierLayerProto barrier_layer = 38;
100  // If active_buffer is not null, record its transform.
101  TransformProto buffer_transform = 39;
102  int32 effective_scaling_mode = 40;
103  // Layer's corner radius.
104  float corner_radius = 41;
105  // Metadata map. May be empty.
106  map<int32, bytes> metadata = 42;
107
108  TransformProto effective_transform = 43;
109  FloatRectProto source_bounds = 44;
110  FloatRectProto bounds = 45;
111  FloatRectProto screen_bounds = 46;
112
113  InputWindowInfoProto input_window_info = 47;
114
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;
121  ColorTransformProto color_transform = 50;
122
123  bool is_relative_of = 51;
124  // Layer's background blur radius in pixels.
125  int32 background_blur_radius = 52;
126}
127
128message PositionProto {
129  float x = 1;
130  float y = 2;
131}
132
133message SizeProto {
134  int32 w = 1;
135  int32 h = 2;
136}
137
138message TransformProto {
139  float dsdx = 1;
140  float dtdx = 2;
141  float dsdy = 3;
142  float dtdy = 4;
143  int32 type = 5;
144}
145
146message RegionProto {
147  reserved 1;  // Previously: uint64 id
148  repeated RectProto rect = 2;
149}
150
151message RectProto {
152  int32 left   = 1;
153  int32 top    = 2;
154  int32 right  = 3;
155  int32 bottom = 4;
156}
157
158message FloatRectProto {
159  float left = 1;
160  float top = 2;
161  float right = 3;
162  float bottom = 4;
163}
164
165message ActiveBufferProto {
166  uint32 width = 1;
167  uint32 height = 2;
168  uint32 stride = 3;
169  int32 format = 4;
170}
171
172message ColorProto {
173  float r = 1;
174  float g = 2;
175  float b = 3;
176  float a = 4;
177}
178
179message BarrierLayerProto {
180  // layer id the barrier is waiting on.
181  int32 id = 1;
182  // frame number the barrier is waiting on.
183  uint64 frame_number = 2;
184}
185
186message InputWindowInfoProto {
187    uint32 layout_params_flags = 1;
188    uint32 layout_params_type = 2;
189    RectProto frame = 3;
190    RegionProto touchable_region = 4;
191
192    uint32 surface_inset = 5;
193    bool visible = 6;
194    bool can_receive_keys = 7;
195    bool has_focus = 8;
196    bool has_wallpaper = 9;
197
198    float global_scale_factor = 10;
199    float window_x_scale = 11;
200    float window_y_scale = 12;
201
202    uint32 crop_layer_id = 13;
203    bool replace_touchable_region_with_crop = 14;
204    RectProto touchable_region_crop = 15;
205}
206
207message ColorTransformProto {
208  // This will be a 4x4 matrix of float values
209  repeated float val = 1;
210}
211