summaryrefslogtreecommitdiffstats
path: root/cc/scheduler
diff options
context:
space:
mode:
authorbrianderson <brianderson@chromium.org>2015-11-17 19:41:15 -0800
committerCommit bot <commit-bot@chromium.org>2015-11-18 03:41:57 +0000
commit0055b7eaee4ca249cb83ac8ddc5200cbf7a12069 (patch)
tree28c8175c71eb6c6831bc2e7903679233db2ec8bd /cc/scheduler
parent27b48cde7e6243c777ff7b44c9fe7d341c0af2d2 (diff)
downloadchromium_src-0055b7eaee4ca249cb83ac8ddc5200cbf7a12069.zip
chromium_src-0055b7eaee4ca249cb83ac8ddc5200cbf7a12069.tar.gz
chromium_src-0055b7eaee4ca249cb83ac8ddc5200cbf7a12069.tar.bz2
cc: Clean up max frames/swaps pending usage.
All output surfaces used by the Renderer and UI should only need a max swaps pending of 1, especially considering Surfaces and CompositorTimingHistory don't support multiple queued frames. The output suface used by the cc::Display, however, may have more than 1 swap pending - especially on platforms like CrOS where the SwapAck is deferred until the buffer is actually displayed. This patch: 1) Changes the default max pending frames/swaps from 2 to 1. 2) Changes Blimp to have only 1 pending frame. 3) DCHECKS that all Renderers and UIs have a max swaps pending of 1. 4) Sets the default value in the constructor of OutpuSurface::Capabilities, rather than through an extra check for zero + init. BUG=525756 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel Review URL: https://codereview.chromium.org/1435133004 Cr-Commit-Position: refs/heads/master@{#360283}
Diffstat (limited to 'cc/scheduler')
-rw-r--r--cc/scheduler/scheduler.cc4
-rw-r--r--cc/scheduler/scheduler.h1
-rw-r--r--cc/scheduler/scheduler_state_machine.cc16
-rw-r--r--cc/scheduler/scheduler_state_machine.h3
-rw-r--r--cc/scheduler/scheduler_unittest.cc8
5 files changed, 7 insertions, 25 deletions
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index 072086f..eb2c3e1 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -193,10 +193,6 @@ void Scheduler::SetNeedsPrepareTiles() {
ProcessScheduledActions();
}
-void Scheduler::SetMaxSwapsPending(int max) {
- state_machine_.SetMaxSwapsPending(max);
-}
-
void Scheduler::DidSwapBuffers() {
state_machine_.DidSwapBuffers();
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index 5773bc4..6f8ba1e 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -95,7 +95,6 @@ class CC_EXPORT Scheduler : public BeginFrameObserverBase {
void SetNeedsPrepareTiles();
- void SetMaxSwapsPending(int max);
void DidSwapBuffers();
void DidSwapBuffersComplete();
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index 01ac8cb..d770689 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -13,6 +13,11 @@
namespace cc {
+namespace {
+// Surfaces and CompositorTimingHistory don't support more than 1 pending swap.
+const int kMaxPendingSwaps = 1;
+} // namespace
+
SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
: settings_(settings),
output_surface_state_(OUTPUT_SURFACE_NONE),
@@ -32,7 +37,6 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings)
invalidate_output_surface_funnel_(false),
prepare_tiles_funnel_(0),
consecutive_checkerboard_animations_(0),
- max_pending_swaps_(1),
pending_swaps_(0),
swaps_with_current_output_surface_(0),
needs_redraw_(false),
@@ -217,7 +221,6 @@ void SchedulerStateMachine::AsValueInto(
invalidate_output_surface_funnel_);
state->SetInteger("consecutive_checkerboard_animations",
consecutive_checkerboard_animations_);
- state->SetInteger("max_pending_swaps_", max_pending_swaps_);
state->SetInteger("pending_swaps_", pending_swaps_);
state->SetInteger("swaps_with_current_output_surface",
swaps_with_current_output_surface_);
@@ -912,7 +915,7 @@ bool SchedulerStateMachine::main_thread_missed_last_deadline() const {
}
bool SchedulerStateMachine::SwapThrottled() const {
- return pending_swaps_ >= max_pending_swaps_;
+ return pending_swaps_ >= kMaxPendingSwaps;
}
void SchedulerStateMachine::SetVisible(bool visible) {
@@ -957,17 +960,12 @@ void SchedulerStateMachine::SetNeedsPrepareTiles() {
needs_prepare_tiles_ = true;
}
}
-
-void SchedulerStateMachine::SetMaxSwapsPending(int max) {
- max_pending_swaps_ = max;
-}
-
void SchedulerStateMachine::DidSwapBuffers() {
TRACE_EVENT_ASYNC_BEGIN0("cc", "Scheduler:pending_swaps", this);
pending_swaps_++;
swaps_with_current_output_surface_++;
- DCHECK_LE(pending_swaps_, max_pending_swaps_);
+ DCHECK_LE(pending_swaps_, kMaxPendingSwaps);
did_perform_swap_in_last_draw_ = true;
last_frame_number_swap_performed_ = current_frame_number_;
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
index 17fdf98..3c32dc6 100644
--- a/cc/scheduler/scheduler_state_machine.h
+++ b/cc/scheduler/scheduler_state_machine.h
@@ -174,9 +174,6 @@ class CC_EXPORT SchedulerStateMachine {
// PrepareTiles will occur shortly (even if no redraw is required).
void SetNeedsPrepareTiles();
- // Sets how many swaps can be pending to the OutputSurface.
- void SetMaxSwapsPending(int max);
-
// If the scheduler attempted to draw and swap, this provides feedback
// regarding whether or not the swap actually occured. We might skip the
// swap when there is not damage, for example.
diff --git a/cc/scheduler/scheduler_unittest.cc b/cc/scheduler/scheduler_unittest.cc
index 6bdf5dd..362946f 100644
--- a/cc/scheduler/scheduler_unittest.cc
+++ b/cc/scheduler/scheduler_unittest.cc
@@ -1471,7 +1471,6 @@ TEST_F(SchedulerTest, MainFrameNotSkippedAfterLateCommit_DrawEstimateTooLong) {
void SchedulerTest::ImplFrameSkippedAfterLateSwapAck(
bool swap_ack_before_deadline) {
// To get into a high latency state, this test disables automatic swap acks.
- scheduler_->SetMaxSwapsPending(1);
client_->SetAutomaticSwapAck(false);
// Draw and swap for first BeginFrame
@@ -1595,7 +1594,6 @@ TEST_F(SchedulerTest,
SetUpScheduler(true);
// To get into a high latency state, this test disables automatic swap acks.
- scheduler_->SetMaxSwapsPending(1);
client_->SetAutomaticSwapAck(false);
// Even if every estimate related to the main thread is slow, we should
@@ -1659,7 +1657,6 @@ TEST_F(SchedulerTest,
void SchedulerTest::ImplFrameIsNotSkippedAfterLateSwapAck() {
// To get into a high latency state, this test disables automatic swap acks.
- scheduler_->SetMaxSwapsPending(1);
client_->SetAutomaticSwapAck(false);
// Draw and swap for first BeginFrame
@@ -1770,7 +1767,6 @@ TEST_F(SchedulerTest,
fake_compositor_timing_history_->SetAllEstimatesTo(slow_duration);
// To get into a high latency state, this test disables automatic swap acks.
- scheduler_->SetMaxSwapsPending(1);
client_->SetAutomaticSwapAck(false);
// Impl thread hits deadline before commit finishes to make
@@ -1899,7 +1895,6 @@ TEST_F(
// Disables automatic swap acks so this test can force swap ack throttling
// to simulate a blocked Browser ui thread.
- scheduler_->SetMaxSwapsPending(1);
client_->SetAutomaticSwapAck(false);
// Get a new active tree in main-thread high latency mode and put us
@@ -1970,7 +1965,6 @@ TEST_F(SchedulerTest,
// Disables automatic swap acks so this test can force swap ack throttling
// to simulate a blocked Browser ui thread.
- scheduler_->SetMaxSwapsPending(1);
client_->SetAutomaticSwapAck(false);
// Start a new commit in main-thread high latency mode and hold off on
@@ -2051,7 +2045,6 @@ TEST_F(
// Disables automatic swap acks so this test can force swap ack throttling
// to simulate a blocked Browser ui thread.
- scheduler_->SetMaxSwapsPending(1);
client_->SetAutomaticSwapAck(false);
// Start a new commit in main-thread high latency mode and hold off on
@@ -2447,7 +2440,6 @@ void SchedulerTest::BeginFramesNotFromClient_SwapThrottled(
fake_compositor_timing_history_->SetDrawDurationEstimate(base::TimeDelta());
// To test swap ack throttling, this test disables automatic swap acks.
- scheduler_->SetMaxSwapsPending(1);
client_->SetAutomaticSwapAck(false);
// SetNeedsBeginMainFrame should begin the frame on the next BeginImplFrame.