1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // IPC Messages sent between compositor instances.
7 #include "cc/output/begin_frame_args.h"
8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/filter_operation.h"
11 #include "cc/output/viewport_selection_bound.h"
12 #include "cc/quads/checkerboard_draw_quad.h"
13 #include "cc/quads/debug_border_draw_quad.h"
14 #include "cc/quads/draw_quad.h"
15 #include "cc/quads/io_surface_draw_quad.h"
16 #include "cc/quads/picture_draw_quad.h"
17 #include "cc/quads/render_pass.h"
18 #include "cc/quads/render_pass_draw_quad.h"
19 #include "cc/quads/shared_quad_state.h"
20 #include "cc/quads/solid_color_draw_quad.h"
21 #include "cc/quads/stream_video_draw_quad.h"
22 #include "cc/quads/surface_draw_quad.h"
23 #include "cc/quads/texture_draw_quad.h"
24 #include "cc/quads/tile_draw_quad.h"
25 #include "cc/quads/yuv_video_draw_quad.h"
26 #include "cc/resources/resource_format.h"
27 #include "cc/resources/returned_resource.h"
28 #include "cc/resources/transferable_resource.h"
29 #include "cc/surfaces/surface_id.h"
30 #include "cc/surfaces/surface_sequence.h"
31 #include "content/common/content_export.h"
32 #include "gpu/ipc/gpu_command_buffer_traits.h"
33 #include "ipc/ipc_message_macros.h"
34 #include "ui/gfx/ipc/gfx_param_traits.h"
36 #ifndef CONTENT_COMMON_CC_MESSAGES_H_
37 #define CONTENT_COMMON_CC_MESSAGES_H_
44 class FilterOperations
;
50 struct ParamTraits
<cc::FilterOperation
> {
51 typedef cc::FilterOperation param_type
;
52 static void Write(Message
* m
, const param_type
& p
);
53 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
54 static void Log(const param_type
& p
, std::string
* l
);
58 struct ParamTraits
<cc::FilterOperations
> {
59 typedef cc::FilterOperations param_type
;
60 static void Write(Message
* m
, const param_type
& p
);
61 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
62 static void Log(const param_type
& p
, std::string
* l
);
66 struct ParamTraits
<skia::RefPtr
<SkImageFilter
> > {
67 typedef skia::RefPtr
<SkImageFilter
> param_type
;
68 static void Write(Message
* m
, const param_type
& p
);
69 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
70 static void Log(const param_type
& p
, std::string
* l
);
74 struct ParamTraits
<gfx::Transform
> {
75 typedef gfx::Transform param_type
;
76 static void Write(Message
* m
, const param_type
& p
);
77 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
78 static void Log(const param_type
& p
, std::string
* l
);
82 struct CONTENT_EXPORT ParamTraits
<cc::RenderPass
> {
83 typedef cc::RenderPass param_type
;
84 static void Write(Message
* m
, const param_type
& p
);
85 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
86 static void Log(const param_type
& p
, std::string
* l
);
90 struct CONTENT_EXPORT ParamTraits
<cc::CompositorFrame
> {
91 typedef cc::CompositorFrame param_type
;
92 static void Write(Message
* m
, const param_type
& p
);
93 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
94 static void Log(const param_type
& p
, std::string
* l
);
98 struct CONTENT_EXPORT ParamTraits
<cc::CompositorFrameAck
> {
99 typedef cc::CompositorFrameAck param_type
;
100 static void Write(Message
* m
, const param_type
& p
);
101 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
102 static void Log(const param_type
& p
, std::string
* l
);
106 struct CONTENT_EXPORT ParamTraits
<cc::DelegatedFrameData
> {
107 typedef cc::DelegatedFrameData param_type
;
108 static void Write(Message
* m
, const param_type
& p
);
109 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
110 static void Log(const param_type
& p
, std::string
* l
);
114 struct CONTENT_EXPORT ParamTraits
<cc::SoftwareFrameData
> {
115 typedef cc::SoftwareFrameData param_type
;
116 static void Write(Message
* m
, const param_type
& p
);
117 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
118 static void Log(const param_type
& p
, std::string
* l
);
122 struct CONTENT_EXPORT ParamTraits
<cc::DrawQuad::Resources
> {
123 typedef cc::DrawQuad::Resources param_type
;
124 static void Write(Message
* m
, const param_type
& p
);
125 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
126 static void Log(const param_type
& p
, std::string
* l
);
130 struct CONTENT_EXPORT ParamTraits
<cc::StreamVideoDrawQuad::OverlayResources
> {
131 typedef cc::StreamVideoDrawQuad::OverlayResources param_type
;
132 static void Write(Message
* m
, const param_type
& p
);
133 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
134 static void Log(const param_type
& p
, std::string
* l
);
138 struct CONTENT_EXPORT ParamTraits
<cc::TextureDrawQuad::OverlayResources
> {
139 typedef cc::TextureDrawQuad::OverlayResources param_type
;
140 static void Write(Message
* m
, const param_type
& p
);
141 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
142 static void Log(const param_type
& p
, std::string
* l
);
147 #endif // CONTENT_COMMON_CC_MESSAGES_H_
149 // Multiply-included message file, hence no include guard.
151 #define IPC_MESSAGE_START CCMsgStart
152 #undef IPC_MESSAGE_EXPORT
153 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
155 IPC_ENUM_TRAITS_MAX_VALUE(cc::DrawQuad::Material
, cc::DrawQuad::MATERIAL_LAST
)
156 IPC_ENUM_TRAITS_MAX_VALUE(cc::IOSurfaceDrawQuad::Orientation
,
157 cc::IOSurfaceDrawQuad::ORIENTATION_LAST
)
158 IPC_ENUM_TRAITS_MAX_VALUE(cc::FilterOperation::FilterType
,
159 cc::FilterOperation::FILTER_TYPE_LAST
)
160 IPC_ENUM_TRAITS_MAX_VALUE(cc::ResourceFormat
, cc::RESOURCE_FORMAT_MAX
)
161 IPC_ENUM_TRAITS_MAX_VALUE(cc::SelectionBoundType
, cc::SELECTION_BOUND_TYPE_LAST
)
162 IPC_ENUM_TRAITS_MAX_VALUE(SkXfermode::Mode
, SkXfermode::kLastMode
)
163 IPC_ENUM_TRAITS_MAX_VALUE(cc::YUVVideoDrawQuad::ColorSpace
,
164 cc::YUVVideoDrawQuad::COLOR_SPACE_LAST
)
166 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPassId
)
167 IPC_STRUCT_TRAITS_MEMBER(layer_id
)
168 IPC_STRUCT_TRAITS_MEMBER(index
)
169 IPC_STRUCT_TRAITS_END()
171 IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceId
)
172 IPC_STRUCT_TRAITS_MEMBER(id
)
173 IPC_STRUCT_TRAITS_END()
175 IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceSequence
)
176 IPC_STRUCT_TRAITS_MEMBER(id_namespace
)
177 IPC_STRUCT_TRAITS_MEMBER(sequence
)
178 IPC_STRUCT_TRAITS_END()
180 IPC_STRUCT_TRAITS_BEGIN(cc::DrawQuad
)
181 IPC_STRUCT_TRAITS_MEMBER(material
)
182 IPC_STRUCT_TRAITS_MEMBER(rect
)
183 IPC_STRUCT_TRAITS_MEMBER(opaque_rect
)
184 IPC_STRUCT_TRAITS_MEMBER(visible_rect
)
185 IPC_STRUCT_TRAITS_MEMBER(needs_blending
)
186 IPC_STRUCT_TRAITS_MEMBER(resources
)
187 IPC_STRUCT_TRAITS_END()
189 IPC_STRUCT_TRAITS_BEGIN(cc::CheckerboardDrawQuad
)
190 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
191 IPC_STRUCT_TRAITS_MEMBER(color
)
192 IPC_STRUCT_TRAITS_MEMBER(scale
)
193 IPC_STRUCT_TRAITS_END()
195 IPC_STRUCT_TRAITS_BEGIN(cc::DebugBorderDrawQuad
)
196 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
197 IPC_STRUCT_TRAITS_MEMBER(color
)
198 IPC_STRUCT_TRAITS_MEMBER(width
)
199 IPC_STRUCT_TRAITS_END()
201 IPC_STRUCT_TRAITS_BEGIN(cc::IOSurfaceDrawQuad
)
202 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
203 IPC_STRUCT_TRAITS_MEMBER(io_surface_size
)
204 IPC_STRUCT_TRAITS_MEMBER(orientation
)
205 IPC_STRUCT_TRAITS_END()
207 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPassDrawQuad
)
208 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
209 IPC_STRUCT_TRAITS_MEMBER(render_pass_id
)
210 IPC_STRUCT_TRAITS_MEMBER(mask_uv_scale
)
211 IPC_STRUCT_TRAITS_MEMBER(mask_texture_size
)
212 IPC_STRUCT_TRAITS_MEMBER(filters
)
213 IPC_STRUCT_TRAITS_MEMBER(filters_scale
)
214 IPC_STRUCT_TRAITS_MEMBER(background_filters
)
215 IPC_STRUCT_TRAITS_END()
217 IPC_STRUCT_TRAITS_BEGIN(cc::SolidColorDrawQuad
)
218 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
219 IPC_STRUCT_TRAITS_MEMBER(color
)
220 IPC_STRUCT_TRAITS_MEMBER(force_anti_aliasing_off
)
221 IPC_STRUCT_TRAITS_END()
223 IPC_STRUCT_TRAITS_BEGIN(cc::StreamVideoDrawQuad
)
224 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
225 IPC_STRUCT_TRAITS_MEMBER(overlay_resources
)
226 IPC_STRUCT_TRAITS_MEMBER(matrix
)
227 IPC_STRUCT_TRAITS_END()
229 IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceDrawQuad
)
230 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
231 IPC_STRUCT_TRAITS_MEMBER(surface_id
)
232 IPC_STRUCT_TRAITS_END()
234 IPC_STRUCT_TRAITS_BEGIN(cc::TextureDrawQuad
)
235 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
236 IPC_STRUCT_TRAITS_MEMBER(overlay_resources
)
237 IPC_STRUCT_TRAITS_MEMBER(premultiplied_alpha
)
238 IPC_STRUCT_TRAITS_MEMBER(uv_top_left
)
239 IPC_STRUCT_TRAITS_MEMBER(uv_bottom_right
)
240 IPC_STRUCT_TRAITS_MEMBER(background_color
)
241 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[0])
242 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[1])
243 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[2])
244 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[3])
245 IPC_STRUCT_TRAITS_MEMBER(y_flipped
)
246 IPC_STRUCT_TRAITS_MEMBER(nearest_neighbor
)
247 IPC_STRUCT_TRAITS_END()
249 IPC_STRUCT_TRAITS_BEGIN(cc::TileDrawQuad
)
250 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
251 IPC_STRUCT_TRAITS_MEMBER(tex_coord_rect
)
252 IPC_STRUCT_TRAITS_MEMBER(texture_size
)
253 IPC_STRUCT_TRAITS_MEMBER(swizzle_contents
)
254 IPC_STRUCT_TRAITS_MEMBER(nearest_neighbor
)
255 IPC_STRUCT_TRAITS_END()
257 IPC_STRUCT_TRAITS_BEGIN(cc::YUVVideoDrawQuad
)
258 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
259 IPC_STRUCT_TRAITS_MEMBER(ya_tex_coord_rect
)
260 IPC_STRUCT_TRAITS_MEMBER(uv_tex_coord_rect
)
261 IPC_STRUCT_TRAITS_MEMBER(ya_tex_size
)
262 IPC_STRUCT_TRAITS_MEMBER(uv_tex_size
)
263 IPC_STRUCT_TRAITS_MEMBER(color_space
)
264 IPC_STRUCT_TRAITS_END()
266 IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState
)
267 IPC_STRUCT_TRAITS_MEMBER(quad_to_target_transform
)
268 IPC_STRUCT_TRAITS_MEMBER(quad_layer_bounds
)
269 IPC_STRUCT_TRAITS_MEMBER(visible_quad_layer_rect
)
270 IPC_STRUCT_TRAITS_MEMBER(clip_rect
)
271 IPC_STRUCT_TRAITS_MEMBER(is_clipped
)
272 IPC_STRUCT_TRAITS_MEMBER(opacity
)
273 IPC_STRUCT_TRAITS_MEMBER(blend_mode
)
274 IPC_STRUCT_TRAITS_MEMBER(sorting_context_id
)
275 IPC_STRUCT_TRAITS_END()
277 IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource
)
278 IPC_STRUCT_TRAITS_MEMBER(id
)
279 IPC_STRUCT_TRAITS_MEMBER(format
)
280 IPC_STRUCT_TRAITS_MEMBER(filter
)
281 IPC_STRUCT_TRAITS_MEMBER(size
)
282 IPC_STRUCT_TRAITS_MEMBER(mailbox_holder
)
283 IPC_STRUCT_TRAITS_MEMBER(read_lock_fences_enabled
)
284 IPC_STRUCT_TRAITS_MEMBER(is_repeated
)
285 IPC_STRUCT_TRAITS_MEMBER(is_software
)
286 IPC_STRUCT_TRAITS_MEMBER(allow_overlay
)
287 IPC_STRUCT_TRAITS_END()
289 IPC_STRUCT_TRAITS_BEGIN(cc::ReturnedResource
)
290 IPC_STRUCT_TRAITS_MEMBER(id
)
291 IPC_STRUCT_TRAITS_MEMBER(sync_point
)
292 IPC_STRUCT_TRAITS_MEMBER(count
)
293 IPC_STRUCT_TRAITS_MEMBER(lost
)
294 IPC_STRUCT_TRAITS_END()
296 IPC_STRUCT_TRAITS_BEGIN(cc::ViewportSelectionBound
)
297 IPC_STRUCT_TRAITS_MEMBER(type
)
298 IPC_STRUCT_TRAITS_MEMBER(edge_top
)
299 IPC_STRUCT_TRAITS_MEMBER(edge_bottom
)
300 IPC_STRUCT_TRAITS_MEMBER(visible
)
301 IPC_STRUCT_TRAITS_END()
303 IPC_STRUCT_TRAITS_BEGIN(cc::ViewportSelection
)
304 IPC_STRUCT_TRAITS_MEMBER(start
)
305 IPC_STRUCT_TRAITS_MEMBER(end
)
306 IPC_STRUCT_TRAITS_MEMBER(is_editable
)
307 IPC_STRUCT_TRAITS_MEMBER(is_empty_text_form_control
)
308 IPC_STRUCT_TRAITS_END()
310 IPC_ENUM_TRAITS_MAX_VALUE( \
311 cc::BeginFrameArgs::BeginFrameArgsType
, \
312 cc::BeginFrameArgs::BEGIN_FRAME_ARGS_TYPE_MAX
- 1)
314 IPC_STRUCT_TRAITS_BEGIN(cc::BeginFrameArgs
)
315 IPC_STRUCT_TRAITS_MEMBER(frame_time
)
316 IPC_STRUCT_TRAITS_MEMBER(deadline
)
317 IPC_STRUCT_TRAITS_MEMBER(interval
)
318 IPC_STRUCT_TRAITS_MEMBER(type
)
319 IPC_STRUCT_TRAITS_END()
321 IPC_STRUCT_TRAITS_BEGIN(cc::CompositorFrameMetadata
)
322 IPC_STRUCT_TRAITS_MEMBER(device_scale_factor
)
323 IPC_STRUCT_TRAITS_MEMBER(root_scroll_offset
)
324 IPC_STRUCT_TRAITS_MEMBER(page_scale_factor
)
325 IPC_STRUCT_TRAITS_MEMBER(scrollable_viewport_size
)
326 IPC_STRUCT_TRAITS_MEMBER(root_layer_size
)
327 IPC_STRUCT_TRAITS_MEMBER(min_page_scale_factor
)
328 IPC_STRUCT_TRAITS_MEMBER(max_page_scale_factor
)
329 IPC_STRUCT_TRAITS_MEMBER(root_overflow_x_hidden
)
330 IPC_STRUCT_TRAITS_MEMBER(root_overflow_y_hidden
)
331 IPC_STRUCT_TRAITS_MEMBER(location_bar_offset
)
332 IPC_STRUCT_TRAITS_MEMBER(location_bar_content_translation
)
333 IPC_STRUCT_TRAITS_MEMBER(selection
)
334 IPC_STRUCT_TRAITS_MEMBER(latency_info
)
335 IPC_STRUCT_TRAITS_MEMBER(satisfies_sequences
)
336 IPC_STRUCT_TRAITS_END()
338 IPC_STRUCT_TRAITS_BEGIN(cc::GLFrameData
)
339 IPC_STRUCT_TRAITS_MEMBER(mailbox
)
340 IPC_STRUCT_TRAITS_MEMBER(sync_point
)
341 IPC_STRUCT_TRAITS_MEMBER(size
)
342 IPC_STRUCT_TRAITS_MEMBER(sub_buffer_rect
)
343 IPC_STRUCT_TRAITS_END()