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

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

Issue 9380037: Use shared memory to update the renderer's view of the command buffer state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: minor unit test change Created 8 years, 10 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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers 94 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers
95 // here. This is so the reply can be delayed if the scheduler is unscheduled. 95 // here. This is so the reply can be delayed if the scheduler is unscheduled.
96 bool handled = true; 96 bool handled = true;
97 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) 97 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message)
98 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, 98 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize,
99 OnInitialize); 99 OnInitialize);
100 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, 100 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer,
101 OnSetGetBuffer); 101 OnSetGetBuffer);
102 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetSharedStateBuffer,
103 OnSetSharedStateBuffer);
102 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, 104 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent,
103 OnSetParent); 105 OnSetParent);
104 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); 106 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState);
105 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, 107 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast,
106 OnGetStateFast); 108 OnGetStateFast);
107 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); 109 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
108 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); 110 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled);
109 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer, 111 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer,
110 OnCreateTransferBuffer); 112 OnCreateTransferBuffer);
111 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer, 113 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 int32 shm_id, IPC::Message* reply_message) { 299 int32 shm_id, IPC::Message* reply_message) {
298 if (command_buffer_.get()) { 300 if (command_buffer_.get()) {
299 command_buffer_->SetGetBuffer(shm_id); 301 command_buffer_->SetGetBuffer(shm_id);
300 } else { 302 } else {
301 DLOG(ERROR) << "no command_buffer."; 303 DLOG(ERROR) << "no command_buffer.";
302 reply_message->set_reply_error(); 304 reply_message->set_reply_error();
303 } 305 }
304 Send(reply_message); 306 Send(reply_message);
305 } 307 }
306 308
309 void GpuCommandBufferStub::OnSetSharedStateBuffer(
310 int32 shm_id, IPC::Message* reply_message) {
311 if (command_buffer_.get()) {
312 command_buffer_->SetSharedStateBuffer(shm_id);
313 } else {
314 DLOG(ERROR) << "no command_buffer.";
315 reply_message->set_reply_error();
316 }
317 Send(reply_message);
318 }
319
307 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, 320 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id,
308 uint32 parent_texture_id, 321 uint32 parent_texture_id,
309 IPC::Message* reply_message) { 322 IPC::Message* reply_message) {
310 GpuCommandBufferStub* parent_stub = NULL; 323 GpuCommandBufferStub* parent_stub = NULL;
311 if (parent_route_id != MSG_ROUTING_NONE) { 324 if (parent_route_id != MSG_ROUTING_NONE) {
312 parent_stub = channel_->LookupCommandBuffer(parent_route_id); 325 parent_stub = channel_->LookupCommandBuffer(parent_route_id);
313 } 326 }
314 327
315 bool result = true; 328 bool result = true;
316 if (scheduler_.get()) { 329 if (scheduler_.get()) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 if (watchdog_) 492 if (watchdog_)
480 watchdog_->CheckArmed(); 493 watchdog_->CheckArmed();
481 } 494 }
482 495
483 void GpuCommandBufferStub::ReportState() { 496 void GpuCommandBufferStub::ReportState() {
484 gpu::CommandBuffer::State state = command_buffer_->GetState(); 497 gpu::CommandBuffer::State state = command_buffer_->GetState();
485 if (state.error == gpu::error::kLostContext && 498 if (state.error == gpu::error::kLostContext &&
486 gfx::GLContext::LosesAllContextsOnContextLost()) { 499 gfx::GLContext::LosesAllContextsOnContextLost()) {
487 channel_->LoseAllContexts(); 500 channel_->LoseAllContexts();
488 } else { 501 } else {
489 IPC::Message* msg = new GpuCommandBufferMsg_UpdateState(route_id_, state); 502 command_buffer_->UpdateState();
490 msg->set_unblock(true);
491 Send(msg);
492 } 503 }
493 } 504 }
494 505
495 void GpuCommandBufferStub::OnCreateVideoDecoder( 506 void GpuCommandBufferStub::OnCreateVideoDecoder(
496 media::VideoDecodeAccelerator::Profile profile, 507 media::VideoDecodeAccelerator::Profile profile,
497 IPC::Message* reply_message) { 508 IPC::Message* reply_message) {
498 int decoder_route_id = channel_->GenerateRouteID(); 509 int decoder_route_id = channel_->GenerateRouteID();
499 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams( 510 GpuCommandBufferMsg_CreateVideoDecoder::WriteReplyParams(
500 reply_message, decoder_route_id); 511 reply_message, decoder_route_id);
501 GpuVideoDecodeAccelerator* decoder = 512 GpuVideoDecodeAccelerator* decoder =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 DCHECK(has_surface_state()); 551 DCHECK(has_surface_state());
541 return *surface_state_.get(); 552 return *surface_state_.get();
542 } 553 }
543 554
544 void GpuCommandBufferStub::SendMemoryAllocationToProxy( 555 void GpuCommandBufferStub::SendMemoryAllocationToProxy(
545 const GpuMemoryAllocation& allocation) { 556 const GpuMemoryAllocation& allocation) {
546 // TODO(mmocny): Send callback once gl extensions are added. 557 // TODO(mmocny): Send callback once gl extensions are added.
547 } 558 }
548 559
549 #endif // defined(ENABLE_GPU) 560 #endif // defined(ENABLE_GPU)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698