Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use CAIOSurface to cache IOSurfaces in the UI process. #11270

Merged
merged 1 commit into from
Mar 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@
CD6122CD2559B6AC00FC657A /* OutputContext.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD6122CB2559B6AC00FC657A /* OutputContext.mm */; };
CD6122D12559B8F200FC657A /* OutputDevice.mm in Sources */ = {isa = PBXBuildFile; fileRef = CD6122CF2559B8F200FC657A /* OutputDevice.mm */; };
CDACB3602387425B0018D7CE /* MediaToolboxSoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CDACB35E23873E480018D7CE /* MediaToolboxSoftLink.cpp */; };
D065131629B69F11008C65C4 /* QuartzCoreSoftLink.mm in Sources */ = {isa = PBXBuildFile; fileRef = D065131429B69F11008C65C4 /* QuartzCoreSoftLink.mm */; };
D065131729B69F12008C65C4 /* QuartzCoreSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = D065131529B69F11008C65C4 /* QuartzCoreSoftLink.h */; settings = {ATTRIBUTES = (Private, ); }; };
DD05A36027BF0ACE0096EFAB /* libWTF.a in Product Dependencies */ = {isa = PBXBuildFile; fileRef = DD05A35F27BF0AC40096EFAB /* libWTF.a */; };
DD0B43C227F679A7009E31FC /* WebGPU.framework in Product Dependencies */ = {isa = PBXBuildFile; fileRef = DD0B43C127F67999009E31FC /* WebGPU.framework */; };
DD20DD1227BC90D60093D175 /* MediaTimeAVFoundation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0C00CFD21F68CE4600AAC26D /* MediaTimeAVFoundation.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -999,6 +1001,8 @@
CDACB35F23873E480018D7CE /* MediaToolboxSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaToolboxSoftLink.h; sourceTree = "<group>"; };
CDF91112220E4EEC001EA39E /* CelestialSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CelestialSPI.h; sourceTree = "<group>"; };
CE5673862151A7B9002F92D7 /* IOKitSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IOKitSPI.h; sourceTree = "<group>"; };
D065131429B69F11008C65C4 /* QuartzCoreSoftLink.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QuartzCoreSoftLink.mm; sourceTree = "<group>"; };
D065131529B69F11008C65C4 /* QuartzCoreSoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuartzCoreSoftLink.h; sourceTree = "<group>"; };
DD05A35F27BF0AC40096EFAB /* libWTF.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWTF.a; sourceTree = BUILT_PRODUCTS_DIR; };
DD0B43C127F67999009E31FC /* WebGPU.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = WebGPU.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DDE99300278D07B800F60D26 /* libWebKitAdditions.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libWebKitAdditions.a; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -1440,6 +1444,8 @@
31647FAE251759DB0010F8FB /* OpenGLSoftLinkCocoa.mm */,
A1F63C9D21A4DBF7006FB43B /* PassKitSoftLink.h */,
A1F63C9E21A4DBF7006FB43B /* PassKitSoftLink.mm */,
D065131529B69F11008C65C4 /* QuartzCoreSoftLink.h */,
D065131429B69F11008C65C4 /* QuartzCoreSoftLink.mm */,
F4974EA1265EEA2200B49B8C /* RevealSoftLink.h */,
F4974EA2265EEA2200B49B8C /* RevealSoftLink.mm */,
93B38EBD25821CB600198E63 /* SpeechSoftLink.h */,
Expand Down Expand Up @@ -1915,6 +1921,7 @@
E34F26F62846D0D90076E549 /* PowerLogSPI.h in Headers */,
DD20DE0427BC90D80093D175 /* pthreadSPI.h in Headers */,
5CB898B2286274FA00CA3485 /* QuarantineSPI.h in Headers */,
D065131729B69F12008C65C4 /* QuartzCoreSoftLink.h in Headers */,
DD20DE0527BC90D80093D175 /* QuartzCoreSPI.h in Headers */,
DD20DE3F27BC90D80093D175 /* QuickLookMacSPI.h in Headers */,
DD20DDC127BC90D70093D175 /* QuickLookSoftLink.h in Headers */,
Expand Down Expand Up @@ -2275,6 +2282,7 @@
CD6122D12559B8F200FC657A /* OutputDevice.mm in Sources */,
A1F63CA021A4DBF7006FB43B /* PassKitSoftLink.mm in Sources */,
A1175B4F1F6B337300C4B9F0 /* PopupMenu.mm in Sources */,
D065131629B69F11008C65C4 /* QuartzCoreSoftLink.mm in Sources */,
4450FC9F21F5F602004DFA56 /* QuickLookSoftLink.mm in Sources */,
F4C85A4E2658551A005B89CC /* QuickLookUISoftLink.mm in Sources */,
071C00372707EDF000D027C7 /* ReplayKitSoftLink.mm in Sources */,
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/PAL/pal/PlatformMac.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ list(APPEND PAL_PUBLIC_HEADERS
cocoa/NetworkConnectionIntegritySoftLink.h
cocoa/OpenGLSoftLinkCocoa.h
cocoa/PassKitSoftLink.h
cocoa/QuartzCoreSoftLink.h
cocoa/RevealSoftLink.h
cocoa/SpeechSoftLink.h
cocoa/TranslationUIServicesSoftLink.h
Expand Down Expand Up @@ -178,6 +179,7 @@ list(APPEND PAL_SOURCES
cocoa/NetworkConnectionIntegritySoftLink.mm
cocoa/OpenGLSoftLinkCocoa.mm
cocoa/PassKitSoftLink.mm
cocoa/QuartzCoreSoftLink.mm
cocoa/RevealSoftLink.mm
cocoa/SpeechSoftLink.mm
cocoa/TranslationUIServicesSoftLink.mm
Expand Down
35 changes: 35 additions & 0 deletions Source/WebCore/PAL/pal/cocoa/QuartzCoreSoftLink.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2023 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#pragma once

#include <pal/spi/cocoa/QuartzCoreSPI.h>
#include <wtf/SoftLinking.h>

SOFT_LINK_FRAMEWORK_FOR_HEADER(PAL, QuartzCore)

SOFT_LINK_FUNCTION_MAY_FAIL_FOR_HEADER(PAL, QuartzCore, CAIOSurfaceCreate, CAIOSurfaceRef, (IOSurfaceRef surface), (surface))
#define CAIOSurfaceCreate PAL::softLink_QuartzCore_CAIOSurfaceCreate

33 changes: 33 additions & 0 deletions Source/WebCore/PAL/pal/cocoa/QuartzCoreSoftLink.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (C) 2020 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "config.h"

#include <pal/spi/cocoa/QuartzCoreSPI.h>
#include <wtf/SoftLinking.h>

SOFT_LINK_FRAMEWORK_FOR_SOURCE_WITH_EXPORT(PAL, QuartzCore, PAL_EXPORT)
SOFT_LINK_FUNCTION_MAY_FAIL_FOR_SOURCE_WITH_EXPORT(PAL, QuartzCore, CAIOSurfaceCreate, CAIOSurfaceRef, (IOSurfaceRef surface), (surface), PAL_EXPORT)

2 changes: 2 additions & 0 deletions Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ CAMachPortRef CAMachPortCreate(mach_port_t);
mach_port_t CAMachPortGetPort(CAMachPortRef);
CFTypeID CAMachPortGetTypeID(void);

typedef struct _CAIOSurface *CAIOSurfaceRef;

void CABackingStoreCollectBlocking(void);

typedef struct _CARenderCGContext CARenderCGContext;
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/platform/graphics/cocoa/IOSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ class IOSurface final {
#ifdef __OBJC__
id asLayerContents() const { return (__bridge id)m_surface.get(); }
#endif
WEBCORE_EXPORT RetainPtr<id> asCAIOSurfaceLayerContents() const;

IOSurfaceRef surface() const { return m_surface.get(); }
WEBCORE_EXPORT CGContextRef ensurePlatformContext(PlatformDisplayID = 0);
// The graphics context cached on the surface counts as a "user", so to get
Expand Down
11 changes: 11 additions & 0 deletions Source/WebCore/platform/graphics/cocoa/IOSurface.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#import "PlatformScreen.h"
#import "ProcessCapabilities.h"
#import "ProcessIdentity.h"
#import <pal/cocoa/QuartzCoreSoftLink.h>
#import <pal/spi/cg/CoreGraphicsSPI.h>
#import <wtf/Assertions.h>
#import <wtf/MachSendRight.h>
Expand Down Expand Up @@ -337,6 +338,16 @@ static IntSize computeMaximumSurfaceSize()
return MachSendRight::adopt(IOSurfaceCreateMachPort(m_surface.get()));
}

RetainPtr<id> IOSurface::asCAIOSurfaceLayerContents() const
{
// CAIOSurface keeps most of the server-side rendering ojects alive,
// but doesn't mark the IOSurface as in-use. We can retain it for efficiency
// without breaking use-counting.
if (PAL::canLoad_QuartzCore_CAIOSurfaceCreate())
return bridge_id_cast(adoptCF(CAIOSurfaceCreate(m_surface.get())));
return nil;
}

RetainPtr<CGImageRef> IOSurface::createImage()
{
return adoptCF(CGIOSurfaceContextCreateImage(ensurePlatformContext()));
Expand Down
11 changes: 10 additions & 1 deletion Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ namespace WebKit {

class PlatformCALayerRemote;
class RemoteLayerBackingStoreCollection;
class RemoteLayerTreeNode;
enum class SwapBuffersDisplayRequirement : uint8_t;

#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
Expand Down Expand Up @@ -170,6 +171,7 @@ class RemoteLayerBackingStore {
}

void discard();
void encode(IPC::Encoder&) const;
};

bool setBufferVolatile(Buffer&);
Expand Down Expand Up @@ -214,12 +216,19 @@ class RemoteLayerBackingStoreProperties {

static WARN_UNUSED_RETURN bool decode(IPC::Decoder&, RemoteLayerBackingStoreProperties&);

enum class LayerContentsType { IOSurface, CAMachPort };
enum class LayerContentsType { IOSurface, CAMachPort, CachedIOSurface };
void applyBackingStoreToLayer(CALayer *, LayerContentsType, bool replayCGDisplayListsIntoBackingStore);

void updateCachedBuffers(RemoteLayerTreeNode&, LayerContentsType);

static RetainPtr<id> layerContentsBufferFromBackendHandle(ImageBufferBackendHandle&&, LayerContentsType);
private:
std::optional<ImageBufferBackendHandle> m_bufferHandle;
RetainPtr<id> m_contentsBuffer;

std::optional<WebCore::RenderingResourceIdentifier> m_frontBufferIdentifier;
std::optional<WebCore::RenderingResourceIdentifier> m_backBufferIdentifier;
std::optional<WebCore::RenderingResourceIdentifier> m_secondaryBackBufferIdentifier;

#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
std::optional<ImageBufferBackendHandle> m_displayListBufferHandle;
Expand Down
62 changes: 61 additions & 1 deletion Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#import "RemoteLayerBackingStoreCollection.h"
#import "RemoteLayerTreeContext.h"
#import "RemoteLayerTreeLayers.h"
#import "RemoteLayerTreeNode.h"
#import "ShareableBitmap.h"
#import "SwapBuffersDisplayRequirement.h"
#import "WebCoreArgumentCoders.h"
Expand Down Expand Up @@ -115,6 +116,14 @@
#endif
}

void RemoteLayerBackingStore::Buffer::encode(IPC::Encoder& encoder) const
{
if (imageBuffer)
encoder << std::optional(imageBuffer->renderingResourceIdentifier());
else
encoder << std::optional<RenderingResourceIdentifier>();
}

void RemoteLayerBackingStore::encode(IPC::Encoder& encoder) const
{
auto handleFromBuffer = [](ImageBuffer& buffer) -> std::optional<ImageBufferBackendHandle> {
Expand Down Expand Up @@ -142,6 +151,10 @@

encoder << WTFMove(handle);

encoder << m_frontBuffer;
encoder << m_backBuffer;
encoder << m_secondaryBackBuffer;

#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
std::optional<ImageBufferBackendHandle> displayListHandle;
if (m_displayListBuffer)
Expand All @@ -159,6 +172,15 @@
if (!decoder.decode(result.m_bufferHandle))
return false;

if (!decoder.decode(result.m_frontBufferIdentifier))
return false;

if (!decoder.decode(result.m_backBufferIdentifier))
return false;

if (!decoder.decode(result.m_secondaryBackBufferIdentifier))
return false;

#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
if (!decoder.decode(result.m_displayListBufferHandle))
return false;
Expand Down Expand Up @@ -577,6 +599,10 @@
case RemoteLayerBackingStoreProperties::LayerContentsType::CAMachPort:
contents = bridge_id_cast(adoptCF(CAMachPortCreate(machSendRight.leakSendRight())));
break;
case RemoteLayerBackingStoreProperties::LayerContentsType::CachedIOSurface:
auto surface = WebCore::IOSurface::createFromSendRight(WTFMove(machSendRight));
contents = surface ? surface->asCAIOSurfaceLayerContents() : nil;
break;
}
}
#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
Expand All @@ -595,7 +621,9 @@

RetainPtr<id> contents;
// m_bufferHandle can be unset here if IPC with the GPU process timed out.
if (m_bufferHandle)
if (m_contentsBuffer)
contents = m_contentsBuffer;
else if (m_bufferHandle)
contents = layerContentsBufferFromBackendHandle(WTFMove(*m_bufferHandle), contentsType);

if (!contents) {
Expand Down Expand Up @@ -624,6 +652,38 @@
layer.contents = contents.get();
}

void RemoteLayerBackingStoreProperties::updateCachedBuffers(RemoteLayerTreeNode& node, LayerContentsType contentsType)
{
Vector<RemoteLayerTreeNode::CachedContentsBuffer> cachedBuffers = node.takeCachedContentsBuffers();

if (contentsType != LayerContentsType::CachedIOSurface || !m_frontBufferIdentifier)
return;

cachedBuffers.removeAllMatching([&](const RemoteLayerTreeNode::CachedContentsBuffer& current) {
if (m_frontBufferIdentifier && m_frontBufferIdentifier == current.m_renderingResourceIdentifier)
return false;
if (m_backBufferIdentifier && m_backBufferIdentifier == current.m_renderingResourceIdentifier)
return false;
if (m_secondaryBackBufferIdentifier && m_secondaryBackBufferIdentifier == current.m_renderingResourceIdentifier)
return false;
return true;
});

for (auto& current : cachedBuffers) {
if (*m_frontBufferIdentifier == current.m_renderingResourceIdentifier) {
m_contentsBuffer = current.m_buffer;
break;
}
}

if (!m_contentsBuffer) {
m_contentsBuffer = layerContentsBufferFromBackendHandle(WTFMove(*m_bufferHandle), LayerContentsType::CachedIOSurface);
cachedBuffers.append({ *m_frontBufferIdentifier, m_contentsBuffer });
}

node.setCachedContentsBuffers(WTFMove(cachedBuffers));
}

Vector<std::unique_ptr<ThreadSafeImageBufferFlusher>> RemoteLayerBackingStore::takePendingFlushers()
{
LOG_WITH_STREAM(RemoteRenderingBufferVolatility, stream << "RemoteLayerBackingStore " << m_layer->layerID() << " takePendingFlushers()");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class RemoteLayerTreePropertyApplier {

static void applyHierarchyUpdates(RemoteLayerTreeNode&, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&);
static void applyProperties(RemoteLayerTreeNode&, RemoteLayerTreeHost*, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&, RemoteLayerBackingStoreProperties::LayerContentsType);
static void applyPropertiesToLayer(CALayer *, RemoteLayerTreeHost*, const RemoteLayerTreeTransaction::LayerProperties&, RemoteLayerBackingStoreProperties::LayerContentsType);
static void applyPropertiesToLayer(CALayer *, RemoteLayerTreeNode*, RemoteLayerTreeHost*, const RemoteLayerTreeTransaction::LayerProperties&, RemoteLayerBackingStoreProperties::LayerContentsType);

private:
static void updateMask(RemoteLayerTreeNode&, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ static void applyCommonPropertiesToLayer(CALayer *layer, const RemoteLayerTreeTr
layer.masksToBounds = properties.masksToBounds;
}

void RemoteLayerTreePropertyApplier::applyPropertiesToLayer(CALayer *layer, RemoteLayerTreeHost* layerTreeHost, const RemoteLayerTreeTransaction::LayerProperties& properties, RemoteLayerBackingStoreProperties::LayerContentsType layerContentsType)
void RemoteLayerTreePropertyApplier::applyPropertiesToLayer(CALayer *layer, RemoteLayerTreeNode* layerTreeNode, RemoteLayerTreeHost* layerTreeHost, const RemoteLayerTreeTransaction::LayerProperties& properties, RemoteLayerBackingStoreProperties::LayerContentsType layerContentsType)
{
applyCommonPropertiesToLayer(layer, properties);

Expand Down Expand Up @@ -256,9 +256,12 @@ static void applyCommonPropertiesToLayer(CALayer *layer, const RemoteLayerTreeTr
|| properties.changedProperties & LayerChange::BackingStoreAttachmentChanged)
{
auto* backingStore = properties.backingStoreProperties.get();
if (backingStore && properties.backingStoreAttached)
if (backingStore && properties.backingStoreAttached) {
if (layerTreeNode)
backingStore->updateCachedBuffers(*layerTreeNode, layerContentsType);

backingStore->applyBackingStoreToLayer(layer, layerContentsType, layerTreeHost->replayCGDisplayListsIntoBackingStore());
else
} else
[layer _web_clearContents];
}

Expand Down Expand Up @@ -297,7 +300,7 @@ static void applyCommonPropertiesToLayer(CALayer *layer, const RemoteLayerTreeTr
{
BEGIN_BLOCK_OBJC_EXCEPTIONS

applyPropertiesToLayer(node.layer(), layerTreeHost, properties, layerContentsType);
applyPropertiesToLayer(node.layer(), &node, layerTreeHost, properties, layerContentsType);
#if ENABLE(INTERACTION_REGIONS_IN_EVENT_REGION)
applyCommonPropertiesToLayer(node.interactionRegionsLayer(), properties);
if (properties.changedProperties & LayerChange::EventRegionChanged)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#import <WebCore/IOSurface.h>
#import <WebCore/PlatformLayer.h>
#import <WebCore/WebCoreCALayerExtras.h>
#import <pal/cocoa/QuartzCoreSoftLink.h>
#import <pal/spi/cocoa/QuartzCoreSPI.h>
#import <wtf/cocoa/TypeCastsCocoa.h>

Expand Down Expand Up @@ -76,6 +77,8 @@
if (m_drawingArea->page().windowKind() == WindowKind::InProcessSnapshotting)
return RemoteLayerBackingStoreProperties::LayerContentsType::IOSurface;

if (PAL::canLoad_QuartzCore_CAIOSurfaceCreate())
return RemoteLayerBackingStoreProperties::LayerContentsType::CachedIOSurface;
#if HAVE(MACH_PORT_CALAYER_CONTENTS)
return RemoteLayerBackingStoreProperties::LayerContentsType::CAMachPort;
#else
Expand Down