[webkit-changes] [WebKit/WebKit] 7dd240: Simplify frame scheduling logic in RemoteLayerTree...

mattwoodrow noreply at github.com
Mon Aug 14 16:19:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7dd240a390141ca50bf9be4a02b27bb05df91556
      https://github.com/WebKit/WebKit/commit/7dd240a390141ca50bf9be4a02b27bb05df91556
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2023-08-14 (Mon, 14 Aug 2023)

  Changed paths:
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
    M Source/WebKit/WebProcess/WebPage/DrawingArea.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
    M Source/WebKit/WebProcess/WebPage/mac/RemoteLayerTreeDrawingAreaMac.mm

  Log Message:
  -----------
  Simplify frame scheduling logic in RemoteLayerTreeDrawingArea.
https://bugs.webkit.org/show_bug.cgi?id=259999
<rdar://113657855>

Reviewed by Simon Fraser.

Previously, both scheduleRenderingUpdate and external calls to triggerRenderingUpdate would wait for the next displayDidRefresh
if one was pending. scheduleRenderingUpdate would check for this explicitly at call time. TriggerRenderingUpdate would
always run updateRendering on a 0ms timer, and then check at that point and reschedule (by setting m_deferredRenderingUpdateWhileWaitingForBackingStoreSwap=true).

This reverses the logic of triggerRenderingUpdate to be the same as scheduleRenderingUpdate by making them use the same code (a new scheduleRenderingUpdate function
with an enum to specify the exact behaviour). In very rare cases this could be a behaviour change (since we're checking state at a different point).

The difference between these two is now more clear, in the case where there isn't a displayDidRefresh pending, schedule has an extra async task dispatch that trigger
does not. This difference affects performance benchmark results, so trying to remove it is outside the scope of this patch.

It should now never be possible for displayDidRefresh to be pending when updateRendering is called, so m_deferredRenderingUpdateWhileWaitingForBackingStoreSwap is removed.
Setting of m_displayDidRefreshIsPending=true happens earlier, since we can sometimes recurse back in to trigger rendering during a rendering update.

Existing internal callers of triggerRenderingUpdate (and startRenderingUpdateTimer) have been changed to use the enum version of scheduleRenderingUpdate to make it clearer. Most
of these are using the as soon as possible variant, but almost certainly don't need to and could be changed.

The two call sites that synchronously called updateRendering have also been changed to scheduleRenderingUpdate(AsSoonAsPossible). These likely weren't synchronous previously (since
updateRendering aborted and rescheduled if displayDidRefresh was pending), but it was non-deterministic. Making them always just schedule seems a lot safer and easier to understand.

Renames m_waitingForBackingStoreSwap to m_displayDidRefreshIsPending since that's the name of the message
we're actually waiting for.

The logic in ::displayDidRefresh cleaned up in response to the above changes, since most of the complexity it checked for no longer exists.

* Source/WebKit/WebProcess/WebPage/DrawingArea.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
(WebKit::RemoteLayerTreeDrawingArea::displayDidRefreshIsPending const):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer):
(WebKit::RemoteLayerTreeDrawingArea::updateGeometry):
(WebKit::RemoteLayerTreeDrawingArea::setLayerTreeStateIsFrozen):
(WebKit::RemoteLayerTreeDrawingArea::forceRepaint):
(WebKit::RemoteLayerTreeDrawingArea::setExposedContentRect):
(WebKit::RemoteLayerTreeDrawingArea::startRenderingUpdateTimer):
(WebKit::RemoteLayerTreeDrawingArea::triggerRenderingUpdate):
(WebKit::RemoteLayerTreeDrawingArea::updateRendering):
(WebKit::RemoteLayerTreeDrawingArea::displayDidRefresh):
(WebKit::RemoteLayerTreeDrawingArea::activityStateDidChange):
(WebKit::RemoteLayerTreeDrawingArea::dispatchAfterEnsuringDrawing):
(WebKit::RemoteLayerTreeDrawingArea::scheduleRenderingUpdateTimerFired):
(WebKit::RemoteLayerTreeDrawingArea::scheduleRenderingUpdate):
* Source/WebKit/WebProcess/WebPage/mac/RemoteLayerTreeDrawingAreaMac.mm:
(WebKit::RemoteLayerTreeDrawingAreaMac::applyTransientZoomToPage):

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




More information about the webkit-changes mailing list