summaryrefslogtreecommitdiffstats
path: root/gpu
diff options
context:
space:
mode:
authorapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-13 21:06:44 +0000
committerapatrick@chromium.org <apatrick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-13 21:06:44 +0000
commit0395f809554e5de0f97dc956f3a7b952b21bdc77 (patch)
tree58f501ae53482e61dc5f5576858cdf02e3081568 /gpu
parent4afa2c4afda77b5d68e6f5ba00fa6ba3e5a0f610 (diff)
downloadchromium_src-0395f809554e5de0f97dc956f3a7b952b21bdc77.zip
chromium_src-0395f809554e5de0f97dc956f3a7b952b21bdc77.tar.gz
chromium_src-0395f809554e5de0f97dc956f3a7b952b21bdc77.tar.bz2
Merge 84679
Defer IPC messages to the GpuCommandBufferStub until GpuScheduler is rescheduled. This stops the renderer process from continusously sending synchronous flushes during the swapbuffers period on mac. TEST=WebGL on windows and mac, trybots BUG=81279 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=84679 Review URL: http://codereview.chromium.org/7013056 git-svn-id: svn://svn.chromium.org/chrome/branches/742/src@85320 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r--gpu/command_buffer/service/gpu_scheduler.cc14
-rw-r--r--gpu/command_buffer/service/gpu_scheduler.h9
2 files changed, 22 insertions, 1 deletions
diff --git a/gpu/command_buffer/service/gpu_scheduler.cc b/gpu/command_buffer/service/gpu_scheduler.cc
index 34605ca..db056fa 100644
--- a/gpu/command_buffer/service/gpu_scheduler.cc
+++ b/gpu/command_buffer/service/gpu_scheduler.cc
@@ -185,13 +185,25 @@ void GpuScheduler::SetScheduled(bool scheduled) {
--unscheduled_count_;
DCHECK_GE(unscheduled_count_, 0);
- if (unscheduled_count_ == 0)
+ if (unscheduled_count_ == 0) {
+ if (scheduled_callback_.get())
+ scheduled_callback_->Run();
+
ScheduleProcessCommands();
+ }
} else {
++unscheduled_count_;
}
}
+bool GpuScheduler::IsScheduled() {
+ return unscheduled_count_ == 0;
+}
+
+void GpuScheduler::SetScheduledCallback(Callback0::Type* scheduled_callback) {
+ scheduled_callback_.reset(scheduled_callback);
+}
+
Buffer GpuScheduler::GetSharedMemoryBuffer(int32 shm_id) {
return command_buffer_->GetTransferBuffer(shm_id);
}
diff --git a/gpu/command_buffer/service/gpu_scheduler.h b/gpu/command_buffer/service/gpu_scheduler.h
index 04784a7..828cbdf 100644
--- a/gpu/command_buffer/service/gpu_scheduler.h
+++ b/gpu/command_buffer/service/gpu_scheduler.h
@@ -69,6 +69,13 @@ class GpuScheduler : public CommandBufferEngine {
// false must eventually be paired by a call with true.
void SetScheduled(bool is_scheduled);
+ // Returns whether the scheduler is currently scheduled to process commands.
+ bool IsScheduled();
+
+ // Sets a callback that is invoked just before scheduler is rescheduled.
+ // Takes ownership of callback object.
+ void SetScheduledCallback(Callback0::Type* scheduled_callback);
+
// Implementation of CommandBufferEngine.
virtual Buffer GetSharedMemoryBuffer(int32 shm_id);
virtual void set_token(int32 token);
@@ -160,6 +167,8 @@ class GpuScheduler : public CommandBufferEngine {
// Greater than zero if this is waiting to be rescheduled before continuing.
int unscheduled_count_;
+ scoped_ptr<Callback0::Type> scheduled_callback_;
+
#if defined(OS_MACOSX)
scoped_ptr<AcceleratedSurface> surface_;
uint64 swap_buffers_count_;