Title: [243984] releases/WebKitGTK/webkit-2.24/Source/WebKit
Revision
243984
Author
carlo...@webkit.org
Date
2019-04-08 03:15:14 -0700 (Mon, 08 Apr 2019)

Log Message

Merge r242597 - REGRESSION(r242364): [WPE] Do not stop the compositing run loop update timer on suspend
https://bugs.webkit.org/show_bug.cgi?id=195410

Patch by Carlos Garcia Campos <cgar...@igalia.com> on 2019-03-07
Reviewed by Žan Doberšek.

Calling CompositingRunLoop::stopUpdates() on suspend is leaving the threaded compositor in an inconsistent
state, failing to resume and stopping the updates forever. This is causing timeouts in WPE layout tests. Instead
of calling stopUpdates(), a new suspend() is called, that stops the update timer, without changing the current
updae tha compositing state. A new method resume() is also added to schedule an update if needed.

* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
(WebKit::CompositingRunLoop::suspend): Set state as suspended and stop the update timer.
(WebKit::CompositingRunLoop::resume): Set state as not suspended and start the update timer if it was scheduled
while suspended.
(WebKit::CompositingRunLoop::scheduleUpdate): Do not start the update timer when suspended.
(WebKit::CompositingRunLoop::compositionCompleted): Ditto.
(WebKit::CompositingRunLoop::updateCompleted): Ditto.
(WebKit::CompositingRunLoop::updateTimerFired): Add an assert to ensure the update timer is not fired while suspended.
* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::suspend): Call CompositingRunLoop::suspend() instead of stopUpdates().
(WebKit::ThreadedCompositor::resume): Call CompositingRunLoop::resume().

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog (243983 => 243984)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog	2019-04-08 10:15:11 UTC (rev 243983)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog	2019-04-08 10:15:14 UTC (rev 243984)
@@ -1,3 +1,28 @@
+2019-03-07  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r242364): [WPE] Do not stop the compositing run loop update timer on suspend
+        https://bugs.webkit.org/show_bug.cgi?id=195410
+
+        Reviewed by Žan Doberšek.
+
+        Calling CompositingRunLoop::stopUpdates() on suspend is leaving the threaded compositor in an inconsistent
+        state, failing to resume and stopping the updates forever. This is causing timeouts in WPE layout tests. Instead
+        of calling stopUpdates(), a new suspend() is called, that stops the update timer, without changing the current
+        updae tha compositing state. A new method resume() is also added to schedule an update if needed.
+
+        * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
+        (WebKit::CompositingRunLoop::suspend): Set state as suspended and stop the update timer.
+        (WebKit::CompositingRunLoop::resume): Set state as not suspended and start the update timer if it was scheduled
+        while suspended.
+        (WebKit::CompositingRunLoop::scheduleUpdate): Do not start the update timer when suspended.
+        (WebKit::CompositingRunLoop::compositionCompleted): Ditto.
+        (WebKit::CompositingRunLoop::updateCompleted): Ditto.
+        (WebKit::CompositingRunLoop::updateTimerFired): Add an assert to ensure the update timer is not fired while suspended.
+        * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h:
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::ThreadedCompositor::suspend): Call CompositingRunLoop::suspend() instead of stopUpdates().
+        (WebKit::ThreadedCompositor::resume): Call CompositingRunLoop::resume().
+
 2019-03-04  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [CoordinatedGraphics] The compositing loop is still running even after exiting AC mode

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp (243983 => 243984)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp	2019-04-08 10:15:11 UTC (rev 243983)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp	2019-04-08 10:15:14 UTC (rev 243984)
@@ -94,6 +94,21 @@
     m_dispatchSyncCondition.wait(m_dispatchSyncConditionMutex);
 }
 
+void CompositingRunLoop::suspend()
+{
+    LockHolder stateLocker(m_state.lock);
+    m_state.isSuspended = true;
+    m_updateTimer.stop();
+}
+
+void CompositingRunLoop::resume()
+{
+    LockHolder stateLocker(m_state.lock);
+    m_state.isSuspended = false;
+    if (m_state.update == UpdateState::Scheduled)
+        m_updateTimer.startOneShot(0_s);
+}
+
 void CompositingRunLoop::scheduleUpdate()
 {
     LockHolder stateLocker(m_state.lock);
@@ -113,7 +128,8 @@
     switch (m_state.update) {
     case UpdateState::Idle:
         m_state.update = UpdateState::Scheduled;
-        m_updateTimer.startOneShot(0_s);
+        if (!m_state.isSuspended)
+            m_updateTimer.startOneShot(0_s);
         return;
     case UpdateState::Scheduled:
         return;
@@ -156,7 +172,8 @@
         if (m_state.pendingUpdate) {
             m_state.pendingUpdate = false;
             m_state.update = UpdateState::Scheduled;
-            m_updateTimer.startOneShot(0_s);
+            if (!m_state.isSuspended)
+                m_updateTimer.startOneShot(0_s);
             return;
         }
 
@@ -188,7 +205,8 @@
         if (m_state.pendingUpdate) {
             m_state.pendingUpdate = false;
             m_state.update = UpdateState::Scheduled;
-            m_updateTimer.startOneShot(0_s);
+            if (!m_state.isSuspended)
+                m_updateTimer.startOneShot(0_s);
             return;
         }
 
@@ -204,6 +222,7 @@
     {
         // Both composition and scene update are now in progress.
         LockHolder locker(m_state.lock);
+        ASSERT(!m_state.isSuspended);
         m_state.composition = CompositionState::InProgress;
         m_state.update = UpdateState::InProgress;
     }

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h (243983 => 243984)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h	2019-04-08 10:15:11 UTC (rev 243983)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h	2019-04-08 10:15:14 UTC (rev 243984)
@@ -47,6 +47,9 @@
     void performTask(Function<void ()>&&);
     void performTaskSync(Function<void ()>&&);
 
+    void suspend();
+    void resume();
+
     Lock& stateLock() { return m_state.lock; }
 
     void scheduleUpdate();
@@ -81,6 +84,7 @@
         CompositionState composition { CompositionState::Idle };
         UpdateState update { UpdateState::Idle };
         bool pendingUpdate { false };
+        bool isSuspended { false };
     } m_state;
 };
 

Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (243983 => 243984)


--- releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2019-04-08 10:15:11 UTC (rev 243983)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2019-04-08 10:15:14 UTC (rev 243984)
@@ -121,7 +121,7 @@
     if (++m_suspendedCount > 1)
         return;
 
-    m_compositingRunLoop->stopUpdates();
+    m_compositingRunLoop->suspend();
     m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
         m_scene->setActive(false);
     });
@@ -136,6 +136,7 @@
     m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
         m_scene->setActive(true);
     });
+    m_compositingRunLoop->resume();
 }
 
 void ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t handle)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to