Title: [295149] trunk/Source
Revision
295149
Author
[email protected]
Date
2022-06-02 15:12:04 -0700 (Thu, 02 Jun 2022)

Log Message

[GPU Process] [Filters] Make ImageBufferAllocator control the creation of the FilterImage buffers
https://bugs.webkit.org/show_bug.cgi?id=240808
<rdar://problem/94117817>

Reviewed by Simon Fraser.

Route all the allocations of the ImageBuffers and the PixelBuffers, which are made
by filter effects to a new class named ImageBufferAllocator. Because some filter
effects may call ImageBuffer::getPixelBuffer() from their FilterImages, we need
to pass an ImageBufferAllocator to this method as well.

The goal is to be able to attribute all the filter intermediate result FilterImage
to WebPorcess from one class. This will be a super class of ImageBufferAllocator
named ImageBufferShareableAllocator.

In a future patch, this class will be able to create shareable PixelBuffer and
will be able to attribute all its allocated memory to WebProcess.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/platform/graphics/ConcreteImageBuffer.h:
* Source/WebCore/platform/graphics/ImageBuffer.h:
* Source/WebCore/platform/graphics/ImageBufferAllocator.cpp: Copied from Source/WebCore/platform/graphics/filters/FilterResults.h.
(WebCore::ImageBufferAllocator::createImageBuffer const):
(WebCore::ImageBufferAllocator::createPixelBuffer const):
* Source/WebCore/platform/graphics/ImageBufferAllocator.h: Copied from Source/WebCore/platform/graphics/filters/FilterResults.h.
* Source/WebCore/platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::getPixelBuffer const):
* Source/WebCore/platform/graphics/ImageBufferBackend.h:
* Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
(WebCore::ImageBufferCGBitmapBackend::getPixelBuffer const):
* Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.h:
* Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::getPixelBuffer const):
* Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h:
* Source/WebCore/platform/graphics/filters/Filter.cpp:
(WebCore::Filter::apply):
* Source/WebCore/platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::apply):
* Source/WebCore/platform/graphics/filters/FilterImage.cpp:
(WebCore::FilterImage::create):
(WebCore::FilterImage::FilterImage):
(WebCore::FilterImage::imageBufferFromPixelBuffer):
(WebCore::getConvertedPixelBuffer):
(WebCore::FilterImage::pixelBuffer):
(WebCore::FilterImage::getPixelBuffer):
(WebCore::FilterImage::copyPixelBuffer):
* Source/WebCore/platform/graphics/filters/FilterImage.h:
* Source/WebCore/platform/graphics/filters/FilterResults.cpp: Copied from Source/WebCore/platform/graphics/filters/FilterResults.h.
(WebCore::FilterResults::FilterResults):
(WebCore::FilterResults::effectResult const):
(WebCore::FilterResults::setEffectResult):
(WebCore::FilterResults::clearEffectResult):
* Source/WebCore/platform/graphics/filters/FilterResults.h:
(WebCore::FilterResults::allocator const):
(WebCore::FilterResults::effectResult const): Deleted.
(WebCore::FilterResults::setEffectResult): Deleted.
(WebCore::FilterResults::clearEffectResult): Deleted.
* Source/WebKit/GPUProcess/graphics/ImageBufferShareableAllocator.cpp: Added.
(WebKit::ImageBufferShareableAllocator::createImageBuffer const):
(WebKit::ImageBufferShareableAllocator::createPixelBuffer const):
(WebKit::ImageBufferShareableAllocator::transferMemoryOwnership):
* Source/WebKit/GPUProcess/graphics/ImageBufferShareableAllocator.h: Copied from Source/WebCore/platform/graphics/filters/FilterResults.h.
* Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp:
(WebKit::RemoteDisplayListRecorder::drawFilteredImageBuffer):
* Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.cpp:
* Source/WebKit/Shared/ShareableBitmap.h:
(WebKit::ShareableBitmap::Handle::handle):
(WebKit::ShareableBitmap::sizeInBytes const):
* Source/WebKit/Sources.txt:
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::getPixelBuffer const):
* Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp:
(WebKit::ImageBufferRemoteIOSurfaceBackend::getPixelBuffer const):
* Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h:

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

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/Headers.cmake (295148 => 295149)


--- trunk/Source/WebCore/Headers.cmake	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/Headers.cmake	2022-06-02 22:12:04 UTC (rev 295149)
@@ -1530,6 +1530,7 @@
     platform/graphics/Image.h
     platform/graphics/ImageBackingStore.h
     platform/graphics/ImageBuffer.h
+    platform/graphics/ImageBufferAllocator.h
     platform/graphics/ImageBufferBackend.h
     platform/graphics/ImageFrame.h
     platform/graphics/ImageObserver.h

Modified: trunk/Source/WebCore/Sources.txt (295148 => 295149)


--- trunk/Source/WebCore/Sources.txt	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/Sources.txt	2022-06-02 22:12:04 UTC (rev 295149)
@@ -2071,6 +2071,7 @@
 platform/graphics/Icon.cpp
 platform/graphics/Image.cpp
 platform/graphics/ImageBuffer.cpp
+platform/graphics/ImageBufferAllocator.cpp
 platform/graphics/ImageBufferBackend.cpp
 platform/graphics/ImageBufferPipe.cpp
 platform/graphics/ImageDecoder.cpp
@@ -2148,6 +2149,7 @@
 platform/graphics/filters/FilterImage.cpp
 platform/graphics/filters/FilterOperation.cpp
 platform/graphics/filters/FilterOperations.cpp
+platform/graphics/filters/FilterResults.cpp
 platform/graphics/filters/PointLightSource.cpp
 platform/graphics/filters/SourceAlpha.cpp
 platform/graphics/filters/SourceGraphic.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (295148 => 295149)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2022-06-02 22:12:04 UTC (rev 295149)
