Title: [210545] trunk/Source/WebKit2
Revision
210545
Author
zandober...@gmail.com
Date
2017-01-10 06:51:02 -0800 (Tue, 10 Jan 2017)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (210544 => 210545)


--- trunk/Source/WebKit2/ChangeLog	2017-01-10 14:49:56 UTC (rev 210544)
+++ trunk/Source/WebKit2/ChangeLog	2017-01-10 14:51:02 UTC (rev 210545)
@@ -1,3 +1,24 @@
+2017-01-10  Zan Dobersek  <zdober...@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  <cdu...@apple.com>
 
         [iOS] Drop VNodeTracker

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (210544 => 210545)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2017-01-10 14:49:56 UTC (rev 210544)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2017-01-10 14:51:02 UTC (rev 210545)
@@ -78,6 +78,11 @@
     if (!m_layerFlushSchedulingEnabled)
         return;
 
+    if (m_isWaitingForRenderer) {
+        m_scheduledWhileWaitingForRenderer = true;
+        return;
+    }
+
     if (!m_layerFlushTimer.isActive())
         m_layerFlushTimer.startOneShot(0);
 }
@@ -146,8 +151,13 @@
 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)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (210544 => 210545)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2017-01-10 14:49:56 UTC (rev 210544)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2017-01-10 14:51:02 UTC (rev 210545)
@@ -86,6 +86,7 @@
 
     CompositingCoordinator m_coordinator;
     bool m_isWaitingForRenderer { true };
+    bool m_scheduledWhileWaitingForRenderer { false };
     uint64_t m_forceRepaintAsyncCallbackID { 0 };
     RunLoop::Timer<CoordinatedLayerTreeHost> m_layerFlushTimer;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to