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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/hash.h" | 9 #include "base/hash.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "content/common/gpu/devtools_gpu_instrumentation.h" | 13 #include "content/common/gpu/devtools_gpu_instrumentation.h" |
14 #include "content/common/gpu/gpu_channel.h" | 14 #include "content/common/gpu/gpu_channel.h" |
15 #include "content/common/gpu/gpu_channel_manager.h" | 15 #include "content/common/gpu/gpu_channel_manager.h" |
16 #include "content/common/gpu/gpu_command_buffer_stub.h" | 16 #include "content/common/gpu/gpu_command_buffer_stub.h" |
17 #include "content/common/gpu/gpu_memory_manager.h" | 17 #include "content/common/gpu/gpu_memory_manager.h" |
18 #include "content/common/gpu/gpu_memory_tracking.h" | 18 #include "content/common/gpu/gpu_memory_tracking.h" |
19 #include "content/common/gpu/gpu_messages.h" | 19 #include "content/common/gpu/gpu_messages.h" |
20 #include "content/common/gpu/gpu_watchdog.h" | 20 #include "content/common/gpu/gpu_watchdog.h" |
21 #include "content/common/gpu/image_transport_surface.h" | 21 #include "content/common/gpu/image_transport_surface.h" |
22 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" | 22 #include "content/common/gpu/media/gpu_video_decode_accelerator.h" |
| 23 #include "content/common/gpu/media/gpu_video_encode_accelerator.h" |
23 #include "content/common/gpu/sync_point_manager.h" | 24 #include "content/common/gpu/sync_point_manager.h" |
24 #include "content/public/common/content_client.h" | 25 #include "content/public/common/content_client.h" |
25 #include "gpu/command_buffer/common/constants.h" | 26 #include "gpu/command_buffer/common/constants.h" |
26 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 27 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
27 #include "gpu/command_buffer/common/mailbox.h" | 28 #include "gpu/command_buffer/common/mailbox.h" |
28 #include "gpu/command_buffer/service/gl_context_virtual.h" | 29 #include "gpu/command_buffer/service/gl_context_virtual.h" |
29 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" | 30 #include "gpu/command_buffer/service/gl_state_restorer_impl.h" |
30 #include "gpu/command_buffer/service/gpu_control_service.h" | 31 #include "gpu/command_buffer/service/gpu_control_service.h" |
31 #include "gpu/command_buffer/service/image_manager.h" | 32 #include "gpu/command_buffer/service/image_manager.h" |
32 #include "gpu/command_buffer/service/logger.h" | 33 #include "gpu/command_buffer/service/logger.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 OnGetStateFast); | 199 OnGetStateFast); |
199 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); | 200 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); |
200 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo); | 201 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo); |
201 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); | 202 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); |
202 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, | 203 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, |
203 OnRegisterTransferBuffer); | 204 OnRegisterTransferBuffer); |
204 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, | 205 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, |
205 OnDestroyTransferBuffer); | 206 OnDestroyTransferBuffer); |
206 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, | 207 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, |
207 OnCreateVideoDecoder) | 208 OnCreateVideoDecoder) |
| 209 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoEncoder, |
| 210 OnCreateVideoEncoder) |
208 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, | 211 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, |
209 OnSetSurfaceVisible) | 212 OnSetSurfaceVisible) |
210 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, | 213 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, |
211 OnRetireSyncPoint) | 214 OnRetireSyncPoint) |
212 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, | 215 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, |
213 OnSignalSyncPoint) | 216 OnSignalSyncPoint) |
214 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, | 217 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, |
215 OnSignalQuery) | 218 OnSignalQuery) |
216 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SendClientManagedMemoryStats, | 219 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SendClientManagedMemoryStats, |
217 OnReceivedClientManagedMemoryStats) | 220 OnReceivedClientManagedMemoryStats) |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 720 |
718 void GpuCommandBufferStub::PutChanged() { | 721 void GpuCommandBufferStub::PutChanged() { |
719 FastSetActiveURL(active_url_, active_url_hash_); | 722 FastSetActiveURL(active_url_, active_url_hash_); |
720 scheduler_->PutChanged(); | 723 scheduler_->PutChanged(); |
721 } | 724 } |
722 | 725 |
723 void GpuCommandBufferStub::OnCreateVideoDecoder( | 726 void GpuCommandBufferStub::OnCreateVideoDecoder( |
724 media::VideoCodecProfile profile, | 727 media::VideoCodecProfile profile, |
725 IPC::Message* reply_message) { | 728 IPC::Message* reply_message) { |
726 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); | 729 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); |
727 int decoder_route_id = channel_->GenerateRouteID(); | 730 int32 decoder_route_id = channel_->GenerateRouteID(); |
728 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( | 731 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( |
729 decoder_route_id, this, channel_->io_message_loop()); | 732 decoder_route_id, this, channel_->io_message_loop()); |
730 decoder->Initialize(profile, reply_message); | 733 decoder->Initialize(profile, reply_message); |
731 // decoder is registered as a DestructionObserver of this stub and will | 734 // decoder is registered as a DestructionObserver of this stub and will |
732 // self-delete during destruction of this stub. | 735 // self-delete during destruction of this stub. |
733 } | 736 } |
734 | 737 |
| 738 void GpuCommandBufferStub::OnCreateVideoEncoder( |
| 739 media::VideoFrame::Format input_format, |
| 740 const gfx::Size& input_visible_size, |
| 741 media::VideoCodecProfile output_profile, |
| 742 uint32 initial_bitrate, |
| 743 IPC::Message* reply_message) { |
| 744 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoEncoder"); |
| 745 int32 encoder_route_id = channel_->GenerateRouteID(); |
| 746 GpuVideoEncodeAccelerator* encoder = |
| 747 new GpuVideoEncodeAccelerator(encoder_route_id, this); |
| 748 encoder->Initialize(input_format, |
| 749 input_visible_size, |
| 750 output_profile, |
| 751 initial_bitrate, |
| 752 reply_message); |
| 753 // encoder is registered as a DestructionObserver of this stub and will |
| 754 // self-delete during destruction of this stub. |
| 755 } |
| 756 |
735 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { | 757 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { |
736 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); | 758 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); |
737 if (memory_manager_client_state_) | 759 if (memory_manager_client_state_) |
738 memory_manager_client_state_->SetVisible(visible); | 760 memory_manager_client_state_->SetVisible(visible); |
739 } | 761 } |
740 | 762 |
741 void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) { | 763 void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) { |
742 sync_points_.push_back(sync_point); | 764 sync_points_.push_back(sync_point); |
743 } | 765 } |
744 | 766 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 if (decoder_) | 981 if (decoder_) |
960 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 982 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
961 command_buffer_->SetParseError(gpu::error::kLostContext); | 983 command_buffer_->SetParseError(gpu::error::kLostContext); |
962 } | 984 } |
963 | 985 |
964 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 986 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
965 return GetMemoryManager()->GetClientMemoryUsage(this); | 987 return GetMemoryManager()->GetClientMemoryUsage(this); |
966 } | 988 } |
967 | 989 |
968 } // namespace content | 990 } // namespace content |
OLD | NEW |