Skip to content

Commit

Permalink
Cherry-pick ab6f033. rdar://problem/111986083
Browse files Browse the repository at this point in the history
    REGRESSION (265825@main): Safari CPU usage in SurferJoannaProxy increased by 5.8%
    https://bugs.webkit.org/show_bug.cgi?id=259805
    rdar://111986083

    Reviewed by Matt Woodrow.

    The fix in 265825@main caused a slight performance regression. We can
    now back out most of it, thanks to a change in CoreAnimation.

    The thing we don't restore is the CATransaction.

    * Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h:
    * Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
    (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):

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

Identifier: 265870.303@safari-7616.1.27.10-branch
  • Loading branch information
grorg authored and rjepstein committed Aug 5, 2023
1 parent 028e6ef commit 54ed588
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
1 change: 0 additions & 1 deletion Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ typedef enum {
kCATransactionPhasePreLayout,
kCATransactionPhasePreCommit,
kCATransactionPhasePostCommit,
kCATransactionPhasePostSynchronize = 5,
kCATransactionPhaseNull = ~0u
} CATransactionPhase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,25 +160,8 @@

void RemoteLayerTreeDrawingAreaProxy::commitLayerTree(IPC::Connection& connection, const Vector<std::pair<RemoteLayerTreeTransaction, RemoteScrollingCoordinatorTransaction>>& transactions)
{
Vector<MachSendRight> sendRights;
for (auto& transaction : transactions) {
// commitLayerTreeTransaction consumes the incoming buffers, so we need to grab them first.
for (auto& [layerID, properties] : transaction.first.changedLayerProperties()) {
const auto backingStoreProperties = properties->backingStoreProperties.get();
if (!backingStoreProperties)
continue;
if (const auto& backendHandle = backingStoreProperties->bufferHandle()) {
if (const auto* sendRight = std::get_if<MachSendRight>(&backendHandle.value()))
sendRights.append(*sendRight);
}
}

for (auto& transaction : transactions)
commitLayerTreeTransaction(connection, transaction.first, transaction.second);
}

// Keep IOSurface send rights alive until the commit makes it to the render server, otherwise we will
// prematurely drop the only reference to them, and `inUse` will be wrong for a brief window.
[CATransaction addCommitHandler:[sendRights = WTFMove(sendRights)]() { } forPhase:kCATransactionPhasePostSynchronize];
}

void RemoteLayerTreeDrawingAreaProxy::commitLayerTreeTransaction(IPC::Connection& connection, const RemoteLayerTreeTransaction& layerTreeTransaction, const RemoteScrollingCoordinatorTransaction& scrollingTreeTransaction)
Expand Down

0 comments on commit 54ed588

Please sign in to comment.