[webkit-changes] [WebKit/WebKit] 06b9ec: [CoordinatedGraphics] Provide scheduled display-up...

Žan Doberšek noreply at github.com
Fri Mar 3 01:21:41 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 06b9ec1834d27a4fb8a324e29908ed274305620a
      https://github.com/WebKit/WebKit/commit/06b9ec1834d27a4fb8a324e29908ed274305620a
  Author: Žan Doberšek <zdobersek at igalia.com>
  Date:   2023-03-03 (Fri, 03 Mar 2023)

  Changed paths:
    M Source/WebCore/page/scrolling/nicosia/ScrollingTreeNicosia.cpp
    M Source/WebCore/page/scrolling/nicosia/ScrollingTreeNicosia.h
    M Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
    M Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h
    M Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp
    M Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp

  Log Message:
  -----------
  [CoordinatedGraphics] Provide scheduled display-update events for better scrolling handling
https://bugs.webkit.org/show_bug.cgi?id=252467

Reviewed by Carlos Garcia Campos.

In ThreadedCompositor, a timer is established on the composition thread that is
used to mimic display updates at the desired update frequency. This is necessary
in order to provide opportunities for update producers like the scrolling thread
to actually enact the desired composition changes, like scrolling, independently
of the main thread.

The timer is put on the composition thread, matching the compositing-thread
update timer in priority. Its delay is based on the established frequency of the
display updates.

ThreadedCompositor::displayUpdateFired() method is added and is dispatched upon
every firing of the timer. It notifies the scrolling thread(s) for the given
display ID through the EventDispatcher instance on the WebProcess singleton,
and the next firing of the timer is then scheduled.

When ThreadedCompositor enters into the composition phase, the display update
timer is stopped, and the displayUpdateFired() dispatcher is invoked manually
when the frame-complete signal is returned from the embedder's environment. This
allows aligning the display update timer with the environment's vsync signals
without disturbing the composition itself.

The target update frequency logic is pulled from ThreadedDisplayRefreshMonitor
into ThreadedCompositor, with the desired DisplayUpdate object now also kept in
that class. In order for ThreadedDisplayRefreshMonitor to use a sensible
DisplayUpdate object for each of its own dispatches, the DisplayUpdate object
is passed through the requiresDisplayRefreshCallback() method to the monitor,
where it's then stored for next invocation on the main thread, if it occurs.

ScrollingTreeNicosia::applyLayerPositionsInternal() override is provided,
establishing an update scope when running on the scrolling thread. This will
cause the applied positions to actually go through composition whenever the
scrolling is being handled on the scrolling thread, meaning outside of the usual
update process.

* Source/WebCore/page/scrolling/nicosia/ScrollingTreeNicosia.cpp:
(WebCore::ScrollingTreeNicosia::applyLayerPositionsInternal):
* Source/WebCore/page/scrolling/nicosia/ScrollingTreeNicosia.h:
* Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::m_displayRefreshMonitor):
(WebKit::ThreadedCompositor::renderLayerTree):
(WebKit::ThreadedCompositor::sceneUpdateFinished):
(WebKit::ThreadedCompositor::frameComplete):
(WebKit::ThreadedCompositor::targetRefreshRateDidChange):
(WebKit::ThreadedCompositor::displayUpdateFired):
* Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp:
(WebKit::ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor):
(WebKit::ThreadedDisplayRefreshMonitor::requiresDisplayRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::invalidate):
(WebKit::ThreadedDisplayRefreshMonitor::displayRefreshCallback):
(WebKit::ThreadedDisplayRefreshMonitor::setTargetRefreshRate): Deleted.
* Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h:
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp:
(WebKit::LayerTreeHost::displayDidRefresh):

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




More information about the webkit-changes mailing list