@@ -2360,6 +2360,7 @@
 		7246963B275C5FA600A9156A /* CSSFilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F53FB83213B1BB800C40D34 /* CSSFilter.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7246963D275C614400A9156A /* FilterEffectVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 7214B9B7274458FA003BE6DF /* FilterEffectVector.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		7246963E275C616700A9156A /* FilterImageVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 72B4EF7C274EE37F00293C2F /* FilterImageVector.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		724DCF2328486C9B0026ACF4 /* ImageBufferAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 724DCF1C284853650026ACF4 /* ImageBufferAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		724ED3321A3A8B2300F5F13C /* JSEXTBlendMinMax.h in Headers */ = {isa = PBXBuildFile; fileRef = 724ED3301A3A8B2300F5F13C /* JSEXTBlendMinMax.h */; };
 		724EE5501DC80D7F00A91FFB /* ActivityState.h in Headers */ = {isa = PBXBuildFile; fileRef = 724EE54E1DC7F25B00A91FFB /* ActivityState.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		724EE5511DC80D8400A91FFB /* ActivityStateChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 724EE54F1DC7F25B00A91FFB /* ActivityStateChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -11406,6 +11407,9 @@
 		722AF2E527E1D09E0078D997 /* CGContextStateSaver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CGContextStateSaver.h; sourceTree = "<group>"; };
 		72435EF4273D07670005E7EE /* FilterImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilterImage.h; sourceTree = "<group>"; };
 		72435EF5273D07670005E7EE /* FilterImage.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FilterImage.cpp; sourceTree = "<group>"; };
+		724DCF1B284853650026ACF4 /* ImageBufferAllocator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferAllocator.cpp; sourceTree = "<group>"; };
+		724DCF1C284853650026ACF4 /* ImageBufferAllocator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBufferAllocator.h; sourceTree = "<group>"; };
+		724DCF1D28485C330026ACF4 /* FilterResults.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FilterResults.cpp; sourceTree = "<group>"; };
 		724ED3291A3A7E5400F5F13C /* EXTBlendMinMax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EXTBlendMinMax.cpp; sourceTree = "<group>"; };
 		724ED32A1A3A7E5400F5F13C /* EXTBlendMinMax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EXTBlendMinMax.h; sourceTree = "<group>"; };
 		724ED32B1A3A7E5400F5F13C /* EXTBlendMinMax.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = EXTBlendMinMax.idl; sourceTree = "<group>"; };
@@ -27221,6 +27225,7 @@
 				49ECEB641499790D00CDD3A4 /* FilterOperation.h */,
 				49ECEB651499790D00CDD3A4 /* FilterOperations.cpp */,
 				49ECEB661499790D00CDD3A4 /* FilterOperations.h */,
+				724DCF1D28485C330026ACF4 /* FilterResults.cpp */,
 				7211B5D6276536820076FEF8 /* FilterResults.h */,
 				84730D741248F0B300D3A9C9 /* LightSource.h */,
 				A1E1154513015C4E0054AC8C /* PointLightSource.cpp */,
@@ -29265,6 +29270,8 @@
 				55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */,
 				43D2597613C816F400608559 /* ImageBuffer.cpp */,
 				B2A10B910B3818BD00099AA4 /* ImageBuffer.h */,
+				724DCF1B284853650026ACF4 /* ImageBufferAllocator.cpp */,
+				724DCF1C284853650026ACF4 /* ImageBufferAllocator.h */,
 				72BAC3A423E17327008D741C /* ImageBufferBackend.cpp */,
 				72BAC3A523E17328008D741C /* ImageBufferBackend.h */,
 				43D2598613C816F400608559 /* ImageBufferPipe.cpp */,
@@ -37742,6 +37749,7 @@
 				0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */,
 				BC5EB74E0E81E06700B25965 /* StyleMultiColData.h in Headers */,
 				E4DACE6A1D12E10B0075980F /* StylePendingResources.h in Headers */,
+				724DCF2328486C9B0026ACF4 /* ImageBufferAllocator.h in Headers */,
 				A80E6DFC0A199067007FB8C5 /* StyleProperties.h in Headers */,
 				4BD781BF21C1965F00D9703E /* StylePropertyMap.h in Headers */,
 				4BAFD0CF2190F9B500C0AB64 /* StylePropertyMapReadOnly.h in Headers */,

Modified: trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -156,7 +156,7 @@
             return nullptr;
 
         const_cast<ConcreteImageBuffer&>(*this).flushDrawingContext();
-        
+
         FilterResults results;
         auto result = filter.apply(this, { { }, logicalSize() }, results);
         if (!result)
@@ -266,11 +266,11 @@
         return { };
     }
 
-    RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const override
+    RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, const ImageBufferAllocator& allocator) const override
     {
         if (auto* backend = ensureBackendCreated()) {
             const_cast<ConcreteImageBuffer&>(*this).flushContext();
-            return backend->getPixelBuffer(outputFormat, srcRect);
+            return backend->getPixelBuffer(outputFormat, srcRect, allocator);
         }
         return nullptr;
     }

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -28,6 +28,7 @@
 #pragma once
 
 #include "GraphicsContextFlushIdentifier.h"
+#include "ImageBufferAllocator.h"
 #include "ImageBufferBackend.h"
 #include "RenderingMode.h"
 #include "RenderingResourceIdentifier.h"
@@ -145,7 +146,7 @@
     virtual String toDataURL(const String& mimeType, std::optional<double> quality = std::nullopt, PreserveResolution = PreserveResolution::No) const = 0;
     virtual Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality = std::nullopt) const = 0;
 
-    virtual RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const = 0;
+    virtual RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, const ImageBufferAllocator& = ImageBufferAllocator()) const = 0;
     virtual void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint = { }, AlphaPremultiplication destFormat = AlphaPremultiplication::Premultiplied) = 0;
 
     // FIXME: current implementations of this method have the restriction that they only work

Copied: trunk/Source/WebCore/platform/graphics/ImageBufferAllocator.cpp (from rev 295148, trunk/Source/WebCore/platform/graphics/filters/FilterResults.h) (0 => 295149)


--- trunk/Source/WebCore/platform/graphics/ImageBufferAllocator.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferAllocator.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2022 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 "ImageBufferAllocator.h"
+
+#include "ImageBuffer.h"
+#include "PixelBuffer.h"
+
+namespace WebCore {
+
+ImageBufferAllocator::ImageBufferAllocator() = default;
+
+RefPtr<ImageBuffer> ImageBufferAllocator::createImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, RenderingMode renderingMode) const
+{
+    return ImageBuffer::create(size, RenderingPurpose::Unspecified, 1, colorSpace, PixelFormat::BGRA8, bufferOptionsForRendingMode(renderingMode));
+}
+
+RefPtr<PixelBuffer> ImageBufferAllocator::createPixelBuffer(const PixelBufferFormat& format, const IntSize& size) const
+{
+    return PixelBuffer::tryCreate(format, size);
+}
+
+} // namespace WebCore

Copied: trunk/Source/WebCore/platform/graphics/ImageBufferAllocator.h (from rev 295148, trunk/Source/WebCore/platform/graphics/filters/FilterResults.h) (0 => 295149)


--- trunk/Source/WebCore/platform/graphics/ImageBufferAllocator.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferAllocator.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2022 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 "PixelBufferFormat.h"
+#include "RenderingMode.h"
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class FloatSize;
+class ImageBuffer;
+class IntSize;
+class PixelBuffer;
+
+class ImageBufferAllocator {
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    WEBCORE_EXPORT ImageBufferAllocator();
+    WEBCORE_EXPORT virtual ~ImageBufferAllocator() = default;
+
+    virtual RefPtr<ImageBuffer> createImageBuffer(const FloatSize&, const DestinationColorSpace&, RenderingMode) const;
+    WEBCORE_EXPORT virtual RefPtr<PixelBuffer> createPixelBuffer(const PixelBufferFormat&, const IntSize&) const;
+};
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -89,13 +89,13 @@
     putPixelBuffer(*pixelBuffer, logicalRect(), IntPoint::zero(), AlphaPremultiplication::Premultiplied);
 }
 
-RefPtr<PixelBuffer> ImageBufferBackend::getPixelBuffer(const PixelBufferFormat& destinationFormat, const IntRect& sourceRect, void* data) const
+RefPtr<PixelBuffer> ImageBufferBackend::getPixelBuffer(const PixelBufferFormat& destinationFormat, const IntRect& sourceRect, void* data, const ImageBufferAllocator& allocator) const
 {
     ASSERT(PixelBuffer::supportedPixelFormat(destinationFormat.pixelFormat));
 
     auto sourceRectScaled = toBackendCoordinates(sourceRect);
 
-    auto pixelBuffer = PixelBuffer::tryCreate(destinationFormat, sourceRectScaled.size());
+    auto pixelBuffer = allocator.createPixelBuffer(destinationFormat, sourceRectScaled.size());
     if (!pixelBuffer)
         return nullptr;
 

Modified: trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/ImageBufferBackend.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -29,6 +29,7 @@
 #include "DestinationColorSpace.h"
 #include "FloatRect.h"
 #include "GraphicsTypesGL.h"
+#include "ImageBufferAllocator.h"
 #include "ImagePaintingOptions.h"
 #include "IntRect.h"
 #include "PixelBufferFormat.h"
@@ -123,7 +124,7 @@
     virtual String toDataURL(const String& mimeType, std::optional<double> quality, PreserveResolution) const = 0;
     virtual Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality) const = 0;
 
-    virtual RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const = 0;
+    virtual RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&, const ImageBufferAllocator& = ImageBufferAllocator()) const = 0;
     virtual void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) = 0;
 
     virtual PlatformLayer* platformLayer() const { return nullptr; }
@@ -179,7 +180,7 @@
     IntRect logicalRect() const { return IntRect(IntPoint::zero(), logicalSize()); };
     IntRect backendRect() const { return IntRect(IntPoint::zero(), backendSize()); };
 
-    WEBCORE_EXPORT RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, void* data) const;
+    WEBCORE_EXPORT RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, void* data, const ImageBufferAllocator&) const;
     WEBCORE_EXPORT void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat, void* data);
 
     Parameters m_parameters;

Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -104,9 +104,9 @@
     return copyNativeImage(copyBehavior);
 }
 
-RefPtr<PixelBuffer> ImageBufferCairoSurfaceBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
+RefPtr<PixelBuffer> ImageBufferCairoSurfaceBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, const ImageBufferAllocator& allocator) const
 {
-    return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, cairo_image_surface_get_data(m_surface.get()));
+    return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, cairo_image_surface_get_data(m_surface.get()), allocator);
 }
 
 void ImageBufferCairoSurfaceBackend::putPixelBuffer(const PixelBuffer& pixelBuffer, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat)

Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairoSurfaceBackend.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -46,7 +46,7 @@
 
     RefPtr<cairo_surface_t> createCairoSurface() override;
 
-    RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const override;
+    RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&, const ImageBufferAllocator&) const override;
     void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) override;
 
 protected:

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -155,9 +155,9 @@
     return nullptr;
 }
 
-RefPtr<PixelBuffer> ImageBufferCGBitmapBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
+RefPtr<PixelBuffer> ImageBufferCGBitmapBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, const ImageBufferAllocator& allocator) const
 {
-    return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, m_data);
+    return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, m_data, allocator);
 }
 
 void ImageBufferCGBitmapBackend::putPixelBuffer(const PixelBuffer& pixelBuffer, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat)

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.h (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -57,7 +57,7 @@
 
     RefPtr<NativeImage> copyNativeImage(BackingStoreCopy = CopyBackingStore) const final;
 
-    RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const final;
+    RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&, const ImageBufferAllocator&) const final;
     void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) final;
 
     void* m_data;

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -190,10 +190,10 @@
     return ImageBufferCGBackend::copyCGImageForEncoding(destinationUTI, preserveResolution);
 }
 
