Commit db8259f0 authored by danakj@chromium.org's avatar danakj@chromium.org

cc: Don't do full tree sync unless needed with impl painting.

When impl painting is enabled, we always did a full tree sync from
the main thread to the pending tree because it was always recreated.
Since we recycle the tree now, it maintains its structure from one
commit to the next, so we don't need to do a full tree sync unless
its structure changed, the same decision as for non-impl-painting
mode.

On the impl side, the pending tree maintains the same structure as the
active tree unless the main thread commits a structure change. This is
the case when the main thread does a full tree sync into the pending
tree. So we propagate the flag to the LayerTreeHostImpl and use it when
activating the pending tree.

Causing a commit every layout() with the 10_10_layer_tree, the win is clear:
Before: *RESULT 10_10_layer_tree: frames= 2657.12 runs/s
After: *RESULT 10_10_layer_tree: frames= 3256.78 runs/s

R=jamesr,enne
BUG=173526


Review URL: https://chromiumcodereview.appspot.com/12094094

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180085 0039d316-1c4b-4281-b951-d872f2087c98
parent e2df99e7
...@@ -265,27 +265,23 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl) ...@@ -265,27 +265,23 @@ void LayerTreeHost::finishCommitOnImplThread(LayerTreeHostImpl* hostImpl)
// time to raster before being displayed. If no pending tree is needed, // time to raster before being displayed. If no pending tree is needed,
// synchronization can happen directly to the active tree. // synchronization can happen directly to the active tree.
LayerTreeImpl* syncTree; LayerTreeImpl* syncTree;
bool needsFullTreeSync = false;
if (m_settings.implSidePainting) { if (m_settings.implSidePainting) {
// Commits should not occur while there is already a pending tree. // Commits should not occur while there is already a pending tree.
DCHECK(!hostImpl->pendingTree()); DCHECK(!hostImpl->pendingTree());
hostImpl->createPendingTree(); hostImpl->createPendingTree();
syncTree = hostImpl->pendingTree(); syncTree = hostImpl->pendingTree();
// TODO(enne): we could recycle old active trees and keep track for
// multiple main thread frames whether a sync is needed
needsFullTreeSync = true;
} else { } else {
syncTree = hostImpl->activeTree(); syncTree = hostImpl->activeTree();
needsFullTreeSync = m_needsFullTreeSync;
} }
if (needsFullTreeSync) if (m_needsFullTreeSync)
syncTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), syncTree->DetachLayerTree(), syncTree)); syncTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), syncTree->DetachLayerTree(), syncTree));
{ {
TRACE_EVENT0("cc", "LayerTreeHost::pushProperties"); TRACE_EVENT0("cc", "LayerTreeHost::pushProperties");
TreeSynchronizer::pushProperties(rootLayer(), syncTree->RootLayer()); TreeSynchronizer::pushProperties(rootLayer(), syncTree->RootLayer());
} }
syncTree->set_needs_full_tree_sync(m_needsFullTreeSync);
m_needsFullTreeSync = false; m_needsFullTreeSync = false;
if (m_rootLayer && m_hudLayer) if (m_rootLayer && m_hudLayer)
......
...@@ -983,7 +983,8 @@ void LayerTreeHostImpl::activatePendingTree() ...@@ -983,7 +983,8 @@ void LayerTreeHostImpl::activatePendingTree()
TRACE_EVENT_ASYNC_END0("cc", "PendingTree", m_pendingTree.get()); TRACE_EVENT_ASYNC_END0("cc", "PendingTree", m_pendingTree.get());
m_activeTree->PushPersistedState(m_pendingTree.get()); m_activeTree->PushPersistedState(m_pendingTree.get());
m_activeTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(m_pendingTree->RootLayer(), m_activeTree->DetachLayerTree(), m_activeTree.get())); if (m_pendingTree->needs_full_tree_sync())
m_activeTree->SetRootLayer(TreeSynchronizer::synchronizeTrees(m_pendingTree->RootLayer(), m_activeTree->DetachLayerTree(), m_activeTree.get()));
TreeSynchronizer::pushProperties(m_pendingTree->RootLayer(), m_activeTree->RootLayer()); TreeSynchronizer::pushProperties(m_pendingTree->RootLayer(), m_activeTree->RootLayer());
DCHECK(!m_recycleTree); DCHECK(!m_recycleTree);
......
...@@ -13,21 +13,22 @@ ...@@ -13,21 +13,22 @@
namespace cc { namespace cc {
LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl)
: layer_tree_host_impl_(layer_tree_host_impl) : layer_tree_host_impl_(layer_tree_host_impl),
, source_frame_number_(-1) source_frame_number_(-1),
, hud_layer_(0) hud_layer_(0),
, root_scroll_layer_(0) root_scroll_layer_(0),
, currently_scrolling_layer_(0) currently_scrolling_layer_(0),
, background_color_(0) background_color_(0),
, has_transparent_background_(false) has_transparent_background_(false),
, page_scale_factor_(1) page_scale_factor_(1),
, page_scale_delta_(1) page_scale_delta_(1),
, sent_page_scale_delta_(1) sent_page_scale_delta_(1),
, min_page_scale_factor_(0) min_page_scale_factor_(0),
, max_page_scale_factor_(0) max_page_scale_factor_(0),
, scrolling_layer_id_from_previous_tree_(0) scrolling_layer_id_from_previous_tree_(0),
, contents_textures_purged_(false) contents_textures_purged_(false),
, needs_update_draw_properties_(true) { needs_update_draw_properties_(true),
needs_full_tree_sync_(true) {
} }
LayerTreeImpl::~LayerTreeImpl() { LayerTreeImpl::~LayerTreeImpl() {
......
...@@ -145,6 +145,9 @@ class CC_EXPORT LayerTreeImpl { ...@@ -145,6 +145,9 @@ class CC_EXPORT LayerTreeImpl {
return needs_update_draw_properties_; return needs_update_draw_properties_;
} }
void set_needs_full_tree_sync(bool needs) { needs_full_tree_sync_ = needs; }
bool needs_full_tree_sync() const { return needs_full_tree_sync_; }
void ClearRenderSurfaces(); void ClearRenderSurfaces();
bool AreVisibleResourcesReady() const; bool AreVisibleResourcesReady() const;
...@@ -206,6 +209,10 @@ protected: ...@@ -206,6 +209,10 @@ protected:
bool contents_textures_purged_; bool contents_textures_purged_;
bool needs_update_draw_properties_; bool needs_update_draw_properties_;
// In impl-side painting mode, this is true when the tree may contain
// structural differences relative to the active tree.
bool needs_full_tree_sync_;
DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment