Title: [242364] trunk/Source/WebKit
- Revision
- 242364
- Author
- [email protected]
- Date
- 2019-03-04 10:06:18 -0800 (Mon, 04 Mar 2019)
Log Message
[CoordinatedGraphics] The compositing loop is still running even after exiting AC mode
https://bugs.webkit.org/show_bug.cgi?id=195270
Patch by Carlos Garcia Campos <[email protected]> on 2019-03-04
Reviewed by Don Olmstead.
Suspend the threaded compositor when the painting is paused or layer flush disabled, and resume it again when
painting is resumed and layer flush enabled.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::suspend): Increment the suspend counter and mark the scene as inactive if it was suspended.
(WebKit::ThreadedCompositor::resume): Decrement the suspend counter and mark the scene as active if it's now resumed.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
(WebKit::DrawingAreaCoordinatedGraphics::forceRepaint): Return early if layer tree state is frozen.
(WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): Ditto.
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): Call ThreadedCompositor::suspend()/resume().
(WebKit::LayerTreeHost::pauseRendering): Call ThreadedCompositor::suspend.
(WebKit::LayerTreeHost::resumeRendering): Call ThreadedCompositor::resume().
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (242363 => 242364)
--- trunk/Source/WebKit/ChangeLog 2019-03-04 17:28:39 UTC (rev 242363)
+++ trunk/Source/WebKit/ChangeLog 2019-03-04 18:06:18 UTC (rev 242364)
@@ -1,3 +1,25 @@
+2019-03-04 Carlos Garcia Campos <[email protected]>
+
+ [CoordinatedGraphics] The compositing loop is still running even after exiting AC mode
+ https://bugs.webkit.org/show_bug.cgi?id=195270
+
+ Reviewed by Don Olmstead.
+
+ Suspend the threaded compositor when the painting is paused or layer flush disabled, and resume it again when
+ painting is resumed and layer flush enabled.
+
+ * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+ (WebKit::ThreadedCompositor::suspend): Increment the suspend counter and mark the scene as inactive if it was suspended.
+ (WebKit::ThreadedCompositor::resume): Decrement the suspend counter and mark the scene as active if it's now resumed.
+ * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
+ * WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp:
+ (WebKit::DrawingAreaCoordinatedGraphics::forceRepaint): Return early if layer tree state is frozen.
+ (WebKit::DrawingAreaCoordinatedGraphics::forceRepaintAsync): Ditto.
+ * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
+ (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled): Call ThreadedCompositor::suspend()/resume().
+ (WebKit::LayerTreeHost::pauseRendering): Call ThreadedCompositor::suspend.
+ (WebKit::LayerTreeHost::resumeRendering): Call ThreadedCompositor::resume().
+
2019-03-04 Simon Fraser <[email protected]>
Share more code between overflow and frame scrolling nodes, fixing overflow scrollbar display
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (242363 => 242364)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp 2019-03-04 17:28:39 UTC (rev 242363)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp 2019-03-04 18:06:18 UTC (rev 242364)
@@ -116,6 +116,28 @@
m_compositingRunLoop = nullptr;
}
+void ThreadedCompositor::suspend()
+{
+ if (++m_suspendedCount > 1)
+ return;
+
+ m_compositingRunLoop->stopUpdates();
+ m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
+ m_scene->setActive(false);
+ });
+}
+
+void ThreadedCompositor::resume()
+{
+ ASSERT(m_suspendedCount > 0);
+ if (--m_suspendedCount > 0)
+ return;
+
+ m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
+ m_scene->setActive(true);
+ });
+}
+
void ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t handle)
{
m_compositingRunLoop->stopUpdates();
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h (242363 => 242364)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h 2019-03-04 17:28:39 UTC (rev 242363)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h 2019-03-04 18:06:18 UTC (rev 242364)
@@ -84,6 +84,9 @@
void frameComplete();
+ void suspend();
+ void resume();
+
private:
ThreadedCompositor(Client&, ThreadedDisplayRefreshMonitor::Client&, WebCore::PlatformDisplayID, const WebCore::IntSize&, float scaleFactor, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
@@ -103,6 +106,7 @@
ShouldDoFrameSync m_doFrameSync;
WebCore::TextureMapper::PaintFlags m_paintFlags { 0 };
bool m_inForceRepaint { false };
+ unsigned m_suspendedCount { 0 };
std::unique_ptr<CompositingRunLoop> m_compositingRunLoop;
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp (242363 => 242364)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp 2019-03-04 17:28:39 UTC (rev 242363)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp 2019-03-04 18:06:18 UTC (rev 242364)
@@ -175,6 +175,9 @@
return;
}
+ if (m_layerTreeStateIsFrozen)
+ return;
+
setNeedsDisplay();
m_webPage.layoutIfNeeded();
if (!m_layerTreeHost)
@@ -195,6 +198,9 @@
bool DrawingAreaCoordinatedGraphics::forceRepaintAsync(CallbackID callbackID)
{
+ if (m_layerTreeStateIsFrozen)
+ return false;
+
return m_layerTreeHost && m_layerTreeHost->forceRepaintAsync(callbackID);
}
Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp (242363 => 242364)
--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 2019-03-04 17:28:39 UTC (rev 242363)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 2019-03-04 18:06:18 UTC (rev 242364)
@@ -106,11 +106,13 @@
m_layerFlushSchedulingEnabled = layerFlushingEnabled;
if (m_layerFlushSchedulingEnabled) {
+ m_compositor->resume();
scheduleLayerFlush();
return;
}
cancelPendingLayerFlush();
+ m_compositor->suspend();
}
void LayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
@@ -248,11 +250,13 @@
void LayerTreeHost::pauseRendering()
{
m_isSuspended = true;
+ m_compositor->suspend();
}
void LayerTreeHost::resumeRendering()
{
m_isSuspended = false;
+ m_compositor->resume();
scheduleLayerFlush();
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes