Title: [277210] trunk/Source
Revision
277210
Author
timothy_hor...@apple.com
Date
2021-05-07 16:46:04 -0700 (Fri, 07 May 2021)

Log Message

Add an experimental alternative display-list-based RemoteLayerBackingStore implementation
https://bugs.webkit.org/show_bug.cgi?id=225508

Reviewed by Sam Weinig.

Source/WebKit:

* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp: Added.
(WebKit::CGDisplayListImageBufferBackend::calculateMemoryCost):
(WebKit::CGDisplayListImageBufferBackend::create):
(WebKit::CGDisplayListImageBufferBackend::CGDisplayListImageBufferBackend):
(WebKit::CGDisplayListImageBufferBackend::createImageBufferBackendHandle const):
(WebKit::CGDisplayListImageBufferBackend::context const):
(WebKit::CGDisplayListImageBufferBackend::backendSize const):
(WebKit::CGDisplayListImageBufferBackend::bytesPerRow const):
(WebKit::CGDisplayListImageBufferBackend::copyNativeImage const):
(WebKit::CGDisplayListImageBufferBackend::toBGRAData const):
(WebKit::CGDisplayListImageBufferBackend::getImageData const):
(WebKit::CGDisplayListImageBufferBackend::putImageData):
* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h: Added.
Add an ImageBuffer backend backed by a CG display list.

* Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
Add a new RemoteLayerBackingStore type that uses CGDisplayListImageBufferBackend.

* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::encode const):
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::supportsPartialRepaint):
Disable partial repaint if using display-list-based backing store,
because we don't currently have any way to mutate display lists.

(WebKit::RemoteLayerBackingStore::display):
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
When applying a display-list-based backing store to a layer, we just
pass the encodede data directly to the layer, and tell it to use the
display list to render.

* SourcesCocoa.txt:
* UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
(WebKit::RemoteLayerTreeNode::createWithPlainLayer):
(-[WKPlainRemoteLayer description]): Deleted.
Move WKPlainRemoteLayer to RemoteLayerTreeLayers, and rename it to WKCompositingLayer.
It will now back all WKCompositingViews.

* UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.h: Added.
* UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.mm: Added.
(-[WKCompositingLayer description]):
(-[WKCompositingLayer _setWKContentsDisplayList:]):
(-[WKCompositingLayer _wkContentsDisplayList]):
(-[WKCompositingLayer drawInContext:]):
Make WKCompositingLayer replay the given display list in drawRect
(just because we're currently missing API to actually directly pass
the encoded display list data to CA).

* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
(+[WKCompositingView layerClass]):
Use WKCompositingLayer as the layer class for all WKCompositingViews.

* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/ImageBufferBackendHandle.h:
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::updateBackingStore):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
(WebKit::RemoteLayerTreeContext::useCGDisplayListsForDOMRendering const):
(WebKit::RemoteLayerTreeContext::setUseCGDisplayListsForDOMRendering):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
Plumb the internal feature flag from WebPreferences to RemoteLayerTreeContext
to PlatformCALayerRemote to RemoteLayerBackingStore; if the preference is
on and the feature is available, we'll always prefer display-list backed
surfaces over either of the bitmap types.

Source/WTF:

* Scripts/Preferences/WebPreferencesInternal.yaml:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (277209 => 277210)


--- trunk/Source/WTF/ChangeLog	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WTF/ChangeLog	2021-05-07 23:46:04 UTC (rev 277210)
@@ -1,3 +1,12 @@
+2021-05-07  Tim Horton  <timothy_hor...@apple.com>
+
+        Add an experimental alternative display-list-based RemoteLayerBackingStore implementation
+        https://bugs.webkit.org/show_bug.cgi?id=225508
+
+        Reviewed by Sam Weinig.
+
+        * Scripts/Preferences/WebPreferencesInternal.yaml:
+
 2021-05-07  Philippe Normand  <pnorm...@igalia.com>
 
         [GTK] Warnings about unused filesystem functions

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml (277209 => 277210)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml	2021-05-07 23:46:04 UTC (rev 277210)
@@ -738,6 +738,17 @@
     WebKit:
       default: true
 
+UseCGDisplayListsForDOMRendering:
+  type: bool
+  humanReadableName: "Use CG Display Lists for DOM rendering"
+  humanReadableDescription: "Use CG Display Lists for DOM rendering"
+  webcoreBinding: none
+  condition: ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+  exposed: [ WebKit ]
+  defaultValue:
+    WebKit:
+      default: false
+
 UseGPUProcessForDOMRenderingEnabled:
   type: bool
   humanReadableName: "GPU Process: DOM Rendering"

Modified: trunk/Source/WebKit/ChangeLog (277209 => 277210)


--- trunk/Source/WebKit/ChangeLog	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/ChangeLog	2021-05-07 23:46:04 UTC (rev 277210)
@@ -1,3 +1,76 @@
+2021-05-07  Tim Horton  <timothy_hor...@apple.com>
+
+        Add an experimental alternative display-list-based RemoteLayerBackingStore implementation
+        https://bugs.webkit.org/show_bug.cgi?id=225508
+
+        Reviewed by Sam Weinig.
+
+        * Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp: Added.
+        (WebKit::CGDisplayListImageBufferBackend::calculateMemoryCost):
+        (WebKit::CGDisplayListImageBufferBackend::create):
+        (WebKit::CGDisplayListImageBufferBackend::CGDisplayListImageBufferBackend):
+        (WebKit::CGDisplayListImageBufferBackend::createImageBufferBackendHandle const):
+        (WebKit::CGDisplayListImageBufferBackend::context const):
+        (WebKit::CGDisplayListImageBufferBackend::backendSize const):
+        (WebKit::CGDisplayListImageBufferBackend::bytesPerRow const):
+        (WebKit::CGDisplayListImageBufferBackend::copyNativeImage const):
+        (WebKit::CGDisplayListImageBufferBackend::toBGRAData const):
+        (WebKit::CGDisplayListImageBufferBackend::getImageData const):
+        (WebKit::CGDisplayListImageBufferBackend::putImageData):
+        * Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h: Added.
+        Add an ImageBuffer backend backed by a CG display list.
+
+        * Shared/RemoteLayerTree/RemoteLayerBackingStore.h:
+        Add a new RemoteLayerBackingStore type that uses CGDisplayListImageBufferBackend.
+
+        * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::encode const):
+        (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
+        (WebKit::RemoteLayerBackingStore::supportsPartialRepaint):
+        Disable partial repaint if using display-list-based backing store,
+        because we don't currently have any way to mutate display lists.
+
+        (WebKit::RemoteLayerBackingStore::display):
+        (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
+        When applying a display-list-based backing store to a layer, we just
+        pass the encodede data directly to the layer, and tell it to use the
+        display list to render.
+
+        * SourcesCocoa.txt:
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm:
+        (WebKit::RemoteLayerTreeNode::createWithPlainLayer):
+        (-[WKPlainRemoteLayer description]): Deleted.
+        Move WKPlainRemoteLayer to RemoteLayerTreeLayers, and rename it to WKCompositingLayer.
+        It will now back all WKCompositingViews.
+
+        * UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.h: Added.
+        * UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.mm: Added.
+        (-[WKCompositingLayer description]):
+        (-[WKCompositingLayer _setWKContentsDisplayList:]):
+        (-[WKCompositingLayer _wkContentsDisplayList]):
+        (-[WKCompositingLayer drawInContext:]):
+        Make WKCompositingLayer replay the given display list in drawRect
+        (just because we're currently missing API to actually directly pass
+        the encoded display list data to CA).
+
+        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm:
+        (+[WKCompositingView layerClass]):
+        Use WKCompositingLayer as the layer class for all WKCompositingViews.
+
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/GPU/graphics/ImageBufferBackendHandle.h:
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::updateBackingStore):
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
+        (WebKit::RemoteLayerTreeContext::useCGDisplayListsForDOMRendering const):
+        (WebKit::RemoteLayerTreeContext::setUseCGDisplayListsForDOMRendering):
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
+        Plumb the internal feature flag from WebPreferences to RemoteLayerTreeContext
+        to PlatformCALayerRemote to RemoteLayerBackingStore; if the preference is
+        on and the feature is available, we'll always prefer display-list backed
+        surfaces over either of the bitmap types.
+
 2021-05-07  Brent Fulgham  <bfulg...@apple.com>
 
         [iOS] Make AccessibilityReduceMotion test case work on iOS

Added: trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp (0 => 277210)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp	                        (rev 0)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp	2021-05-07 23:46:04 UTC (rev 277210)
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2021 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. AND ITS CONTRIBUTORS ``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 ITS 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 "CGDisplayListImageBufferBackend.h"
+
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/ImageData.h>
+#include <WebKitAdditions/CGDisplayListImageBufferAdditions.h>
+#include <wtf/IsoMallocInlines.h>
+
+namespace WebKit {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(CGDisplayListImageBufferBackend);
+
+size_t CGDisplayListImageBufferBackend::calculateMemoryCost(const Parameters& parameters)
+{
+    // FIXME: This is fairly meaningless, because we don't actually have a bitmap, and
+    // should really be based on the encoded data size.
+    auto backendSize = calculateBackendSize(parameters);
+    return WebCore::ImageBufferBackend::calculateMemoryCost(backendSize, calculateBytesPerRow(backendSize));
+}
+
+std::unique_ptr<CGDisplayListImageBufferBackend> CGDisplayListImageBufferBackend::create(const Parameters& parameters)
+{
+    auto backendSize = calculateBackendSize(parameters);
+    if (backendSize.isEmpty())
+        return nullptr;
+
+    auto cgContext = adoptCF(WKCGCommandsContextCreate(backendSize, nullptr));
+    if (!cgContext)
+        return nullptr;
+
+    auto context = makeUnique<WebCore::GraphicsContext>(cgContext.get());
+    return std::unique_ptr<CGDisplayListImageBufferBackend>(new CGDisplayListImageBufferBackend(parameters, WTFMove(context)));
+}
+
+std::unique_ptr<CGDisplayListImageBufferBackend> CGDisplayListImageBufferBackend::create(const Parameters& parameters, const WebCore::HostWindow*)
+{
+    return CGDisplayListImageBufferBackend::create(parameters);
+}
+
+CGDisplayListImageBufferBackend::CGDisplayListImageBufferBackend(const Parameters& parameters, std::unique_ptr<WebCore::GraphicsContext>&& context)
+    : ImageBufferCGBackend { parameters }
+    , m_context { WTFMove(context) }
+{
+}
+
+ImageBufferBackendHandle CGDisplayListImageBufferBackend::createImageBufferBackendHandle() const
+{
+    auto data = ""
+    ASSERT(data);
+
+    return ImageBufferBackendHandle { IPC::SharedBufferCopy { WebCore::SharedBuffer::create(data.get()) } };
+}
+
+WebCore::GraphicsContext& CGDisplayListImageBufferBackend::context() const
+{
+    return *m_context;
+}
+
+WebCore::IntSize CGDisplayListImageBufferBackend::backendSize() const
+{
+    return calculateBackendSize(m_parameters);
+}
+
+unsigned CGDisplayListImageBufferBackend::bytesPerRow() const
+{
+    return calculateBytesPerRow(backendSize());
+}
+
+RefPtr<WebCore::NativeImage> CGDisplayListImageBufferBackend::copyNativeImage(WebCore::BackingStoreCopy) const
+{
+    ASSERT_NOT_REACHED();
+    return nullptr;
+}
+
+Vector<uint8_t> CGDisplayListImageBufferBackend::toBGRAData() const
+{
+    ASSERT_NOT_REACHED();
+    return { };
+}
+
+RefPtr<WebCore::ImageData> CGDisplayListImageBufferBackend::getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const
+{
+    ASSERT_NOT_REACHED();
+    return nullptr;
+}
+
+void CGDisplayListImageBufferBackend::putImageData(WebCore::AlphaPremultiplication inputFormat, const WebCore::ImageData& imageData, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat)
+{
+    ASSERT_NOT_REACHED();
+}
+
+}
+
+#endif // ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)

Added: trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h (0 => 277210)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h	                        (rev 0)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.h	2021-05-07 23:46:04 UTC (rev 277210)
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2021 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. AND ITS CONTRIBUTORS ``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 ITS 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
+
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+
+#include "ImageBufferBackendHandle.h"
+#include <WebCore/ImageBufferCGBackend.h>
+#include <wtf/IsoMalloc.h>
+
+namespace WebKit {
+
+class CGDisplayListImageBufferBackend : public WebCore::ImageBufferCGBackend {
+    WTF_MAKE_ISO_ALLOCATED(CGDisplayListImageBufferBackend);
+    WTF_MAKE_NONCOPYABLE(CGDisplayListImageBufferBackend);
+public:
+    static size_t calculateMemoryCost(const Parameters&);
+
+    static std::unique_ptr<CGDisplayListImageBufferBackend> create(const Parameters&);
+    static std::unique_ptr<CGDisplayListImageBufferBackend> create(const Parameters&, const WebCore::HostWindow*);
+
+    ImageBufferBackendHandle createImageBufferBackendHandle() const;
+
+    WebCore::GraphicsContext& context() const override;
+    WebCore::IntSize backendSize() const override;
+
+    // NOTE: These all ASSERT_NOT_REACHED().
+    RefPtr<WebCore::NativeImage> copyNativeImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore) const override;
+    Vector<uint8_t> toBGRAData() const override;
+    RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect&) const override;
+    void putImageData(WebCore::AlphaPremultiplication inputFormat, const WebCore::ImageData&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) override;
+
+    static constexpr bool isOriginAtUpperLeftCorner = true;
+
+protected:
+    CGDisplayListImageBufferBackend(const Parameters&, std::unique_ptr<WebCore::GraphicsContext>&&);
+
+    unsigned bytesPerRow() const override;
+
+    std::unique_ptr<WebCore::GraphicsContext> m_context;
+};
+
+}
+
+#endif // ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h (277209 => 277210)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.h	2021-05-07 23:46:04 UTC (rev 277210)
@@ -55,6 +55,9 @@
     enum class Type : uint8_t {
         IOSurface,
         Bitmap,
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+        CGDisplayList,
+#endif
     };
 
     void ensureBackingStore(Type, WebCore::FloatSize, float scale, bool deepColor, bool isOpaque);
@@ -103,6 +106,8 @@
     void clearBackingStore();
     void swapToValidFrontBuffer();
 
+    bool supportsPartialRepaint();
+
     WebCore::PixelFormat pixelFormat() const;
 
     PlatformCALayerRemote* m_layer;
@@ -146,9 +151,12 @@
 
 template<> struct EnumTraits<WebKit::RemoteLayerBackingStore::Type> {
     using values = EnumValues<
-        WebKit::RemoteLayerBackingStore::Type,
-        WebKit::RemoteLayerBackingStore::Type::IOSurface,
-        WebKit::RemoteLayerBackingStore::Type::Bitmap
+        WebKit::RemoteLayerBackingStore::Type
+        , WebKit::RemoteLayerBackingStore::Type::IOSurface
+        , WebKit::RemoteLayerBackingStore::Type::Bitmap
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+        , WebKit::RemoteLayerBackingStore::Type::CGDisplayList
+#endif
     >;
 };
 

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (277209 => 277210)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2021-05-07 23:46:04 UTC (rev 277210)
@@ -1,5 +1,5 @@
  /*
- * Copyright (C) 2013-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,11 +27,13 @@
 #import "RemoteLayerBackingStore.h"
 
 #import "ArgumentCoders.h"
+#import "CGDisplayListImageBufferBackend.h"
 #import "MachPort.h"
 #import "PlatformCALayerRemote.h"
 #import "PlatformRemoteImageBufferProxy.h"
 #import "RemoteLayerBackingStoreCollection.h"
 #import "RemoteLayerTreeContext.h"
+#import "RemoteLayerTreeLayers.h"
 #import "ShareableBitmap.h"
 #import "WebCoreArgumentCoders.h"
 #import "WebProcess.h"
@@ -45,6 +47,10 @@
 #import <mach/mach_port.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+#import <WebKitAdditions/CGDisplayListImageBufferAdditions.h>
+#endif
+
 namespace WebKit {
 
 RemoteLayerBackingStore::RemoteLayerBackingStore(PlatformCALayerRemote* layer)
@@ -115,6 +121,11 @@
         case Type::Bitmap:
             handle = static_cast<UnacceleratedImageBufferShareableBackend&>(*m_frontBuffer.imageBuffer->ensureBackendCreated()).createImageBufferBackendHandle();
             break;
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+        case Type::CGDisplayList:
+            handle = static_cast<CGDisplayListImageBufferBackend&>(*m_frontBuffer.imageBuffer->ensureBackendCreated()).createImageBufferBackendHandle();
+            break;
+#endif
         }
     }
 
@@ -209,9 +220,29 @@
         else
             m_frontBuffer.imageBuffer = WebCore::ConcreteImageBuffer<UnacceleratedImageBufferShareableBackend>::create(m_size, m_scale, WebCore::DestinationColorSpace::SRGB, pixelFormat(), nullptr);
         break;
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+    case Type::CGDisplayList:
+        m_frontBuffer.imageBuffer = WebCore::ConcreteImageBuffer<CGDisplayListImageBufferBackend>::create(m_size, m_scale, WebCore::DestinationColorSpace::SRGB, pixelFormat(), nullptr);
+        break;
+#endif
     }
 }
 
+bool RemoteLayerBackingStore::supportsPartialRepaint()
+{
+    switch (m_type) {
+    case Type::IOSurface:
+    case Type::Bitmap:
+        return true;
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+    case Type::CGDisplayList:
+        return false;
+#endif
+    }
+
+    return true;
+}
+
 bool RemoteLayerBackingStore::display()
 {
     ASSERT(!m_frontBufferFlusher);
@@ -229,7 +260,7 @@
         return needToEncodeBackingStore;
 
     WebCore::IntRect layerBounds(WebCore::IntPoint(), WebCore::expandedIntSize(m_size));
-    if (!hasFrontBuffer())
+    if (!hasFrontBuffer() || !supportsPartialRepaint())
         m_dirtyRegion.unite(layerBounds);
 
     if (m_layer->owner()->platformCALayerShowRepaintCounter(m_layer)) {
@@ -354,24 +385,37 @@
     ASSERT(m_bufferHandle);
     layer.contentsOpaque = m_isOpaque;
 
-    switch (m_type) {
-    case Type::IOSurface:
-        switch (contentsType) {
-        case LayerContentsType::IOSurface: {
-            auto surface = WebCore::IOSurface::createFromSendRight(WTFMove(WTF::get<MachSendRight>(*m_bufferHandle)), WebCore::sRGBColorSpaceRef());
-            layer.contents = surface ? surface->asLayerContents() : nil;
-            break;
+    WTF::switchOn(*m_bufferHandle,
+        [&] (ShareableBitmap::Handle& handle) {
+            ASSERT(m_type == Type::Bitmap);
+            auto bitmap = ShareableBitmap::create(handle);
+            layer.contents = (__bridge id)bitmap->makeCGImageCopy().get();
+        },
+        [&] (MachSendRight& machSendRight) {
+            ASSERT(m_type == Type::IOSurface);
+            switch (contentsType) {
+            case LayerContentsType::IOSurface: {
+                auto surface = WebCore::IOSurface::createFromSendRight(WTFMove(machSendRight), WebCore::sRGBColorSpaceRef());
+                layer.contents = surface ? surface->asLayerContents() : nil;
+                break;
+            }
+            case LayerContentsType::CAMachPort:
+                layer.contents = (__bridge id)adoptCF(CAMachPortCreate(machSendRight.leakSendRight())).get();
+                break;
+            }
         }
-        case LayerContentsType::CAMachPort:
-            layer.contents = (__bridge id)adoptCF(CAMachPortCreate(WTF::get<MachSendRight>(*m_bufferHandle).leakSendRight())).get();
-            break;
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+        , [&] (IPC::SharedBufferCopy& buffer) {
+            ASSERT(m_type == Type::CGDisplayList);
+            ASSERT([layer isKindOfClass:[WKCompositingLayer class]]);
+            if (![layer isKindOfClass:[WKCompositingLayer class]])
+                return;
+            [layer setValue:@1 forKeyPath:WKCGDisplayListEnabledKey];
+            auto data = ""
+            [(WKCompositingLayer *)layer _setWKContentsDisplayList:data.get()];
         }
-        break;
-    case Type::Bitmap:
-        auto bitmap = ShareableBitmap::create(WTF::get<ShareableBitmap::Handle>(*m_bufferHandle));
-        layer.contents = (__bridge id)bitmap->makeCGImageCopy().get();
-        break;
-    }
+#endif
+    );
 }
 
 std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher> RemoteLayerBackingStore::takePendingFlusher()

Modified: trunk/Source/WebKit/SourcesCocoa.txt (277209 => 277210)


--- trunk/Source/WebKit/SourcesCocoa.txt	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2021-05-07 23:46:04 UTC (rev 277210)
@@ -540,6 +540,8 @@
 UIProcess/Plugins/mac/PluginProcessManagerMac.mm
 UIProcess/Plugins/mac/PluginProcessProxyMac.mm
 
+UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.mm
+
 UIProcess/RemoteLayerTree/mac/ScrollerMac.mm
 UIProcess/RemoteLayerTree/mac/ScrollerPairMac.mm
 UIProcess/RemoteLayerTree/mac/ScrollingTreeFrameScrollingNodeRemoteMac.cpp

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm (277209 => 277210)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm	2021-05-07 23:46:04 UTC (rev 277210)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "RemoteLayerTreeNode.h"
 
+#import "RemoteLayerTreeLayers.h"
 #import <QuartzCore/CALayer.h>
 #import <WebCore/WebActionDisablingCALayerDelegate.h>
 
@@ -33,16 +34,6 @@
 #import <UIKit/UIView.h>
 #endif
 
-@interface WKPlainRemoteLayer : CALayer
-@end
-
-@implementation WKPlainRemoteLayer
-- (NSString *)description
-{
-    return WebKit::RemoteLayerTreeNode::appendLayerDescription(super.description, self);
-}
-@end
-
 namespace WebKit {
 
 static NSString *const WKRemoteLayerTreeNodePropertyKey = @"WKRemoteLayerTreeNode";
@@ -72,7 +63,7 @@
 
 std::unique_ptr<RemoteLayerTreeNode> RemoteLayerTreeNode::createWithPlainLayer(WebCore::GraphicsLayer::PlatformLayerID layerID)
 {
-    RetainPtr<CALayer> layer = adoptNS([[WKPlainRemoteLayer alloc] init]);
+    RetainPtr<CALayer> layer = adoptNS([[WKCompositingLayer alloc] init]);
     return makeUnique<RemoteLayerTreeNode>(layerID, WTFMove(layer));
 }
 

Copied: trunk/Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.h (from rev 277209, trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferBackendHandle.h) (0 => 277210)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.h	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.h	2021-05-07 23:46:04 UTC (rev 277210)
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 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. AND ITS CONTRIBUTORS ``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 ITS 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
+
+#if PLATFORM(COCOA)
+
+#import <Foundation/Foundation.h>
+#import <QuartzCore/QuartzCore.h>
+
+@interface WKCompositingLayer : CALayer
+
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+@property (nonatomic, retain, setter=_setWKContentsDisplayList:) __attribute__((NSObject)) CFDataRef _wkContentsDisplayList;
+#endif
+
+@end
+
+#endif // PLATFORM(COCOA)

Copied: trunk/Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.mm (from rev 277209, trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferBackendHandle.h) (0 => 277210)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.mm	                        (rev 0)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/cocoa/RemoteLayerTreeLayers.mm	2021-05-07 23:46:04 UTC (rev 277210)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2021 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#import "config.h"
+#import "RemoteLayerTreeLayers.h"
+
+#if PLATFORM(COCOA)
+
+#import "Logging.h"
+#import "RemoteLayerTreeNode.h"
+#import <pal/spi/cocoa/QuartzCoreSPI.h>
+
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+#import <WebKitAdditions/CGDisplayListImageBufferAdditions.h>
+#endif
+
+@implementation WKCompositingLayer {
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+    RetainPtr<CFDataRef> _contentsDisplayList;
+#endif
+}
+
+- (NSString *)description
+{
+    return WebKit::RemoteLayerTreeNode::appendLayerDescription(super.description, self);
+}
+
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+- (void)_setWKContentsDisplayList:(CFDataRef)data
+{
+    _contentsDisplayList = data;
+    [self setNeedsDisplay];
+}
+
+- (CFDataRef)_wkContentsDisplayList
+{
+    return _contentsDisplayList.get();
+}
+
+- (void)drawInContext:(CGContextRef)context
+{
+    if (!_contentsDisplayList)
+        return;
+    WKCGContextDrawCGCommandsEncodedData(context, _contentsDisplayList.get(), nullptr);
+}
+#endif // ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+
+@end
+
+#endif // PLATFORM(COCOA)

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm (277209 => 277210)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeViews.mm	2021-05-07 23:46:04 UTC (rev 277210)
@@ -30,6 +30,7 @@
 
 #import "Logging.h"
 #import "RemoteLayerTreeHost.h"
+#import "RemoteLayerTreeLayers.h"
 #import "RemoteLayerTreeNode.h"
 #import "UIKitSPI.h"
 #import "WKDeferringGestureRecognizer.h"
@@ -313,6 +314,11 @@
 
 @implementation WKCompositingView
 
++ (Class)layerClass
+{
+    return [WKCompositingLayer class];
+}
+
 - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
 {
     return [self _web_findDescendantViewAtPoint:point withEvent:event];

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (277209 => 277210)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-05-07 23:46:04 UTC (rev 277210)
@@ -667,6 +667,7 @@
 		2D54C31A212F3B330049C174 /* UnifiedSource61-mm.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D54C306212F3B330049C174 /* UnifiedSource61-mm.mm */; };
 		2D54C31B212F4DA60049C174 /* ProcessLauncher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE117F511DBB30900981615 /* ProcessLauncher.cpp */; };
 		2D5C9D0619C81D8F00B3C5C1 /* WebPageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5C9D0419C81D8F00B3C5C1 /* WebPageOverlay.h */; };
+		2D64824B2644B1AB00030335 /* RemoteLayerTreeLayers.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6482492644B1AB00030335 /* RemoteLayerTreeLayers.h */; };
 		2D6AB541192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6AB53F192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.h */; };
 		2D6B371B18A967AD0042AE80 /* _WKThumbnailView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2D6CD119189058A500E5A4A0 /* ViewSnapshotStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6CD117189058A500E5A4A0 /* ViewSnapshotStore.h */; };
@@ -1828,6 +1829,8 @@
 		BCE469541214E6CB000B98EB /* WebFormClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469501214E6CB000B98EB /* WebFormClient.h */; };
 		BCE469561214E6CB000B98EB /* WebFormSubmissionListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */; };
 		BCE4695A1214EDF4000B98EB /* WKFormSubmissionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		BCE579A62634836700F5C5E9 /* CGDisplayListImageBufferBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE579A42634836700F5C5E9 /* CGDisplayListImageBufferBackend.h */; };
+		BCE579A72634836700F5C5E9 /* CGDisplayListImageBufferBackend.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE579A52634836700F5C5E9 /* CGDisplayListImageBufferBackend.cpp */; };
 		BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE81D8B1319F7EF00241910 /* FontInfo.h */; };
 		BCEE7AD012817988009827DA /* WebProcessProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE7ACC12817988009827DA /* WebProcessProxyMessageReceiver.cpp */; };
 		BCEE7AD112817988009827DA /* WebProcessProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEE7ACD12817988009827DA /* WebProcessProxyMessages.h */; };
