[webkit-changes] [WebKit/WebKit] 318643: Implement scroll synchronisation for UI-side compo...

mattwoodrow noreply at github.com
Mon Apr 3 15:45:21 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 318643e7b097508e3ff4d2b513b2530287febe75
      https://github.com/WebKit/WebKit/commit/318643e7b097508e3ff4d2b513b2530287febe75
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2023-04-03 (Mon, 03 Apr 2023)

  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.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm

  Log Message:
  -----------
  Implement scroll synchronisation for UI-side compositing.
https://bugs.webkit.org/show_bug.cgi?id=254772
<rdar://106293351>

Reviewed by Simon Fraser.

This largely duplicates what ThreadedScrollingTree does, in RemoteLayerTreeEventDispatcher instead.

The main functional difference is that since this code runs in the UI process, we can't easily
determine if the Web process main thread has rendering scheduled.

The code instead sets a 1ms timeout (on didRefreshDisplay) to wait for the UI process main thread
to acknoweledge the display update. This can fail if the thread is busy, or if we didn't send
didRefreshDisplay to that thread (which usually runs at a lower refresh rate than the scrolling thread).

If the timeout elapses, then scroll positions are immediately applied, but the synchronization state
isn't set to Desynchronized, since this happens every second frame (when the scrolling thread refreshes
at 120hz).

* Source/WebCore/page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::frameDuration):
(WebCore::ScrollingTree::maxAllowableRenderingUpdateDurationForSynchronization):
* Source/WebCore/page/scrolling/ScrollingTree.h:
* Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::frameDuration): Deleted.
(WebCore::ThreadedScrollingTree::maxAllowableRenderingUpdateDurationForSynchronization): Deleted.
* Source/WebCore/page/scrolling/ThreadedScrollingTree.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp:
(WebKit::RemoteLayerTreeEventDispatcher::internalHandleWheelEvent):
(WebKit::RemoteLayerTreeEventDispatcher::didRefreshDisplay):
(WebKit::RemoteLayerTreeEventDispatcher::scheduleDelayedRenderingUpdateDetectionTimer):
(WebKit::RemoteLayerTreeEventDispatcher::delayedRenderingUpdateDetectionTimerFired):
(WebKit::RemoteLayerTreeEventDispatcher::waitForRenderingUpdateCompletionOrTimeout):
(WebKit::RemoteLayerTreeEventDispatcher::mainThreadDisplayDidRefresh):
(WebKit::RemoteLayerTreeEventDispatcher::renderingUpdateComplete):
(WebKit::RemoteLayerTreeEventDispatcher::windowScreenDidChange):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.h:
(WebKit::RemoteLayerTreeEventDispatcher::WTF_GUARDED_BY_LOCK):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm:
(WebKit::RemoteScrollingCoordinatorProxyMac::applyScrollingTreeLayerPositionsAfterCommit):

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




More information about the webkit-changes mailing list