-RefPtr<PixelBuffer> ImageBufferIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
+RefPtr<PixelBuffer> ImageBufferIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, const ImageBufferAllocator& allocator) const
 {
     IOSurface::Locker lock(*m_surface);
-    return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, lock.surfaceBaseAddress());
+    return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, lock.surfaceBaseAddress(), allocator);
 }
 
 void ImageBufferIOSurfaceBackend::putPixelBuffer(const PixelBuffer& pixelBuffer, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat)

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -62,7 +62,7 @@
     RefPtr<NativeImage> copyNativeImage(BackingStoreCopy = CopyBackingStore) const override;
     RefPtr<NativeImage> sinkIntoNativeImage() override;
 
-    RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&) const override;
+    RefPtr<PixelBuffer> getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect&, const ImageBufferAllocator&) const override;
     void putPixelBuffer(const PixelBuffer&, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat) override;
 
     bool isInUse() const override;

Modified: trunk/Source/WebCore/platform/graphics/filters/Filter.cpp (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/filters/Filter.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/filters/Filter.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -28,6 +28,7 @@
 
 #include "FilterEffect.h"
 #include "FilterImage.h"
+#include "FilterResults.h"
 #include "ImageBuffer.h"
 
 namespace WebCore {
@@ -87,7 +88,7 @@
 
     if (sourceImage) {
         auto absoluteSourceImageRect = enclosingIntRect(scaledByFilterScale(sourceImageRect));
-        input = FilterImage::create(m_filterRegion, sourceImageRect, absoluteSourceImageRect, Ref { *sourceImage });
+        input = FilterImage::create(m_filterRegion, sourceImageRect, absoluteSourceImageRect, Ref { *sourceImage }, results.allocator());
         if (!input)
             return nullptr;
     }

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterEffect.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -134,7 +134,7 @@
     if (!applier)
         return nullptr;
 
-    auto result = FilterImage::create(primitiveSubregion, imageRect, absoluteImageRect, isAlphaImage, isValidPremultiplied, filter.renderingMode(), imageColorSpace);
+    auto result = FilterImage::create(primitiveSubregion, imageRect, absoluteImageRect, isAlphaImage, isValidPremultiplied, filter.renderingMode(), imageColorSpace, results.allocator());
     if (!result)
         return nullptr;
 

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterImage.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -38,18 +38,18 @@
 
 namespace WebCore {
 
-RefPtr<FilterImage> FilterImage::create(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, bool isAlphaImage, bool isValidPremultiplied, RenderingMode renderingMode, const DestinationColorSpace& colorSpace)
+RefPtr<FilterImage> FilterImage::create(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, bool isAlphaImage, bool isValidPremultiplied, RenderingMode renderingMode, const DestinationColorSpace& colorSpace, ImageBufferAllocator& allocator)
 {
     ASSERT(!ImageBuffer::sizeNeedsClamping(absoluteImageRect.size()));
-    return adoptRef(new FilterImage(primitiveSubregion, imageRect, absoluteImageRect, isAlphaImage, isValidPremultiplied, renderingMode, colorSpace));
+    return adoptRef(new FilterImage(primitiveSubregion, imageRect, absoluteImageRect, isAlphaImage, isValidPremultiplied, renderingMode, colorSpace, allocator));
 }
 
-RefPtr<FilterImage> FilterImage::create(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, Ref<ImageBuffer>&& imageBuffer)
+RefPtr<FilterImage> FilterImage::create(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, Ref<ImageBuffer>&& imageBuffer, ImageBufferAllocator& allocator)
 {
-    return adoptRef(*new FilterImage(primitiveSubregion, imageRect, absoluteImageRect, WTFMove(imageBuffer)));
+    return adoptRef(*new FilterImage(primitiveSubregion, imageRect, absoluteImageRect, WTFMove(imageBuffer), allocator));
 }
 
-FilterImage::FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, bool isAlphaImage, bool isValidPremultiplied, RenderingMode renderingMode, const DestinationColorSpace& colorSpace)
+FilterImage::FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, bool isAlphaImage, bool isValidPremultiplied, RenderingMode renderingMode, const DestinationColorSpace& colorSpace, ImageBufferAllocator& allocator)
     : m_primitiveSubregion(primitiveSubregion)
     , m_imageRect(imageRect)
     , m_absoluteImageRect(absoluteImageRect)
@@ -57,10 +57,11 @@
     , m_isValidPremultiplied(isValidPremultiplied)
     , m_renderingMode(renderingMode)
     , m_colorSpace(colorSpace)
+    , m_allocator(allocator)
 {
 }
 
-FilterImage::FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, Ref<ImageBuffer>&& imageBuffer)
+FilterImage::FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, Ref<ImageBuffer>&& imageBuffer, ImageBufferAllocator& allocator)
     : m_primitiveSubregion(primitiveSubregion)
     , m_imageRect(imageRect)
     , m_absoluteImageRect(absoluteImageRect)
@@ -67,6 +68,7 @@
     , m_renderingMode(imageBuffer->renderingMode())
     , m_colorSpace(imageBuffer->colorSpace())
     , m_imageBuffer(WTFMove(imageBuffer))
+    , m_allocator(allocator)
 {
 }
 
@@ -99,7 +101,7 @@
     if (m_imageBuffer)
         return m_imageBuffer.get();
 
