Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 185403020: Make VEA client of command buffer; move sync. IPC to VDA/VEA::Initialize() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 890d8f71 last fischman@ bits Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_GetTransferBuffer, 207 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer,
207 OnGetTransferBuffer); 208 OnGetTransferBuffer);
208 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, 209 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder,
209 OnCreateVideoDecoder) 210 OnCreateVideoDecoder)
211 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoEncoder,
212 OnCreateVideoEncoder)
210 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, 213 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible,
211 OnSetSurfaceVisible) 214 OnSetSurfaceVisible)
212 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, 215 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint,
213 OnRetireSyncPoint) 216 OnRetireSyncPoint)
214 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, 217 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint,
215 OnSignalSyncPoint) 218 OnSignalSyncPoint)
216 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery, 219 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalQuery,
217 OnSignalQuery) 220 OnSignalQuery)
218 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SendClientManagedMemoryStats, 221 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SendClientManagedMemoryStats,
219 OnReceivedClientManagedMemoryStats) 222 OnReceivedClientManagedMemoryStats)
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 746
744 void GpuCommandBufferStub::PutChanged() { 747 void GpuCommandBufferStub::PutChanged() {
745 FastSetActiveURL(active_url_, active_url_hash_); 748 FastSetActiveURL(active_url_, active_url_hash_);
746 scheduler_->PutChanged(); 749 scheduler_->PutChanged();
747 } 750 }
748 751
749 void GpuCommandBufferStub::OnCreateVideoDecoder( 752 void GpuCommandBufferStub::OnCreateVideoDecoder(
750 media::VideoCodecProfile profile, 753 media::VideoCodecProfile profile,
751 IPC::Message* reply_message) { 754 IPC::Message* reply_message) {
752 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder"); 755 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoDecoder");
753 int decoder_route_id = channel_->GenerateRouteID(); 756 int32 decoder_route_id = channel_->GenerateRouteID();
754 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator( 757 GpuVideoDecodeAccelerator* decoder = new GpuVideoDecodeAccelerator(
755 decoder_route_id, this, channel_->io_message_loop()); 758 decoder_route_id, this, channel_->io_message_loop());
756 decoder->Initialize(profile, reply_message); 759 decoder->Initialize(profile, reply_message);
757 // decoder is registered as a DestructionObserver of this stub and will 760 // decoder is registered as a DestructionObserver of this stub and will
758 // self-delete during destruction of this stub. 761 // self-delete during destruction of this stub.
759 } 762 }
760 763
764 void GpuCommandBufferStub::OnCreateVideoEncoder(
765 media::VideoFrame::Format input_format,
766 const gfx::Size& input_visible_size,
767 media::VideoCodecProfile output_profile,
768 uint32 initial_bitrate,
769 IPC::Message* reply_message) {
770 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnCreateVideoEncoder");
771 int32 encoder_route_id = channel_->GenerateRouteID();
772 GpuVideoEncodeAccelerator* encoder =
773 new GpuVideoEncodeAccelerator(encoder_route_id, this);
774 encoder->Initialize(input_format,
775 input_visible_size,
776 output_profile,
777 initial_bitrate,
778 reply_message);
779 // encoder is registered as a DestructionObserver of this stub and will
780 // self-delete during destruction of this stub.
781 }
782
761 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { 783 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) {
762 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible"); 784 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnSetSurfaceVisible");
763 if (memory_manager_client_state_) 785 if (memory_manager_client_state_)
764 memory_manager_client_state_->SetVisible(visible); 786 memory_manager_client_state_->SetVisible(visible);
765 } 787 }
766 788
767 void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) { 789 void GpuCommandBufferStub::AddSyncPoint(uint32 sync_point) {
768 sync_points_.push_back(sync_point); 790 sync_points_.push_back(sync_point);
769 } 791 }
770 792
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698