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

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: address comments 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
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 4de06dbfc8381f52a62cc7c8664246ec37644cce..96632613dedd10e0afacba227cb2003ae45e1941 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -198,7 +198,7 @@ GpuCommandBufferStub::GpuCommandBufferStub(
last_flush_count_(0),
last_memory_allocation_valid_(false),
watchdog_(watchdog),
- sync_point_wait_count_(0),
+ waiting_for_sync_point_(false),
delayed_work_scheduled_(false),
previous_processed_num_(0),
active_url_(active_url),
@@ -620,9 +620,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(
@@ -718,6 +717,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) {
@@ -900,6 +905,7 @@ void GpuCommandBufferStub::OnRetireSyncPoint(uint32 sync_point) {
}
bool GpuCommandBufferStub::OnWaitSyncPoint(uint32 sync_point) {
+ DCHECK(!waiting_for_sync_point_);
if (!sync_point)
return true;
GpuChannelManager* manager = channel_->gpu_channel_manager();
@@ -908,27 +914,25 @@ 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_;
piman 2015/09/16 23:21:09 return !waiting_for_sync_point_;
sunnyps 2015/09/16 23:38:42 Done.
}
void GpuCommandBufferStub::OnWaitSyncPointCompleted(uint32 sync_point) {
+ DCHECK(waiting_for_sync_point_);
+ 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);
}

Powered by Google App Engine
This is Rietveld 408576698