[webkit-changes] [WebKit/WebKit] 972d19: Drive macOS RemoteLayerTreeDrawingAreaProxy update...

Simon Fraser noreply at github.com
Mon Oct 31 19:18:42 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 972d19fa6e3366d294c4a2735c8d931d8f41f0d2
      https://github.com/WebKit/WebKit/commit/972d19fa6e3366d294c4a2735c8d931d8f41f0d2
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2022-10-31 (Mon, 31 Oct 2022)

  Changed paths:
    M Source/WebCore/page/scrolling/ScrollingTree.cpp
    M Source/WebCore/page/scrolling/ScrollingTree.h
    M Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp
    M Source/WebCore/page/scrolling/ThreadedScrollingTree.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h
    M Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.h
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebProcessPool.h
    M Source/WebKit/UIProcess/mac/DisplayLink.h

  Log Message:
  -----------
  Drive macOS RemoteLayerTreeDrawingAreaProxy updates from a DisplayLink
https://bugs.webkit.org/show_bug.cgi?id=247222
rdar://101704617

Reviewed by Tim Horton.

Replace the timer-based `displayDidRefresh` updates in RemoteLayerTreeDrawingAreaProxyMac with ones
driven from a DisplayLink.

RemoteLayerTreeDrawingAreaProxyMac owns a RemoteLayerTreeDisplayLinkClient, which receives `displayLinkFired()`
off the main thread; this bounces to the main thread, looking up the target DrawingAreaProxy via a WebPageProxyIdentifier
(to avoid the need to use WeakPtr across threads, or extend object lifetime). RemoteLayerTreeDrawingAreaProxyMac
uses m_displayRefreshObserverID to identify its primary observer, used to drive displayDidRefresh() which ultimately
drives rendering updates.

RemoteLayerTreeDrawingAreaProxyMac has a second observer identified with m_fullSpeedUpdateObserverID which
is only active when the scrolling tree has animations (e.g. rubber-banding); this observer will request
120Hz on capable displays. Future changes will ensure that 120Hz updates get filtered out of the rendering
update pipeline as appropriate. (This avoids use of DisplayLink::{increment,decrement}FullSpeedRequestClientCount
used for web process compositing, which was a mistake.)

RemoteLayerTreeDrawingAreaProxyMac::windowScreenDidChange() has to respond by unregistering
observers on the DisplayLink for the old display, and re-registering them for the new one.

`serviceScrollAnimations()` is moved from ThreadedScrollingTree to ScrollingTree so we can call
it from RemoteScrollingCoordinatorProxy. RemoteScrollingCoordinatorProxyMac also needs an override
so we actually apply layer positions after the scroll animations run.

`hasNodeWithAnimatedScrollChanged` is hooked up as the signal to start/stop the m_fullSpeedUpdateObserverID.

WebPageProxy::displayId() is renamed to WebPageProxy::displayID().

* Source/WebCore/page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::serviceScrollAnimations):
* Source/WebCore/page/scrolling/ScrollingTree.h:
(WebCore::ScrollingTree::displayDidRefresh):
* Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::serviceScrollAnimations): Deleted.
* Source/WebCore/page/scrolling/ThreadedScrollingTree.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
(WebKit::RemoteLayerTreeDrawingAreaProxy::setDisplayLinkWantsFullSpeedUpdates):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::displayDidRefresh):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
(WebKit::RemoteScrollingCoordinatorProxy::hasNodeWithAnimatedScrollChanged):
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeDrawingAreaProxyIOS.mm:
(-[WKDisplayLinkHandler initWithDrawingAreaProxy:]):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm:
(WebKit::RemoteLayerTreeDisplayLinkClient::displayLinkFired):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::RemoteLayerTreeDrawingAreaProxyMac):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::~RemoteLayerTreeDrawingAreaProxyMac):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::exisingDisplayLink):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::ensureDisplayLink):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::removeObserver):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::scheduleDisplayRefreshCallbacks):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::pauseDisplayRefreshCallbacks):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::setPreferredFramesPerSecond):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::setDisplayLinkWantsFullSpeedUpdates):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::windowScreenDidChange):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::didRefreshDisplay):
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::displayLinkTimerFired): Deleted.
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm:
(WebKit::RemoteScrollingCoordinatorProxyMac::displayDidRefresh):
(WebKit::RemoteScrollingCoordinatorProxyMac::hasNodeWithAnimatedScrollChanged):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.cpp:
(WebKit::RemoteScrollingTreeMac::hasNodeWithAnimatedScrollChanged):
(WebKit::RemoteScrollingTreeMac::displayDidRefresh):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.h:
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/UIProcess/mac/DisplayLink.h:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:

Canonical link: https://commits.webkit.org/256181@main




More information about the webkit-changes mailing list