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/quads/checkerboard_draw_quad.h"
12 #include "cc/quads/debug_border_draw_quad.h"
13 #include "cc/quads/draw_quad.h"
14 #include "cc/quads/io_surface_draw_quad.h"
15 #include "cc/quads/picture_draw_quad.h"
16 #include "cc/quads/render_pass.h"
17 #include "cc/quads/render_pass_draw_quad.h"
18 #include "cc/quads/shared_quad_state.h"
19 #include "cc/quads/solid_color_draw_quad.h"
20 #include "cc/quads/stream_video_draw_quad.h"
21 #include "cc/quads/surface_draw_quad.h"
22 #include "cc/quads/texture_draw_quad.h"
23 #include "cc/quads/tile_draw_quad.h"
24 #include "cc/quads/yuv_video_draw_quad.h"
25 #include "cc/resources/resource_format.h"
26 #include "cc/resources/returned_resource.h"
27 #include "cc/resources/transferable_resource.h"
28 #include "content/common/content_export.h"
29 #include "gpu/ipc/gpu_command_buffer_traits.h"
30 #include "ipc/ipc_message_macros.h"
32 #ifndef CONTENT_COMMON_CC_MESSAGES_H_
33 #define CONTENT_COMMON_CC_MESSAGES_H_
40 class FilterOperations
;
46 struct ParamTraits
<cc::FilterOperation
> {
47 typedef cc::FilterOperation param_type
;
48 static void Write(Message
* m
, const param_type
& p
);
49 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
50 static void Log(const param_type
& p
, std::string
* l
);
54 struct ParamTraits
<cc::FilterOperations
> {
55 typedef cc::FilterOperations param_type
;
56 static void Write(Message
* m
, const param_type
& p
);
57 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
58 static void Log(const param_type
& p
, std::string
* l
);
62 struct ParamTraits
<skia::RefPtr
<SkImageFilter
> > {
63 typedef skia::RefPtr
<SkImageFilter
> param_type
;
64 static void Write(Message
* m
, const param_type
& p
);
65 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
66 static void Log(const param_type
& p
, std::string
* l
);
70 struct ParamTraits
<gfx::Transform
> {
71 typedef gfx::Transform param_type
;
72 static void Write(Message
* m
, const param_type
& p
);
73 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
74 static void Log(const param_type
& p
, std::string
* l
);
78 struct CONTENT_EXPORT ParamTraits
<cc::RenderPass
> {
79 typedef cc::RenderPass param_type
;
80 static void Write(Message
* m
, const param_type
& p
);
81 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
82 static void Log(const param_type
& p
, std::string
* l
);
86 struct CONTENT_EXPORT ParamTraits
<cc::CompositorFrame
> {
87 typedef cc::CompositorFrame param_type
;
88 static void Write(Message
* m
, const param_type
& p
);
89 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
90 static void Log(const param_type
& p
, std::string
* l
);
94 struct CONTENT_EXPORT ParamTraits
<cc::CompositorFrameAck
> {
95 typedef cc::CompositorFrameAck param_type
;
96 static void Write(Message
* m
, const param_type
& p
);
97 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
98 static void Log(const param_type
& p
, std::string
* l
);
102 struct CONTENT_EXPORT ParamTraits
<cc::DelegatedFrameData
> {
103 typedef cc::DelegatedFrameData param_type
;
104 static void Write(Message
* m
, const param_type
& p
);
105 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
106 static void Log(const param_type
& p
, std::string
* l
);
111 #endif // CONTENT_COMMON_CC_MESSAGES_H_
113 // Multiply-included message file, hence no include guard.
115 #define IPC_MESSAGE_START CCMsgStart
116 #undef IPC_MESSAGE_EXPORT
117 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
119 IPC_ENUM_TRAITS(cc::DrawQuad::Material
)
120 IPC_ENUM_TRAITS(cc::IOSurfaceDrawQuad::Orientation
)
121 IPC_ENUM_TRAITS(cc::FilterOperation::FilterType
)
122 IPC_ENUM_TRAITS_MAX_VALUE(cc::ResourceFormat
, cc::RESOURCE_FORMAT_MAX
)
123 IPC_ENUM_TRAITS_MAX_VALUE(SkXfermode::Mode
, SkXfermode::kLastMode
)
125 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPass::Id
)
126 IPC_STRUCT_TRAITS_MEMBER(layer_id
)
127 IPC_STRUCT_TRAITS_MEMBER(index
)
128 IPC_STRUCT_TRAITS_END()
130 IPC_STRUCT_TRAITS_BEGIN(cc::DrawQuad
)
131 IPC_STRUCT_TRAITS_MEMBER(material
)
132 IPC_STRUCT_TRAITS_MEMBER(rect
)
133 IPC_STRUCT_TRAITS_MEMBER(opaque_rect
)
134 IPC_STRUCT_TRAITS_MEMBER(visible_rect
)
135 IPC_STRUCT_TRAITS_MEMBER(needs_blending
)
136 IPC_STRUCT_TRAITS_END()
138 IPC_STRUCT_TRAITS_BEGIN(cc::CheckerboardDrawQuad
)
139 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
140 IPC_STRUCT_TRAITS_MEMBER(color
)
141 IPC_STRUCT_TRAITS_END()
143 IPC_STRUCT_TRAITS_BEGIN(cc::DebugBorderDrawQuad
)
144 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
145 IPC_STRUCT_TRAITS_MEMBER(color
)
146 IPC_STRUCT_TRAITS_MEMBER(width
)
147 IPC_STRUCT_TRAITS_END()
149 IPC_STRUCT_TRAITS_BEGIN(cc::IOSurfaceDrawQuad
)
150 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
151 IPC_STRUCT_TRAITS_MEMBER(io_surface_size
)
152 IPC_STRUCT_TRAITS_MEMBER(io_surface_resource_id
)
153 IPC_STRUCT_TRAITS_MEMBER(orientation
)
154 IPC_STRUCT_TRAITS_END()
156 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPassDrawQuad
)
157 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
158 IPC_STRUCT_TRAITS_MEMBER(render_pass_id
)
159 IPC_STRUCT_TRAITS_MEMBER(is_replica
)
160 IPC_STRUCT_TRAITS_MEMBER(mask_resource_id
)
161 IPC_STRUCT_TRAITS_MEMBER(contents_changed_since_last_frame
)
162 IPC_STRUCT_TRAITS_MEMBER(mask_uv_rect
)
163 IPC_STRUCT_TRAITS_MEMBER(filters
)
164 IPC_STRUCT_TRAITS_MEMBER(background_filters
)
165 IPC_STRUCT_TRAITS_END()
167 IPC_STRUCT_TRAITS_BEGIN(cc::SolidColorDrawQuad
)
168 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
169 IPC_STRUCT_TRAITS_MEMBER(color
)
170 IPC_STRUCT_TRAITS_MEMBER(force_anti_aliasing_off
)
171 IPC_STRUCT_TRAITS_END()
173 IPC_STRUCT_TRAITS_BEGIN(cc::StreamVideoDrawQuad
)
174 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
175 IPC_STRUCT_TRAITS_MEMBER(resource_id
)
176 IPC_STRUCT_TRAITS_MEMBER(matrix
)
177 IPC_STRUCT_TRAITS_END()
179 IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceDrawQuad
)
180 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
181 IPC_STRUCT_TRAITS_MEMBER(surface_id
)
182 IPC_STRUCT_TRAITS_END()
184 IPC_STRUCT_TRAITS_BEGIN(cc::TextureDrawQuad
)
185 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
186 IPC_STRUCT_TRAITS_MEMBER(resource_id
)
187 IPC_STRUCT_TRAITS_MEMBER(premultiplied_alpha
)
188 IPC_STRUCT_TRAITS_MEMBER(uv_top_left
)
189 IPC_STRUCT_TRAITS_MEMBER(uv_bottom_right
)
190 IPC_STRUCT_TRAITS_MEMBER(background_color
)
191 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[0])
192 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[1])
193 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[2])
194 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[3])
195 IPC_STRUCT_TRAITS_MEMBER(flipped
)
196 IPC_STRUCT_TRAITS_END()
198 IPC_STRUCT_TRAITS_BEGIN(cc::TileDrawQuad
)
199 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
200 IPC_STRUCT_TRAITS_MEMBER(resource_id
)
201 IPC_STRUCT_TRAITS_MEMBER(tex_coord_rect
)
202 IPC_STRUCT_TRAITS_MEMBER(texture_size
)
203 IPC_STRUCT_TRAITS_MEMBER(swizzle_contents
)
204 IPC_STRUCT_TRAITS_END()
206 IPC_STRUCT_TRAITS_BEGIN(cc::YUVVideoDrawQuad
)
207 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
208 IPC_STRUCT_TRAITS_MEMBER(tex_scale
)
209 IPC_STRUCT_TRAITS_MEMBER(y_plane_resource_id
)
210 IPC_STRUCT_TRAITS_MEMBER(u_plane_resource_id
)
211 IPC_STRUCT_TRAITS_MEMBER(v_plane_resource_id
)
212 IPC_STRUCT_TRAITS_MEMBER(a_plane_resource_id
)
213 IPC_STRUCT_TRAITS_END()
215 IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState
)
216 IPC_STRUCT_TRAITS_MEMBER(content_to_target_transform
)
217 IPC_STRUCT_TRAITS_MEMBER(content_bounds
)
218 IPC_STRUCT_TRAITS_MEMBER(visible_content_rect
)
219 IPC_STRUCT_TRAITS_MEMBER(clip_rect
)
220 IPC_STRUCT_TRAITS_MEMBER(is_clipped
)
221 IPC_STRUCT_TRAITS_MEMBER(opacity
)
222 IPC_STRUCT_TRAITS_MEMBER(blend_mode
)
223 IPC_STRUCT_TRAITS_END()
225 IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource
)
226 IPC_STRUCT_TRAITS_MEMBER(id
)
227 IPC_STRUCT_TRAITS_MEMBER(sync_point
)
228 IPC_STRUCT_TRAITS_MEMBER(format
)
229 IPC_STRUCT_TRAITS_MEMBER(target
)
230 IPC_STRUCT_TRAITS_MEMBER(filter
)
231 IPC_STRUCT_TRAITS_MEMBER(size
)
232 IPC_STRUCT_TRAITS_MEMBER(mailbox
)
233 IPC_STRUCT_TRAITS_MEMBER(is_software
)
234 IPC_STRUCT_TRAITS_END()
236 IPC_STRUCT_TRAITS_BEGIN(cc::ReturnedResource
)
237 IPC_STRUCT_TRAITS_MEMBER(id
)
238 IPC_STRUCT_TRAITS_MEMBER(sync_point
)
239 IPC_STRUCT_TRAITS_MEMBER(count
)
240 IPC_STRUCT_TRAITS_MEMBER(lost
)
241 IPC_STRUCT_TRAITS_END()
243 IPC_STRUCT_TRAITS_BEGIN(cc::BeginFrameArgs
)
244 IPC_STRUCT_TRAITS_MEMBER(frame_time
)
245 IPC_STRUCT_TRAITS_MEMBER(deadline
)
246 IPC_STRUCT_TRAITS_MEMBER(interval
)
247 IPC_STRUCT_TRAITS_END()
249 IPC_STRUCT_TRAITS_BEGIN(cc::CompositorFrameMetadata
)
250 IPC_STRUCT_TRAITS_MEMBER(device_scale_factor
)
251 IPC_STRUCT_TRAITS_MEMBER(root_scroll_offset
)
252 IPC_STRUCT_TRAITS_MEMBER(page_scale_factor
)
253 IPC_STRUCT_TRAITS_MEMBER(viewport_size
)
254 IPC_STRUCT_TRAITS_MEMBER(root_layer_size
)
255 IPC_STRUCT_TRAITS_MEMBER(min_page_scale_factor
)
256 IPC_STRUCT_TRAITS_MEMBER(max_page_scale_factor
)
257 IPC_STRUCT_TRAITS_MEMBER(location_bar_offset
)
258 IPC_STRUCT_TRAITS_MEMBER(location_bar_content_translation
)
259 IPC_STRUCT_TRAITS_MEMBER(overdraw_bottom_height
)
260 IPC_STRUCT_TRAITS_MEMBER(latency_info
)
261 IPC_STRUCT_TRAITS_END()
263 IPC_STRUCT_TRAITS_BEGIN(cc::GLFrameData
)
264 IPC_STRUCT_TRAITS_MEMBER(mailbox
)
265 IPC_STRUCT_TRAITS_MEMBER(sync_point
)
266 IPC_STRUCT_TRAITS_MEMBER(size
)
267 IPC_STRUCT_TRAITS_MEMBER(sub_buffer_rect
)
268 IPC_STRUCT_TRAITS_END()
270 IPC_STRUCT_TRAITS_BEGIN(cc::SoftwareFrameData
)
271 IPC_STRUCT_TRAITS_MEMBER(id
)
272 IPC_STRUCT_TRAITS_MEMBER(size
)
273 IPC_STRUCT_TRAITS_MEMBER(damage_rect
)
274 IPC_STRUCT_TRAITS_MEMBER(handle
)
275 IPC_STRUCT_TRAITS_END()