summaryrefslogtreecommitdiffstats
path: root/gfx/layers/protobuf/LayerScopePacket.proto
blob: 9b4306b2a6e7fd4505a21d2251dfb6b385b0efde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
/* vim:set ts=2 sw=2 sts=2 et: */

option optimize_for = LITE_RUNTIME;

package mozilla.layers.layerscope;

// ===============================
// Server to Client messages
// ===============================
message FramePacket {
  optional uint64 value = 1;
  optional float  scale = 2;
}

message ColorPacket {
  required uint64 layerref = 1;
  optional uint32 width = 2;
  optional uint32 height = 3;
  optional uint32 color = 4;
}

message TexturePacket {
  enum Filter {
    GOOD = 0;
    LINEAR = 1;
    POINT = 2;
  }
  message Rect {
    optional float x = 1;
    optional float y = 2;
    optional float w = 3;
    optional float h = 4;
  }
  message Size {
    optional int32 w = 1;
    optional int32 h = 2;
  }
  message Matrix {
    optional bool is2D = 1;
    optional bool isId = 2;
    repeated float m = 3;
  }
  message EffectMask {
    optional bool mIs3D = 1;
    optional Size mSize = 2;
    optional Matrix mMaskTransform = 3;
  }

  // Basic info
  required uint64 layerref = 1;
  optional uint32 width = 2;
  optional uint32 height = 3;
  optional uint32 stride = 4;
  optional uint32 name = 5;
  optional uint32 target = 6;
  optional uint32 dataformat = 7;
  optional uint64 glcontext = 8;
  optional bytes data = 9;

  // TextureEffect attributes
  optional Rect mTextureCoords = 10;
  optional bool mPremultiplied = 11;
  optional Filter mFilter = 12;

  // Mask attributes
  optional bool isMask = 20;
  optional EffectMask mask = 21;
}

message LayersPacket {
  message Layer {
    enum LayerType {
      UnknownLayer = 0;
      LayerManager = 1;
      ContainerLayer = 2;
      PaintedLayer = 3;
      CanvasLayer = 4;
      ImageLayer = 5;
      ColorLayer = 6;
      RefLayer = 7;
      ReadbackLayer = 8;
    }
    enum ScrollingDirect {
      VERTICAL = 1;
      HORIZONTAL = 2;
    }
    enum Filter {
      FILTER_FAST = 0; // deprecated
      FILTER_GOOD = 1;
      FILTER_BEST = 2; // deprecated
      FILTER_NEAREST = 3; //deprecated
      FILTER_BILINEAR = 4; //deprecated
      FILTER_GAUSSIAN = 5; //deprecated
      FILTER_SENTINEL = 6; //deprecated
      FILTER_LINEAR = 7;
      FILTER_POINT = 8;
    }
    message Size {
      optional int32 w = 1;
      optional int32 h = 2;
    }
    message Rect {
      optional int32 x = 1;
      optional int32 y = 2;
      optional int32 w = 3;
      optional int32 h = 4;
    }
    message Region {
      repeated Rect r = 1;
    }
    message Matrix {
      optional bool is2D = 1;
      optional bool isId = 2;
      repeated float m = 3;
    }
    message Shadow {
      optional Rect clip = 1;
      optional Matrix transform = 2;
      optional Region vRegion = 3;
    }

    // Basic info
    // Note: Parent's pointer is used to recontruct the layer tree
    required LayerType type = 1;
    required uint64 ptr = 2;
    required uint64 parentPtr = 3;

    // Common info (10 to 99)
    optional Rect clip = 10;
    optional Matrix transform = 11;
    optional Region vRegion = 12; // visible region
    optional Shadow shadow = 13;  // shadow info
    optional float opacity = 14;
    optional bool cOpaque = 15;   // content opaque
    optional bool cAlpha = 16;    // component alpha
    optional ScrollingDirect direct = 17;
    optional uint64 barID = 18;
    optional uint64 mask = 19;    // mask layer
    optional Region hitRegion = 20;
    optional Region dispatchRegion = 21;
    optional Region noActionRegion = 22;
    optional Region hPanRegion = 23;
    optional Region vPanRegion = 24;

    // Specific info (100 to max)
    // Painted Layer
    optional Region valid = 100;
    // Color Layer
    optional uint32 color = 101;
    // Canvas & Image Layer
    optional Filter filter = 102;
    // Ref Layer
    optional uint64 refID = 103;
    // Readback Layer
    optional Size size = 104;
    optional uint32 displayListLogLength = 105;
    optional bytes displayListLog = 106;
  }
  repeated Layer layer = 1;
}

message MetaPacket {
  optional bool composedByHwc = 1;
}

message DrawPacket {
  message Rect {
    required float x = 1;
    required float y = 2;
    required float w = 3;
    required float h = 4;
  }

  required float  offsetX = 1;
  required float  offsetY = 2;
  repeated float  mvMatrix = 3;
  required uint32 totalRects = 4;
  repeated Rect   layerRect = 5;
  required uint64 layerref = 6;
  repeated uint32 texIDs = 7;
  repeated Rect   textureRect = 8;
}

// We only need to use this Packet.
// Other packet definitions are just type defines
message Packet {
  enum DataType {
    FRAMESTART = 1;
    FRAMEEND = 2;
    COLOR = 3;
    TEXTURE = 4;
    LAYERS = 5;
    META = 6;
    DRAW = 7;
  }
  required DataType type = 1;

  optional FramePacket frame = 2;
  optional ColorPacket color = 3;
  optional TexturePacket texture = 4;
  optional LayersPacket layers = 5;
  optional MetaPacket meta = 6;
  optional DrawPacket draw = 7;
}


// ===============================
// Client to Server messages
// ===============================
message CommandPacket {
  enum CmdType {
    NO_OP = 0;
    LAYERS_TREE = 1;
    LAYERS_BUFFER = 2;
  }
  required CmdType type = 1;
  optional bool value = 2;
}