summaryrefslogtreecommitdiffstats
path: root/cc/trees/thread_proxy.cc
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 05:01:20 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-06 05:01:20 +0000
commite0341359793fd1b9cef790e6927d6fa2cb33c0ff (patch)
tree75dd6a56c44aeea4a6bab43a21aad7ce30584b80 /cc/trees/thread_proxy.cc
parent34e25581f9c2513ef1b294cadfa6c4ea250c288c (diff)
downloadchromium_src-e0341359793fd1b9cef790e6927d6fa2cb33c0ff.zip
chromium_src-e0341359793fd1b9cef790e6927d6fa2cb33c0ff.tar.gz
chromium_src-e0341359793fd1b9cef790e6927d6fa2cb33c0ff.tar.bz2
cc: Don't draw and swap if the frame will not change.
When there is no visible damage in the root surface, we have no reason to do CalculateRenderPasses, DrawLayers, or SwapBuffers. This adds an early out in each of these when there is no damage, but storing a flag on the FrameData to communicate this state. When doing a readback, we need to make sure we draw the area being read back, so we pass a damage rect in to PrepareToDraw to enforce this. This mechanism can be used to also implement the "ForceFullFrameDamage" mechanism, so we move the flag to LayerTreeHostImpl and have DamageTracker take a general rect instead. Before: [ RUN ] LayerTreeHostPerfTestJsonReader.TenTenSingleThread *RESULT 10_10_layer_tree: frames= 3089.37 runs/s After: [ RUN ] LayerTreeHostPerfTestJsonReader.TenTenSingleThread *RESULT 10_10_layer_tree: frames= 4679.13 runs/s When there's no damage, a full single-threaded commit+composite speeds up about 50%. Tests: DamageTrackerTest.DamageWhenAddedExternally LayerTreeHostDamageTestNoDamageDoesNotSwap.RunSingleThread LayerTreeHostDamageTestNoDamageDoesNotSwap.RunMultiThread LayerTreeHostDamageTestNoDamageReadbackDoesDraw.RunSingleThread LayerTreeHostDamageTestNoDamageReadbackDoesDraw.RunMultiThread LayerTreeHostDamageTestForcedFullDamage.RunSingleThread LayerTreeHostDamageTestForcedFullDamage.RunMultiThread Adding a new perf test with damage: LayerTreeHostPerfTestJsonReader.TenTenSingleThread_FullDamageEachFrame *RESULT 10_10_layer_tree: frames= 3233.98 runs/s R=nduca BUG=222915 Review URL: https://chromiumcodereview.appspot.com/12662021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/trees/thread_proxy.cc')
-rw-r--r--cc/trees/thread_proxy.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 2ec6f7d..f824c9b 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -894,6 +894,11 @@ ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) {
// DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
// CanDraw() as well.
+ // If it is a forced draw, make sure we do a draw and swap.
+ gfx::Rect readback_rect;
+ if (readback_request_on_impl_thread_)
+ readback_rect = readback_request_on_impl_thread_->rect;
+
LayerTreeHostImpl::FrameData frame;
bool draw_frame = false;
bool start_ready_animations = true;
@@ -901,7 +906,8 @@ ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) {
if (layer_tree_host_impl_->CanDraw()) {
// Do not start animations if we skip drawing the frame to avoid
// checkerboarding.
- if (layer_tree_host_impl_->PrepareToDraw(&frame) || forced_draw)
+ if (layer_tree_host_impl_->PrepareToDraw(&frame, readback_rect) ||
+ forced_draw)
draw_frame = true;
else
start_ready_animations = false;
@@ -939,7 +945,7 @@ ThreadProxy::ScheduledActionDrawAndSwapInternal(bool forced_draw) {
readback_request_on_impl_thread_->completion.Signal();
readback_request_on_impl_thread_ = NULL;
} else if (draw_frame) {
- result.did_swap = layer_tree_host_impl_->SwapBuffers();
+ result.did_swap = layer_tree_host_impl_->SwapBuffers(frame);
if (frame.contains_incomplete_tile)
DidSwapUseIncompleteTileOnImplThread();