Changeset 286720 in webkit
- Timestamp:
- Dec 8, 2021, 1:25:47 PM (5 years ago)
- Location:
- branches/safari-612.4.2.1-branch/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
page/scrolling/ThreadedScrollingTree.cpp (modified) (2 diffs)
-
page/scrolling/ThreadedScrollingTree.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-612.4.2.1-branch/Source/WebCore/ChangeLog
r286719 r286720 1 2021-12-02 Russell Epstein <repstein@apple.com> 2 3 Cherry-pick r286410. rdar://problem/85928816 4 5 Scrolling complex websites can stutter: scrolling thread commit can get blocked on scroll synchronization 6 https://bugs.webkit.org/show_bug.cgi?id=233738 7 rdar://85880147 8 9 Reviewed by Tim Horton. 10 11 The scroll synchronization added in r261985 can cause dropped frames while scrolling. This 12 occurs when ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout(), which is 13 called at the start of a rendering update on the main thread, starts at a time when it will 14 delay the handling of displayDidRefreshOnScrollingThread(). This can result in delaying the 15 CA commit for that frame on the scrolling thread. 16 17 The solution is to clamp the duration that waitForRenderingUpdateCompletionOrTimeout() waits 18 on the condition, so that it doesn't exceed the next expected display refresh time. 19 20 * page/scrolling/ThreadedScrollingTree.cpp: 21 (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout): 22 (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread): 23 * page/scrolling/ThreadedScrollingTree.h: 24 25 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@286410 268f45cc-cd09-0410-ab3c-d52691b4dbfc 26 27 2021-12-01 Simon Fraser <simon.fraser@apple.com> 28 29 Scrolling complex websites can stutter: scrolling thread commit can get blocked on scroll synchronization 30 https://bugs.webkit.org/show_bug.cgi?id=233738 31 rdar://85880147 32 33 Reviewed by Tim Horton. 34 35 The scroll synchronization added in r261985 can cause dropped frames while scrolling. This 36 occurs when ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout(), which is 37 called at the start of a rendering update on the main thread, starts at a time when it will 38 delay the handling of displayDidRefreshOnScrollingThread(). This can result in delaying the 39 CA commit for that frame on the scrolling thread. 40 41 The solution is to clamp the duration that waitForRenderingUpdateCompletionOrTimeout() waits 42 on the condition, so that it doesn't exceed the next expected display refresh time. 43 44 * page/scrolling/ThreadedScrollingTree.cpp: 45 (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout): 46 (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread): 47 * page/scrolling/ThreadedScrollingTree.h: 48 1 49 2021-12-02 Russell Epstein <repstein@apple.com> 2 50 -
branches/safari-612.4.2.1-branch/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp
r286719 r286720 324 324 m_delayedRenderingUpdateDetectionTimer->stop(); 325 325 326 auto startTime = MonotonicTime::now(); 327 auto timeoutTime = startTime + maxAllowableRenderingUpdateDurationForSynchronization(); 326 auto currentTime = MonotonicTime::now(); 327 auto estimatedNextDisplayRefreshTime = std::max(m_lastDisplayDidRefreshTime + frameDuration(), currentTime); 328 auto timeoutTime = std::min(currentTime + maxAllowableRenderingUpdateDurationForSynchronization(), estimatedNextDisplayRefreshTime); 328 329 329 330 bool becameIdle = m_stateCondition.waitUntil(m_treeLock, timeoutTime, [&] { … … 387 388 388 389 Locker locker { m_treeLock }; 390 391 auto now = MonotonicTime::now(); 392 m_lastDisplayDidRefreshTime = now; 393 serviceScrollAnimations(); 389 394 390 395 if (m_state != SynchronizationState::Idle && canUpdateLayersOnScrollingThread()) -
branches/safari-612.4.2.1-branch/Source/WebCore/page/scrolling/ThreadedScrollingTree.h
r286718 r286720 110 110 bool m_receivedBeganEventFromMainThread WTF_GUARDED_BY_LOCK(m_treeLock) { false }; 111 111 Condition m_waitingForBeganEventCondition; 112 113 MonotonicTime m_lastDisplayDidRefreshTime; 112 114 113 115 // Dynamically allocated because it has to use the ScrollingThread's runloop.
Note:
See TracChangeset
for help on using the changeset viewer.