Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
ThreadedCoordinatedLayerTreeHost::renderNextFrame() should short-cut …
…to layer flushing

https://bugs.webkit.org/show_bug.cgi?id=157614

Reviewed by Carlos Garcia Campos.

CoordinatedLayerTreeHost prevents any layer flushes while a previously-commited scene
state is still being rendered on the composition thread. renderNextFrame() is called
once that is complete, and a new layer flush is scheduled.

This change improves the whole ordeal by immediately performing the layer flush only if
it was requested during the time we were waiting on the renderer (i.e. when the latest
scene state was being composited), instead of scheduling it unconditionally.
m_scheduledWhileWaitingForRenderer member variable is added to track that occurrence.

* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::scheduleLayerFlush):
(WebKit::CoordinatedLayerTreeHost::renderNextFrame):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:


Canonical link: https://commits.webkit.org/183990@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210545 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
zdobersek committed Jan 10, 2017
1 parent 8f9d570 commit b018262
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
21 changes: 21 additions & 0 deletions Source/WebKit2/ChangeLog
@@ -1,3 +1,24 @@
2017-01-10 Zan Dobersek <zdobersek@igalia.com>

ThreadedCoordinatedLayerTreeHost::renderNextFrame() should short-cut to layer flushing
https://bugs.webkit.org/show_bug.cgi?id=157614

Reviewed by Carlos Garcia Campos.

CoordinatedLayerTreeHost prevents any layer flushes while a previously-commited scene
state is still being rendered on the composition thread. renderNextFrame() is called
once that is complete, and a new layer flush is scheduled.

This change improves the whole ordeal by immediately performing the layer flush only if
it was requested during the time we were waiting on the renderer (i.e. when the latest
scene state was being composited), instead of scheduling it unconditionally.
m_scheduledWhileWaitingForRenderer member variable is added to track that occurrence.

* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::scheduleLayerFlush):
(WebKit::CoordinatedLayerTreeHost::renderNextFrame):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:

2017-01-09 Chris Dumez <cdumez@apple.com>

[iOS] Drop VNodeTracker
Expand Down
Expand Up @@ -78,6 +78,11 @@ void CoordinatedLayerTreeHost::scheduleLayerFlush()
if (!m_layerFlushSchedulingEnabled)
return;

if (m_isWaitingForRenderer) {
m_scheduledWhileWaitingForRenderer = true;
return;
}

if (!m_layerFlushTimer.isActive())
m_layerFlushTimer.startOneShot(0);
}
Expand Down Expand Up @@ -146,8 +151,13 @@ void CoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, con
void CoordinatedLayerTreeHost::renderNextFrame()
{
m_isWaitingForRenderer = false;
scheduleLayerFlush();
bool scheduledWhileWaitingForRenderer = std::exchange(m_scheduledWhileWaitingForRenderer, false);
m_coordinator.renderNextFrame();

if (scheduledWhileWaitingForRenderer || m_layerFlushTimer.isActive()) {
m_layerFlushTimer.stop();
layerFlushTimerFired();
}
}

void CoordinatedLayerTreeHost::didFlushRootLayer(const FloatRect& visibleContentRect)
Expand Down
Expand Up @@ -86,6 +86,7 @@ class CoordinatedLayerTreeHost : public LayerTreeHost, public CompositingCoordin

CompositingCoordinator m_coordinator;
bool m_isWaitingForRenderer { true };
bool m_scheduledWhileWaitingForRenderer { false };
uint64_t m_forceRepaintAsyncCallbackID { 0 };
RunLoop::Timer<CoordinatedLayerTreeHost> m_layerFlushTimer;
};
Expand Down

0 comments on commit b018262

Please sign in to comment.