Title: [242597] trunk/Source/WebKit
- Revision
- 242597
- Author
- [email protected]
- Date
- 2019-03-07 09:17:16 -0800 (Thu, 07 Mar 2019)
Log Message
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 <[email protected]> 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: trunk/Source/WebKit/ChangeLog (242596 => 242597)
--- trunk/Source/WebKit/ChangeLog 2019-03-07 10:16:58 UTC (rev 242596)
+++ trunk/Source/WebKit/ChangeLog 2019-03-07 17:17:16 UTC (rev 242597)
@@ -1,3 +1,28 @@
+2019-03-07 Carlos Garcia Campos <[email protected]>
+
+ 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-06 Mark Lam <[email protected]>
Exception is a JSCell, not a JSObject.
Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp (242596 => 242597)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp 2019-03-07 10:16:58 UTC (rev 242596)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp 2019-03-07 17:17:16 UTC (rev 242597)
@@ -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: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h (242596 => 242597)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h 2019-03-07 10:16:58 UTC (rev 242596)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.h 2019-03-07 17:17:16 UTC (rev 242597)
@@ -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: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (242596 => 242597)
--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp 2019-03-07 10:16:58 UTC (rev 242596)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp 2019-03-07 17:17:16 UTC (rev 242597)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes