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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo); | 200 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetLatencyInfo, OnSetLatencyInfo); |
200 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); | 201 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); |
201 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, | 202 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RegisterTransferBuffer, |
202 OnRegisterTransferBuffer); | 203 OnRegisterTransferBuffer); |
203 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, | 204 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, |
204 OnDestroyTransferBuffer); | 205 OnDestroyTransferBuffer); |
205 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer, | 206 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer, |
206 OnGetTransferBuffer); | 207 OnGetTransferBuffer); |
207 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, | 208 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, |
208 OnCreateVideoDecoder) | 209 OnCreateVideoDecoder) |
| 210 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoEncoder, |
| 211 OnCreateVideoEncoder) |
209 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, | 212 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, |
210 OnSetSurfaceVisible) | 213 OnSetSurfaceVisible) |
211 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, | 214 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, |
212 OnRetireSyncPoint) | 215 OnRetireSyncPoint) |
213 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, | 216 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, |
214 OnSignalSyncPoint) | 217 OnSignalSyncPoint) |
215 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, | 218 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, |
216 OnSignalQuery) | 219 OnSignalQuery) |
217 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SendClientManagedMemoryStats, | 220 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SendClientManagedMemoryStats, |
218 OnReceivedClientManagedMemoryStats) | 221 OnReceivedClientManagedMemoryStats) |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 | 748 |
746 void GpuCommandBufferStub::PutChanged() { | 749 void GpuCommandBufferStub::PutChanged() { |
747 FastSetActiveURL(active_url_, active_url_hash_); | 750 FastSetActiveURL(active_url_, active_url_hash_); |
748 scheduler_->PutChanged(); | 751 scheduler_->PutChanged(); |
749 } | 752 } |
750 | 753 |
751 void GpuCommandBufferStub::OnCreateVideoDecoder( | 754 void GpuCommandBufferStub::OnCreateVideoDecoder( |
752 media::VideoCodecProfile profile, | 755 media::VideoCodecProfile profile, |
753 IPC::Message* reply_message) { | 756 IPC::Message* reply_message) { |
754 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); | 757 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); |
755 int decoder_route_id = channel_->GenerateRouteID(); | 758 int32 decoder_route_id = channel_->GenerateRouteID(); |
756 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( | 759 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( |
757 decoder_route_id, this, channel_->io_message_loop()); | 760 decoder_route_id, this, channel_->io_message_loop()); |
758 decoder->Initialize(profile, reply_message); | 761 decoder->Initialize(profile, reply_message); |
759 // decoder is registered as a DestructionObserver of this stub and will | 762 // decoder is registered as a DestructionObserver of this stub and will |
760 // self-delete during destruction of this stub. | 763 // self-delete during destruction of this stub. |
761 } | 764 } |
762 | 765 |
| 766 void GpuCommandBufferStub::OnCreateVideoEncoder( |
| 767 media::VideoFrame::Format input_format, |
| 768 const gfx::Size& input_visible_size, |
| 769 media::VideoCodecProfile output_profile, |
| 770 uint32 initial_bitrate, |
| 771 IPC::Message* reply_message) { |
| 772 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoEncoder"); |
| 773 int32 encoder_route_id = channel_->GenerateRouteID(); |
| 774 GpuVideoEncodeAccelerator* encoder = |
| 775 new GpuVideoEncodeAccelerator(encoder_route_id, this); |
| 776 encoder->Initialize(input_format, |
| 777 input_visible_size, |
| 778 output_profile, |
| 779 initial_bitrate, |
| 780 reply_message); |
| 781 // encoder is registered as a DestructionObserver of this stub and will |
| 782 // self-delete during destruction of this stub. |
| 783 } |
| 784 |
763 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { | 785 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { |
764 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); | 786 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); |
765 if (memory_manager_client_state_) | 787 if (memory_manager_client_state_) |
766 memory_manager_client_state_->SetVisible(visible); | 788 memory_manager_client_state_->SetVisible(visible); |
767 } | 789 } |
768 | 790 |
769 void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) { | 791 void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) { |
770 sync_points_.push_back(sync_point); | 792 sync_points_.push_back(sync_point); |
771 } | 793 } |
772 | 794 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 if (decoder_) | 998 if (decoder_) |
977 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 999 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
978 command_buffer_->SetParseError(gpu::error::kLostContext); | 1000 command_buffer_->SetParseError(gpu::error::kLostContext); |
979 } | 1001 } |
980 | 1002 |
981 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 1003 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
982 return GetMemoryManager()->GetClientMemoryUsage(this); | 1004 return GetMemoryManager()->GetClientMemoryUsage(this); |
983 } | 1005 } |
984 | 1006 |
985 } // namespace content | 1007 } // namespace content |
OLD | NEW |