⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 284811 in webkit


Ignore:
Timestamp:
Oct 25, 2021, 12:10:10 PM (5 years ago)
Author:
Alan Coon
Message:

Cherry-pick r284644. rdar://problem/84153991

Rare crash under DisplayLink::displayLinkCallback()
https://bugs.webkit.org/show_bug.cgi?id=232101
<rdar://84153991>

Reviewed by Tim Horton.

The crash was a divide by zero under m_currentUpdate.nextUpdate(), indicating that
m_currentUpdate.updatesPerSecond was zero. Previous assumptions that this was caused
by weird display configs were wrong. The actual issue is a race condition where
the callback can fire while we're still inside CVDisplayLinkStart(), or at least
before we've updated m_currentUpdate.

The fix is to initialize m_currentUpdate before we call CVDisplayLinkStart().

  • UIProcess/mac/DisplayLink.cpp: (WebKit::DisplayLink::addObserver):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284644 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612-branch/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612-branch/Source/WebKit/ChangeLog

    r284482 r284811  
     12021-10-25  Null  <null@apple.com>
     2
     3        Cherry-pick r284644. rdar://problem/84153991
     4
     5    Rare crash under DisplayLink::displayLinkCallback()
     6    https://bugs.webkit.org/show_bug.cgi?id=232101
     7    <rdar://84153991>
     8   
     9    Reviewed by Tim Horton.
     10   
     11    The crash was a divide by zero under m_currentUpdate.nextUpdate(), indicating that
     12    m_currentUpdate.updatesPerSecond was zero. Previous assumptions that this was caused
     13    by weird display configs were wrong. The actual issue is a race condition where
     14    the callback can fire while we're still inside CVDisplayLinkStart(), or at least
     15    before we've updated m_currentUpdate.
     16   
     17    The fix is to initialize m_currentUpdate before we call CVDisplayLinkStart().
     18   
     19    * UIProcess/mac/DisplayLink.cpp:
     20    (WebKit::DisplayLink::addObserver):
     21   
     22   
     23    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@284644 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     24
     25    2021-10-21  Simon Fraser  <simon.fraser@apple.com>
     26
     27            Rare crash under DisplayLink::displayLinkCallback()
     28            https://bugs.webkit.org/show_bug.cgi?id=232101
     29            <rdar://84153991>
     30
     31            Reviewed by Tim Horton.
     32
     33            The crash was a divide by zero under m_currentUpdate.nextUpdate(), indicating that
     34            m_currentUpdate.updatesPerSecond was zero. Previous assumptions that this was caused
     35            by weird display configs were wrong. The actual issue is a race condition where
     36            the callback can fire while we're still inside CVDisplayLinkStart(), or at least
     37            before we've updated m_currentUpdate.
     38
     39            The fix is to initialize m_currentUpdate before we call CVDisplayLinkStart().
     40
     41            * UIProcess/mac/DisplayLink.cpp:
     42            (WebKit::DisplayLink::addObserver):
     43
    1442021-10-19  Russell Epstein  <repstein@apple.com>
    245
  • branches/safari-612-branch/Source/WebKit/UIProcess/mac/DisplayLink.cpp

    r283691 r284811  
    102102    if (!CVDisplayLinkIsRunning(m_displayLink)) {
    103103        LOG_WITH_STREAM(DisplayLink, stream << "[UI ] DisplayLink for display " << m_displayID << " starting CVDisplayLink with fps " << m_displayNominalFramesPerSecond);
     104
     105        m_currentUpdate = { 0, m_displayNominalFramesPerSecond };
     106
    104107        CVReturn error = CVDisplayLinkStart(m_displayLink);
    105108        if (error)
    106109            RELEASE_LOG_FAULT(DisplayLink, "DisplayLink: Could not start the display link: %d", error);
    107 
    108         if (!m_displayNominalFramesPerSecond) {
    109             RELEASE_LOG_FAULT(DisplayLink, "DisplayLink: displayNominalFramesPerSecond is 0, using %d", WebCore::FullSpeedFramesPerSecond);
    110             m_displayNominalFramesPerSecond = WebCore::FullSpeedFramesPerSecond;
    111         };
    112 
    113         m_currentUpdate = { 0, m_displayNominalFramesPerSecond };
    114110    }
    115111}
Note: See TracChangeset for help on using the changeset viewer.