Skip to content

Commit

Permalink
[UI-side compositing] Scrolling is not as smooth as it should be on 1…
Browse files Browse the repository at this point in the history
…20Hz displays

https://bugs.webkit.org/show_bug.cgi?id=255254
<rdar://107837416>

Reviewed by Tim Horton and Matt Woodrow.

On 120Hz displays, the scrolling thread would get displayDidRefresh() at 120Hz, but frameDuration()
was the default 1/60s, causing
RemoteLayerTreeEventDispatcher::waitForRenderingUpdateCompletionOrTimeout() to block for up to 8ms
(half the frame duration).

No-one called ScrollingTree::windowScreenDidChange(), so fix that by calling it from
RemoteLayerTreeEventDispatcher.

* Source/WebCore/page/scrolling/ScrollingTree.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp:
(WebKit::RemoteLayerTreeEventDispatcher::windowScreenDidChange):

Canonical link: https://commits.webkit.org/262801@main
  • Loading branch information
smfr committed Apr 11, 2023
1 parent 0f2621d commit 80da2ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/WebCore/page/scrolling/ScrollingTree.h
Expand Up @@ -209,7 +209,7 @@ class ScrollingTree : public ThreadSafeRefCounted<ScrollingTree> {

Lock& treeLock() WTF_RETURNS_LOCK(m_treeLock) { return m_treeLock; }

void windowScreenDidChange(PlatformDisplayID, std::optional<FramesPerSecond> nominalFramesPerSecond);
WEBCORE_EXPORT void windowScreenDidChange(PlatformDisplayID, std::optional<FramesPerSecond> nominalFramesPerSecond);
PlatformDisplayID displayID();
WEBCORE_EXPORT virtual void displayDidRefresh(PlatformDisplayID) { }

Expand Down
Expand Up @@ -497,6 +497,9 @@ void RemoteLayerTreeEventDispatcher::windowScreenDidChange(PlatformDisplayID dis
UNUSED_PARAM(displayID);
UNUSED_PARAM(nominalFramesPerSecond);
#endif
if (auto scrollingTree = this->scrollingTree())
scrollingTree->windowScreenDidChange(displayID, nominalFramesPerSecond);

// FIXME: Restart the displayLink if necessary.
}

Expand Down

0 comments on commit 80da2ab

Please sign in to comment.