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" | |
26 #include "media/video/video_decode_accelerator.h" | 27 #include "media/video/video_decode_accelerator.h" |
28 #include "media/video/video_encode_accelerator.h" | |
27 #include "ui/base/latency_info.h" | 29 #include "ui/base/latency_info.h" |
28 #include "ui/gfx/native_widget_types.h" | 30 #include "ui/gfx/native_widget_types.h" |
29 #include "ui/gfx/size.h" | 31 #include "ui/gfx/size.h" |
30 #include "ui/gl/gpu_preference.h" | 32 #include "ui/gl/gpu_preference.h" |
31 | 33 |
32 #if defined(OS_ANDROID) | 34 #if defined(OS_ANDROID) |
33 #include "content/common/android/surface_texture_peer.h" | 35 #include "content/common/android/surface_texture_peer.h" |
34 #endif | 36 #endif |
35 | 37 |
36 #define IPC_MESSAGE_START GpuMsgStart | 38 #define IPC_MESSAGE_START GpuMsgStart |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 | 212 |
211 IPC_STRUCT_TRAITS_BEGIN(content::GpuRenderingStats) | 213 IPC_STRUCT_TRAITS_BEGIN(content::GpuRenderingStats) |
212 IPC_STRUCT_TRAITS_MEMBER(global_texture_upload_count) | 214 IPC_STRUCT_TRAITS_MEMBER(global_texture_upload_count) |
213 IPC_STRUCT_TRAITS_MEMBER(global_total_texture_upload_time) | 215 IPC_STRUCT_TRAITS_MEMBER(global_total_texture_upload_time) |
214 IPC_STRUCT_TRAITS_MEMBER(texture_upload_count) | 216 IPC_STRUCT_TRAITS_MEMBER(texture_upload_count) |
215 IPC_STRUCT_TRAITS_MEMBER(total_texture_upload_time) | 217 IPC_STRUCT_TRAITS_MEMBER(total_texture_upload_time) |
216 IPC_STRUCT_TRAITS_MEMBER(global_total_processing_commands_time) | 218 IPC_STRUCT_TRAITS_MEMBER(global_total_processing_commands_time) |
217 IPC_STRUCT_TRAITS_MEMBER(total_processing_commands_time) | 219 IPC_STRUCT_TRAITS_MEMBER(total_processing_commands_time) |
218 IPC_STRUCT_TRAITS_END() | 220 IPC_STRUCT_TRAITS_END() |
219 | 221 |
222 IPC_ENUM_TRAITS(media::VideoFrame::Format) | |
223 | |
224 IPC_ENUM_TRAITS(media::VideoEncodeAccelerator::Error) | |
225 | |
220 //------------------------------------------------------------------------------ | 226 //------------------------------------------------------------------------------ |
221 // GPU Messages | 227 // GPU Messages |
222 // These are messages from the browser to the GPU process. | 228 // These are messages from the browser to the GPU process. |
223 | 229 |
224 // Tells the GPU process to initialize itself. The browser explicitly | 230 // Tells the GPU process to initialize itself. The browser explicitly |
225 // requests this be done so that we are guaranteed that the channel is set | 231 // requests this be done so that we are guaranteed that the channel is set |
226 // up between the browser and GPU process before doing any work that might | 232 // up between the browser and GPU process before doing any work that might |
227 // potentially crash the GPU process. Detection of the child process | 233 // potentially crash the GPU process. Detection of the child process |
228 // exiting abruptly is predicated on having the IPC channel set up. | 234 // exiting abruptly is predicated on having the IPC channel set up. |
229 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize) | 235 IPC_MESSAGE_CONTROL0(GpuMsg_Initialize) |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
440 std::vector<gpu::Mailbox> /* mailbox_names */) | 446 std::vector<gpu::Mailbox> /* mailbox_names */) |
441 | 447 |
442 // Generates n new unique mailbox names asynchronously. | 448 // Generates n new unique mailbox names asynchronously. |
443 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesAsync, | 449 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesAsync, |
444 unsigned /* num */) | 450 unsigned /* num */) |
445 | 451 |
446 // Reply to GpuChannelMsg_GenerateMailboxNamesAsync. | 452 // Reply to GpuChannelMsg_GenerateMailboxNamesAsync. |
447 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesReply, | 453 IPC_MESSAGE_CONTROL1(GpuChannelMsg_GenerateMailboxNamesReply, |
448 std::vector<gpu::Mailbox> /* mailbox_names */) | 454 std::vector<gpu::Mailbox> /* mailbox_names */) |
449 | 455 |
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 | |
450 #if defined(OS_ANDROID) | 462 #if defined(OS_ANDROID) |
451 // Register the StreamTextureProxy class with the GPU process, so that | 463 // Register the StreamTextureProxy class with the GPU process, so that |
452 // the renderer process will get notified whenever a frame becomes available. | 464 // the renderer process will get notified whenever a frame becomes available. |
453 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_RegisterStreamTextureProxy, | 465 IPC_SYNC_MESSAGE_CONTROL1_1(GpuChannelMsg_RegisterStreamTextureProxy, |
454 int32, /* stream_id */ | 466 int32, /* stream_id */ |
455 int /* route_id */) | 467 int /* route_id */) |
456 | 468 |
457 // Tells the GPU process create and send the java surface texture object to | 469 // Tells the GPU process create and send the java surface texture object to |
458 // the renderer process through the binder thread. | 470 // the renderer process through the binder thread. |
459 IPC_MESSAGE_CONTROL3(GpuChannelMsg_EstablishStreamTexture, | 471 IPC_MESSAGE_CONTROL3(GpuChannelMsg_EstablishStreamTexture, |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
683 | 695 |
684 // Confirm decoder has been flushed. | 696 // Confirm decoder has been flushed. |
685 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone) | 697 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_FlushDone) |
686 | 698 |
687 // Confirm decoder has been reset. | 699 // Confirm decoder has been reset. |
688 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone) | 700 IPC_MESSAGE_ROUTED0(AcceleratedVideoDecoderHostMsg_ResetDone) |
689 | 701 |
690 // Video decoder has encountered an error. | 702 // Video decoder has encountered an error. |
691 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, | 703 IPC_MESSAGE_ROUTED1(AcceleratedVideoDecoderHostMsg_ErrorNotification, |
692 uint32) /* Error ID */ | 704 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 int32 /* 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_ROUTED1(AcceleratedVideoEncoderMsg_RequestEncodingParameterChange, | |
734 int32 /* bitrate */) | |
735 | |
736 //------------------------------------------------------------------------------ | |
737 // Accelerated Video Encoder Host Messages | |
738 // These messages are sent from GPU process to Renderer process. | |
739 | |
740 // Notify of the completion of initialization. | |
741 IPC_MESSAGE_ROUTED0(AcceleratedVideoEncoderHostMsg_NotifyInitializeDone) | |
742 | |
743 // Notify renderer of the input/output buffer requirements of the encoder. | |
744 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_RequireBitstreamBuffers, | |
745 int /* input_count */, | |
746 gfx::Size /* input_coded_size */, | |
747 uint32 /* output_buffer_size */) | |
748 | |
749 // Notify the renderer that encoding has been completed on an input buffer. | |
Ami GONE FROM CHROMIUM
2013/08/06 20:41:13
really? I thought this notification was that the
sheu
2013/08/07 09:25:03
Reworded and renamed. This comment is a little ob
| |
750 // There is not congruent entry point in the media::VideoEncodeAccelerator | |
Ami GONE FROM CHROMIUM
2013/08/06 20:41:13
s/congruent/congruent to/
sheu
2013/08/07 09:25:03
Changed, but not that way.
| |
751 // interface, as the duration of encoding is implicit in the lifespan of the | |
752 // media::VideoFrame passed to VEA::Encode(). | |
753 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyEncodeDone, | |
754 int32 /* frame_id */) | |
755 | |
756 // Notify the renderer that an output buffer has been filled with encoded data. | |
757 IPC_MESSAGE_ROUTED3(AcceleratedVideoEncoderHostMsg_BitstreamBufferReady, | |
758 int32 /* bitstream_buffer_id */, | |
759 uint32 /* payload_size */, | |
760 bool /* key_frame */) | |
761 | |
762 // Report error condition. | |
763 IPC_MESSAGE_ROUTED1(AcceleratedVideoEncoderHostMsg_NotifyError, | |
764 media::VideoEncodeAccelerator::Error /* error */) | |
OLD | NEW |