Changeset 266710 in webkit
- Timestamp:
- Sep 7, 2020 1:55:31 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r266709 r266710 1 2020-09-07 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r266645. 4 https://bugs.webkit.org/show_bug.cgi?id=216251 5 6 Caused MotionMark regression 7 8 Reverted changeset: 9 10 "Move lazy DisplayLink tear down logic from the WebProcess to 11 the UIProcess" 12 https://bugs.webkit.org/show_bug.cgi?id=216195 13 https://trac.webkit.org/changeset/266645 14 1 15 2020-09-07 Sam Weinig <weinig@apple.com> 2 16 -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp
r266645 r266710 95 95 { 96 96 LockHolder lock(m_mutex); 97 LOG(RequestAnimationFrame, "DisplayRefreshMonitor::displayDidRefresh(%p) - m_scheduled(%d)", this, m_scheduled); 97 LOG(RequestAnimationFrame, "DisplayRefreshMonitor::displayDidRefresh(%p) - m_scheduled(%d), m_unscheduledFireCount(%d)", this, m_scheduled, m_unscheduledFireCount); 98 if (!m_scheduled) 99 ++m_unscheduledFireCount; 100 else 101 m_unscheduledFireCount = 0; 102 98 103 m_scheduled = false; 99 104 } -
trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h
r266645 r266710 61 61 PlatformDisplayID displayID() const { return m_displayID; } 62 62 63 bool shouldBeTerminated() const { return !m_scheduled; } 63 bool shouldBeTerminated() const 64 { 65 const int maxInactiveFireCount = 20; 66 return !m_scheduled && m_unscheduledFireCount > maxInactiveFireCount; 67 } 64 68 65 69 static RefPtr<DisplayRefreshMonitor> createDefaultDisplayRefreshMonitor(PlatformDisplayID); … … 91 95 Lock m_mutex; 92 96 PlatformDisplayID m_displayID { 0 }; 97 int m_unscheduledFireCount { 0 }; // Number of times the display link has fired with no clients. 93 98 bool m_active { true }; 94 99 bool m_scheduled { false }; -
trunk/Source/WebKit/ChangeLog
r266702 r266710 1 2020-09-07 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r266645. 4 https://bugs.webkit.org/show_bug.cgi?id=216251 5 6 Caused MotionMark regression 7 8 Reverted changeset: 9 10 "Move lazy DisplayLink tear down logic from the WebProcess to 11 the UIProcess" 12 https://bugs.webkit.org/show_bug.cgi?id=216195 13 https://trac.webkit.org/changeset/266645 14 1 15 2020-09-07 Mike Gorse <mgorse@suse.com> 2 16 -
trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp
r266645 r266710 33 33 34 34 namespace WebKit { 35 36 constexpr unsigned maxFireCountWithObservers { 20 };37 35 38 36 DisplayLink::DisplayLink(WebCore::PlatformDisplayID displayID) … … 75 73 { 76 74 ASSERT(RunLoop::isMain()); 75 bool isRunning = !m_observers.isEmpty(); 77 76 78 LockHolder locker(m_observersLock); 79 m_observers.ensure(&connection, [] { 80 return Vector<DisplayLinkObserverID> { }; 81 }).iterator->value.append(observerID); 77 { 78 LockHolder locker(m_observersLock); 79 m_observers.ensure(&connection, [] { 80 return Vector<DisplayLinkObserverID> { }; 81 }).iterator->value.append(observerID); 82 } 82 83 83 if (! CVDisplayLinkIsRunning(m_displayLink)) {84 if (!isRunning) { 84 85 CVReturn error = CVDisplayLinkStart(m_displayLink); 85 86 if (error) … … 92 93 ASSERT(RunLoop::isMain()); 93 94 94 LockHolder locker(m_observersLock); 95 { 96 LockHolder locker(m_observersLock); 95 97 96 auto it = m_observers.find(&connection); 97 if (it == m_observers.end()) 98 return; 99 bool removed = it->value.removeFirst(observerID); 100 ASSERT_UNUSED(removed, removed); 101 if (it->value.isEmpty()) 102 m_observers.remove(it); 98 auto it = m_observers.find(&connection); 99 if (it == m_observers.end()) 100 return; 101 bool removed = it->value.removeFirst(observerID); 102 ASSERT_UNUSED(removed, removed); 103 if (it->value.isEmpty()) 104 m_observers.remove(it); 105 } 103 106 104 // We do not stop the display link right away when |m_observers| becomes empty. Instead, we 105 // let the display link fire up to |maxFireCountWithObservers| times without observers to avoid 106 // killing & restarting too many threads when observers gets removed & added in quick succession. 107 if (m_observers.isEmpty()) 108 CVDisplayLinkStop(m_displayLink); 107 109 } 108 110 … … 111 113 ASSERT(RunLoop::isMain()); 112 114 113 LockHolder locker(m_observersLock); 114 m_observers.remove(&connection); 115 { 116 LockHolder locker(m_observersLock); 117 m_observers.remove(&connection); 118 } 115 119 116 // We do not stop the display link right away when |m_observers| becomes empty. Instead, we 117 // let the display link fire up to |maxFireCountWithObservers| times without observers to avoid 118 // killing & restarting too many threads when observers gets removed & added in quick succession. 120 if (m_observers.isEmpty()) 121 CVDisplayLinkStop(m_displayLink); 122 } 123 124 bool DisplayLink::hasObservers() const 125 { 126 ASSERT(RunLoop::isMain()); 127 return !m_observers.isEmpty(); 119 128 } 120 129 121 130 CVReturn DisplayLink::displayLinkCallback(CVDisplayLinkRef displayLinkRef, const CVTimeStamp*, const CVTimeStamp*, CVOptionFlags, CVOptionFlags*, void* data) 122 131 { 123 ASSERT(!RunLoop::isMain());124 132 auto* displayLink = static_cast<DisplayLink*>(data); 125 126 133 LockHolder locker(displayLink->m_observersLock); 127 if (displayLink->m_observers.isEmpty()) {128 if (++(displayLink->m_fireCountWithoutObservers) >= maxFireCountWithObservers)129 CVDisplayLinkStop(displayLink->m_displayLink);130 return kCVReturnSuccess;131 }132 displayLink->m_fireCountWithoutObservers = 0;133 134 134 for (auto& connection : displayLink->m_observers.keys()) 135 135 connection->send(Messages::EventDispatcher::DisplayWasRefreshed(displayLink->m_displayID), 0); -
trunk/Source/WebKit/UIProcess/mac/DisplayLink.h
r266645 r266710 49 49 void removeObserver(IPC::Connection&, DisplayLinkObserverID); 50 50 void removeObservers(IPC::Connection&); 51 bool hasObservers() const; 51 52 52 53 WebCore::PlatformDisplayID displayID() const { return m_displayID; } … … 61 62 HashMap<RefPtr<IPC::Connection>, Vector<DisplayLinkObserverID>> m_observers; 62 63 WebCore::PlatformDisplayID m_displayID; 63 unsigned m_fireCountWithoutObservers { 0 };64 64 }; 65 65
Note: See TracChangeset
for help on using the changeset viewer.