Changeset 266710 in webkit


Ignore:
Timestamp:
Sep 7, 2020 1:55:31 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, reverting r266645.
https://bugs.webkit.org/show_bug.cgi?id=216251

Caused MotionMark regression

Reverted changeset:

"Move lazy DisplayLink tear down logic from the WebProcess to
the UIProcess"
https://bugs.webkit.org/show_bug.cgi?id=216195
https://trac.webkit.org/changeset/266645

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r266709 r266710  
     12020-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
    1152020-09-07  Sam Weinig  <weinig@apple.com>
    216
  • trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.cpp

    r266645 r266710  
    9595    {
    9696        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
    98103        m_scheduled = false;
    99104    }
  • trunk/Source/WebCore/platform/graphics/DisplayRefreshMonitor.h

    r266645 r266710  
    6161    PlatformDisplayID displayID() const { return m_displayID; }
    6262
    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    }
    6468
    6569    static RefPtr<DisplayRefreshMonitor> createDefaultDisplayRefreshMonitor(PlatformDisplayID);
     
    9195    Lock m_mutex;
    9296    PlatformDisplayID m_displayID { 0 };
     97    int m_unscheduledFireCount { 0 }; // Number of times the display link has fired with no clients.
    9398    bool m_active { true };
    9499    bool m_scheduled { false };
  • trunk/Source/WebKit/ChangeLog

    r266702 r266710  
     12020-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
    1152020-09-07  Mike Gorse  <mgorse@suse.com>
    216
  • trunk/Source/WebKit/UIProcess/mac/DisplayLink.cpp

    r266645 r266710  
    3333
    3434namespace WebKit {
    35 
    36 constexpr unsigned maxFireCountWithObservers { 20 };
    3735   
    3836DisplayLink::DisplayLink(WebCore::PlatformDisplayID displayID)
     
    7573{
    7674    ASSERT(RunLoop::isMain());
     75    bool isRunning = !m_observers.isEmpty();
    7776
    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    }
    8283
    83     if (!CVDisplayLinkIsRunning(m_displayLink)) {
     84    if (!isRunning) {
    8485        CVReturn error = CVDisplayLinkStart(m_displayLink);
    8586        if (error)
     
    9293    ASSERT(RunLoop::isMain());
    9394
    94     LockHolder locker(m_observersLock);
     95    {
     96        LockHolder locker(m_observersLock);
    9597
    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    }
    103106
    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);
    107109}
    108110
     
    111113    ASSERT(RunLoop::isMain());
    112114
    113     LockHolder locker(m_observersLock);
    114     m_observers.remove(&connection);
     115    {
     116        LockHolder locker(m_observersLock);
     117        m_observers.remove(&connection);
     118    }
    115119
    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
     124bool DisplayLink::hasObservers() const
     125{
     126    ASSERT(RunLoop::isMain());
     127    return !m_observers.isEmpty();
    119128}
    120129
    121130CVReturn DisplayLink::displayLinkCallback(CVDisplayLinkRef displayLinkRef, const CVTimeStamp*, const CVTimeStamp*, CVOptionFlags, CVOptionFlags*, void* data)
    122131{
    123     ASSERT(!RunLoop::isMain());
    124132    auto* displayLink = static_cast<DisplayLink*>(data);
    125 
    126133    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 
    134134    for (auto& connection : displayLink->m_observers.keys())
    135135        connection->send(Messages::EventDispatcher::DisplayWasRefreshed(displayLink->m_displayID), 0);
  • trunk/Source/WebKit/UIProcess/mac/DisplayLink.h

    r266645 r266710  
    4949    void removeObserver(IPC::Connection&, DisplayLinkObserverID);
    5050    void removeObservers(IPC::Connection&);
     51    bool hasObservers() const;
    5152
    5253    WebCore::PlatformDisplayID displayID() const { return m_displayID; }
     
    6162    HashMap<RefPtr<IPC::Connection>, Vector<DisplayLinkObserverID>> m_observers;
    6263    WebCore::PlatformDisplayID m_displayID;
    63     unsigned m_fireCountWithoutObservers { 0 };
    6464};
    6565
Note: See TracChangeset for help on using the changeset viewer.