OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/shared_memory.h" | 8 #include "base/shared_memory.h" |
9 #include "chrome/common/gpu_info.h" | 9 #include "content/common/common_param_traits.h" |
10 #include "chrome/common/gpu_video_common.h" | 10 #include "content/common/gpu_info.h" |
| 11 #include "gpu/ipc/gpu_command_buffer_traits.h" |
| 12 #include "gpu/command_buffer/common/command_buffer.h" |
| 13 #include "ipc/ipc_channel_handle.h" |
11 #include "ipc/ipc_message_macros.h" | 14 #include "ipc/ipc_message_macros.h" |
| 15 #include "ui/gfx/native_widget_types.h" |
| 16 #include "ui/gfx/size.h" |
| 17 |
| 18 // Multiply-included message file, hence no include guard. |
12 | 19 |
13 #define IPC_MESSAGE_START GpuMsgStart | 20 #define IPC_MESSAGE_START GpuMsgStart |
14 | 21 |
15 namespace gfx { | 22 // Flag assigned to a video buffer for both input and output. |
16 class Size; | 23 #define kGpuVideoEndOfStream (1 << 0) |
17 } | |
18 | 24 |
19 namespace IPC { | 25 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig) |
20 struct ChannelHandle; | 26 IPC_STRUCT_MEMBER(std::string, allowed_extensions) |
21 } | 27 IPC_STRUCT_MEMBER(std::vector<int>, attribs) |
| 28 IPC_STRUCT_END() |
22 | 29 |
23 struct GPUCreateCommandBufferConfig; | 30 IPC_STRUCT_BEGIN(GpuVideoDecoderInitParam) |
24 struct GPUInfo; | 31 IPC_STRUCT_MEMBER(int32, codec_id) |
| 32 IPC_STRUCT_MEMBER(int32, width) |
| 33 IPC_STRUCT_MEMBER(int32, height) |
| 34 IPC_STRUCT_MEMBER(int32, profile) |
| 35 IPC_STRUCT_MEMBER(int32, level) |
| 36 IPC_STRUCT_MEMBER(int32, frame_rate_den) |
| 37 IPC_STRUCT_MEMBER(int32, frame_rate_num) |
| 38 IPC_STRUCT_MEMBER(int32, aspect_ratio_den) |
| 39 IPC_STRUCT_MEMBER(int32, aspect_ratio_num) |
| 40 IPC_STRUCT_END() |
| 41 |
| 42 IPC_STRUCT_BEGIN(GpuVideoDecoderInitDoneParam) |
| 43 // other parameter is only meaningful when this is true. |
| 44 IPC_STRUCT_MEMBER(int32, success) |
| 45 IPC_STRUCT_MEMBER(int32, input_buffer_size) |
| 46 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, input_buffer_handle) |
| 47 IPC_STRUCT_END() |
| 48 |
| 49 IPC_STRUCT_BEGIN(GpuVideoDecoderInputBufferParam) |
| 50 IPC_STRUCT_MEMBER(int64, timestamp) // In unit of microseconds. |
| 51 IPC_STRUCT_MEMBER(int32, offset) |
| 52 IPC_STRUCT_MEMBER(int32, size) |
| 53 IPC_STRUCT_MEMBER(int32, flags) // Miscellaneous flag bit mask. |
| 54 IPC_STRUCT_END() |
| 55 |
| 56 IPC_STRUCT_BEGIN(GpuVideoDecoderErrorInfoParam) |
| 57 IPC_STRUCT_MEMBER(int32, error_id) // TODO(jiesun): define enum. |
| 58 IPC_STRUCT_END() |
| 59 |
| 60 // TODO(jiesun): define this. |
| 61 IPC_STRUCT_BEGIN(GpuVideoDecoderFormatChangeParam) |
| 62 IPC_STRUCT_MEMBER(int32, input_buffer_size) |
| 63 IPC_STRUCT_MEMBER(base::SharedMemoryHandle, input_buffer_handle) |
| 64 IPC_STRUCT_END() |
| 65 |
| 66 #if defined(OS_MACOSX) |
| 67 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params) |
| 68 IPC_STRUCT_MEMBER(int32, renderer_id) |
| 69 IPC_STRUCT_MEMBER(int32, render_view_id) |
| 70 IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, window) |
| 71 IPC_STRUCT_MEMBER(int32, width) |
| 72 IPC_STRUCT_MEMBER(int32, height) |
| 73 IPC_STRUCT_MEMBER(uint64, identifier) |
| 74 IPC_STRUCT_END() |
| 75 |
| 76 IPC_STRUCT_BEGIN(GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params) |
| 77 IPC_STRUCT_MEMBER(int32, renderer_id) |
| 78 IPC_STRUCT_MEMBER(int32, render_view_id) |
| 79 IPC_STRUCT_MEMBER(gfx::PluginWindowHandle, window) |
| 80 IPC_STRUCT_MEMBER(uint64, surface_id) |
| 81 IPC_STRUCT_MEMBER(int32, route_id) |
| 82 IPC_STRUCT_MEMBER(uint64, swap_buffers_count) |
| 83 IPC_STRUCT_END() |
| 84 #endif |
| 85 |
| 86 IPC_STRUCT_TRAITS_BEGIN(DxDiagNode) |
| 87 IPC_STRUCT_TRAITS_MEMBER(values) |
| 88 IPC_STRUCT_TRAITS_MEMBER(children) |
| 89 IPC_STRUCT_TRAITS_END() |
| 90 |
| 91 IPC_ENUM_TRAITS(GPUInfo::Level) |
| 92 |
| 93 IPC_STRUCT_TRAITS_BEGIN(GPUInfo) |
| 94 IPC_STRUCT_TRAITS_MEMBER(level) |
| 95 IPC_STRUCT_TRAITS_MEMBER(initialization_time) |
| 96 IPC_STRUCT_TRAITS_MEMBER(vendor_id) |
| 97 IPC_STRUCT_TRAITS_MEMBER(device_id) |
| 98 IPC_STRUCT_TRAITS_MEMBER(driver_vendor) |
| 99 IPC_STRUCT_TRAITS_MEMBER(driver_version) |
| 100 IPC_STRUCT_TRAITS_MEMBER(driver_date) |
| 101 IPC_STRUCT_TRAITS_MEMBER(pixel_shader_version) |
| 102 IPC_STRUCT_TRAITS_MEMBER(vertex_shader_version) |
| 103 IPC_STRUCT_TRAITS_MEMBER(gl_version) |
| 104 IPC_STRUCT_TRAITS_MEMBER(gl_version_string) |
| 105 IPC_STRUCT_TRAITS_MEMBER(gl_vendor) |
| 106 IPC_STRUCT_TRAITS_MEMBER(gl_renderer) |
| 107 IPC_STRUCT_TRAITS_MEMBER(gl_extensions) |
| 108 IPC_STRUCT_TRAITS_MEMBER(can_lose_context) |
| 109 IPC_STRUCT_TRAITS_MEMBER(collection_error) |
| 110 #if defined(OS_WIN) |
| 111 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics) |
| 112 #endif |
| 113 IPC_STRUCT_TRAITS_END() |
25 | 114 |
26 //------------------------------------------------------------------------------ | 115 //------------------------------------------------------------------------------ |
27 // GPU Messages | 116 // GPU Messages |
28 // These are messages from the browser to the GPU process. | 117 // These are messages from the browser to the GPU process. |
29 | 118 |
30 // Tells the GPU process to initialize itself. The browser explicitly | 119 // Tells the GPU process to initialize itself. The browser explicitly |
31 // requests this be done so that we are guaranteed that the channel is set | 120 // requests this be done so that we are guaranteed that the channel is set |
32 // up between the browser and GPU process before doing any work that might | 121 // up between the browser and GPU process before doing any work that might |
33 // potentially crash the GPU process. Detection of the child process | 122 // potentially crash the GPU process. Detection of the child process |
34 // exiting abruptly is predicated on having the IPC channel set up. | 123 // exiting abruptly is predicated on having the IPC channel set up. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 int /* renderer_id */, | 174 int /* renderer_id */, |
86 int32 /* renderer_route_id */) | 175 int32 /* renderer_route_id */) |
87 #endif | 176 #endif |
88 | 177 |
89 // Tells the GPU process to crash. | 178 // Tells the GPU process to crash. |
90 IPC_MESSAGE_CONTROL0(GpuMsg_Crash) | 179 IPC_MESSAGE_CONTROL0(GpuMsg_Crash) |
91 | 180 |
92 // Tells the GPU process to hang. | 181 // Tells the GPU process to hang. |
93 IPC_MESSAGE_CONTROL0(GpuMsg_Hang) | 182 IPC_MESSAGE_CONTROL0(GpuMsg_Hang) |
94 | 183 |
| 184 // The browser sends this to a renderer process in response to a |
| 185 // GpuHostMsg_EstablishGpuChannel message. |
| 186 IPC_MESSAGE_CONTROL3(GpuMsg_GpuChannelEstablished, |
| 187 IPC::ChannelHandle /* handle to channel */, |
| 188 base::ProcessHandle /* renderer_process_for_gpu */, |
| 189 GPUInfo /* stats about GPU process*/) |
| 190 |
95 //------------------------------------------------------------------------------ | 191 //------------------------------------------------------------------------------ |
96 // GPU Host Messages | 192 // GPU Host Messages |
97 // These are messages to the browser. | 193 // These are messages to the browser. |
98 | 194 |
99 // A renderer sends this when it wants to create a connection to the GPU | 195 // A renderer sends this when it wants to create a connection to the GPU |
100 // process. The browser will create the GPU process if necessary, and will | 196 // process. The browser will create the GPU process if necessary, and will |
101 // return a handle to the channel via a GpuChannelEstablished message. | 197 // return a handle to the channel via a GpuChannelEstablished message. |
102 IPC_MESSAGE_CONTROL0(GpuHostMsg_EstablishGpuChannel) | 198 IPC_MESSAGE_CONTROL0(GpuHostMsg_EstablishGpuChannel) |
103 | 199 |
104 // A renderer sends this to the browser process to provide a synchronization | 200 // A renderer sends this to the browser process to provide a synchronization |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 // Release all video frames allocated for a hardware video decoder. | 468 // Release all video frames allocated for a hardware video decoder. |
373 IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_ReleaseAllVideoFrames) | 469 IPC_MESSAGE_ROUTED0(GpuVideoDecoderHostMsg_ReleaseAllVideoFrames) |
374 | 470 |
375 // GpuVideoDecoder report output format change. | 471 // GpuVideoDecoder report output format change. |
376 IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_MediaFormatChange, | 472 IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_MediaFormatChange, |
377 GpuVideoDecoderFormatChangeParam) | 473 GpuVideoDecoderFormatChangeParam) |
378 | 474 |
379 // GpuVideoDecoder report error. | 475 // GpuVideoDecoder report error. |
380 IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_ErrorNotification, | 476 IPC_MESSAGE_ROUTED1(GpuVideoDecoderHostMsg_ErrorNotification, |
381 GpuVideoDecoderErrorInfoParam) | 477 GpuVideoDecoderErrorInfoParam) |
OLD | NEW |