OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 | 5 // Multiply-included message file, hence no include guard here, but see below |
6 // for a much smaller-than-usual include guard section. | 6 // for a much smaller-than-usual include guard section. |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
13 #include "content/common/gpu/gpu_memory_allocation.h" | 13 #include "content/common/gpu/gpu_memory_allocation.h" |
14 #include "content/common/gpu/gpu_memory_uma_stats.h" | 14 #include "content/common/gpu/gpu_memory_uma_stats.h" |
15 #include "content/common/gpu/gpu_process_launch_causes.h" | 15 #include "content/common/gpu/gpu_process_launch_causes.h" |
16 #include "content/common/gpu/gpu_rendering_stats.h" | 16 #include "content/common/gpu/gpu_rendering_stats.h" |
17 #include "content/public/common/common_param_traits.h" | 17 #include "content/public/common/common_param_traits.h" |
18 #include "content/public/common/gpu_memory_stats.h" | 18 #include "content/public/common/gpu_memory_stats.h" |
19 #include "gpu/command_buffer/common/command_buffer.h" | 19 #include "gpu/command_buffer/common/command_buffer.h" |
20 #include "gpu/command_buffer/common/constants.h" | 20 #include "gpu/command_buffer/common/constants.h" |
21 #include "gpu/command_buffer/common/mailbox.h" | 21 #include "gpu/command_buffer/common/mailbox.h" |
22 #include "gpu/config/gpu_info.h" | 22 #include "gpu/config/gpu_info.h" |
23 #include "gpu/ipc/gpu_command_buffer_traits.h" | 23 #include "gpu/ipc/gpu_command_buffer_traits.h" |
24 #include "ipc/ipc_channel_handle.h" | 24 #include "ipc/ipc_channel_handle.h" |
25 #include "ipc/ipc_message_macros.h" | 25 #include "ipc/ipc_message_macros.h" |
26 #include "media/base/video_frame.h" | |
27 #include "media/video/video_decode_accelerator.h" | 26 #include "media/video/video_decode_accelerator.h" |
28 #include "media/video/video_encode_accelerator.h" | |
29 #include "ui/base/latency_info.h" | 27 #include "ui/base/latency_info.h" |
30 #include "ui/gfx/native_widget_types.h" | 28 #include "ui/gfx/native_widget_types.h" |
31 #include "ui/gfx/size.h" | 29 #include "ui/gfx/size.h" |
32 #include "ui/gl/gpu_preference.h" | 30 #include "ui/gl/gpu_preference.h" |
33 | 31 |
34 #if defined(OS_ANDROID) | 32 #if defined(OS_ANDROID) |
35 #include "content/common/android/surface_texture_peer.h" | 33 #include "content/common/android/surface_texture_peer.h" |
36 #endif | 34 #endif |
37 | 35 |
38 #define IPC_MESSAGE_START GpuMsgStart | 36 #define IPC_MESSAGE_START GpuMsgStart |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 | 210 |
213 IPC_STRUCT_TRAITS_BEGIN(content::GpuRenderingStats) | 211 IPC_STRUCT_TRAITS_BEGIN(content::GpuRenderingStats) |
214 IPC_STRUCT_TRAITS_MEMBER(global_texture_upload_count) | 212 IPC_STRUCT_TRAITS_MEMBER(global_texture_upload_count) |
215 IPC_STRUCT_TRAITS_MEMBER(global_total_texture_upload_time) | 213 IPC_STRUCT_TRAITS_MEMBER(global_total_texture_upload_time) |
216 IPC_STRUCT_TRAITS_MEMBER(texture_upload_count) | 214 IPC_STRUCT_TRAITS_MEMBER(texture_upload_count) |
217 IPC_STRUCT_TRAITS_MEMBER(total_texture_upload_time) | 215 IPC_STRUCT_TRAITS_MEMBER(total_texture_upload_time) |
218 IPC_STRUCT_TRAITS_MEMBER(global_total_processing_commands_time) | 216 IPC_STRUCT_TRAITS_MEMBER(global_total_processing_commands_time) |
219 IPC_STRUCT_TRAITS_MEMBER(total_processing_commands_time) | 217 IPC_STRUCT_TRAITS_MEMBER(total_processing_commands_time) |
220 IPC_STRUCT_TRAITS_END() | 218 IPC_STRUCT_TRAITS_END() |
221 | 219 |
222 IPC_ENUM_TRAITS(media::VideoFrame::Format) | |
223 | |
224 IPC_ENUM_TRAITS(media::VideoEncodeAccelerator::Error) | |
225 | |
226 //------------------------------------------------------------------------------ | 220 //------------------------------------------------------------------------------ |
227 // GPU Messages | 221 // GPU Messages |
228 // These are messages from the browser to the GPU process. | 222 // These are messages from the browser to the GPU process. |
229 | 223 |
230 // Tells the GPU process to initialize itself. The browser explicitly | 224 // Tells the GPU process to initialize itself. The browser explicitly |
231 // requests this be done so that we are guaranteed that the channel is set | 225 // requests this be done so that we are guaranteed that the channel is set |
232 // up between the browser and GPU process before doing any work that might | 226 // up between the browser and GPU process before doing any work that might |
233 // potentially crash the GPU process. Detection of the child process | 227 // potentially crash the GPU process. Detection of the child process |
234 // exiting abruptly is predicated on having the IPC channel set up. | 228 // exiting abruptly is predicated on having the IPC channel set up. |
235 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize) | 229 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize) |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 std::vector<gpu::Mailbox> /* mailbox_names */) | 440 std::vector<gpu::Mailbox> /* mailbox_names */) |
447 | 441 |
448 // Generates n new unique mailbox names asynchronously. | 442 // Generates n new unique mailbox names asynchronously. |
449 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesAsync, | 443 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesAsync, |
450 unsigned /* num */) | 444 unsigned /* num */) |
451 | 445 |
452 // Reply to GpuChannelMsg_GenerateMailboxNamesAsync. | 446 // Reply to GpuChannelMsg_GenerateMailboxNamesAsync. |
453 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesReply, | 447 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesReply, |
454 std::vector<gpu::Mailbox> /* mailbox_names */) | 448 std::vector<gpu::Mailbox> /* mailbox_names */) |
455 | 449 |
456 // Create a new GPU-accelerated video encoder. | |
457 IPC_SYNC_MESSAGE_CONTROL0_1(GpuChannelMsg_CreateVideoEncoder, | |
458 int32 /* route_id */) | |
459 | |
460 IPC_MESSAGE_CONTROL1(GpuChannelMsg_DestroyVideoEncoder, int32 /* route_id */) | |
461 | |
462 #if defined(OS_ANDROID) | 450 #if defined(OS_ANDROID) |
463 // Register the StreamTextureProxy class with the GPU process, so that | 451 // Register the StreamTextureProxy class with the GPU process, so that |
464 // the renderer process will get notified whenever a frame becomes available. | 452 // the renderer process will get notified whenever a frame becomes available. |
465 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_RegisterStreamTextureProxy, | 453 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_RegisterStreamTextureProxy, |
466 int32, /* stream_id */ | 454 int32, /* stream_id */ |
467 int /* route_id */) | 455 int /* route_id */) |
468 | 456 |
469 // Tells the GPU process create and send the java surface texture object to | 457 // Tells the GPU process create and send the java surface texture object to |
470 // the renderer process through the binder thread. | 458 // the renderer process through the binder thread. |
471 IPC_MESSAGE_CONTROL3(GpuChannelMsg_EstablishStreamTexture, | 459 IPC_MESSAGE_CONTROL3(GpuChannelMsg_EstablishStreamTexture, |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 | 683 |
696 // Confirm decoder has been flushed. | 684 // Confirm decoder has been flushed. |
697 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone) | 685 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone) |
698 | 686 |
699 // Confirm decoder has been reset. | 687 // Confirm decoder has been reset. |
700 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone) | 688 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone) |
701 | 689 |
702 // Video decoder has encountered an error. | 690 // Video decoder has encountered an error. |
703 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, | 691 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, |
704 uint32) /* Error ID */ | 692 uint32) /* Error ID */ |
705 | |
706 //------------------------------------------------------------------------------ | |
707 // Accelerated Video Encoder Messages | |
708 // These messages are sent from the Renderer process to GPU process. | |
709 | |
710 // Initialize the accelerated encoder. | |
711 IPC_MESSAGE_ROUTED4(AcceleratedVideoEncoderMsg_Initialize, | |
712 media::VideoFrame::Format /* input_format */, | |
713 gfx::Size /* input_visible_size */, | |
714 media::VideoCodecProfile /* output_profile */, | |
715 uint32 /* initial_bitrate */) | |
716 | |
717 // Queue a input buffer to the encoder to encode. |frame_id| will be returned by | |
718 // AcceleratedVideoEncoderHostMsg_NotifyEncodeDone. | |
719 IPC_MESSAGE_ROUTED4(AcceleratedVideoEncoderMsg_Encode, | |
720 int32 /* frame_id */, | |
721 base::SharedMemoryHandle /* buffer_handle */, | |
722 uint32 /* buffer_size */, | |
723 bool /* force_keyframe */) | |
724 | |
725 // Queue a buffer to the encoder for use in returning output. |buffer_id| will | |
726 // be returned by AcceleratedVideoEncoderHostMsg_BitstreamBufferReady. | |
727 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderMsg_UseOutputBitstreamBuffer, | |
728 int32 /* buffer_id */, | |
729 base::SharedMemoryHandle /* buffer_handle */, | |
730 uint32 /* buffer_size */) | |
731 | |
732 // Request a runtime encoding parameter change. | |
733 IPC_MESSAGE_ROUTED2(AcceleratedVideoEncoderMsg_RequestEncodingParametersChange, | |
734 uint32 /* bitrate */, | |
735 uint32 /* framerate */) | |
736 | |
737 //------------------------------------------------------------------------------ | |
738 // Accelerated Video Encoder Host Messages | |
739 // These messages are sent from GPU process to Renderer process. | |
740 | |
741 // Notify of the completion of initialization. | |
742 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderHostMsg_NotifyInitializeDone) | |
743 | |
744 // Notify renderer of the input/output buffer requirements of the encoder. | |
745 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers, | |
746 uint32 /* input_count */, | |
747 gfx::Size /* input_coded_size */, | |
748 uint32 /* output_buffer_size */) | |
749 | |
750 // Notify the renderer that the encoder has finished using an input buffer. | |
751 // There is no congruent entry point in the media::VideoEncodeAccelerator | |
752 // interface, in VEA this same done condition is indicated by dropping the | |
753 // reference to the media::VideoFrame passed to VEA::Encode(). | |
754 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyInputDone, | |
755 int32 /* frame_id */) | |
756 | |
757 // Notify the renderer that an output buffer has been filled with encoded data. | |
758 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady, | |
759 int32 /* bitstream_buffer_id */, | |
760 uint32 /* payload_size */, | |
761 bool /* key_frame */) | |
762 | |
763 // Report error condition. | |
764 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError, | |
765 media::VideoEncodeAccelerator::Error /* error */) | |
OLD | NEW |