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