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

Unified Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 1348363003: content/gpu: Simplify stub scheduling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gpu_channel_stream
Patch Set: fix android compile error sigh Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | gpu/command_buffer/service/gpu_scheduler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/gpu_command_buffer_stub.cc
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index 9db0f8e8edff0d29dc8df65de7395b73a4a9a901..3388f33f05dabc0f69b0f01b9264b0aa744c51ec 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -203,7 +203,7 @@ GpuCommandBufferStub::GpuCommandBufferStub(
last_flush_count_(0),
last_memory_allocation_valid_(false),
watchdog_(watchdog),
- sync_point_wait_count_(0),
+ waiting_for_sync_point_(false),
previous_processed_num_(0),
active_url_(active_url),
total_gpu_memory_(0) {
@@ -333,7 +333,7 @@ bool GpuCommandBufferStub::Send(IPC::Message* message) {
}
bool GpuCommandBufferStub::IsScheduled() {
- return (!scheduler_.get() || scheduler_->IsScheduled());
+ return (!scheduler_.get() || scheduler_->scheduled());
}
void GpuCommandBufferStub::PollWork() {
@@ -425,8 +425,7 @@ void GpuCommandBufferStub::ScheduleDelayedWork(base::TimeDelta delay) {
// for more work at the rate idle work is performed. This also ensures
// that idle work is done as efficiently as possible without any
// unnecessary delays.
- if (scheduler_.get() &&
- scheduler_->IsScheduled() &&
+ if (scheduler_.get() && scheduler_->scheduled() &&
scheduler_->HasMoreIdleWork()) {
delay = base::TimeDelta();
}
@@ -650,9 +649,8 @@ void GpuCommandBufferStub::OnInitialize(
base::Unretained(scheduler_.get())));
command_buffer_->SetParseErrorCallback(
base::Bind(&GpuCommandBufferStub::OnParseError, base::Unretained(this)));
- scheduler_->SetSchedulingChangedCallback(
- base::Bind(&GpuChannel::StubSchedulingChanged,
- base::Unretained(channel_)));
+ scheduler_->SetSchedulingChangedCallback(base::Bind(
+ &GpuCommandBufferStub::OnSchedulingChanged, base::Unretained(this)));
if (watchdog_) {
scheduler_->SetCommandProcessedCallback(
@@ -748,6 +746,12 @@ void GpuCommandBufferStub::OnParseError() {
CheckContextLost();
}
+void GpuCommandBufferStub::OnSchedulingChanged(bool scheduled) {
+ TRACE_EVENT1("gpu", "GpuCommandBufferStub::OnSchedulingChanged", "scheduled",
+ scheduled);
+ channel_->OnStubSchedulingChanged(this, scheduled);
+}
+
void GpuCommandBufferStub::OnWaitForTokenInRange(int32 start,
int32 end,
IPC::Message* reply_message) {
@@ -930,6 +934,8 @@ void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) {
}
bool GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) {
+ DCHECK(!waiting_for_sync_point_);
+ DCHECK(scheduler_->scheduled());
if (!sync_point)
return true;
GpuChannelManager* manager = channel_->gpu_channel_manager();
@@ -938,27 +944,26 @@ bool GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) {
return true;
}
- if (sync_point_wait_count_ == 0) {
- TRACE_EVENT_ASYNC_BEGIN1("gpu", "WaitSyncPoint", this,
- "GpuCommandBufferStub", this);
- }
+ TRACE_EVENT_ASYNC_BEGIN1("gpu", "WaitSyncPoint", this, "GpuCommandBufferStub",
+ this);
+
scheduler_->SetScheduled(false);
- ++sync_point_wait_count_;
+ waiting_for_sync_point_ = true;
manager->sync_point_manager()->AddSyncPointCallback(
sync_point,
base::Bind(&RunOnThread, task_runner_,
base::Bind(&GpuCommandBufferStub::OnWaitSyncPointCompleted,
this->AsWeakPtr(), sync_point)));
- return scheduler_->IsScheduled();
+ return !waiting_for_sync_point_;
}
void GpuCommandBufferStub::OnWaitSyncPointCompleted(uint32 sync_point) {
+ DCHECK(waiting_for_sync_point_);
+ DCHECK(!scheduler_->scheduled());
+ TRACE_EVENT_ASYNC_END1("gpu", "WaitSyncPoint", this, "GpuCommandBufferStub",
+ this);
PullTextureUpdates(sync_point);
- --sync_point_wait_count_;
- if (sync_point_wait_count_ == 0) {
- TRACE_EVENT_ASYNC_END1("gpu", "WaitSyncPoint", this,
- "GpuCommandBufferStub", this);
- }
+ waiting_for_sync_point_ = false;
scheduler_->SetScheduled(true);
}
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | gpu/command_buffer/service/gpu_scheduler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698