@@ -3227,6 +3230,8 @@
 		2D54C306212F3B330049C174 /* UnifiedSource61-mm.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = "UnifiedSource61-mm.mm"; path = "DerivedSources/WebKit2/unified-sources/UnifiedSource61-mm.mm"; sourceTree = BUILT_PRODUCTS_DIR; };
 		2D5C9D0319C81D8F00B3C5C1 /* WebPageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPageOverlay.cpp; sourceTree = "<group>"; };
 		2D5C9D0419C81D8F00B3C5C1 /* WebPageOverlay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPageOverlay.h; sourceTree = "<group>"; };
+		2D6482492644B1AB00030335 /* RemoteLayerTreeLayers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteLayerTreeLayers.h; sourceTree = "<group>"; };
+		2D64824A2644B1AB00030335 /* RemoteLayerTreeLayers.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeLayers.mm; sourceTree = "<group>"; };
 		2D6AB53F192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKPDFPageNumberIndicator.h; path = ios/WKPDFPageNumberIndicator.h; sourceTree = "<group>"; };
 		2D6AB540192B1C4A003A9FD1 /* WKPDFPageNumberIndicator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKPDFPageNumberIndicator.mm; path = ios/WKPDFPageNumberIndicator.mm; sourceTree = "<group>"; };
 		2D6B371918A967AD0042AE80 /* _WKThumbnailView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKThumbnailView.h; sourceTree = "<group>"; };
@@ -5508,6 +5513,8 @@
 		BCE469521214E6CB000B98EB /* WebFormSubmissionListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFormSubmissionListenerProxy.h; sourceTree = "<group>"; };
 		BCE469571214EDF4000B98EB /* WKFormSubmissionListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKFormSubmissionListener.cpp; sourceTree = "<group>"; };
 		BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFormSubmissionListener.h; sourceTree = "<group>"; };
+		BCE579A42634836700F5C5E9 /* CGDisplayListImageBufferBackend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CGDisplayListImageBufferBackend.h; sourceTree = "<group>"; };
+		BCE579A52634836700F5C5E9 /* CGDisplayListImageBufferBackend.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CGDisplayListImageBufferBackend.cpp; sourceTree = "<group>"; };
 		BCE81D8A1319F7EF00241910 /* FontInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontInfo.cpp; sourceTree = "<group>"; };
 		BCE81D8B1319F7EF00241910 /* FontInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontInfo.h; sourceTree = "<group>"; };
 		BCE9C0CF1485965D00E33D61 /* WebConnectionToUIProcess.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebConnectionToUIProcess.cpp; sourceTree = "<group>"; };
@@ -7291,6 +7298,7 @@
 		2D1551A91F5A9B420006E3FE /* RemoteLayerTree */ = {
 			isa = PBXGroup;
 			children = (
+				2D6482482644B1AB00030335 /* cocoa */,
 				2D1551AA1F5A9BA70006E3FE /* ios */,
 				E404906F21DE65D70037F0DB /* mac */,
 				1AB16AE01648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h */,
@@ -7358,6 +7366,8 @@
 		2D2E04761F5BEC4F00BB25ED /* RemoteLayerTree */ = {
 			isa = PBXGroup;
 			children = (
+				BCE579A52634836700F5C5E9 /* CGDisplayListImageBufferBackend.cpp */,
+				BCE579A42634836700F5C5E9 /* CGDisplayListImageBufferBackend.h */,
 				2D47B56B1810714E003A3AEE /* RemoteLayerBackingStore.h */,
 				2D47B56A1810714E003A3AEE /* RemoteLayerBackingStore.mm */,
 				2DDF731318E95060004F5A66 /* RemoteLayerBackingStoreCollection.h */,
@@ -7375,6 +7385,15 @@
 			path = RemoteLayerTree;
 			sourceTree = "<group>";
 		};
+		2D6482482644B1AB00030335 /* cocoa */ = {
+			isa = PBXGroup;
+			children = (
+				2D6482492644B1AB00030335 /* RemoteLayerTreeLayers.h */,
+				2D64824A2644B1AB00030335 /* RemoteLayerTreeLayers.mm */,
+			);
+			path = cocoa;
+			sourceTree = "<group>";
+		};
 		2D7DEBE221269E4B00B9F73C /* unified-sources */ = {
 			isa = PBXGroup;
 			children = (
@@ -11870,6 +11889,7 @@
 				41897ED81F415D8A0016FA42 /* CacheStorageEngine.h in Headers */,
 				41FABD2A1F4DE001006A6C97 /* CacheStorageEngineCache.h in Headers */,
 				41897EDA1F415D8A0016FA42 /* CacheStorageEngineConnection.h in Headers */,
+				BCE579A62634836700F5C5E9 /* CGDisplayListImageBufferBackend.h in Headers */,
 				57B4B46020B504AC00D4AD79 /* ClientCertificateAuthenticationXPCConstants.h in Headers */,
 				F4FE0A3B24632B60002631E1 /* CocoaColor.h in Headers */,
 				4482734724528F6000A95493 /* CocoaImage.h in Headers */,
@@ -12207,6 +12227,7 @@
 				1AB16AE21648656D00290D62 /* RemoteLayerTreeDrawingAreaProxy.h in Headers */,
 				0FF24A2E1879E4BC003ABF0C /* RemoteLayerTreeDrawingAreaProxyMessages.h in Headers */,
 				1AA3D75C1651B44F008713D0 /* RemoteLayerTreeHost.h in Headers */,
+				2D64824B2644B1AB00030335 /* RemoteLayerTreeLayers.h in Headers */,
 				E4E57F6B21A83B1200345F3C /* RemoteLayerTreeNode.h in Headers */,
 				2DDE0AFA18298CC900F97EAA /* RemoteLayerTreePropertyApplier.h in Headers */,
 				0FF264A01A1FF9CC001FE759 /* RemoteLayerTreeScrollingPerformanceData.h in Headers */,
@@ -14092,6 +14113,7 @@
 				51FAEC3B1B0657680009C4E7 /* AuxiliaryProcessMessageReceiver.cpp in Sources */,
 				2D92A785212B6AB100F493FD /* BlobDataFileReferenceWithSandboxExtension.cpp in Sources */,
 				517CF0E3163A486C00C2950F /* CacheStorageEngineConnectionMessageReceiver.cpp in Sources */,
+				BCE579A72634836700F5C5E9 /* CGDisplayListImageBufferBackend.cpp in Sources */,
 				2D92A77D212B6A7100F493FD /* Connection.cpp in Sources */,
 				2D92A77F212B6A7100F493FD /* Decoder.cpp in Sources */,
 				49DAA38C24CBA1A800793D75 /* DefaultWebBrowserChecks.mm in Sources */,

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferBackendHandle.h (277209 => 277210)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferBackendHandle.h	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferBackendHandle.h	2021-05-07 23:46:04 UTC (rev 277210)
@@ -28,6 +28,7 @@
 #if ENABLE(GPU_PROCESS)
 
 #include "ShareableBitmap.h"
+#include "SharedBufferCopy.h"
 #include <wtf/MachSendRight.h>
 #include <wtf/Variant.h>
 
@@ -34,10 +35,13 @@
 namespace WebKit {
 
 using ImageBufferBackendHandle = Variant<
+    ShareableBitmap::Handle
 #if PLATFORM(COCOA) // FIXME: This is really about IOSurface.
-    MachSendRight,
+    , MachSendRight
 #endif
-    ShareableBitmap::Handle
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+    , IPC::SharedBufferCopy
+#endif
 >;
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp (277209 => 277210)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp	2021-05-07 23:46:04 UTC (rev 277210)
@@ -234,6 +234,10 @@
     ASSERT(m_properties.backingStoreAttached);
 
     auto type = m_acceleratesDrawing ? RemoteLayerBackingStore::Type::IOSurface : RemoteLayerBackingStore::Type::Bitmap;
+#if ENABLE(CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER)
+    if (m_context->useCGDisplayListsForDOMRendering())
+        type = RemoteLayerBackingStore::Type::CGDisplayList;
+#endif
     m_properties.backingStore->ensureBackingStore(type, m_properties.bounds.size(), m_properties.contentsScale, m_wantsDeepColorBackingStore, m_properties.opaque);
 }
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h (277209 => 277210)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h	2021-05-07 23:46:04 UTC (rev 277210)
@@ -80,6 +80,9 @@
     void adoptLayersFromContext(RemoteLayerTreeContext&);
 
     RemoteRenderingBackendProxy& ensureRemoteRenderingBackendProxy();
+
+    bool useCGDisplayListsForDOMRendering() const { return m_useCGDisplayListsForDOMRendering; }
+    void setUseCGDisplayListsForDOMRendering(bool useCGDisplayLists) { m_useCGDisplayListsForDOMRendering = useCGDisplayLists; }
     
 #if PLATFORM(IOS_FAMILY)
     bool canShowWhileLocked() const;
@@ -106,6 +109,8 @@
     WebCore::LayerPool m_layerPool;
     
     bool m_nextRenderingUpdateRequiresSynchronousImageDecoding { false };
+
+    bool m_useCGDisplayListsForDOMRendering { false };
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm (277209 => 277210)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm	2021-05-07 23:03:43 UTC (rev 277209)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm	2021-05-07 23:46:04 UTC (rev 277210)
@@ -38,6 +38,7 @@
 #import "WebPage.h"
 #import "WebPageCreationParameters.h"
 #import "WebPageProxyMessages.h"
+#import "WebPreferencesKeys.h"
 #import "WebProcess.h"
 #import <QuartzCore/QuartzCore.h>
 #import <WebCore/DebugPageOverlays.h>
@@ -161,7 +162,7 @@
     return frameView.frame().isMainFrame() || m_webPage.corePage()->settings().asyncFrameScrollingEnabled();
 }
 
-void RemoteLayerTreeDrawingArea::updatePreferences(const WebPreferencesStore&)
+void RemoteLayerTreeDrawingArea::updatePreferences(const WebPreferencesStore& preferences)
 {
     Settings& settings = m_webPage.corePage()->settings();
 
@@ -171,6 +172,8 @@
 
     m_rootLayer->setShowDebugBorder(settings.showDebugBorders());
 
+    m_remoteLayerTreeContext->setUseCGDisplayListsForDOMRendering(preferences.getBoolValueForKey(WebPreferencesKey::useCGDisplayListsForDOMRenderingKey()));
+
     DebugPageOverlays::settingsChanged(*m_webPage.corePage());
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to