-    m_imageBuffer = ImageBuffer::create(m_absoluteImageRect.size(), RenderingPurpose::Unspecified, 1, m_colorSpace, PixelFormat::BGRA8, bufferOptionsForRendingMode(m_renderingMode));
+    m_imageBuffer = m_allocator.createImageBuffer(m_absoluteImageRect.size(), m_colorSpace, m_renderingMode);
     if (!m_imageBuffer)
         return nullptr;
 
@@ -167,10 +169,10 @@
     }
 }
 
-static RefPtr<PixelBuffer> getConvertedPixelBuffer(ImageBuffer& imageBuffer, AlphaPremultiplication alphaFormat, const IntRect& sourceRect, DestinationColorSpace colorSpace)
+static RefPtr<PixelBuffer> getConvertedPixelBuffer(ImageBuffer& imageBuffer, AlphaPremultiplication alphaFormat, const IntRect& sourceRect, DestinationColorSpace colorSpace, ImageBufferAllocator& allocator)
 {
     auto clampedSize = ImageBuffer::clampedSize(sourceRect.size());
-    auto convertedImageBuffer = ImageBuffer::create(clampedSize, RenderingPurpose::Unspecified, 1, colorSpace, PixelFormat::BGRA8);
+    auto convertedImageBuffer = allocator.createImageBuffer(clampedSize, colorSpace, RenderingMode::Unaccelerated);
     
     if (!convertedImageBuffer)
         return nullptr;
@@ -178,21 +180,21 @@
     // Color space conversion happens internally when drawing from one image buffer to another
     convertedImageBuffer->context().drawImageBuffer(imageBuffer, sourceRect);
     PixelBufferFormat format { alphaFormat, PixelFormat::RGBA8, colorSpace };
-    return convertedImageBuffer->getPixelBuffer(format, sourceRect);
+    return convertedImageBuffer->getPixelBuffer(format, sourceRect, allocator);
 }
 
-static RefPtr<PixelBuffer> getConvertedPixelBuffer(PixelBuffer& sourcePixelBuffer, AlphaPremultiplication alphaFormat, DestinationColorSpace colorSpace)
+static RefPtr<PixelBuffer> getConvertedPixelBuffer(PixelBuffer& sourcePixelBuffer, AlphaPremultiplication alphaFormat, DestinationColorSpace colorSpace, ImageBufferAllocator& allocator)
 {
     auto sourceRect = IntRect { { } , sourcePixelBuffer.size() };
     auto clampedSize = ImageBuffer::clampedSize(sourceRect.size());
 
     auto& sourceColorSpace = sourcePixelBuffer.format().colorSpace;
-    auto imageBuffer = ImageBuffer::create(clampedSize, RenderingPurpose::Unspecified, 1, sourceColorSpace, PixelFormat::BGRA8);
+    auto imageBuffer = allocator.createImageBuffer(clampedSize, sourceColorSpace, RenderingMode::Unaccelerated);
     if (!imageBuffer)
         return nullptr;
 
     imageBuffer->putPixelBuffer(sourcePixelBuffer, sourceRect);
-    return getConvertedPixelBuffer(*imageBuffer, alphaFormat, sourceRect, colorSpace);
+    return getConvertedPixelBuffer(*imageBuffer, alphaFormat, sourceRect, colorSpace, allocator);
 }
 
 bool FilterImage::requiresPixelBufferColorSpaceConversion(std::optional<DestinationColorSpace> colorSpace) const
@@ -223,7 +225,7 @@
     PixelBufferFormat format { alphaFormat, PixelFormat::RGBA8, m_colorSpace };
 
     if (m_imageBuffer) {
-        pixelBuffer = m_imageBuffer->getPixelBuffer(format, { { }, m_absoluteImageRect.size() });
+        pixelBuffer = m_imageBuffer->getPixelBuffer(format, { { }, m_absoluteImageRect.size() }, m_allocator);
         if (!pixelBuffer)
             return nullptr;
         return pixelBuffer.get();
@@ -232,7 +234,7 @@
     IntSize logicalSize(m_absoluteImageRect.size());
     ASSERT(!ImageBuffer::sizeNeedsClamping(logicalSize));
 
-    pixelBuffer = PixelBuffer::tryCreate(format, logicalSize);
+    pixelBuffer = m_allocator.createPixelBuffer(format, logicalSize);
     if (!pixelBuffer)
         return nullptr;
 
@@ -253,7 +255,7 @@
 
     PixelBufferFormat format { alphaFormat, PixelFormat::RGBA8, colorSpace? *colorSpace : m_colorSpace };
 
-    auto pixelBuffer = PixelBuffer::tryCreate(format, sourceRect.size());
+    auto pixelBuffer = m_allocator.createPixelBuffer(format, sourceRect.size());
     if (!pixelBuffer)
         return nullptr;
 
@@ -273,7 +275,7 @@
             // We prefer a conversion from the image buffer.
             if (m_imageBuffer) {
                 IntRect rect { { }, m_absoluteImageRect.size() };
-                if (auto convertedPixelBuffer = getConvertedPixelBuffer(*m_imageBuffer, alphaFormat, rect, colorSpace))
+                if (auto convertedPixelBuffer = getConvertedPixelBuffer(*m_imageBuffer, alphaFormat, rect, colorSpace, m_allocator))
                     copyImageBytes(*convertedPixelBuffer, destinationPixelBuffer, sourceRect);
                 return;
             }
@@ -286,7 +288,7 @@
         return;
 
     if (requiresPixelBufferColorSpaceConversion(colorSpace)) {
-        if (auto convertedPixelBuffer = getConvertedPixelBuffer(*sourcePixelBuffer, alphaFormat, colorSpace))
+        if (auto convertedPixelBuffer = getConvertedPixelBuffer(*sourcePixelBuffer, alphaFormat, colorSpace, m_allocator))
             copyImageBytes(*convertedPixelBuffer, destinationPixelBuffer, sourceRect);
         return;
     }

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterImage.h (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/filters/FilterImage.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterImage.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -42,11 +42,12 @@
 class Filter;
 class FloatRect;
 class ImageBuffer;
+class ImageBufferAllocator;
 
 class FilterImage : public RefCounted<FilterImage> {
 public:
-    static RefPtr<FilterImage> create(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, bool isAlphaImage, bool isValidPremultiplied, RenderingMode, const DestinationColorSpace&);
-    static RefPtr<FilterImage> create(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, Ref<ImageBuffer>&&);
+    static RefPtr<FilterImage> create(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, bool isAlphaImage, bool isValidPremultiplied, RenderingMode, const DestinationColorSpace&, ImageBufferAllocator&);
+    static RefPtr<FilterImage> create(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, Ref<ImageBuffer>&&, ImageBufferAllocator&);
 
     // The return values are in filter coordinates.
     FloatRect primitiveSubregion() const { return m_primitiveSubregion; }
@@ -77,8 +78,8 @@
 #endif
 
 private:
-    FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, bool isAlphaImage, bool isValidPremultiplied, RenderingMode, const DestinationColorSpace&);
-    FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, Ref<ImageBuffer>&&);
+    FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, bool isAlphaImage, bool isValidPremultiplied, RenderingMode, const DestinationColorSpace&, ImageBufferAllocator&);
+    FilterImage(const FloatRect& primitiveSubregion, const FloatRect& imageRect, const IntRect& absoluteImageRect, Ref<ImageBuffer>&&, ImageBufferAllocator&);
 
     RefPtr<PixelBuffer>& pixelBufferSlot(AlphaPremultiplication);
 
