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. 4 // 5 // IPC Messages sent between compositor instances. 6 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 "cc/surfaces/surface_id.h" 29 #include "content/common/content_export.h" 30 #include "gpu/ipc/gpu_command_buffer_traits.h" 31 #include "ipc/ipc_message_macros.h" 32 33 #ifndef CONTENT_COMMON_CC_MESSAGES_H_ 34 #define CONTENT_COMMON_CC_MESSAGES_H_ 35 36 namespace gfx { 37 class Transform; 38 } 39 40 namespace cc { 41 class FilterOperations; 42 } 43 44 namespace IPC { 45 46 template <> 47 struct ParamTraits<cc::FilterOperation> { 48 typedef cc::FilterOperation param_type; 49 static void Write(Message* m, const param_type& p); 50 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 51 static void Log(const param_type& p, std::string* l); 52 }; 53 54 template <> 55 struct ParamTraits<cc::FilterOperations> { 56 typedef cc::FilterOperations param_type; 57 static void Write(Message* m, const param_type& p); 58 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 59 static void Log(const param_type& p, std::string* l); 60 }; 61 62 template <> 63 struct ParamTraits<skia::RefPtr<SkImageFilter> > { 64 typedef skia::RefPtr<SkImageFilter> param_type; 65 static void Write(Message* m, const param_type& p); 66 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 67 static void Log(const param_type& p, std::string* l); 68 }; 69 70 template <> 71 struct ParamTraits<gfx::Transform> { 72 typedef gfx::Transform param_type; 73 static void Write(Message* m, const param_type& p); 74 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 75 static void Log(const param_type& p, std::string* l); 76 }; 77 78 template <> 79 struct CONTENT_EXPORT ParamTraits<cc::RenderPass> { 80 typedef cc::RenderPass param_type; 81 static void Write(Message* m, const param_type& p); 82 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 83 static void Log(const param_type& p, std::string* l); 84 }; 85 86 template<> 87 struct CONTENT_EXPORT ParamTraits<cc::CompositorFrame> { 88 typedef cc::CompositorFrame param_type; 89 static void Write(Message* m, const param_type& p); 90 static bool Read(const Message* m, PickleIterator* iter, param_type* p); 91 static void Log(const param_type& p, std::string* l); 92 }; 93 94 template<> 95 struct CONTENT_EXPORT ParamTraits<cc::CompositorFrameAck> { 96 typedef cc::CompositorFrameAck param_type; 97 static void Write(Message* m, const param_type& p); 98 static bool Read(const Message* m, PickleIterator* iter, param_type* p); 99 static void Log(const param_type& p, std::string* l); 100 }; 101 102 template<> 103 struct CONTENT_EXPORT ParamTraits<cc::DelegatedFrameData> { 104 typedef cc::DelegatedFrameData param_type; 105 static void Write(Message* m, const param_type& p); 106 static bool Read(const Message* m, PickleIterator* iter, param_type* p); 107 static void Log(const param_type& p, std::string* l); 108 }; 109 110 template <> 111 struct CONTENT_EXPORT ParamTraits<cc::SoftwareFrameData> { 112 typedef cc::SoftwareFrameData param_type; 113 static void Write(Message* m, const param_type& p); 114 static bool Read(const Message* m, PickleIterator* iter, param_type* p); 115 static void Log(const param_type& p, std::string* l); 116 }; 117 118 } // namespace IPC 119 120 #endif // CONTENT_COMMON_CC_MESSAGES_H_ 121 122 // Multiply-included message file, hence no include guard. 123 124 #define IPC_MESSAGE_START CCMsgStart 125 #undef IPC_MESSAGE_EXPORT 126 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT 127 128 IPC_ENUM_TRAITS_MAX_VALUE(cc::DrawQuad::Material, cc::DrawQuad::MATERIAL_LAST) 129 IPC_ENUM_TRAITS_MAX_VALUE(cc::IOSurfaceDrawQuad::Orientation, 130 cc::IOSurfaceDrawQuad::ORIENTATION_LAST) 131 IPC_ENUM_TRAITS_MAX_VALUE(cc::FilterOperation::FilterType, 132 cc::FilterOperation::FILTER_TYPE_LAST ) 133 IPC_ENUM_TRAITS_MAX_VALUE(cc::ResourceFormat, cc::RESOURCE_FORMAT_MAX) 134 IPC_ENUM_TRAITS_MAX_VALUE(SkXfermode::Mode, SkXfermode::kLastMode) 135 IPC_ENUM_TRAITS_MAX_VALUE(cc::YUVVideoDrawQuad::ColorSpace, 136 cc::YUVVideoDrawQuad::COLOR_SPACE_LAST) 137 138 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPass::Id) 139 IPC_STRUCT_TRAITS_MEMBER(layer_id) 140 IPC_STRUCT_TRAITS_MEMBER(index) 141 IPC_STRUCT_TRAITS_END() 142 143 IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceId) 144 IPC_STRUCT_TRAITS_MEMBER(id) 145 IPC_STRUCT_TRAITS_END() 146 147 IPC_STRUCT_TRAITS_BEGIN(cc::DrawQuad) 148 IPC_STRUCT_TRAITS_MEMBER(material) 149 IPC_STRUCT_TRAITS_MEMBER(rect) 150 IPC_STRUCT_TRAITS_MEMBER(opaque_rect) 151 IPC_STRUCT_TRAITS_MEMBER(visible_rect) 152 IPC_STRUCT_TRAITS_MEMBER(needs_blending) 153 IPC_STRUCT_TRAITS_END() 154 155 IPC_STRUCT_TRAITS_BEGIN(cc::CheckerboardDrawQuad) 156 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 157 IPC_STRUCT_TRAITS_MEMBER(color) 158 IPC_STRUCT_TRAITS_END() 159 160 IPC_STRUCT_TRAITS_BEGIN(cc::DebugBorderDrawQuad) 161 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 162 IPC_STRUCT_TRAITS_MEMBER(color) 163 IPC_STRUCT_TRAITS_MEMBER(width) 164 IPC_STRUCT_TRAITS_END() 165 166 IPC_STRUCT_TRAITS_BEGIN(cc::IOSurfaceDrawQuad) 167 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 168 IPC_STRUCT_TRAITS_MEMBER(io_surface_size) 169 IPC_STRUCT_TRAITS_MEMBER(io_surface_resource_id) 170 IPC_STRUCT_TRAITS_MEMBER(orientation) 171 IPC_STRUCT_TRAITS_END() 172 173 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPassDrawQuad) 174 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 175 IPC_STRUCT_TRAITS_MEMBER(render_pass_id) 176 IPC_STRUCT_TRAITS_MEMBER(is_replica) 177 IPC_STRUCT_TRAITS_MEMBER(mask_resource_id) 178 IPC_STRUCT_TRAITS_MEMBER(contents_changed_since_last_frame) 179 IPC_STRUCT_TRAITS_MEMBER(mask_uv_rect) 180 IPC_STRUCT_TRAITS_MEMBER(filters) 181 IPC_STRUCT_TRAITS_MEMBER(background_filters) 182 IPC_STRUCT_TRAITS_END() 183 184 IPC_STRUCT_TRAITS_BEGIN(cc::SolidColorDrawQuad) 185 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 186 IPC_STRUCT_TRAITS_MEMBER(color) 187 IPC_STRUCT_TRAITS_MEMBER(force_anti_aliasing_off) 188 IPC_STRUCT_TRAITS_END() 189 190 IPC_STRUCT_TRAITS_BEGIN(cc::StreamVideoDrawQuad) 191 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 192 IPC_STRUCT_TRAITS_MEMBER(resource_id) 193 IPC_STRUCT_TRAITS_MEMBER(matrix) 194 IPC_STRUCT_TRAITS_END() 195 196 IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceDrawQuad) 197 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 198 IPC_STRUCT_TRAITS_MEMBER(surface_id) 199 IPC_STRUCT_TRAITS_END() 200 201 IPC_STRUCT_TRAITS_BEGIN(cc::TextureDrawQuad) 202 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 203 IPC_STRUCT_TRAITS_MEMBER(resource_id) 204 IPC_STRUCT_TRAITS_MEMBER(premultiplied_alpha) 205 IPC_STRUCT_TRAITS_MEMBER(uv_top_left) 206 IPC_STRUCT_TRAITS_MEMBER(uv_bottom_right) 207 IPC_STRUCT_TRAITS_MEMBER(background_color) 208 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[0]) 209 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[1]) 210 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[2]) 211 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[3]) 212 IPC_STRUCT_TRAITS_MEMBER(flipped) 213 IPC_STRUCT_TRAITS_END() 214 215 IPC_STRUCT_TRAITS_BEGIN(cc::TileDrawQuad) 216 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 217 IPC_STRUCT_TRAITS_MEMBER(resource_id) 218 IPC_STRUCT_TRAITS_MEMBER(tex_coord_rect) 219 IPC_STRUCT_TRAITS_MEMBER(texture_size) 220 IPC_STRUCT_TRAITS_MEMBER(swizzle_contents) 221 IPC_STRUCT_TRAITS_END() 222 223 IPC_STRUCT_TRAITS_BEGIN(cc::YUVVideoDrawQuad) 224 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad) 225 IPC_STRUCT_TRAITS_MEMBER(tex_coord_rect) 226 IPC_STRUCT_TRAITS_MEMBER(y_plane_resource_id) 227 IPC_STRUCT_TRAITS_MEMBER(u_plane_resource_id) 228 IPC_STRUCT_TRAITS_MEMBER(v_plane_resource_id) 229 IPC_STRUCT_TRAITS_MEMBER(a_plane_resource_id) 230 IPC_STRUCT_TRAITS_MEMBER(color_space) 231 IPC_STRUCT_TRAITS_END() 232 233 IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState) 234 IPC_STRUCT_TRAITS_MEMBER(content_to_target_transform) 235 IPC_STRUCT_TRAITS_MEMBER(content_bounds) 236 IPC_STRUCT_TRAITS_MEMBER(visible_content_rect) 237 IPC_STRUCT_TRAITS_MEMBER(clip_rect) 238 IPC_STRUCT_TRAITS_MEMBER(is_clipped) 239 IPC_STRUCT_TRAITS_MEMBER(opacity) 240 IPC_STRUCT_TRAITS_MEMBER(blend_mode) 241 IPC_STRUCT_TRAITS_MEMBER(sorting_context_id) 242 IPC_STRUCT_TRAITS_END() 243 244 IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource) 245 IPC_STRUCT_TRAITS_MEMBER(id) 246 IPC_STRUCT_TRAITS_MEMBER(format) 247 IPC_STRUCT_TRAITS_MEMBER(filter) 248 IPC_STRUCT_TRAITS_MEMBER(size) 249 IPC_STRUCT_TRAITS_MEMBER(mailbox_holder) 250 IPC_STRUCT_TRAITS_MEMBER(is_repeated) 251 IPC_STRUCT_TRAITS_MEMBER(is_software) 252 IPC_STRUCT_TRAITS_END() 253 254 IPC_STRUCT_TRAITS_BEGIN(cc::ReturnedResource) 255 IPC_STRUCT_TRAITS_MEMBER(id) 256 IPC_STRUCT_TRAITS_MEMBER(sync_point) 257 IPC_STRUCT_TRAITS_MEMBER(count) 258 IPC_STRUCT_TRAITS_MEMBER(lost) 259 IPC_STRUCT_TRAITS_END() 260 261 IPC_STRUCT_TRAITS_BEGIN(cc::BeginFrameArgs) 262 IPC_STRUCT_TRAITS_MEMBER(frame_time) 263 IPC_STRUCT_TRAITS_MEMBER(deadline) 264 IPC_STRUCT_TRAITS_MEMBER(interval) 265 IPC_STRUCT_TRAITS_END() 266 267 IPC_STRUCT_TRAITS_BEGIN(cc::CompositorFrameMetadata) 268 IPC_STRUCT_TRAITS_MEMBER(device_scale_factor) 269 IPC_STRUCT_TRAITS_MEMBER(root_scroll_offset) 270 IPC_STRUCT_TRAITS_MEMBER(page_scale_factor) 271 IPC_STRUCT_TRAITS_MEMBER(viewport_size) 272 IPC_STRUCT_TRAITS_MEMBER(root_layer_size) 273 IPC_STRUCT_TRAITS_MEMBER(min_page_scale_factor) 274 IPC_STRUCT_TRAITS_MEMBER(max_page_scale_factor) 275 IPC_STRUCT_TRAITS_MEMBER(location_bar_offset) 276 IPC_STRUCT_TRAITS_MEMBER(location_bar_content_translation) 277 IPC_STRUCT_TRAITS_MEMBER(overdraw_bottom_height) 278 IPC_STRUCT_TRAITS_MEMBER(latency_info) 279 IPC_STRUCT_TRAITS_END() 280 281 IPC_STRUCT_TRAITS_BEGIN(cc::GLFrameData) 282 IPC_STRUCT_TRAITS_MEMBER(mailbox) 283 IPC_STRUCT_TRAITS_MEMBER(sync_point) 284 IPC_STRUCT_TRAITS_MEMBER(size) 285 IPC_STRUCT_TRAITS_MEMBER(sub_buffer_rect) 286 IPC_STRUCT_TRAITS_END() 287