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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
742 | 745 |
743 void GpuCommandBufferStub::PutChanged() { | 746 void GpuCommandBufferStub::PutChanged() { |
744 FastSetActiveURL(active_url_, active_url_hash_); | 747 FastSetActiveURL(active_url_, active_url_hash_); |
745 scheduler_->PutChanged(); | 748 scheduler_->PutChanged(); |
746 } | 749 } |
747 | 750 |
748 void GpuCommandBufferStub::OnCreateVideoDecoder( | 751 void GpuCommandBufferStub::OnCreateVideoDecoder( |
749 media::VideoCodecProfile profile, | 752 media::VideoCodecProfile profile, |
750 IPC::Message* reply_message) { | 753 IPC::Message* reply_message) { |
751 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); | 754 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); |
752 int decoder_route_id = channel_->GenerateRouteID(); | 755 int32 decoder_route_id = channel_->GenerateRouteID(); |
753 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( | 756 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( |
754 decoder_route_id, this, channel_->io_message_loop()); | 757 decoder_route_id, this, channel_->io_message_loop()); |
755 decoder->Initialize(profile, reply_message); | 758 decoder->Initialize(profile, reply_message); |
Ami GONE FROM CHROMIUM
2014/03/17 03:17:54
It is at best suspicious that the return value is
sheu
2014/03/18 22:38:35
Aha! Note that GpuVideoDecodeAccelerator _doesn't
Ami GONE FROM CHROMIUM
2014/03/18 23:53:19
lolnice
| |
756 // decoder is registered as a DestructionObserver of this stub and will | 759 // decoder is registered as a DestructionObserver of this stub and will |
757 // self-delete during destruction of this stub. | 760 // self-delete during destruction of this stub. |
758 } | 761 } |
759 | 762 |
763 void GpuCommandBufferStub::OnCreateVideoEncoder( | |
764 media::VideoFrame::Format input_format, | |
765 const gfx::Size& input_visible_size, | |
766 media::VideoCodecProfile output_profile, | |
767 uint32 initial_bitrate, | |
768 IPC::Message* reply_message) { | |
769 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoEncoder"); | |
770 int32 encoder_route_id = channel_->GenerateRouteID(); | |
771 GpuVideoEncodeAccelerator* encoder = | |
772 new GpuVideoEncodeAccelerator(encoder_route_id, this); | |
773 encoder->Initialize(input_format, | |
Ami GONE FROM CHROMIUM
2014/03/17 03:17:54
ditto
(should the interfaces use WARN_UNUSED_RESU
sheu
2014/03/18 22:38:35
See above.
| |
774 input_visible_size, | |
775 output_profile, | |
776 initial_bitrate, | |
777 reply_message); | |
778 // encoder is registered as a DestructionObserver of this stub and will | |
779 // self-delete during destruction of this stub. | |
780 } | |
781 | |
760 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { | 782 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { |
761 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); | 783 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); |
762 if (memory_manager_client_state_) | 784 if (memory_manager_client_state_) |
763 memory_manager_client_state_->SetVisible(visible); | 785 memory_manager_client_state_->SetVisible(visible); |
764 } | 786 } |
765 | 787 |
766 void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) { | 788 void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) { |
767 sync_points_.push_back(sync_point); | 789 sync_points_.push_back(sync_point); |
768 } | 790 } |
769 | 791 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
973 if (decoder_) | 995 if (decoder_) |
974 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); | 996 decoder_->LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB); |
975 command_buffer_->SetParseError(gpu::error::kLostContext); | 997 command_buffer_->SetParseError(gpu::error::kLostContext); |
976 } | 998 } |
977 | 999 |
978 uint64 GpuCommandBufferStub::GetMemoryUsage() const { | 1000 uint64 GpuCommandBufferStub::GetMemoryUsage() const { |
979 return GetMemoryManager()->GetClientMemoryUsage(this); | 1001 return GetMemoryManager()->GetClientMemoryUsage(this); |
980 } | 1002 } |
981 | 1003 |
982 } // namespace content | 1004 } // namespace content |
OLD | NEW |