@@ -106,6 +107,8 @@
 #if USE(CORE_IMAGE)
     RetainPtr<CIImage> m_ciImage;
 #endif
+
+    ImageBufferAllocator& m_allocator;
 };
 
 } // namespace WebCore

Copied: trunk/Source/WebCore/platform/graphics/filters/FilterResults.cpp (from rev 295148, trunk/Source/WebCore/platform/graphics/filters/FilterResults.h) (0 => 295149)


--- trunk/Source/WebCore/platform/graphics/filters/FilterResults.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterResults.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2022 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 "FilterResults.h"
+
+namespace WebCore {
+
+FilterResults::FilterResults(std::unique_ptr<ImageBufferAllocator>&& allocator)
+    : m_allocator(allocator ? WTFMove(allocator) : makeUnique<ImageBufferAllocator>())
+{
+}
+
+FilterImage* FilterResults::effectResult(FilterEffect& effect) const
+{
+    return m_results.get(effect);
+}
+
+void FilterResults::setEffectResult(FilterEffect& effect, const FilterImageVector& inputs, Ref<FilterImage>&& result)
+{
+    m_results.set({ effect }, WTFMove(result));
+
+    for (auto& input : inputs)
+        m_resultReferences.add(input, FilterEffectSet()).iterator->value.add(effect);
+}
+
+void FilterResults::clearEffectResult(FilterEffect& effect)
+{
+    auto iterator = m_results.find(effect);
+    if (iterator == m_results.end())
+        return;
+
+    auto result = iterator->value;
+    m_results.remove(iterator);
+
+    for (auto& reference : m_resultReferences.get(result))
+        clearEffectResult(reference);
+
+    m_resultReferences.remove(result);
+}
+
+} // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/filters/FilterResults.h (295148 => 295149)


--- trunk/Source/WebCore/platform/graphics/filters/FilterResults.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebCore/platform/graphics/filters/FilterResults.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -27,6 +27,7 @@
 
 #include "FilterEffect.h"
 #include "FilterImageVector.h"
+#include "ImageBufferAllocator.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 
@@ -37,41 +38,22 @@
 
 class FilterResults {
 public:
-    FilterResults() = default;
+    WEBCORE_EXPORT FilterResults(std::unique_ptr<ImageBufferAllocator>&& = nullptr);
 
-    FilterImage* effectResult(FilterEffect& effect) const
-    {
-        return m_results.get(effect);
-    }
+    ImageBufferAllocator& allocator() const { return *m_allocator; }
 
-    void setEffectResult(FilterEffect& effect, const FilterImageVector& inputs, Ref<FilterImage>&& result)
-    {
-        m_results.set({ effect }, WTFMove(result));
-        
-        for (auto& input : inputs)
-            m_resultReferences.add(input, FilterEffectSet()).iterator->value.add(effect);
-    }
+    FilterImage* effectResult(FilterEffect&) const;
+    void setEffectResult(FilterEffect&, const FilterImageVector& inputs, Ref<FilterImage>&& result);
+    void clearEffectResult(FilterEffect&);
 
-    void clearEffectResult(FilterEffect& effect)
-    {
-        auto iterator = m_results.find(effect);
-        if (iterator == m_results.end())
-            return;
-
-        auto result = iterator->value;
-        m_results.remove(iterator);
-
-        for (auto& reference : m_resultReferences.get(result))
-            clearEffectResult(reference);
-        
-        m_resultReferences.remove(result);
-    }
-
 private:
-    using FilterEffectSet = HashSet<Ref<FilterEffect>>;
     HashMap<Ref<FilterEffect>, Ref<FilterImage>> m_results;
+
     // The value is a list of FilterEffects, whose FilterImages depend on the key FilterImage.
+    using FilterEffectSet = HashSet<Ref<FilterEffect>>;
     HashMap<Ref<FilterImage>, FilterEffectSet> m_resultReferences;
+
+    std::unique_ptr<ImageBufferAllocator> m_allocator;
 };
 
 } // namespace WebCore

Added: trunk/Source/WebKit/GPUProcess/graphics/ImageBufferShareableAllocator.cpp (0 => 295149)


