OLD | NEW |
1 // Copyright (c) 2011 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 // Multiply-included message file, hence no include guard here, but see below |
| 6 // for a much smaller-than-usual include guard section. |
| 7 |
5 #include <vector> | 8 #include <vector> |
6 #include <string> | 9 #include <string> |
7 | 10 |
8 | |
9 #include "base/shared_memory.h" | 11 #include "base/shared_memory.h" |
10 #include "content/common/common_param_traits.h" | 12 #include "content/common/common_param_traits.h" |
11 #include "content/common/gpu/gpu_info.h" | 13 #include "content/common/gpu/gpu_info.h" |
12 #include "content/common/gpu/gpu_process_launch_causes.h" | 14 #include "content/common/gpu/gpu_process_launch_causes.h" |
13 #include "gpu/command_buffer/common/command_buffer.h" | 15 #include "gpu/command_buffer/common/command_buffer.h" |
14 #include "gpu/ipc/gpu_command_buffer_traits.h" | 16 #include "gpu/ipc/gpu_command_buffer_traits.h" |
15 #include "ipc/ipc_channel_handle.h" | 17 #include "ipc/ipc_channel_handle.h" |
16 #include "ipc/ipc_message_macros.h" | 18 #include "ipc/ipc_message_macros.h" |
17 #include "ui/gfx/native_widget_types.h" | 19 #include "ui/gfx/native_widget_types.h" |
18 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
19 // Multiply-included message file, hence no include guard. | |
20 | 21 |
21 #define IPC_MESSAGE_START GpuMsgStart | 22 #define IPC_MESSAGE_START GpuMsgStart |
22 | 23 |
23 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig) | 24 IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig) |
24 IPC_STRUCT_MEMBER(std::string, allowed_extensions) | 25 IPC_STRUCT_MEMBER(std::string, allowed_extensions) |
25 IPC_STRUCT_MEMBER(std::vector<int>, attribs) | 26 IPC_STRUCT_MEMBER(std::vector<int>, attribs) |
26 IPC_STRUCT_MEMBER(GURL, active_url) | 27 IPC_STRUCT_MEMBER(GURL, active_url) |
27 IPC_STRUCT_END() | 28 IPC_STRUCT_END() |
28 | 29 |
29 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 IPC_STRUCT_TRAITS_MEMBER(gl_version_string) | 92 IPC_STRUCT_TRAITS_MEMBER(gl_version_string) |
92 IPC_STRUCT_TRAITS_MEMBER(gl_vendor) | 93 IPC_STRUCT_TRAITS_MEMBER(gl_vendor) |
93 IPC_STRUCT_TRAITS_MEMBER(gl_renderer) | 94 IPC_STRUCT_TRAITS_MEMBER(gl_renderer) |
94 IPC_STRUCT_TRAITS_MEMBER(gl_extensions) | 95 IPC_STRUCT_TRAITS_MEMBER(gl_extensions) |
95 IPC_STRUCT_TRAITS_MEMBER(can_lose_context) | 96 IPC_STRUCT_TRAITS_MEMBER(can_lose_context) |
96 #if defined(OS_WIN) | 97 #if defined(OS_WIN) |
97 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics) | 98 IPC_STRUCT_TRAITS_MEMBER(dx_diagnostics) |
98 #endif | 99 #endif |
99 IPC_STRUCT_TRAITS_END() | 100 IPC_STRUCT_TRAITS_END() |
100 | 101 |
| 102 IPC_STRUCT_TRAITS_BEGIN(gpu::ReadWriteTokens) |
| 103 IPC_STRUCT_TRAITS_MEMBER(last_token_read) |
| 104 IPC_STRUCT_TRAITS_MEMBER(last_token_written) |
| 105 IPC_STRUCT_TRAITS_END() |
| 106 |
101 IPC_ENUM_TRAITS(content::CauseForGpuLaunch) | 107 IPC_ENUM_TRAITS(content::CauseForGpuLaunch) |
102 | 108 |
103 //------------------------------------------------------------------------------ | 109 //------------------------------------------------------------------------------ |
104 // GPU Messages | 110 // GPU Messages |
105 // These are messages from the browser to the GPU process. | 111 // These are messages from the browser to the GPU process. |
106 | 112 |
107 // Tells the GPU process to initialize itself. The browser explicitly | 113 // Tells the GPU process to initialize itself. The browser explicitly |
108 // requests this be done so that we are guaranteed that the channel is set | 114 // requests this be done so that we are guaranteed that the channel is set |
109 // up between the browser and GPU process before doing any work that might | 115 // up between the browser and GPU process before doing any work that might |
110 // potentially crash the GPU process. Detection of the child process | 116 // potentially crash the GPU process. Detection of the child process |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 304 |
299 // Create a surface for offscreen rendering. | 305 // Create a surface for offscreen rendering. |
300 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_CreateOffscreenSurface, | 306 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_CreateOffscreenSurface, |
301 gfx::Size, /* size */ | 307 gfx::Size, /* size */ |
302 int /* route_id */) | 308 int /* route_id */) |
303 | 309 |
304 // Destroy a surface by routing id. | 310 // Destroy a surface by routing id. |
305 IPC_MESSAGE_CONTROL1(GpuChannelMsg_DestroySurface, | 311 IPC_MESSAGE_CONTROL1(GpuChannelMsg_DestroySurface, |
306 int /* route_id */) | 312 int /* route_id */) |
307 | 313 |
308 // Create hardware video decoder && associate it with the output |decoder_id|; | 314 // Create a hardware video decoder; the new route ID is returned through |
| 315 // AcceleratedVideoDecoderHostMsg_CreateDone. |
309 // We need this to be control message because we had to map the GpuChannel and | 316 // We need this to be control message because we had to map the GpuChannel and |
310 // |decoder_id|. | 317 // |decoder_id|. |
311 IPC_MESSAGE_CONTROL3(GpuChannelMsg_CreateVideoDecoder, | 318 IPC_MESSAGE_CONTROL3(GpuChannelMsg_CreateVideoDecoder, |
312 int32, /* decoder_id */ | 319 int32, /* decoder_host_id */ |
313 uint32, /* command buffer route id*/ | 320 uint32, /* command buffer route id*/ |
314 std::vector<uint32>) /* configs */ | 321 std::vector<uint32>) /* configs */ |
315 | 322 |
316 // Release all resource of the hardware video decoder which was assocaited | 323 // Release all resource of the hardware video decoder which was assocaited |
317 // with the input |decoder_id|. | 324 // with the input |decoder_id|. |
318 // TODO(hclam): This message needs to be asynchronous. | 325 // TODO(hclam): This message needs to be asynchronous. |
319 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder, | 326 IPC_SYNC_MESSAGE_CONTROL1_0(GpuChannelMsg_DestroyVideoDecoder, |
320 int32 /* decoder_id */) | 327 int32 /* decoder_id */) |
321 | 328 |
322 // Create a TransportTexture corresponding to |host_id|. | 329 // Create a TransportTexture corresponding to |host_id|. |
323 IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateTransportTexture, | 330 IPC_MESSAGE_CONTROL2(GpuChannelMsg_CreateTransportTexture, |
324 int32, /* context_route_id */ | 331 int32, /* context_route_id */ |
325 int32 /* host_id */) | 332 int32 /* host_id */) |
326 | 333 |
327 // Sent from Renderer process to the GPU process to give the texture IDs for | |
328 // the textures the decoder will use for output. | |
329 IPC_MESSAGE_CONTROL4(GpuChannelMsg_AssignTexturesToVideoDecoder, | |
330 int32, /* Decoder ID */ | |
331 std::vector<int32>, /* Picture buffer ID */ | |
332 std::vector<uint32>, /* Texture ID */ | |
333 std::vector<gfx::Size>) /* Size */ | |
334 //------------------------------------------------------------------------------ | 334 //------------------------------------------------------------------------------ |
335 // GPU Command Buffer Messages | 335 // GPU Command Buffer Messages |
336 // These are messages between a renderer process to the GPU process relating to | 336 // These are messages between a renderer process to the GPU process relating to |
337 // a single OpenGL context. | 337 // a single OpenGL context. |
338 // Initialize a command buffer with the given number of command entries. | 338 // Initialize a command buffer with the given number of command entries. |
339 // Returns the shared memory handle for the command buffer mapped to the | 339 // Returns the shared memory handle for the command buffer mapped to the |
340 // calling process. | 340 // calling process. |
341 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_Initialize, | 341 IPC_SYNC_MESSAGE_ROUTED2_1(GpuCommandBufferMsg_Initialize, |
342 base::SharedMemoryHandle /* ring_buffer */, | 342 base::SharedMemoryHandle /* ring_buffer */, |
343 int32 /* size */, | 343 int32 /* size */, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 // Instruct the renderer to release all generated textures. | 456 // Instruct the renderer to release all generated textures. |
457 IPC_MESSAGE_ROUTED0(GpuTransportTextureHostMsg_ReleaseTextures) | 457 IPC_MESSAGE_ROUTED0(GpuTransportTextureHostMsg_ReleaseTextures) |
458 | 458 |
459 // Notify a texture has been updated. The texture id is in the client context. | 459 // Notify a texture has been updated. The texture id is in the client context. |
460 IPC_MESSAGE_ROUTED1(GpuTransportTextureHostMsg_TextureUpdated, | 460 IPC_MESSAGE_ROUTED1(GpuTransportTextureHostMsg_TextureUpdated, |
461 int /* texture_id */) | 461 int /* texture_id */) |
462 | 462 |
463 //------------------------------------------------------------------------------ | 463 //------------------------------------------------------------------------------ |
464 // Accelerated Video Decoder Messages | 464 // Accelerated Video Decoder Messages |
465 // These messages are sent from Renderer process to GPU process. | 465 // These messages are sent from Renderer process to GPU process. |
| 466 // |
| 467 // These messages defer execution until |tokens.last_token_written| is |
| 468 // seen (using |tokens.last_token_read| as a wrap-around indicator). The |
| 469 // implementation REQUIRES that |tokens| be the first parameter of these |
| 470 // messages. |
| 471 |
466 // Message to query configuration information from the GPU process. | 472 // Message to query configuration information from the GPU process. |
467 IPC_SYNC_MESSAGE_CONTROL1_1(AcceleratedVideoDecoderMsg_GetConfigs, | 473 IPC_SYNC_MESSAGE_CONTROL2_1(AcceleratedVideoDecoderMsg_GetConfigs, |
| 474 gpu::ReadWriteTokens, /* tokens */ |
468 std::vector<uint32>, /* Proto config */ | 475 std::vector<uint32>, /* Proto config */ |
469 std::vector<uint32>) /* Matching configs */ | 476 std::vector<uint32>) /* Matching configs */ |
470 | 477 |
471 // Message to initialize the accelerated video decoder. | 478 // Message to initialize the accelerated video decoder. |
472 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Initialize, | 479 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_Initialize, |
| 480 gpu::ReadWriteTokens, /* tokens */ |
473 std::vector<uint32>) /* Config */ | 481 std::vector<uint32>) /* Config */ |
474 | 482 |
475 // Send input buffer for decoding. | 483 // Send input buffer for decoding. |
476 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_Decode, | 484 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_Decode, |
| 485 gpu::ReadWriteTokens, /* tokens */ |
| 486 base::SharedMemoryHandle, /* input_buffer_handle */ |
477 int32, /* bitstream_buffer_id */ | 487 int32, /* bitstream_buffer_id */ |
478 base::SharedMemoryHandle, /* input_buffer_handle */ | |
479 int32) /* size */ | 488 int32) /* size */ |
480 | 489 |
| 490 // Sent from Renderer process to the GPU process to give the texture IDs for |
| 491 // the textures the decoder will use for output. Delays evaluation until |
| 492 // |token.second| is seen. |
| 493 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_AssignTextures, |
| 494 gpu::ReadWriteTokens, /* tokens */ |
| 495 std::vector<int32>, /* Picture buffer ID */ |
| 496 std::vector<uint32>, /* Texture ID */ |
| 497 std::vector<gfx::Size>) /* Size */ |
| 498 |
481 // Sent from Renderer process to the GPU process to give the system memory | 499 // Sent from Renderer process to the GPU process to give the system memory |
482 // buffers that the decoder will use for output. | 500 // buffers that the decoder will use for output. |
483 // | 501 // |
484 // The length of the list of SharedMemoryHandles cannot exceed | 502 // The length of the list of SharedMemoryHandles cannot exceed |
485 // FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE; see | 503 // FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE; see |
486 // ipc/file_descriptor_set_posix. | 504 // ipc/file_descriptor_set_posix. |
487 IPC_MESSAGE_ROUTED3(AcceleratedVideoDecoderMsg_AssignSysmemBuffers, | 505 IPC_MESSAGE_ROUTED4(AcceleratedVideoDecoderMsg_AssignSysmemBuffers, |
| 506 gpu::ReadWriteTokens, /* tokens */ |
488 std::vector<int32>, /* Picture buffer ID */ | 507 std::vector<int32>, /* Picture buffer ID */ |
489 std::vector<base::SharedMemoryHandle>, /* Sysmem buffer */ | 508 std::vector<base::SharedMemoryHandle>, /* Sysmem buffer */ |
490 std::vector<gfx::Size>) /* Size */ | 509 std::vector<gfx::Size>) /* Size */ |
491 | 510 |
492 // Send from Renderer process to the GPU process to recycle the given picture | 511 // Send from Renderer process to the GPU process to recycle the given picture |
493 // buffer for further decoding. | 512 // buffer for further decoding. |
494 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_ReusePictureBuffer, | 513 IPC_MESSAGE_ROUTED2(AcceleratedVideoDecoderMsg_ReusePictureBuffer, |
| 514 gpu::ReadWriteTokens, /* tokens */ |
495 int32) /* Picture buffer ID */ | 515 int32) /* Picture buffer ID */ |
496 | 516 |
497 // Send flush request to the decoder. | 517 // Send flush request to the decoder. |
498 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Flush) | 518 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Flush, |
| 519 gpu::ReadWriteTokens) /* tokens */ |
499 | 520 |
500 // Send abort request to the decoder. | 521 // Send abort request to the decoder. |
501 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderMsg_Abort) | 522 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderMsg_Abort, |
| 523 gpu::ReadWriteTokens) /* tokens */ |
502 | 524 |
503 // Destroy and release decoder asynchronously. | 525 // Destroy and release decoder asynchronously. |
504 IPC_SYNC_MESSAGE_CONTROL0_0(AcceleratedVideoDecoderMsg_Destroy) | 526 IPC_SYNC_MESSAGE_CONTROL1_0(AcceleratedVideoDecoderMsg_Destroy, |
| 527 gpu::ReadWriteTokens) /* tokens */ |
505 | 528 |
506 //------------------------------------------------------------------------------ | 529 //------------------------------------------------------------------------------ |
507 // Accelerated Video Decoder Host Messages | 530 // Accelerated Video Decoder Host Messages |
508 // These messages are sent from GPU process to Renderer process. | 531 // These messages are sent from GPU process to Renderer process. |
509 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been | 532 // Inform AcceleratedVideoDecoderHost that AcceleratedVideoDecoder has been |
510 // created. | 533 // created. |
511 | 534 |
512 // Accelerated video decoder has consumed input buffer from transfer buffer. | 535 // Accelerated video decoder has consumed input buffer from transfer buffer. |
513 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, | 536 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed, |
514 int32) /* Processed buffer ID */ | 537 int32) /* Processed buffer ID */ |
(...skipping 28 matching lines...) Expand all Loading... |
543 | 566 |
544 // Confirm decoder has been aborted. | 567 // Confirm decoder has been aborted. |
545 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_AbortDone) | 568 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_AbortDone) |
546 | 569 |
547 // Decoder has faced end of stream marker in the stream. | 570 // Decoder has faced end of stream marker in the stream. |
548 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_EndOfStream) | 571 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_EndOfStream) |
549 | 572 |
550 // Video decoder has encountered an error. | 573 // Video decoder has encountered an error. |
551 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, | 574 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, |
552 uint32) /* Error ID */ | 575 uint32) /* Error ID */ |
OLD | NEW |