1/* vim:set ts=2 sw=2 sts=2 et: */ 2 3syntax = "proto2"; 4 5option optimize_for = LITE_RUNTIME; 6 7package mozilla.layers.layerscope; 8 9// =============================== 10// Server to Client messages 11// =============================== 12message FramePacket { 13 optional uint64 value = 1; 14 optional float scale = 2; 15} 16 17message ColorPacket { 18 required uint64 layerref = 1; 19 optional uint32 width = 2; 20 optional uint32 height = 3; 21 optional uint32 color = 4; 22} 23 24message TexturePacket { 25 enum Filter { 26 GOOD = 0; 27 LINEAR = 1; 28 POINT = 2; 29 } 30 message Rect { 31 optional float x = 1; 32 optional float y = 2; 33 optional float w = 3; 34 optional float h = 4; 35 } 36 message Size { 37 optional int32 w = 1; 38 optional int32 h = 2; 39 } 40 message Matrix { 41 optional bool is2D = 1; 42 optional bool isId = 2; 43 repeated float m = 3; 44 } 45 message EffectMask { 46 optional bool mIs3D = 1; 47 optional Size mSize = 2; 48 optional Matrix mMaskTransform = 3; 49 } 50 51 // Basic info 52 required uint64 layerref = 1; 53 optional uint32 width = 2; 54 optional uint32 height = 3; 55 optional uint32 stride = 4; 56 optional uint32 name = 5; 57 optional uint32 target = 6; 58 optional uint32 dataformat = 7; 59 optional uint64 glcontext = 8; 60 optional bytes data = 9; 61 62 // TextureEffect attributes 63 optional Rect mTextureCoords = 10; 64 optional bool mPremultiplied = 11; 65 optional Filter mFilter = 12; 66 67 // Mask attributes 68 optional bool isMask = 20; 69 optional EffectMask mask = 21; 70} 71 72message LayersPacket { 73 message Layer { 74 enum LayerType { 75 UnknownLayer = 0; 76 LayerManager = 1; 77 ContainerLayer = 2; 78 PaintedLayer = 3; 79 CanvasLayer = 4; 80 ImageLayer = 5; 81 ColorLayer = 6; 82 RefLayer = 8; 83 ReadbackLayer = 9; 84 DisplayItemLayer = 10; 85 } 86 enum ScrollingDirect { 87 VERTICAL = 1; 88 HORIZONTAL = 2; 89 } 90 enum Filter { 91 FILTER_FAST = 0; // deprecated 92 FILTER_GOOD = 1; 93 FILTER_BEST = 2; // deprecated 94 FILTER_NEAREST = 3; //deprecated 95 FILTER_BILINEAR = 4; //deprecated 96 FILTER_GAUSSIAN = 5; //deprecated 97 FILTER_SENTINEL = 6; //deprecated 98 FILTER_LINEAR = 7; 99 FILTER_POINT = 8; 100 } 101 message Size { 102 optional int32 w = 1; 103 optional int32 h = 2; 104 } 105 message Rect { 106 optional int32 x = 1; 107 optional int32 y = 2; 108 optional int32 w = 3; 109 optional int32 h = 4; 110 } 111 message Region { 112 repeated Rect r = 1; 113 } 114 message Matrix { 115 optional bool is2D = 1; 116 optional bool isId = 2; 117 repeated float m = 3; 118 } 119 message Shadow { 120 optional Rect clip = 1; 121 optional Matrix transform = 2; 122 optional Region vRegion = 3; 123 } 124 125 // Basic info 126 // Note: Parent's pointer is used to recontruct the layer tree 127 required LayerType type = 1; 128 required uint64 ptr = 2; 129 required uint64 parentPtr = 3; 130 131 // Common info (10 to 99) 132 optional Rect clip = 10; 133 optional Matrix transform = 11; 134 optional Region vRegion = 12; // visible region 135 optional Shadow shadow = 13; // shadow info 136 optional float opacity = 14; 137 optional bool cOpaque = 15; // content opaque 138 optional bool cAlpha = 16; // component alpha 139 optional ScrollingDirect direct = 17; 140 optional uint64 barID = 18; 141 optional uint64 mask = 19; // mask layer 142 optional Region hitRegion = 20; 143 optional Region dispatchRegion = 21; 144 optional Region noActionRegion = 22; 145 optional Region hPanRegion = 23; 146 optional Region vPanRegion = 24; 147 148 // Specific info (100 to max) 149 // Painted Layer 150 optional Region valid = 100; 151 // Color Layer 152 optional uint32 color = 101; 153 // Canvas & Image Layer 154 optional Filter filter = 102; 155 // Ref Layer 156 optional uint64 refID = 103; 157 // Readback Layer 158 optional Size size = 104; 159 optional uint32 displayListLogLength = 105; 160 optional bytes displayListLog = 106; 161 } 162 repeated Layer layer = 1; 163} 164 165message MetaPacket { 166 optional bool composedByHwc = 1; 167} 168 169message DrawPacket { 170 message Rect { 171 required float x = 1; 172 required float y = 2; 173 required float w = 3; 174 required float h = 4; 175 } 176 177 required float offsetX = 1; 178 required float offsetY = 2; 179 repeated float mvMatrix = 3; 180 required uint32 totalRects = 4; 181 repeated Rect layerRect = 5; 182 required uint64 layerref = 6; 183 repeated uint32 texIDs = 7; 184 repeated Rect textureRect = 8; 185} 186 187// We only need to use this Packet. 188// Other packet definitions are just type defines 189message Packet { 190 enum DataType { 191 FRAMESTART = 1; 192 FRAMEEND = 2; 193 COLOR = 3; 194 TEXTURE = 4; 195 LAYERS = 5; 196 META = 6; 197 DRAW = 7; 198 } 199 required DataType type = 1; 200 201 optional FramePacket frame = 2; 202 optional ColorPacket color = 3; 203 optional TexturePacket texture = 4; 204 optional LayersPacket layers = 5; 205 optional MetaPacket meta = 6; 206 optional DrawPacket draw = 7; 207} 208 209 210// =============================== 211// Client to Server messages 212// =============================== 213message CommandPacket { 214 enum CmdType { 215 NO_OP = 0; 216 LAYERS_TREE = 1; 217 LAYERS_BUFFER = 2; 218 } 219 required CmdType type = 1; 220 optional bool value = 2; 221} 222