--- trunk/Source/WebKit/GPUProcess/graphics/ImageBufferShareableAllocator.cpp	                        (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/ImageBufferShareableAllocator.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2022 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 "ImageBufferShareableAllocator.h"
+
+#include "ImageBufferShareableBitmapBackend.h"
+#include <WebCore/ConcreteImageBuffer.h>
+
+#if ENABLE(GPU_PROCESS)
+
+namespace WebKit {
+using namespace WebCore;
+
+RefPtr<ImageBuffer> ImageBufferShareableAllocator::createImageBuffer(const FloatSize& size, const DestinationColorSpace& colorSpace, RenderingMode) const
+{
+    RefPtr<ImageBuffer> imageBuffer = ConcreteImageBuffer<ImageBufferShareableBitmapBackend>::create(size, 1, colorSpace, PixelFormat::BGRA8, RenderingPurpose::Unspecified, { });
+    if (!imageBuffer)
+        return nullptr;
+
+    auto* backend = imageBuffer->backend();
+    if (!backend)
+        return nullptr;
+
+    auto* sharing = backend->toBackendSharing();
+    ASSERT(is<ImageBufferBackendHandleSharing>(sharing));
+
+    auto bitmap = downcast<ImageBufferBackendHandleSharing>(*sharing).bitmap();
+    if (!bitmap)
+        return nullptr;
+
+    ShareableBitmap::Handle handle;
+    if (!bitmap->createHandle(handle))
+        return nullptr;
+
+    transferMemoryOwnership(WTFMove(handle.handle()), bitmap->sizeInBytes());
+    return imageBuffer;
+}
+
+RefPtr<PixelBuffer> ImageBufferShareableAllocator::createPixelBuffer(const PixelBufferFormat& format, const IntSize& size) const
+{
+    // FIXME: Create a shareable PixelBuffer and transfer the ownership of its memory to WebProcess.
+    return ImageBufferAllocator::createPixelBuffer(format, size);
+}
+
+void ImageBufferShareableAllocator::transferMemoryOwnership(SharedMemory::Handle&&, size_t) const
+{
+    // FIXME: Transfer the ownership of the SharedMemory::Handle to WebProcess.
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)

Copied: trunk/Source/WebKit/GPUProcess/graphics/ImageBufferShareableAllocator.h (from rev 295148, trunk/Source/WebCore/platform/graphics/filters/FilterResults.h) (0 => 295149)


--- trunk/Source/WebKit/GPUProcess/graphics/ImageBufferShareableAllocator.h	                        (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/ImageBufferShareableAllocator.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2022 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
+
+#if ENABLE(GPU_PROCESS)
+
+#include <WebCore/ImageBufferAllocator.h>
+
+namespace WebKit {
+
+class ImageBufferShareableAllocator final : public WebCore::ImageBufferAllocator {
+public:
+    ImageBufferShareableAllocator() = default;
+
+private:
+    RefPtr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, const WebCore::DestinationColorSpace&, WebCore::RenderingMode) const final;
+    RefPtr<WebCore::PixelBuffer> createPixelBuffer(const WebCore::PixelBufferFormat&, const WebCore::IntSize&) const final;
+
+    void transferMemoryOwnership(SharedMemory::Handle&&, size_t dataSize) const;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp (295148 => 295149)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -28,6 +28,7 @@
 
 #if ENABLE(GPU_PROCESS)
 
+#include "ImageBufferShareableAllocator.h"
 #include "RemoteDisplayListRecorderMessages.h"
 #include <WebCore/BitmapImage.h>
 #include <WebCore/FilterResults.h>
@@ -235,7 +236,7 @@
         feImage.setImageSource(WTFMove(*sourceImage));
     }
 
-    FilterResults results;
+    FilterResults results(makeUnique<ImageBufferShareableAllocator>());
     handleItem(DisplayList::DrawFilteredImageBuffer(sourceImageIdentifier, sourceImageRect, WTFMove(filter)), sourceImage.get(), results);
 }
 

Modified: trunk/Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.cpp (295148 => 295149)


--- trunk/Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -43,6 +43,8 @@
 
 namespace WebKit {
 
+using namespace WebCore;
+
 static WorkQueue& remoteVideoFrameObjectHeapQueue()
 {
     static NeverDestroyed queue = WorkQueue::create("org.webkit.RemoteVideoFrameObjectHeap", WorkQueue::QOS::UserInteractive);

Modified: trunk/Source/WebKit/Shared/ShareableBitmap.h (295148 => 295149)


--- trunk/Source/WebKit/Shared/ShareableBitmap.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/Shared/ShareableBitmap.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -59,6 +59,8 @@
 
         bool isNull() const { return m_handle.isNull(); }
 
+        SharedMemory::Handle& handle() { return m_handle; }
+
         // Take ownership of the memory for process memory accounting purposes.
         void takeOwnershipOfMemory(MemoryLedger) const;
 
@@ -97,6 +99,7 @@
 
     void* data() const;
     size_t bytesPerRow() const { return calculateBytesPerRow(m_size, m_configuration); }
+    size_t sizeInBytes() const { return numBytesForSize(m_size, m_configuration); }
 
     // Create a graphics context that can be used to paint into the backing store.
     std::unique_ptr<WebCore::GraphicsContext> createGraphicsContext();
@@ -139,8 +142,6 @@
     static void releaseSurfaceData(void* typelessBitmap);
 #endif
 
-    size_t sizeInBytes() const { return numBytesForSize(m_size, m_configuration); }
-
     WebCore::IntSize m_size;
     Configuration m_configuration;
 

Modified: trunk/Source/WebKit/Sources.txt (295148 => 295149)


--- trunk/Source/WebKit/Sources.txt	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/Sources.txt	2022-06-02 22:12:04 UTC (rev 295149)
@@ -24,9 +24,10 @@
 GPUProcess/GPUProcess.cpp
 GPUProcess/GPUConnectionToWebProcess.cpp
 GPUProcess/GPUProcessCreationParameters.cpp
+GPUProcess/graphics/ImageBufferShareableAllocator.cpp
 GPUProcess/graphics/RemoteDisplayListRecorder.cpp
+GPUProcess/graphics/RemoteGraphicsContextGL.cpp
 GPUProcess/graphics/RemoteRenderingBackend.cpp
-GPUProcess/graphics/RemoteGraphicsContextGL.cpp
 GPUProcess/graphics/RemoteResourceCache.cpp
 GPUProcess/graphics/ScopedRenderingResourcesRequest.cpp
 GPUProcess/graphics/ScopedWebGLRenderingResourcesRequest.cpp

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (295148 => 295149)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-06-02 22:12:04 UTC (rev 295149)
@@ -5374,6 +5374,8 @@
 		7227800B2408BD7D007D376B /* PlatformRemoteImageBufferProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteImageBufferProxy.h; sourceTree = "<group>"; };
 		722E1CDB2840B7E7005828BD /* PixelBufferReference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PixelBufferReference.h; sourceTree = "<group>"; };
 		7246963A275B7E6700A9156A /* FilterReference.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FilterReference.h; sourceTree = "<group>"; };
+		724DCF21284862FC0026ACF4 /* ImageBufferShareableAllocator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBufferShareableAllocator.h; sourceTree = "<group>"; };
+		724DCF22284862FC0026ACF4 /* ImageBufferShareableAllocator.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferShareableAllocator.cpp; sourceTree = "<group>"; };
 		726D56DD253A64810002EF90 /* RemoteResourceCache.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteResourceCache.cpp; sourceTree = "<group>"; };
 		726D56DE253A64810002EF90 /* RemoteResourceCache.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteResourceCache.h; sourceTree = "<group>"; };
 		727A7F342407857D004D2931 /* ImageBufferShareableMappedIOSurfaceBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferShareableMappedIOSurfaceBackend.cpp; sourceTree = "<group>"; };
@@ -10424,6 +10426,8 @@
 			isa = PBXGroup;
 			children = (
 				1C98C01C27446926002CCB78 /* WebGPU */,
+				724DCF22284862FC0026ACF4 /* ImageBufferShareableAllocator.cpp */,
+				724DCF21284862FC0026ACF4 /* ImageBufferShareableAllocator.h */,
 				55AD09432408A0E600DE4D2F /* PlatformRemoteImageBuffer.h */,
 				1CC54AFD270F9654005BF8BE /* QualifiedRenderingResourceIdentifier.h */,
 				1CBF9012271018B5000C457D /* QualifiedResourceHeap.h */,

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp (295148 => 295149)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -158,9 +158,9 @@
     return m_bitmap->createImage();
 }
 
-RefPtr<PixelBuffer> ImageBufferShareableBitmapBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect) const
+RefPtr<PixelBuffer> ImageBufferShareableBitmapBackend::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& srcRect, const ImageBufferAllocator& allocator) const
 {
-    return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, m_bitmap->data());
+    return ImageBufferBackend::getPixelBuffer(outputFormat, srcRect, m_bitmap->data(), allocator);
 }
 
 void ImageBufferShareableBitmapBackend::putPixelBuffer(const PixelBuffer& pixelBuffer, const IntRect& srcRect, const IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat)

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h (295148 => 295149)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -65,7 +65,7 @@
     RefPtr<WebCore::NativeImage> copyNativeImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore) const final;
     RefPtr<WebCore::Image> copyImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore, WebCore::PreserveResolution = WebCore::PreserveResolution::No) const final;
 
