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

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

Issue 12340118: GPU: Only allow the UI channel to preempt if all stubs are scheduled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) { 263 void GpuCommandBufferStub::OnEcho(const IPC::Message& message) {
264 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho"); 264 TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEcho");
265 Send(new IPC::Message(message)); 265 Send(new IPC::Message(message));
266 } 266 }
267 267
268 void GpuCommandBufferStub::OnReschedule() { 268 void GpuCommandBufferStub::OnReschedule() {
269 if (!IsScheduled()) 269 if (!IsScheduled())
270 return; 270 return;
271 271
272 channel_->OnScheduled(); 272 channel_->OnScheduled();
273 channel_->StubSchedulingChanged();
273 } 274 }
274 275
275 bool GpuCommandBufferStub::MakeCurrent() { 276 bool GpuCommandBufferStub::MakeCurrent() {
276 if (decoder_->MakeCurrent()) 277 if (decoder_->MakeCurrent())
277 return true; 278 return true;
278 DLOG(ERROR) << "Context lost because MakeCurrent failed."; 279 DLOG(ERROR) << "Context lost because MakeCurrent failed.";
279 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason()); 280 command_buffer_->SetContextLostReason(decoder_->GetContextLostReason());
280 command_buffer_->SetParseError(gpu::error::kLostContext); 281 command_buffer_->SetParseError(gpu::error::kLostContext);
281 if (gfx::GLContext::LosesAllContextsOnContextLost()) 282 if (gfx::GLContext::LosesAllContextsOnContextLost())
282 channel_->LoseAllContexts(); 283 channel_->LoseAllContexts();
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 481
481 command_buffer_->SetPutOffsetChangeCallback( 482 command_buffer_->SetPutOffsetChangeCallback(
482 base::Bind(&GpuCommandBufferStub::PutChanged, base::Unretained(this))); 483 base::Bind(&GpuCommandBufferStub::PutChanged, base::Unretained(this)));
483 command_buffer_->SetGetBufferChangeCallback( 484 command_buffer_->SetGetBufferChangeCallback(
484 base::Bind(&gpu::GpuScheduler::SetGetBuffer, 485 base::Bind(&gpu::GpuScheduler::SetGetBuffer,
485 base::Unretained(scheduler_.get()))); 486 base::Unretained(scheduler_.get())));
486 command_buffer_->SetParseErrorCallback( 487 command_buffer_->SetParseErrorCallback(
487 base::Bind(&GpuCommandBufferStub::OnParseError, base::Unretained(this))); 488 base::Bind(&GpuCommandBufferStub::OnParseError, base::Unretained(this)));
488 scheduler_->SetScheduledCallback( 489 scheduler_->SetScheduledCallback(
489 base::Bind(&GpuCommandBufferStub::OnReschedule, base::Unretained(this))); 490 base::Bind(&GpuCommandBufferStub::OnReschedule, base::Unretained(this)));
491 scheduler_->SetDescheduledCallback(
492 base::Bind(&GpuChannel::StubSchedulingChanged,
493 base::Unretained(channel_)));
piman 2013/02/27 21:54:43 Could we merge the 2 callbacks (eg passing the sch
jonathan.backer 2013/02/28 21:43:56 Done.
490 494
491 if (watchdog_) { 495 if (watchdog_) {
492 scheduler_->SetCommandProcessedCallback( 496 scheduler_->SetCommandProcessedCallback(
493 base::Bind(&GpuCommandBufferStub::OnCommandProcessed, 497 base::Bind(&GpuCommandBufferStub::OnCommandProcessed,
494 base::Unretained(this))); 498 base::Unretained(this)));
495 } 499 }
496 500
497 #if defined(OS_ANDROID) 501 #if defined(OS_ANDROID)
498 decoder_->SetStreamTextureManager(channel_->stream_texture_manager()); 502 decoder_->SetStreamTextureManager(channel_->stream_texture_manager());
499 #endif 503 #endif
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 if (surface_ && MakeCurrent()) 883 if (surface_ && MakeCurrent())
880 surface_->SetFrontbufferAllocation( 884 surface_->SetFrontbufferAllocation(
881 allocation.browser_allocation.suggest_have_frontbuffer); 885 allocation.browser_allocation.suggest_have_frontbuffer);
882 } 886 }
883 887
884 last_memory_allocation_valid_ = true; 888 last_memory_allocation_valid_ = true;
885 last_memory_allocation_ = allocation; 889 last_memory_allocation_ = allocation;
886 } 890 }
887 891
888 } // namespace content 892 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698