-    RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
+    RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&, const WebCore::ImageBufferAllocator&) const final;
     void putPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) final;
 
     void setOwnershipIdentity(const WebCore::ProcessIdentity&) { }

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (295148 => 295149)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -234,13 +234,13 @@
         return m_remoteRenderingBackendProxy->getFilteredImage(m_renderingResourceIdentifier, filter);
     }
 
-    RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& destinationFormat, const WebCore::IntRect& srcRect) const final
+    RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& destinationFormat, const WebCore::IntRect& srcRect, const WebCore::ImageBufferAllocator& allocator) const final
     {
         if (UNLIKELY(!m_remoteRenderingBackendProxy))
             return nullptr;
         auto& mutableThis = const_cast<RemoteImageBufferProxy&>(*this);
         mutableThis.flushDrawingContextAsync();
-        auto pixelBuffer = WebCore::PixelBuffer::tryCreate(destinationFormat, srcRect.size());
+        auto pixelBuffer = allocator.createPixelBuffer(destinationFormat, srcRect.size());
         if (!pixelBuffer)
             return nullptr;
         auto& data = ""

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp (295148 => 295149)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp	2022-06-02 22:12:04 UTC (rev 295149)
@@ -130,7 +130,7 @@
     return { };
 }
 
-RefPtr<PixelBuffer> ImageBufferRemoteIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat&, const IntRect&) const
+RefPtr<PixelBuffer> ImageBufferRemoteIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat&, const IntRect&, const ImageBufferAllocator&) const
 {
     RELEASE_ASSERT_NOT_REACHED();
     return nullptr;

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h (295148 => 295149)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h	2022-06-02 21:45:04 UTC (rev 295148)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h	2022-06-02 22:12:04 UTC (rev 295149)
@@ -63,7 +63,7 @@
     RefPtr<WebCore::Image> copyImage(WebCore::BackingStoreCopy, WebCore::PreserveResolution) const final;
     String toDataURL(const String& mimeType, std::optional<double> quality, WebCore::PreserveResolution) const final;
     Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality) const final;
-    RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
+    RefPtr<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&, const WebCore::ImageBufferAllocator&) const final;
     void putPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) final;
 
     bool originAtBottomLeftCorner() const final { return isOriginAtBottomLeftCorner; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to