Title: [283941] trunk/Source
Revision
283941
Author
[email protected]
Date
2021-10-11 15:37:04 -0700 (Mon, 11 Oct 2021)

Log Message

Introduce RemoteDisplayListRecorderProxy and RemoteDisplayListRecorder
https://bugs.webkit.org/show_bug.cgi?id=231484

Reviewed by Simon Fraser.

Source/WebCore:

See WebKit ChangeLog for more details.

* platform/graphics/GraphicsContext.h:
* platform/graphics/ImageBuffer.h:
* platform/graphics/displaylists/DisplayListItems.h:

Add default constructors for a couple of display list items so that they can be encoded as IPC arguments using
SimpleArgumentCoder.

Source/WebKit:

Introduce two new classes that house most of the logic for propagating display list items from the web content
process to the GPU process. RemoteDisplayListRecorderProxy is a subclass of DisplayList::Recorder that records
each item by sending it to the GPU process through a stream connection, which will be added to
RemoteRenderingBackendProxy in a subsequent patch. The RemoteDisplayListRecorderProxy will be managed by
RemoteImageBufferProxy in the web process. RemoteDisplayListRecorder acts as the streaming IPC destination in
the GPU process, and handles the incoming display list items by applying them to the platform graphics context.

For most of these display list items, we can propagate them to the GPU process by sending each display list
item's constructor arguments as separate IPC arguments. In a future patch, we should add support for encoding
the following display list items in the same way:

- SetInlineFillColor
- SetInlineStrokeColor
- SetState
- SetLineDash
- DrawGlyphs
- DrawLinesForText
- FillRectWithGradient

For now, the above display list items are encoded and decoded as whole items. While there's no practical
disadvantage to implementing it this way, it would be nice to make it consistent.

* CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* GPUProcess/graphics/RemoteDisplayListRecorder.cpp: Added.
(WebKit::RemoteDisplayListRecorder::RemoteDisplayListRecorder):
(WebKit::RemoteDisplayListRecorder::resourceCache):
(WebKit::RemoteDisplayListRecorder::drawingContext):
(WebKit::RemoteDisplayListRecorder::startListeningForIPC):
(WebKit::RemoteDisplayListRecorder::stopListeningForIPC):
(WebKit::RemoteDisplayListRecorder::save):
(WebKit::RemoteDisplayListRecorder::restore):
(WebKit::RemoteDisplayListRecorder::translate):
(WebKit::RemoteDisplayListRecorder::rotate):
(WebKit::RemoteDisplayListRecorder::scale):
(WebKit::RemoteDisplayListRecorder::setCTM):
(WebKit::RemoteDisplayListRecorder::concatenateCTM):
(WebKit::RemoteDisplayListRecorder::setInlineFillColor):
(WebKit::RemoteDisplayListRecorder::setInlineStrokeColor):
(WebKit::RemoteDisplayListRecorder::setStrokeThickness):
(WebKit::RemoteDisplayListRecorder::setState):
(WebKit::RemoteDisplayListRecorder::setLineCap):
(WebKit::RemoteDisplayListRecorder::setLineDash):
(WebKit::RemoteDisplayListRecorder::setLineJoin):
(WebKit::RemoteDisplayListRecorder::setMiterLimit):
(WebKit::RemoteDisplayListRecorder::clearShadow):
(WebKit::RemoteDisplayListRecorder::clip):
(WebKit::RemoteDisplayListRecorder::clipOut):
(WebKit::RemoteDisplayListRecorder::clipToImageBuffer):
(WebKit::RemoteDisplayListRecorder::clipOutToPath):
(WebKit::RemoteDisplayListRecorder::clipPath):
(WebKit::RemoteDisplayListRecorder::beginClipToDrawingCommands):
(WebKit::RemoteDisplayListRecorder::endClipToDrawingCommands):
(WebKit::RemoteDisplayListRecorder::drawGlyphs):
(WebKit::RemoteDisplayListRecorder::drawImageBuffer):
(WebKit::RemoteDisplayListRecorder::drawNativeImage):
(WebKit::RemoteDisplayListRecorder::drawPattern):
(WebKit::RemoteDisplayListRecorder::beginTransparencyLayer):
(WebKit::RemoteDisplayListRecorder::endTransparencyLayer):
(WebKit::RemoteDisplayListRecorder::drawRect):
(WebKit::RemoteDisplayListRecorder::drawLine):
(WebKit::RemoteDisplayListRecorder::drawLinesForText):
(WebKit::RemoteDisplayListRecorder::drawDotsForDocumentMarker):
(WebKit::RemoteDisplayListRecorder::drawEllipse):
(WebKit::RemoteDisplayListRecorder::drawPath):
(WebKit::RemoteDisplayListRecorder::drawFocusRingPath):
(WebKit::RemoteDisplayListRecorder::drawFocusRingRects):
(WebKit::RemoteDisplayListRecorder::fillRect):
(WebKit::RemoteDisplayListRecorder::fillRectWithColor):
(WebKit::RemoteDisplayListRecorder::fillRectWithGradient):
(WebKit::RemoteDisplayListRecorder::fillCompositedRect):
(WebKit::RemoteDisplayListRecorder::fillRoundedRect):
(WebKit::RemoteDisplayListRecorder::fillRectWithRoundedHole):
(WebKit::RemoteDisplayListRecorder::fillLine):
(WebKit::RemoteDisplayListRecorder::fillArc):
(WebKit::RemoteDisplayListRecorder::fillQuadCurve):
(WebKit::RemoteDisplayListRecorder::fillBezierCurve):
(WebKit::RemoteDisplayListRecorder::fillPath):
(WebKit::RemoteDisplayListRecorder::fillEllipse):
(WebKit::RemoteDisplayListRecorder::getPixelBuffer):
(WebKit::RemoteDisplayListRecorder::putPixelBuffer):
(WebKit::RemoteDisplayListRecorder::paintFrameForMedia):
(WebKit::RemoteDisplayListRecorder::strokeRect):
(WebKit::RemoteDisplayListRecorder::strokeLine):
(WebKit::RemoteDisplayListRecorder::strokeArc):
(WebKit::RemoteDisplayListRecorder::strokeQuadCurve):
(WebKit::RemoteDisplayListRecorder::strokeBezierCurve):
(WebKit::RemoteDisplayListRecorder::strokePath):
(WebKit::RemoteDisplayListRecorder::strokeEllipse):
(WebKit::RemoteDisplayListRecorder::clearRect):
(WebKit::RemoteDisplayListRecorder::applyStrokePattern):
(WebKit::RemoteDisplayListRecorder::applyFillPattern):
(WebKit::RemoteDisplayListRecorder::applyDeviceScaleFactor):
(WebKit::RemoteDisplayListRecorder::flushContext):
* GPUProcess/graphics/RemoteDisplayListRecorder.h: Added.
(WebKit::RemoteDisplayListRecorder::create):
(WebKit::RemoteDisplayListRecorder::handleItem):
* GPUProcess/graphics/RemoteDisplayListRecorder.messages.in: Added.
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::performWithMediaPlayerOnMainThread):
* GPUProcess/graphics/RemoteRenderingBackend.h:

Add helper methods to RemoteRenderingBackend that are called from RemoteDisplayListRecorder.

* Scripts/webkit/messages.py:
(headers_for_type):
* Shared/WebCoreArgumentCoders.cpp:
* Shared/WebCoreArgumentCoders.h:

Make it possible to encode and decode SetInlineFillColor and SetInlineStrokeColor using simple argument coder.

* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp: Added.
(WebKit::RemoteDisplayListRecorderProxy::RemoteDisplayListRecorderProxy):
(WebKit::m_renderingBackend):
(WebKit::RemoteDisplayListRecorderProxy::getPixelBuffer):
(WebKit::RemoteDisplayListRecorderProxy::putPixelBuffer):
(WebKit::RemoteDisplayListRecorderProxy::canDrawImageBuffer const):
(WebKit::RemoteDisplayListRecorderProxy::renderingMode const):
(WebKit::RemoteDisplayListRecorderProxy::recordSave):
(WebKit::RemoteDisplayListRecorderProxy::recordRestore):
(WebKit::RemoteDisplayListRecorderProxy::recordTranslate):
(WebKit::RemoteDisplayListRecorderProxy::recordRotate):
(WebKit::RemoteDisplayListRecorderProxy::recordScale):
(WebKit::RemoteDisplayListRecorderProxy::recordSetCTM):
(WebKit::RemoteDisplayListRecorderProxy::recordConcatenateCTM):
(WebKit::RemoteDisplayListRecorderProxy::recordSetInlineFillColor):
(WebKit::RemoteDisplayListRecorderProxy::recordSetInlineStrokeColor):
(WebKit::RemoteDisplayListRecorderProxy::recordSetStrokeThickness):
(WebKit::RemoteDisplayListRecorderProxy::recordSetState):
(WebKit::RemoteDisplayListRecorderProxy::recordSetLineCap):
(WebKit::RemoteDisplayListRecorderProxy::recordSetLineDash):
(WebKit::RemoteDisplayListRecorderProxy::recordSetLineJoin):
(WebKit::RemoteDisplayListRecorderProxy::recordSetMiterLimit):
(WebKit::RemoteDisplayListRecorderProxy::recordClearShadow):
(WebKit::RemoteDisplayListRecorderProxy::recordClip):
(WebKit::RemoteDisplayListRecorderProxy::recordClipOut):
(WebKit::RemoteDisplayListRecorderProxy::recordClipToImageBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordClipOutToPath):
(WebKit::RemoteDisplayListRecorderProxy::recordClipPath):
(WebKit::RemoteDisplayListRecorderProxy::recordBeginClipToDrawingCommands):
(WebKit::RemoteDisplayListRecorderProxy::recordEndClipToDrawingCommands):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawGlyphs):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawImageBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawNativeImage):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern):
(WebKit::RemoteDisplayListRecorderProxy::recordBeginTransparencyLayer):
(WebKit::RemoteDisplayListRecorderProxy::recordEndTransparencyLayer):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawRect):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawLine):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawLinesForText):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawDotsForDocumentMarker):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawEllipse):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawPath):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawFocusRingPath):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawFocusRingRects):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRect):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRectWithColor):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRectWithGradient):
(WebKit::RemoteDisplayListRecorderProxy::recordFillCompositedRect):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRoundedRect):
(WebKit::RemoteDisplayListRecorderProxy::recordFillRectWithRoundedHole):
(WebKit::RemoteDisplayListRecorderProxy::recordFillLine):
(WebKit::RemoteDisplayListRecorderProxy::recordFillArc):
(WebKit::RemoteDisplayListRecorderProxy::recordFillQuadCurve):
(WebKit::RemoteDisplayListRecorderProxy::recordFillBezierCurve):
(WebKit::RemoteDisplayListRecorderProxy::recordFillPath):
(WebKit::RemoteDisplayListRecorderProxy::recordFillEllipse):
(WebKit::RemoteDisplayListRecorderProxy::recordGetPixelBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordPutPixelBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordPaintFrameForMedia):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeRect):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeLine):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeArc):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeQuadCurve):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeBezierCurve):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokePath):
(WebKit::RemoteDisplayListRecorderProxy::recordStrokeEllipse):
(WebKit::RemoteDisplayListRecorderProxy::recordClearRect):
(WebKit::RemoteDisplayListRecorderProxy::recordApplyStrokePattern):
(WebKit::RemoteDisplayListRecorderProxy::recordApplyFillPattern):
(WebKit::RemoteDisplayListRecorderProxy::recordApplyDeviceScaleFactor):
(WebKit::RemoteDisplayListRecorderProxy::recordResourceUse):
(WebKit::RemoteDisplayListRecorderProxy::flushContext):
(WebKit::RemoteDisplayListRecorderProxy::createNestedContext):
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h: Added.
(WebKit::RemoteDisplayListRecorderProxy::~RemoteDisplayListRecorderProxy):
(WebKit::RemoteDisplayListRecorderProxy::resetNeedsFlush):
(WebKit::RemoteDisplayListRecorderProxy::needsFlush const):
(WebKit::RemoteDisplayListRecorderProxy::send):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::recordNativeImageUse):
(WebKit::RemoteRenderingBackendProxy::recordFontUse):
(WebKit::RemoteRenderingBackendProxy::recordImageBufferUse):
(WebKit::RemoteRenderingBackendProxy::isCached const):

Add helper methods to RemoteRenderingBackendProxy that are called from RemoteDisplayListRecorderProxy.

* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
(WebKit::RemoteRenderingBackendProxy::sendToStream):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (283940 => 283941)


--- trunk/Source/WebCore/ChangeLog	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebCore/ChangeLog	2021-10-11 22:37:04 UTC (rev 283941)
@@ -1,3 +1,19 @@
+2021-10-11  Wenson Hsieh  <[email protected]>
+
+        Introduce RemoteDisplayListRecorderProxy and RemoteDisplayListRecorder
+        https://bugs.webkit.org/show_bug.cgi?id=231484
+
+        Reviewed by Simon Fraser.
+
+        See WebKit ChangeLog for more details.
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/ImageBuffer.h:
+        * platform/graphics/displaylists/DisplayListItems.h:
+
+        Add default constructors for a couple of display list items so that they can be encoded as IPC arguments using
+        SimpleArgumentCoder.
+
 2021-10-11  Tim Nguyen  <[email protected]>
 
         Implement new autofocus behavior

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (283940 => 283941)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2021-10-11 22:37:04 UTC (rev 283941)
@@ -430,7 +430,7 @@
     WEBCORE_EXPORT ImageDrawResult drawImage(Image&, const FloatRect& destination, const ImagePaintingOptions& = { ImageOrientation::FromImage });
     WEBCORE_EXPORT virtual ImageDrawResult drawImage(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions& = { ImageOrientation::FromImage });
 
-    virtual ImageDrawResult drawImageForCanvas(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&, DestinationColorSpace canvasColorSpace);
+    WEBCORE_EXPORT virtual ImageDrawResult drawImageForCanvas(Image&, const FloatRect& destination, const FloatRect& source, const ImagePaintingOptions&, DestinationColorSpace canvasColorSpace);
 
     WEBCORE_EXPORT virtual ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatPoint& source, const FloatSize& tileSize, const FloatSize& spacing, const ImagePaintingOptions& = { });
     WEBCORE_EXPORT virtual ImageDrawResult drawTiledImage(Image&, const FloatRect& destination, const FloatRect& source, const FloatSize& tileScaleFactor, Image::TileRule, Image::TileRule, const ImagePaintingOptions& = { });

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (283940 => 283941)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2021-10-11 22:37:04 UTC (rev 283941)
@@ -50,7 +50,7 @@
 
     // Create an image buffer compatible with the context, with suitable resolution for drawing into the buffer and then into this context.
     static RefPtr<ImageBuffer> createCompatibleBuffer(const FloatSize&, const GraphicsContext&);
-    static RefPtr<ImageBuffer> createCompatibleBuffer(const FloatSize&, const DestinationColorSpace&, const GraphicsContext&);
+    WEBCORE_EXPORT static RefPtr<ImageBuffer> createCompatibleBuffer(const FloatSize&, const DestinationColorSpace&, const GraphicsContext&);
     static RefPtr<ImageBuffer> createCompatibleBuffer(const FloatSize&, float resolutionScale, const DestinationColorSpace&, const GraphicsContext&);
 
     // These functions are used when clamping the ImageBuffer which is created for filter, masker or clipper.

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (283940 => 283941)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2021-10-11 22:37:04 UTC (rev 283941)
@@ -188,6 +188,7 @@
     static constexpr bool isInlineItem = true;
     static constexpr bool isDrawingItem = false;
 
+    SetInlineFillColor() = default;
     SetInlineFillColor(SRGBA<uint8_t> colorData)
         : m_colorData(colorData)
     {
@@ -206,6 +207,7 @@
     static constexpr bool isInlineItem = true;
     static constexpr bool isDrawingItem = false;
 
+    SetInlineStrokeColor() = default;
     SetInlineStrokeColor(SRGBA<uint8_t> colorData)
         : m_colorData(colorData)
     {

Modified: trunk/Source/WebKit/CMakeLists.txt (283940 => 283941)


--- trunk/Source/WebKit/CMakeLists.txt	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/CMakeLists.txt	2021-10-11 22:37:04 UTC (rev 283941)
@@ -127,6 +127,7 @@
     GPUProcess/GPUConnectionToWebProcess
     GPUProcess/GPUProcess
 
+    GPUProcess/graphics/RemoteDisplayListRecorder
     GPUProcess/graphics/RemoteGraphicsContextGL
     GPUProcess/graphics/RemoteRenderingBackend
 

Modified: trunk/Source/WebKit/ChangeLog (283940 => 283941)


--- trunk/Source/WebKit/ChangeLog	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/ChangeLog	2021-10-11 22:37:04 UTC (rev 283941)
@@ -1,3 +1,215 @@
+2021-10-11  Wenson Hsieh  <[email protected]>
+
+        Introduce RemoteDisplayListRecorderProxy and RemoteDisplayListRecorder
+        https://bugs.webkit.org/show_bug.cgi?id=231484
+
+        Reviewed by Simon Fraser.
+
+        Introduce two new classes that house most of the logic for propagating display list items from the web content
+        process to the GPU process. RemoteDisplayListRecorderProxy is a subclass of DisplayList::Recorder that records
+        each item by sending it to the GPU process through a stream connection, which will be added to
+        RemoteRenderingBackendProxy in a subsequent patch. The RemoteDisplayListRecorderProxy will be managed by
+        RemoteImageBufferProxy in the web process. RemoteDisplayListRecorder acts as the streaming IPC destination in
+        the GPU process, and handles the incoming display list items by applying them to the platform graphics context.
+
+        For most of these display list items, we can propagate them to the GPU process by sending each display list
+        item's constructor arguments as separate IPC arguments. In a future patch, we should add support for encoding
+        the following display list items in the same way:
+
+        - SetInlineFillColor
+        - SetInlineStrokeColor
+        - SetState
+        - SetLineDash
+        - DrawGlyphs
+        - DrawLinesForText
+        - FillRectWithGradient
+
+        For now, the above display list items are encoded and decoded as whole items. While there's no practical
+        disadvantage to implementing it this way, it would be nice to make it consistent.
+
+        * CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * GPUProcess/graphics/RemoteDisplayListRecorder.cpp: Added.
+        (WebKit::RemoteDisplayListRecorder::RemoteDisplayListRecorder):
+        (WebKit::RemoteDisplayListRecorder::resourceCache):
+        (WebKit::RemoteDisplayListRecorder::drawingContext):
+        (WebKit::RemoteDisplayListRecorder::startListeningForIPC):
+        (WebKit::RemoteDisplayListRecorder::stopListeningForIPC):
+        (WebKit::RemoteDisplayListRecorder::save):
+        (WebKit::RemoteDisplayListRecorder::restore):
+        (WebKit::RemoteDisplayListRecorder::translate):
+        (WebKit::RemoteDisplayListRecorder::rotate):
+        (WebKit::RemoteDisplayListRecorder::scale):
+        (WebKit::RemoteDisplayListRecorder::setCTM):
+        (WebKit::RemoteDisplayListRecorder::concatenateCTM):
+        (WebKit::RemoteDisplayListRecorder::setInlineFillColor):
+        (WebKit::RemoteDisplayListRecorder::setInlineStrokeColor):
+        (WebKit::RemoteDisplayListRecorder::setStrokeThickness):
+        (WebKit::RemoteDisplayListRecorder::setState):
+        (WebKit::RemoteDisplayListRecorder::setLineCap):
+        (WebKit::RemoteDisplayListRecorder::setLineDash):
+        (WebKit::RemoteDisplayListRecorder::setLineJoin):
+        (WebKit::RemoteDisplayListRecorder::setMiterLimit):
+        (WebKit::RemoteDisplayListRecorder::clearShadow):
+        (WebKit::RemoteDisplayListRecorder::clip):
+        (WebKit::RemoteDisplayListRecorder::clipOut):
+        (WebKit::RemoteDisplayListRecorder::clipToImageBuffer):
+        (WebKit::RemoteDisplayListRecorder::clipOutToPath):
+        (WebKit::RemoteDisplayListRecorder::clipPath):
+        (WebKit::RemoteDisplayListRecorder::beginClipToDrawingCommands):
+        (WebKit::RemoteDisplayListRecorder::endClipToDrawingCommands):
+        (WebKit::RemoteDisplayListRecorder::drawGlyphs):
+        (WebKit::RemoteDisplayListRecorder::drawImageBuffer):
+        (WebKit::RemoteDisplayListRecorder::drawNativeImage):
+        (WebKit::RemoteDisplayListRecorder::drawPattern):
+        (WebKit::RemoteDisplayListRecorder::beginTransparencyLayer):
+        (WebKit::RemoteDisplayListRecorder::endTransparencyLayer):
+        (WebKit::RemoteDisplayListRecorder::drawRect):
+        (WebKit::RemoteDisplayListRecorder::drawLine):
+        (WebKit::RemoteDisplayListRecorder::drawLinesForText):
+        (WebKit::RemoteDisplayListRecorder::drawDotsForDocumentMarker):
+        (WebKit::RemoteDisplayListRecorder::drawEllipse):
+        (WebKit::RemoteDisplayListRecorder::drawPath):
+        (WebKit::RemoteDisplayListRecorder::drawFocusRingPath):
+        (WebKit::RemoteDisplayListRecorder::drawFocusRingRects):
+        (WebKit::RemoteDisplayListRecorder::fillRect):
+        (WebKit::RemoteDisplayListRecorder::fillRectWithColor):
+        (WebKit::RemoteDisplayListRecorder::fillRectWithGradient):
+        (WebKit::RemoteDisplayListRecorder::fillCompositedRect):
+        (WebKit::RemoteDisplayListRecorder::fillRoundedRect):
+        (WebKit::RemoteDisplayListRecorder::fillRectWithRoundedHole):
+        (WebKit::RemoteDisplayListRecorder::fillLine):
+        (WebKit::RemoteDisplayListRecorder::fillArc):
+        (WebKit::RemoteDisplayListRecorder::fillQuadCurve):
+        (WebKit::RemoteDisplayListRecorder::fillBezierCurve):
+        (WebKit::RemoteDisplayListRecorder::fillPath):
+        (WebKit::RemoteDisplayListRecorder::fillEllipse):
+        (WebKit::RemoteDisplayListRecorder::getPixelBuffer):
+        (WebKit::RemoteDisplayListRecorder::putPixelBuffer):
+        (WebKit::RemoteDisplayListRecorder::paintFrameForMedia):
+        (WebKit::RemoteDisplayListRecorder::strokeRect):
+        (WebKit::RemoteDisplayListRecorder::strokeLine):
+        (WebKit::RemoteDisplayListRecorder::strokeArc):
+        (WebKit::RemoteDisplayListRecorder::strokeQuadCurve):
+        (WebKit::RemoteDisplayListRecorder::strokeBezierCurve):
+        (WebKit::RemoteDisplayListRecorder::strokePath):
+        (WebKit::RemoteDisplayListRecorder::strokeEllipse):
+        (WebKit::RemoteDisplayListRecorder::clearRect):
+        (WebKit::RemoteDisplayListRecorder::applyStrokePattern):
+        (WebKit::RemoteDisplayListRecorder::applyFillPattern):
+        (WebKit::RemoteDisplayListRecorder::applyDeviceScaleFactor):
+        (WebKit::RemoteDisplayListRecorder::flushContext):
+        * GPUProcess/graphics/RemoteDisplayListRecorder.h: Added.
+        (WebKit::RemoteDisplayListRecorder::create):
+        (WebKit::RemoteDisplayListRecorder::handleItem):
+        * GPUProcess/graphics/RemoteDisplayListRecorder.messages.in: Added.
+        * GPUProcess/graphics/RemoteRenderingBackend.cpp:
+        (WebKit::RemoteRenderingBackend::performWithMediaPlayerOnMainThread):
+        * GPUProcess/graphics/RemoteRenderingBackend.h:
+
+        Add helper methods to RemoteRenderingBackend that are called from RemoteDisplayListRecorder.
+
+        * Scripts/webkit/messages.py:
+        (headers_for_type):
+        * Shared/WebCoreArgumentCoders.cpp:
+        * Shared/WebCoreArgumentCoders.h:
+
+        Make it possible to encode and decode SetInlineFillColor and SetInlineStrokeColor using simple argument coder.
+
+        * Sources.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp: Added.
+        (WebKit::RemoteDisplayListRecorderProxy::RemoteDisplayListRecorderProxy):
+        (WebKit::m_renderingBackend):
+        (WebKit::RemoteDisplayListRecorderProxy::getPixelBuffer):
+        (WebKit::RemoteDisplayListRecorderProxy::putPixelBuffer):
+        (WebKit::RemoteDisplayListRecorderProxy::canDrawImageBuffer const):
+        (WebKit::RemoteDisplayListRecorderProxy::renderingMode const):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSave):
+        (WebKit::RemoteDisplayListRecorderProxy::recordRestore):
+        (WebKit::RemoteDisplayListRecorderProxy::recordTranslate):
+        (WebKit::RemoteDisplayListRecorderProxy::recordRotate):
+        (WebKit::RemoteDisplayListRecorderProxy::recordScale):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSetCTM):
+        (WebKit::RemoteDisplayListRecorderProxy::recordConcatenateCTM):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSetInlineFillColor):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSetInlineStrokeColor):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSetStrokeThickness):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSetState):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSetLineCap):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSetLineDash):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSetLineJoin):
+        (WebKit::RemoteDisplayListRecorderProxy::recordSetMiterLimit):
+        (WebKit::RemoteDisplayListRecorderProxy::recordClearShadow):
+        (WebKit::RemoteDisplayListRecorderProxy::recordClip):
+        (WebKit::RemoteDisplayListRecorderProxy::recordClipOut):
+        (WebKit::RemoteDisplayListRecorderProxy::recordClipToImageBuffer):
+        (WebKit::RemoteDisplayListRecorderProxy::recordClipOutToPath):
+        (WebKit::RemoteDisplayListRecorderProxy::recordClipPath):
+        (WebKit::RemoteDisplayListRecorderProxy::recordBeginClipToDrawingCommands):
+        (WebKit::RemoteDisplayListRecorderProxy::recordEndClipToDrawingCommands):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawGlyphs):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawImageBuffer):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawNativeImage):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern):
+        (WebKit::RemoteDisplayListRecorderProxy::recordBeginTransparencyLayer):
+        (WebKit::RemoteDisplayListRecorderProxy::recordEndTransparencyLayer):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawRect):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawLine):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawLinesForText):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawDotsForDocumentMarker):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawEllipse):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawPath):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawFocusRingPath):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawFocusRingRects):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillRect):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillRectWithColor):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillRectWithGradient):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillCompositedRect):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillRoundedRect):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillRectWithRoundedHole):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillLine):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillArc):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillQuadCurve):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillBezierCurve):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillPath):
+        (WebKit::RemoteDisplayListRecorderProxy::recordFillEllipse):
+        (WebKit::RemoteDisplayListRecorderProxy::recordGetPixelBuffer):
+        (WebKit::RemoteDisplayListRecorderProxy::recordPutPixelBuffer):
+        (WebKit::RemoteDisplayListRecorderProxy::recordPaintFrameForMedia):
+        (WebKit::RemoteDisplayListRecorderProxy::recordStrokeRect):
+        (WebKit::RemoteDisplayListRecorderProxy::recordStrokeLine):
+        (WebKit::RemoteDisplayListRecorderProxy::recordStrokeArc):
+        (WebKit::RemoteDisplayListRecorderProxy::recordStrokeQuadCurve):
+        (WebKit::RemoteDisplayListRecorderProxy::recordStrokeBezierCurve):
+        (WebKit::RemoteDisplayListRecorderProxy::recordStrokePath):
+        (WebKit::RemoteDisplayListRecorderProxy::recordStrokeEllipse):
+        (WebKit::RemoteDisplayListRecorderProxy::recordClearRect):
+        (WebKit::RemoteDisplayListRecorderProxy::recordApplyStrokePattern):
+        (WebKit::RemoteDisplayListRecorderProxy::recordApplyFillPattern):
+        (WebKit::RemoteDisplayListRecorderProxy::recordApplyDeviceScaleFactor):
+        (WebKit::RemoteDisplayListRecorderProxy::recordResourceUse):
+        (WebKit::RemoteDisplayListRecorderProxy::flushContext):
+        (WebKit::RemoteDisplayListRecorderProxy::createNestedContext):
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h: Added.
+        (WebKit::RemoteDisplayListRecorderProxy::~RemoteDisplayListRecorderProxy):
+        (WebKit::RemoteDisplayListRecorderProxy::resetNeedsFlush):
+        (WebKit::RemoteDisplayListRecorderProxy::needsFlush const):
+        (WebKit::RemoteDisplayListRecorderProxy::send):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawPattern):
+        * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
+        (WebKit::RemoteRenderingBackendProxy::recordNativeImageUse):
+        (WebKit::RemoteRenderingBackendProxy::recordFontUse):
+        (WebKit::RemoteRenderingBackendProxy::recordImageBufferUse):
+        (WebKit::RemoteRenderingBackendProxy::isCached const):
+
+        Add helper methods to RemoteRenderingBackendProxy that are called from RemoteDisplayListRecorderProxy.
+
+        * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
+        (WebKit::RemoteRenderingBackendProxy::sendToStream):
+
 2021-10-11  Dean Jackson  <[email protected]>
 
         Disable SystemPreview in WKContentProviderRegistry

Modified: trunk/Source/WebKit/DerivedSources-input.xcfilelist (283940 => 283941)


--- trunk/Source/WebKit/DerivedSources-input.xcfilelist	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/DerivedSources-input.xcfilelist	2021-10-11 22:37:04 UTC (rev 283941)
@@ -20,6 +20,8 @@
 $(_javascript_CORE_PRIVATE_HEADERS_DIR)/xxd.pl
 $(PROJECT_DIR)/GPUProcess/GPUConnectionToWebProcess.messages.in
 $(PROJECT_DIR)/GPUProcess/GPUProcess.messages.in
+$(PROJECT_DIR)/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in
+$(PROJECT_DIR)/GPUProcess/graphics/RemoteGraphicsContext.messages.in
 $(PROJECT_DIR)/GPUProcess/graphics/RemoteGraphicsContextGL.messages.in
 $(PROJECT_DIR)/GPUProcess/graphics/RemoteRenderingBackend.messages.in
 $(PROJECT_DIR)/GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in

Modified: trunk/Source/WebKit/DerivedSources-output.xcfilelist (283940 => 283941)


--- trunk/Source/WebKit/DerivedSources-output.xcfilelist	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/DerivedSources-output.xcfilelist	2021-10-11 22:37:04 UTC (rev 283941)
@@ -203,6 +203,9 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteCaptureSampleManagerMessageReceiver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteCaptureSampleManagerMessages.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteCaptureSampleManagerMessagesReplies.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteDisplayListRecorderMessageReceiver.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteDisplayListRecorderMessages.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteDisplayListRecorderMessagesReplies.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteGraphicsContextGLMessageReceiver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteGraphicsContextGLMessages.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteGraphicsContextGLMessagesReplies.h
@@ -209,6 +212,9 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteGraphicsContextGLProxyMessageReceiver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteGraphicsContextGLProxyMessages.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteGraphicsContextGLProxyMessagesReplies.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteGraphicsContextMessageReceiver.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteGraphicsContextMessages.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteGraphicsContextMessagesReplies.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteImageDecoderAVFManagerMessageReceiver.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteImageDecoderAVFManagerMessages.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebKit2/RemoteImageDecoderAVFManagerMessagesReplies.h

Modified: trunk/Source/WebKit/DerivedSources.make (283940 => 283941)


--- trunk/Source/WebKit/DerivedSources.make	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/DerivedSources.make	2021-10-11 22:37:04 UTC (rev 283941)
@@ -247,6 +247,7 @@
 	PluginProcess/PluginControllerProxy \
 	PluginProcess/PluginProcess \
 	GPUProcess/GPUConnectionToWebProcess \
+	GPUProcess/graphics/RemoteDisplayListRecorder \
 	GPUProcess/graphics/RemoteRenderingBackend \
 	GPUProcess/graphics/RemoteGraphicsContextGL \
 	GPUProcess/webrtc/LibWebRTCCodecsProxy \

Added: trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp (0 => 283941)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp	                        (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.cpp	2021-10-11 22:37:04 UTC (rev 283941)
@@ -0,0 +1,465 @@
+/*
+ * 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 "RemoteDisplayListRecorder.h"
+
+#if ENABLE(GPU_PROCESS)
+
+#include "RemoteDisplayListRecorderMessages.h"
+
+namespace WebKit {
+using namespace WebCore;
+
+RemoteDisplayListRecorder::RemoteDisplayListRecorder(ImageBuffer& imageBuffer, QualifiedRenderingResourceIdentifier imageBufferIdentifier, RemoteRenderingBackend& renderingBackend)
+    : m_imageBuffer(imageBuffer)
+    , m_imageBufferIdentifier(imageBufferIdentifier)
+    , m_renderingBackend(renderingBackend)
+{
+}
+
+RemoteResourceCache& RemoteDisplayListRecorder::resourceCache()
+{
+    return m_renderingBackend->remoteResourceCache();
+}
+
+GraphicsContext& RemoteDisplayListRecorder::drawingContext()
+{
+    return m_maskImageBuffer ? m_maskImageBuffer->context() : m_imageBuffer->context();
+}
+
+void RemoteDisplayListRecorder::startListeningForIPC()
+{
+    ASSERT(!m_isListeningForIPC);
+    m_isListeningForIPC = true;
+    // FIXME: Not implemented yet.
+}
+
+void RemoteDisplayListRecorder::stopListeningForIPC()
+{
+    if (!m_isListeningForIPC)
+        return;
+
+    // FIXME: Not implemented yet.
+    m_isListeningForIPC = false;
+}
+
+void RemoteDisplayListRecorder::save()
+{
+    handleItem(DisplayList::Save());
+}
+
+void RemoteDisplayListRecorder::restore()
+{
+    handleItem(DisplayList::Restore());
+}
+
+void RemoteDisplayListRecorder::translate(float x, float y)
+{
+    handleItem(DisplayList::Translate(x, y));
+}
+
+void RemoteDisplayListRecorder::rotate(float angle)
+{
+    handleItem(DisplayList::Rotate(angle));
+}
+
+void RemoteDisplayListRecorder::scale(const FloatSize& scale)
+{
+    handleItem(DisplayList::Scale(scale));
+}
+
+void RemoteDisplayListRecorder::setCTM(const AffineTransform& ctm)
+{
+    handleItem(DisplayList::SetCTM(ctm));
+}
+
+void RemoteDisplayListRecorder::concatenateCTM(const AffineTransform& ctm)
+{
+    handleItem(DisplayList::ConcatenateCTM(ctm));
+}
+
+void RemoteDisplayListRecorder::setInlineFillColor(DisplayList::SetInlineFillColor&& item)
+{
+    handleItem(WTFMove(item));
+}
+
+void RemoteDisplayListRecorder::setInlineStrokeColor(DisplayList::SetInlineStrokeColor&& item)
+{
+    handleItem(WTFMove(item));
+}
+
+void RemoteDisplayListRecorder::setStrokeThickness(float thickness)
+{
+    handleItem(DisplayList::SetStrokeThickness(thickness));
+}
+
+void RemoteDisplayListRecorder::setState(DisplayList::SetState&& item)
+{
+    auto strokePatternImageIdentifier = item.strokePatternImageIdentifier();
+    RefPtr<NativeImage> strokePatternImage;
+    if (strokePatternImageIdentifier)
+        strokePatternImage = resourceCache().cachedNativeImage(strokePatternImageIdentifier);
+
+    auto fillPatternImageIdentifier = item.fillPatternImageIdentifier();
+    RefPtr<NativeImage> fillPatternImage;
+    if (fillPatternImageIdentifier)
+        fillPatternImage = resourceCache().cachedNativeImage(fillPatternImageIdentifier);
+
+    handleItem(WTFMove(item), strokePatternImage.get(), fillPatternImage.get());
+
+    if (strokePatternImage)
+        resourceCache().recordResourceUse(strokePatternImageIdentifier);
+
+    if (fillPatternImage)
+        resourceCache().recordResourceUse(fillPatternImageIdentifier);
+}
+
+void RemoteDisplayListRecorder::setLineCap(LineCap lineCap)
+{
+    handleItem(DisplayList::SetLineCap(lineCap));
+}
+
+void RemoteDisplayListRecorder::setLineDash(DisplayList::SetLineDash&& item)
+{
+    handleItem(WTFMove(item));
+}
+
+void RemoteDisplayListRecorder::setLineJoin(LineJoin lineJoin)
+{
+    handleItem(DisplayList::SetLineJoin(lineJoin));
+}
+
+void RemoteDisplayListRecorder::setMiterLimit(float limit)
+{
+    handleItem(DisplayList::SetMiterLimit(limit));
+}
+
+void RemoteDisplayListRecorder::clearShadow()
+{
+    handleItem(DisplayList::ClearShadow());
+}
+
+void RemoteDisplayListRecorder::clip(const FloatRect& rect)
+{
+    handleItem(DisplayList::Clip(rect));
+}
+
+void RemoteDisplayListRecorder::clipOut(const FloatRect& rect)
+{
+    handleItem(DisplayList::ClipOut(rect));
+}
+
+void RemoteDisplayListRecorder::clipToImageBuffer(WebCore::RenderingResourceIdentifier imageBufferIdentifier, const WebCore::FloatRect& destinationRect)
+{
+    RefPtr imageBuffer = resourceCache().cachedImageBuffer(imageBufferIdentifier);
+    if (!imageBuffer) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    handleItem(DisplayList::ClipToImageBuffer(imageBufferIdentifier, destinationRect), *imageBuffer);
+    resourceCache().recordResourceUse(imageBufferIdentifier);
+}
+
+void RemoteDisplayListRecorder::clipOutToPath(const Path& path)
+{
+    handleItem(DisplayList::ClipOutToPath(path));
+}
+
+void RemoteDisplayListRecorder::clipPath(const Path& path, WindRule rule)
+{
+    handleItem(DisplayList::ClipPath(path, rule));
+}
+
+void RemoteDisplayListRecorder::beginClipToDrawingCommands(const FloatRect& destination, const DestinationColorSpace& colorSpace)
+{
+    m_maskImageBuffer = ImageBuffer::createCompatibleBuffer(destination.size(), colorSpace, drawingContext());
+}
+
+void RemoteDisplayListRecorder::endClipToDrawingCommands(const FloatRect& destination)
+{
+    auto maskImageBuffer = std::exchange(m_maskImageBuffer, { });
+    if (!maskImageBuffer) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    drawingContext().clipToImageBuffer(*maskImageBuffer, destination);
+}
+
+void RemoteDisplayListRecorder::drawGlyphs(DisplayList::DrawGlyphs&& item)
+{
+    auto fontIdentifier = item.fontIdentifier();
+    RefPtr font = resourceCache().cachedFont(fontIdentifier);
+    if (!font) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    handleItem(WTFMove(item), *font);
+    resourceCache().recordResourceUse(fontIdentifier);
+}
+
+void RemoteDisplayListRecorder::drawImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destinationRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
+{
+    RefPtr imageBuffer = resourceCache().cachedImageBuffer(imageBufferIdentifier);
+    if (!imageBuffer) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    handleItem(DisplayList::DrawImageBuffer(imageBufferIdentifier, destinationRect, srcRect, options), *imageBuffer);
+    resourceCache().recordResourceUse(imageBufferIdentifier);
+}
+
+void RemoteDisplayListRecorder::drawNativeImage(RenderingResourceIdentifier imageIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
+{
+    RefPtr image = resourceCache().cachedNativeImage(imageIdentifier);
+    if (!image) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    handleItem(DisplayList::DrawNativeImage(imageIdentifier, imageSize, destRect, srcRect, options), *image);
+    resourceCache().recordResourceUse(imageIdentifier);
+}
+
+void RemoteDisplayListRecorder::drawPattern(RenderingResourceIdentifier imageIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& transform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
+{
+    RefPtr image = resourceCache().cachedNativeImage(imageIdentifier);
+    if (!image) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    handleItem(DisplayList::DrawPattern(imageIdentifier, imageSize, destRect, tileRect, transform, phase, spacing, options), *image);
+    resourceCache().recordResourceUse(imageIdentifier);
+}
+
+void RemoteDisplayListRecorder::beginTransparencyLayer(float opacity)
+{
+    handleItem(DisplayList::BeginTransparencyLayer(opacity));
+}
+
+void RemoteDisplayListRecorder::endTransparencyLayer()
+{
+    handleItem(DisplayList::EndTransparencyLayer());
+}
+
+void RemoteDisplayListRecorder::drawRect(const FloatRect& rect, float borderThickness)
+{
+    handleItem(DisplayList::DrawRect(rect, borderThickness));
+}
+
+void RemoteDisplayListRecorder::drawLine(const FloatPoint& point1, const FloatPoint& point2)
+{
+    handleItem(DisplayList::DrawLine(point1, point2));
+}
+
+void RemoteDisplayListRecorder::drawLinesForText(DisplayList::DrawLinesForText&& item)
+{
+    handleItem(WTFMove(item));
+}
+
+void RemoteDisplayListRecorder::drawDotsForDocumentMarker(const FloatRect& rect, const DocumentMarkerLineStyle& style)
+{
+    handleItem(DisplayList::DrawDotsForDocumentMarker(rect, style));
+}
+
+void RemoteDisplayListRecorder::drawEllipse(const FloatRect& rect)
+{
+    handleItem(DisplayList::DrawEllipse(rect));
+}
+
+void RemoteDisplayListRecorder::drawPath(const Path& path)
+{
+    handleItem(DisplayList::DrawPath(path));
+}
+
+void RemoteDisplayListRecorder::drawFocusRingPath(const Path& path, float width, float offset, const Color& color)
+{
+    handleItem(DisplayList::DrawFocusRingPath(path, width, offset, color));
+}
+
+void RemoteDisplayListRecorder::drawFocusRingRects(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
+{
+    handleItem(DisplayList::DrawFocusRingRects(rects, width, offset, color));
+}
+
+void RemoteDisplayListRecorder::fillRect(const FloatRect& rect)
+{
+    handleItem(DisplayList::FillRect(rect));
+}
+
+void RemoteDisplayListRecorder::fillRectWithColor(const FloatRect& rect, const Color& color)
+{
+    handleItem(DisplayList::FillRectWithColor(rect, color));
+}
+
+void RemoteDisplayListRecorder::fillRectWithGradient(DisplayList::FillRectWithGradient&& item)
+{
+    handleItem(WTFMove(item));
+}
+
+void RemoteDisplayListRecorder::fillCompositedRect(const FloatRect& rect, const Color& color, CompositeOperator op, BlendMode blendMode)
+{
+    handleItem(DisplayList::FillCompositedRect(rect, color, op, blendMode));
+}
+
+void RemoteDisplayListRecorder::fillRoundedRect(const FloatRoundedRect& rect, const Color& color, BlendMode blendMode)
+{
+    handleItem(DisplayList::FillRoundedRect(rect, color, blendMode));
+}
+
+void RemoteDisplayListRecorder::fillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedHoleRect, const Color& color)
+{
+    handleItem(DisplayList::FillRectWithRoundedHole(rect, roundedHoleRect, color));
+}
+
+#if ENABLE(INLINE_PATH_DATA)
+
+void RemoteDisplayListRecorder::fillLine(const LineData& data)
+{
+    handleItem(DisplayList::FillLine(data));
+}
+
+void RemoteDisplayListRecorder::fillArc(const ArcData& data)
+{
+    handleItem(DisplayList::FillArc(data));
+}
+
+void RemoteDisplayListRecorder::fillQuadCurve(const QuadCurveData& data)
+{
+    handleItem(DisplayList::FillQuadCurve(data));
+}
+
+void RemoteDisplayListRecorder::fillBezierCurve(const BezierCurveData& data)
+{
+    handleItem(DisplayList::FillBezierCurve(data));
+}
+
+#endif // ENABLE(INLINE_PATH_DATA)
+
+void RemoteDisplayListRecorder::fillPath(const Path& path)
+{
+    handleItem(DisplayList::FillPath(path));
+}
+
+void RemoteDisplayListRecorder::fillEllipse(const FloatRect& rect)
+{
+    handleItem(DisplayList::FillEllipse(rect));
+}
+
+void RemoteDisplayListRecorder::getPixelBuffer(const IntRect& srcRect, const PixelBufferFormat& outputFormat)
+{
+    m_renderingBackend->populateGetPixelBufferSharedMemory(m_imageBuffer->getPixelBuffer(outputFormat, srcRect));
+}
+
+void RemoteDisplayListRecorder::putPixelBuffer(const IntRect& srcRect, const IntPoint& destPoint, const PixelBuffer& pixelBuffer, AlphaPremultiplication destFormat)
+{
+    m_imageBuffer->putPixelBuffer(pixelBuffer, srcRect, destPoint, destFormat);
+}
+
+void RemoteDisplayListRecorder::paintFrameForMedia(MediaPlayerIdentifier identifier, const FloatRect& destination)
+{
+    m_renderingBackend->performWithMediaPlayerOnMainThread(identifier, [imageBuffer = m_imageBuffer.copyRef(), destination](MediaPlayer& player) {
+        // It is currently not safe to call paintFrameForMedia() off the main thread.
+        imageBuffer->context().paintFrameForMedia(player, destination);
+    });
+}
+
+void RemoteDisplayListRecorder::strokeRect(const FloatRect& rect, float lineWidth)
+{
+    handleItem(DisplayList::StrokeRect(rect, lineWidth));
+}
+
+#if ENABLE(INLINE_PATH_DATA)
+
+void RemoteDisplayListRecorder::strokeLine(const LineData& data)
+{
+    handleItem(DisplayList::StrokeLine(data));
+}
+
+void RemoteDisplayListRecorder::strokeArc(const ArcData& data)
+{
+    handleItem(DisplayList::StrokeArc(data));
+}
+
+void RemoteDisplayListRecorder::strokeQuadCurve(const QuadCurveData& data)
+{
+    handleItem(DisplayList::StrokeQuadCurve(data));
+}
+
+void RemoteDisplayListRecorder::strokeBezierCurve(const BezierCurveData& data)
+{
+    handleItem(DisplayList::StrokeBezierCurve(data));
+}
+
+#endif // ENABLE(INLINE_PATH_DATA)
+
+void RemoteDisplayListRecorder::strokePath(const Path& path)
+{
+    handleItem(DisplayList::StrokePath(path));
+}
+
+void RemoteDisplayListRecorder::strokeEllipse(const FloatRect& rect)
+{
+    handleItem(DisplayList::StrokeEllipse(rect));
+}
+
+void RemoteDisplayListRecorder::clearRect(const FloatRect& rect)
+{
+    handleItem(DisplayList::ClearRect(rect));
+}
+
+#if USE(CG)
+
+void RemoteDisplayListRecorder::applyStrokePattern()
+{
+    handleItem(DisplayList::ApplyStrokePattern());
+}
+
+void RemoteDisplayListRecorder::applyFillPattern()
+{
+    handleItem(DisplayList::ApplyFillPattern());
+}
+
+#endif // USE(CG)
+
+void RemoteDisplayListRecorder::applyDeviceScaleFactor(float scaleFactor)
+{
+    handleItem(DisplayList::ApplyDeviceScaleFactor(scaleFactor));
+}
+
+void RemoteDisplayListRecorder::flushContext(GraphicsContextFlushIdentifier identifier)
+{
+    m_imageBuffer->flushContext();
+    m_renderingBackend->didFlush(identifier, m_imageBufferIdentifier);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)

Added: trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h (0 => 283941)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h	                        (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.h	2021-10-11 22:37:04 UTC (rev 283941)
@@ -0,0 +1,153 @@
+/*
+ * 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(GPU_PROCESS)
+
+#include "Decoder.h"
+#include "QualifiedRenderingResourceIdentifier.h"
+#include "RemoteRenderingBackend.h"
+#include "StreamMessageReceiver.h"
+#include "StreamServerConnection.h"
+#include <WebCore/DisplayListItems.h>
+#include <wtf/RefCounted.h>
+#include <wtf/WeakPtr.h>
+
+namespace WebKit {
+
+class RemoteRenderingBackend;
+class RemoteResourceCache;
+
+class RemoteDisplayListRecorder : public IPC::StreamMessageReceiver, public CanMakeWeakPtr<RemoteDisplayListRecorder> {
+public:
+    static Ref<RemoteDisplayListRecorder> create(WebCore::ImageBuffer& imageBuffer, QualifiedRenderingResourceIdentifier imageBufferIdentifier, RemoteRenderingBackend& renderingBackend)
+    {
+        auto instance = adoptRef(*new RemoteDisplayListRecorder(imageBuffer, imageBufferIdentifier, renderingBackend));
+        instance->startListeningForIPC();
+        return instance;
+    }
+
+    void stopListeningForIPC();
+
+    void save();
+    void restore();
+    void translate(float x, float y);
+    void rotate(float angle);
+    void scale(const WebCore::FloatSize& scale);
+    void setCTM(const WebCore::AffineTransform&);
+    void concatenateCTM(const WebCore::AffineTransform&);
+    void setInlineFillColor(WebCore::DisplayList::SetInlineFillColor&&);
+    void setInlineStrokeColor(WebCore::DisplayList::SetInlineStrokeColor&&);
+    void setStrokeThickness(float);
+    void setState(WebCore::DisplayList::SetState&&);
+    void setLineCap(WebCore::LineCap);
+    void setLineDash(WebCore::DisplayList::SetLineDash&&);
+    void setLineJoin(WebCore::LineJoin);
+    void setMiterLimit(float);
+    void clearShadow();
+    void clip(const WebCore::FloatRect&);
+    void clipOut(const WebCore::FloatRect&);
+    void clipToImageBuffer(WebCore::RenderingResourceIdentifier, const WebCore::FloatRect& destinationRect);
+    void clipOutToPath(const WebCore::Path&);
+    void clipPath(const WebCore::Path&, WebCore::WindRule);
+    void beginClipToDrawingCommands(const WebCore::FloatRect& destination, const WebCore::DestinationColorSpace&);
+    void endClipToDrawingCommands(const WebCore::FloatRect& destination);
+    void drawGlyphs(WebCore::DisplayList::DrawGlyphs&&);
+    void drawImageBuffer(WebCore::RenderingResourceIdentifier imageBufferIdentifier, const WebCore::FloatRect& destinationRect, const WebCore::FloatRect& srcRect, const WebCore::ImagePaintingOptions&);
+    void drawNativeImage(WebCore::RenderingResourceIdentifier imageIdentifier, const WebCore::FloatSize& imageSize, const WebCore::FloatRect& destRect, const WebCore::FloatRect& srcRect, const WebCore::ImagePaintingOptions&);
+    void drawPattern(WebCore::RenderingResourceIdentifier imageIdentifier, const WebCore::FloatSize& imageSize, const WebCore::FloatRect& destRect, const WebCore::FloatRect& tileRect, const WebCore::AffineTransform&, const WebCore::FloatPoint&, const WebCore::FloatSize& spacing, const WebCore::ImagePaintingOptions&);
+    void beginTransparencyLayer(float opacity);
+    void endTransparencyLayer();
+    void drawRect(const WebCore::FloatRect&, float borderThickness);
+    void drawLine(const WebCore::FloatPoint& point1, const WebCore::FloatPoint& point2);
+    void drawLinesForText(WebCore::DisplayList::DrawLinesForText&&);
+    void drawDotsForDocumentMarker(const WebCore::FloatRect&, const WebCore::DocumentMarkerLineStyle&);
+    void drawEllipse(const WebCore::FloatRect&);
+    void drawPath(const WebCore::Path&);
+    void drawFocusRingPath(const WebCore::Path&, float width, float offset, const WebCore::Color&);
+    void drawFocusRingRects(const Vector<WebCore::FloatRect>& rects, float width, float offset, const WebCore::Color&);
+    void fillRect(const WebCore::FloatRect&);
+    void fillRectWithColor(const WebCore::FloatRect&, const WebCore::Color&);
+    void fillRectWithGradient(WebCore::DisplayList::FillRectWithGradient&&);
+    void fillCompositedRect(const WebCore::FloatRect&, const WebCore::Color&, WebCore::CompositeOperator, WebCore::BlendMode);
+    void fillRoundedRect(const WebCore::FloatRoundedRect&, const WebCore::Color&, WebCore::BlendMode);
+    void fillRectWithRoundedHole(const WebCore::FloatRect&, const WebCore::FloatRoundedRect&, const WebCore::Color&);
+#if ENABLE(INLINE_PATH_DATA)
+    void fillLine(const WebCore::LineData&);
+    void fillArc(const WebCore::ArcData&);
+    void fillQuadCurve(const WebCore::QuadCurveData&);
+    void fillBezierCurve(const WebCore::BezierCurveData&);
+#endif
+    void fillPath(const WebCore::Path&);
+    void fillEllipse(const WebCore::FloatRect&);
+    void getPixelBuffer(const WebCore::IntRect& srcRect, const WebCore::PixelBufferFormat& outputFormat);
+    void putPixelBuffer(const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, const WebCore::PixelBuffer&, WebCore::AlphaPremultiplication destFormat);
+    void paintFrameForMedia(WebCore::MediaPlayerIdentifier, const WebCore::FloatRect& destination);
+    void strokeRect(const WebCore::FloatRect&, float lineWidth);
+#if ENABLE(INLINE_PATH_DATA)
+    void strokeLine(const WebCore::LineData&);
+    void strokeArc(const WebCore::ArcData&);
+    void strokeQuadCurve(const WebCore::QuadCurveData&);
+    void strokeBezierCurve(const WebCore::BezierCurveData&);
+#endif
+    void strokePath(const WebCore::Path&);
+    void strokeEllipse(const WebCore::FloatRect&);
+    void clearRect(const WebCore::FloatRect&);
+#if USE(CG)
+    void applyStrokePattern();
+    void applyFillPattern();
+#endif
+    void applyDeviceScaleFactor(float);
+    void flushContext(WebCore::GraphicsContextFlushIdentifier);
+
+private:
+    RemoteDisplayListRecorder(WebCore::ImageBuffer&, QualifiedRenderingResourceIdentifier, RemoteRenderingBackend&);
+
+    RemoteResourceCache& resourceCache();
+    WebCore::GraphicsContext& drawingContext();
+
+    template<typename T, typename ... AdditionalArgs>
+    void handleItem(T&& item, AdditionalArgs&& ... args)
+    {
+        // FIXME: In the future, we should consider buffering up batches of display list items before
+        // applying them instead of applying them immediately, so that we can apply clipping and occlusion
+        // optimizations to skip over parts of a display list, if possible.
+        item.apply(drawingContext(), args...);
+    }
+
+    void startListeningForIPC();
+    void didReceiveStreamMessage(IPC::StreamServerConnectionBase&, IPC::Decoder&) final;
+
+    Ref<WebCore::ImageBuffer> m_imageBuffer;
+    QualifiedRenderingResourceIdentifier m_imageBufferIdentifier;
+    Ref<RemoteRenderingBackend> m_renderingBackend;
+    RefPtr<WebCore::ImageBuffer> m_maskImageBuffer;
+    bool m_isListeningForIPC { false };
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)

Added: trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in (0 => 283941)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in	                        (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteDisplayListRecorder.messages.in	2021-10-11 22:37:04 UTC (rev 283941)
@@ -0,0 +1,98 @@
+# 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.
+
+#if ENABLE(GPU_PROCESS)
+
+messages -> RemoteDisplayListRecorder NotRefCounted Stream {
+    Save()
+    Restore()
+    Translate(float x, float y)
+    Rotate(float angle)
+    Scale(WebCore::FloatSize scale)
+    SetCTM(WebCore::AffineTransform ctm)
+    ConcatenateCTM(WebCore::AffineTransform ctm)
+    SetInlineFillColor(WebCore::DisplayList::SetInlineFillColor item)
+    SetInlineStrokeColor(WebCore::DisplayList::SetInlineStrokeColor item)
+    SetStrokeThickness(float thickness)
+    SetState(WebCore::DisplayList::SetState item)
+    SetLineCap(enum:uint8_t WebCore::LineCap lineCap)
+    SetLineDash(WebCore::DisplayList::SetLineDash item)
+    SetLineJoin(enum:uint8_t WebCore::LineJoin lineJoin)
+    SetMiterLimit(float limit)
+    ClearShadow()
+    Clip(WebCore::FloatRect rect)
+    ClipOut(WebCore::FloatRect rect)
+    ClipToImageBuffer(WebCore::RenderingResourceIdentifier renderingResourceIdentifier, WebCore::FloatRect destinationRect)
+    ClipOutToPath(WebCore::Path path)
+    ClipPath(WebCore::Path path, enum:uint8_t WebCore::WindRule windRule)
+    BeginClipToDrawingCommands(WebCore::FloatRect destination, WebCore::DestinationColorSpace colorSpace)
+    EndClipToDrawingCommands(WebCore::FloatRect destination)
+    DrawGlyphs(WebCore::DisplayList::DrawGlyphs item)
+    DrawImageBuffer(WebCore::RenderingResourceIdentifier imageBufferIdentifier, WebCore::FloatRect destinationRect, WebCore::FloatRect srcRect, struct WebCore::ImagePaintingOptions options)
+    DrawNativeImage(WebCore::RenderingResourceIdentifier imageIdentifier, WebCore::FloatSize imageSize, WebCore::FloatRect destRect, WebCore::FloatRect srcRect, struct WebCore::ImagePaintingOptions options)
+    DrawPattern(WebCore::RenderingResourceIdentifier imageIdentifier, WebCore::FloatSize imageSize, WebCore::FloatRect destRect, WebCore::FloatRect tileRect, WebCore::AffineTransform transform, WebCore::FloatPoint phase, WebCore::FloatSize spacing, struct WebCore::ImagePaintingOptions options)
+    BeginTransparencyLayer(float opacity)
+    EndTransparencyLayer()
+    DrawRect(WebCore::FloatRect rect, float borderThickness)
+    DrawLine(WebCore::FloatPoint point1, WebCore::FloatPoint point2)
+    DrawLinesForText(WebCore::DisplayList::DrawLinesForText item)
+    DrawDotsForDocumentMarker(WebCore::FloatRect rect, struct WebCore::DocumentMarkerLineStyle style)
+    DrawEllipse(WebCore::FloatRect rect)
+    DrawPath(WebCore::Path path)
+    DrawFocusRingPath(WebCore::Path path, float width, float offset, WebCore::Color color)
+    DrawFocusRingRects(Vector<WebCore::FloatRect> rects, float width, float offset, WebCore::Color color)
+    FillRect(WebCore::FloatRect rect)
+    FillRectWithColor(WebCore::FloatRect rect, WebCore::Color color)
+    FillRectWithGradient(WebCore::DisplayList::FillRectWithGradient item)
+    FillCompositedRect(WebCore::FloatRect rect, WebCore::Color color, enum:uint8_t WebCore::CompositeOperator op, enum:uint8_t WebCore::BlendMode blendMode)
+    FillRoundedRect(WebCore::FloatRoundedRect rect, WebCore::Color color, enum:uint8_t WebCore::BlendMode blendMode)
+    FillRectWithRoundedHole(WebCore::FloatRect rect, WebCore::FloatRoundedRect roundedHoleRect, WebCore::Color color)
+#if ENABLE(INLINE_PATH_DATA)
+    FillLine(struct WebCore::LineData data)
+    FillArc(struct WebCore::ArcData data)
+    FillQuadCurve(struct WebCore::QuadCurveData data)
+    FillBezierCurve(struct WebCore::BezierCurveData data)
+#endif
+    FillPath(WebCore::Path path)
+    FillEllipse(WebCore::FloatRect rect)
+    GetPixelBuffer(WebCore::IntRect srcRect, struct WebCore::PixelBufferFormat outputFormat)
+    PutPixelBuffer(WebCore::IntRect srcRect, WebCore::IntPoint destPoint, WebCore::PixelBuffer pixelBuffer, enum:uint8_t WebCore::AlphaPremultiplication destFormat)
+    PaintFrameForMedia(WebCore::MediaPlayerIdentifier identifier, WebCore::FloatRect destination)
+    StrokeRect(WebCore::FloatRect rect, float lineWidth)
+#if ENABLE(INLINE_PATH_DATA)
+    StrokeLine(struct WebCore::LineData data)
+    StrokeArc(struct WebCore::ArcData data)
+    StrokeQuadCurve(struct WebCore::QuadCurveData data)
+    StrokeBezierCurve(struct WebCore::BezierCurveData data)
+#endif
+    StrokePath(WebCore::Path path)
+    StrokeEllipse(WebCore::FloatRect rect)
+    ClearRect(WebCore::FloatRect rect)
+#if USE(CG)
+    ApplyStrokePattern()
+    ApplyFillPattern()
+#endif
+    ApplyDeviceScaleFactor(float scaleFactor)
+    FlushContext(WebCore::GraphicsContextFlushIdentifier identifier)
+}
+
+#endif // ENABLE(GPU_PROCESS)

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (283940 => 283941)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2021-10-11 22:37:04 UTC (rev 283941)
@@ -783,6 +783,14 @@
     m_lastKnownState.storeRelaxed(state);
 }
 
+void RemoteRenderingBackend::performWithMediaPlayerOnMainThread(MediaPlayerIdentifier identifier, Function<void(MediaPlayer&)>&& callback)
+{
+    callOnMainRunLoopAndWait([&, gpuConnectionToWebProcess = m_gpuConnectionToWebProcess, identifier] {
+        if (auto player = gpuConnectionToWebProcess->remoteMediaPlayerManagerProxy().mediaPlayer(identifier))
+            callback(*player);
+    });
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(GPU_PROCESS)

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h (283940 => 283941)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h	2021-10-11 22:37:04 UTC (rev 283941)
@@ -99,6 +99,8 @@
 
     RemoteRenderingBackendState lastKnownState() const;
 
+    void performWithMediaPlayerOnMainThread(WebCore::MediaPlayerIdentifier, Function<void(WebCore::MediaPlayer&)>&&);
+
 private:
     RemoteRenderingBackend(GPUConnectionToWebProcess&, RemoteRenderingBackendCreationParameters&&);
     void startListeningForIPC();

Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (283940 => 283941)


--- trunk/Source/WebKit/Scripts/webkit/messages.py	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py	2021-10-11 22:37:04 UTC (rev 283941)
@@ -691,13 +691,18 @@
         'WallTime': ['<wtf/WallTime.h>'],
         'String': ['<wtf/text/WTFString.h>'],
         'PAL::SessionID': ['<pal/SessionID.h>'],
+        'WebCore::ArcData': ['<WebCore/InlinePathData.h>'],
         'WebCore::AutoplayEventFlags': ['<WebCore/AutoplayEvent.h>'],
+        'WebCore::BezierCurveData': ['<WebCore/InlinePathData.h>'],
+        'WebCore::BlendMode': ['<WebCore/GraphicsTypes.h>'],
         'WebCore::BrowsingContextGroupSwitchDecision': ['<WebCore/FrameLoaderTypes.h>'],
         'WebCore::COEPDisposition': ['<WebCore/CrossOriginEmbedderPolicy.h>'],
         'WebCore::COOPDisposition': ['<WebCore/CrossOriginOpenerPolicy.h>'],
+        'WebCore::CompositeOperator': ['<WebCore/GraphicsTypes.h>'],
         'WebCore::CreateNewGroupForHighlight': ['<WebCore/AppHighlight.h>'],
         'WebCore::DOMPasteAccessResponse': ['<WebCore/DOMPasteAccess.h>'],
         'WebCore::DestinationColorSpace': ['<WebCore/ColorSpace.h>'],
+        'WebCore::DocumentMarkerLineStyle': ['<WebCore/GraphicsTypes.h>'],
         'WebCore::DocumentOrWorkerIdentifier': ['<WebCore/ServiceWorkerTypes.h>'],
         'WebCore::DragApplicationFlags': ['<WebCore/DragData.h>'],
         'WebCore::DragHandlingMethod': ['<WebCore/DragActions.h>'],
@@ -708,6 +713,7 @@
         'WebCore::FileChooserSettings': ['<WebCore/FileChooser.h>'],
         'WebCore::FirstPartyWebsiteDataRemovalMode': ['<WebCore/NetworkStorageSession.h>'],
         'WebCore::FontChanges': ['<WebCore/FontAttributeChanges.h>'],
+        'WebCore::FontSmoothingMode': ['<WebCore/GraphicsTypes.h>'],
         'WebCore::FrameLoadType': ['<WebCore/FrameLoaderTypes.h>'],
         'WebCore::GenericCueData': ['<WebCore/InbandGenericCue.h>'],
         'WebCore::GrammarDetail': ['<WebCore/TextCheckerClient.h>'],
@@ -723,10 +729,14 @@
         'WebCore::KeypressCommand': ['<WebCore/KeyboardEvent.h>'],
         'WebCore::LastNavigationWasAppInitiated': ['<WebCore/ServiceWorkerClientData.h>'],
         'WebCore::LegacyCDMSessionClient::MediaKeyErrorCode': ['<WebCore/LegacyCDMSession.h>'],
+        'WebCore::LineCap': ['<WebCore/GraphicsTypes.h>'],
+        'WebCore::LineData': ['<WebCore/InlinePathData.h>'],
+        'WebCore::LineJoin': ['<WebCore/GraphicsTypes.h>'],
         'WebCore::LockBackForwardList': ['<WebCore/FrameLoaderTypes.h>'],
         'WebCore::MediaEngineSupportParameters': ['<WebCore/MediaPlayer.h>'],
         'WebCore::MessagePortChannelProvider::HasActivity': ['<WebCore/MessagePortChannelProvider.h>'],
         'WebCore::MouseEventPolicy': ['<WebCore/DocumentLoader.h>'],
+        'WebCore::MoveData': ['<WebCore/InlinePathData.h>'],
         'WebCore::NetworkTransactionInformation': ['<WebCore/NetworkLoadInformation.h>'],
         'WebCore::PasteboardCustomData': ['<WebCore/Pasteboard.h>'],
         'WebCore::PasteboardImage': ['<WebCore/Pasteboard.h>'],
@@ -742,6 +752,7 @@
         'WebCore::PolicyCheckIdentifier': ['<WebCore/FrameLoaderTypes.h>'],
         'WebCore::PreserveResolution': ['<WebCore/ImageBufferBackend.h>'],
         'WebCore::ProcessIdentifier': ['<WebCore/ProcessIdentifier.h>'],
+        'WebCore::QuadCurveData': ['<WebCore/InlinePathData.h>'],
         'WebCore::RecentSearch': ['<WebCore/SearchPopupMenu.h>'],
         'WebCore::RequestStorageAccessResult': ['<WebCore/DocumentStorageAccess.h>'],
         'WebCore::RouteSharingPolicy': ['<WebCore/AudioSession.h>'],

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp (283940 => 283941)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.cpp	2021-10-11 22:37:04 UTC (rev 283941)
@@ -159,6 +159,9 @@
 DEFINE_SIMPLE_ARGUMENT_CODER_FOR_SOURCE(CGAffineTransform)
 #endif
 
+DEFINE_SIMPLE_ARGUMENT_CODER_FOR_SOURCE(DisplayList::SetInlineFillColor)
+DEFINE_SIMPLE_ARGUMENT_CODER_FOR_SOURCE(DisplayList::SetInlineStrokeColor)
+
 #undef DEFINE_SIMPLE_ARGUMENT_CODER_FOR_SOURCE
 
 static void encodeSharedBuffer(Encoder& encoder, const SharedBuffer* buffer)

Modified: trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h (283940 => 283941)


--- trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/Shared/WebCoreArgumentCoders.h	2021-10-11 22:37:04 UTC (rev 283941)
@@ -30,6 +30,7 @@
 #include <WebCore/AutoplayEvent.h>
 #include <WebCore/ColorSpace.h>
 #include <WebCore/DiagnosticLoggingClient.h>
+#include <WebCore/DisplayListItems.h>
 #include <WebCore/FloatPoint.h>
 #include <WebCore/FloatPoint3D.h>
 #include <WebCore/FloatRect.h>
@@ -253,6 +254,9 @@
 DEFINE_SIMPLE_ARGUMENT_CODER_FOR_HEADER(CGAffineTransform)
 #endif
 
+DEFINE_SIMPLE_ARGUMENT_CODER_FOR_HEADER(WebCore::DisplayList::SetInlineFillColor)
+DEFINE_SIMPLE_ARGUMENT_CODER_FOR_HEADER(WebCore::DisplayList::SetInlineStrokeColor)
+
 #undef DEFINE_SIMPLE_ARGUMENT_CODER_FOR_HEADER
 
 template<> struct ArgumentCoder<WebCore::AttributedString> {

Modified: trunk/Source/WebKit/Sources.txt (283940 => 283941)


--- trunk/Source/WebKit/Sources.txt	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/Sources.txt	2021-10-11 22:37:04 UTC (rev 283941)
@@ -25,6 +25,7 @@
 GPUProcess/GPUConnectionToWebProcess.cpp
 GPUProcess/GPUProcessCreationParameters.cpp
 GPUProcess/graphics/DisplayListReaderHandle.cpp
+GPUProcess/graphics/RemoteDisplayListRecorder.cpp
 GPUProcess/graphics/RemoteRenderingBackend.cpp
 GPUProcess/graphics/RemoteGraphicsContextGL.cpp
 GPUProcess/graphics/RemoteResourceCache.cpp
@@ -611,6 +612,7 @@
 WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp
 WebProcess/GPU/graphics/RemoteGraphicsContextGLProxyFunctionsGenerated.cpp
 WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp
+WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp
 WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp
 WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp
 WebProcess/GPU/media/AudioTrackPrivateRemote.cpp
@@ -755,6 +757,7 @@
 RTCDataChannelRemoteManagerMessageReceiver.cpp
 RTCDataChannelRemoteManagerProxyMessageReceiver.cpp
 RemoteAudioMediaStreamTrackRendererInternalUnitManagerMessageReceiver.cpp
+RemoteDisplayListRecorderMessageReceiver.cpp
 RemoteGraphicsContextGLMessageReceiver.cpp
 RemoteGraphicsContextGLProxyMessageReceiver.cpp
 PlatformXRSystemMessageReceiver.cpp

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (283940 => 283941)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-10-11 22:37:04 UTC (rev 283941)
@@ -2053,6 +2053,9 @@
 		F44291961FA5942A002CC93E /* _WKAttachmentInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = F44291951FA5942A002CC93E /* _WKAttachmentInternal.h */; };
 		F44815642387820000982657 /* WKDeferringGestureRecognizer.h in Headers */ = {isa = PBXBuildFile; fileRef = F44815622387820000982657 /* WKDeferringGestureRecognizer.h */; };
 		F44DFEB21E9E752F0038D196 /* WebIconUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = F44DFEB01E9E752F0038D196 /* WebIconUtilities.h */; };
+		F4517D7B26FBCD39004C8475 /* RemoteRenderingBackendMessagesReplies.h in Headers */ = {isa = PBXBuildFile; fileRef = F4517D7926FBCD38004C8475 /* RemoteRenderingBackendMessagesReplies.h */; };
+		F4517D7C26FBCD39004C8475 /* RemoteRenderingBackendMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = F4517D7A26FBCD38004C8475 /* RemoteRenderingBackendMessages.h */; };
+		F451C0FE2703B263002BA03B /* RemoteDisplayListRecorderProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = F48BB8DD26F9635D001C1C40 /* RemoteDisplayListRecorderProxy.h */; };
 		F4660BC225DEF08100E86598 /* PasteboardAccessIntent.h in Headers */ = {isa = PBXBuildFile; fileRef = F4660BC125DEF08100E86598 /* PasteboardAccessIntent.h */; };
 		F48570A32644BEC500C05F71 /* Timeout.h in Headers */ = {isa = PBXBuildFile; fileRef = F48570A22644BEC400C05F71 /* Timeout.h */; };
 		F48D2A8521583A7E00C6752B /* AppKitSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = F48D2A8421583A0200C6752B /* AppKitSPI.h */; };
@@ -6130,9 +6133,17 @@
 		F44815632387820000982657 /* WKDeferringGestureRecognizer.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKDeferringGestureRecognizer.mm; path = ios/WKDeferringGestureRecognizer.mm; sourceTree = "<group>"; };
 		F44DFEB01E9E752F0038D196 /* WebIconUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebIconUtilities.h; path = ios/WebIconUtilities.h; sourceTree = "<group>"; };
 		F44DFEB11E9E752F0038D196 /* WebIconUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebIconUtilities.mm; path = ios/WebIconUtilities.mm; sourceTree = "<group>"; };
+		F4517D7726FBCCE4004C8475 /* RemoteRenderingBackendMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RemoteRenderingBackendMessageReceiver.cpp; path = DerivedSources/WebKit2/RemoteRenderingBackendMessageReceiver.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
+		F4517D7926FBCD38004C8475 /* RemoteRenderingBackendMessagesReplies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteRenderingBackendMessagesReplies.h; path = DerivedSources/WebKit2/RemoteRenderingBackendMessagesReplies.h; sourceTree = BUILT_PRODUCTS_DIR; };
+		F4517D7A26FBCD38004C8475 /* RemoteRenderingBackendMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RemoteRenderingBackendMessages.h; path = DerivedSources/WebKit2/RemoteRenderingBackendMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
+		F451C1002703D853002BA03B /* RemoteDisplayListRecorder.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = RemoteDisplayListRecorder.messages.in; sourceTree = "<group>"; };
 		F4660BC125DEF08100E86598 /* PasteboardAccessIntent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PasteboardAccessIntent.h; sourceTree = "<group>"; };
 		F47A051626827A09007E5CF2 /* QuickLookPreviewActivity.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QuickLookPreviewActivity.h; sourceTree = "<group>"; };
 		F48570A22644BEC400C05F71 /* Timeout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Timeout.h; sourceTree = "<group>"; };
+		F48BB8DD26F9635D001C1C40 /* RemoteDisplayListRecorderProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteDisplayListRecorderProxy.h; sourceTree = "<group>"; };
+		F48BB8DE26F9635D001C1C40 /* RemoteDisplayListRecorderProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteDisplayListRecorderProxy.cpp; sourceTree = "<group>"; };
+		F48BB8DF26F96392001C1C40 /* RemoteDisplayListRecorder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteDisplayListRecorder.h; sourceTree = "<group>"; };
+		F48BB8E026F96392001C1C40 /* RemoteDisplayListRecorder.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteDisplayListRecorder.cpp; sourceTree = "<group>"; };
 		F48D2A8421583A0200C6752B /* AppKitSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppKitSPI.h; sourceTree = "<group>"; };
 		F496A42F1F58A272004C1757 /* DragDropInteractionState.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = DragDropInteractionState.h; path = ios/DragDropInteractionState.h; sourceTree = "<group>"; };
 		F496A4301F58A272004C1757 /* DragDropInteractionState.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = DragDropInteractionState.mm; path = ios/DragDropInteractionState.mm; sourceTree = "<group>"; };
@@ -9073,6 +9084,8 @@
 				727A7F36240788F0004D2931 /* ImageBufferShareableBitmapBackend.h */,
 				727A7F38240788F0004D2931 /* PlatformImageBufferShareableBackend.h */,
 				7227800B2408BD7D007D376B /* PlatformRemoteImageBufferProxy.h */,
+				F48BB8DE26F9635D001C1C40 /* RemoteDisplayListRecorderProxy.cpp */,
+				F48BB8DD26F9635D001C1C40 /* RemoteDisplayListRecorderProxy.h */,
 				7B904165254AFDEA006EEB8C /* RemoteGraphicsContextGLProxy.cpp */,
 				7B904166254AFDEB006EEB8C /* RemoteGraphicsContextGLProxy.h */,
 				7B904167254AFE17006EEB8C /* RemoteGraphicsContextGLProxy.messages.in */,
@@ -9095,6 +9108,9 @@
 				F4094CBB255304AF003D73E3 /* DisplayListReaderHandle.h */,
 				55AD09432408A0E600DE4D2F /* PlatformRemoteImageBuffer.h */,
 				1CC54AFD270F9654005BF8BE /* QualifiedRenderingResourceIdentifier.h */,
+				F48BB8E026F96392001C1C40 /* RemoteDisplayListRecorder.cpp */,
+				F48BB8DF26F96392001C1C40 /* RemoteDisplayListRecorder.h */,
+				F451C1002703D853002BA03B /* RemoteDisplayListRecorder.messages.in */,
 				7B904169254AFEA7006EEB8C /* RemoteGraphicsContextGL.cpp */,
 				7B90416A254AFEA7006EEB8C /* RemoteGraphicsContextGL.h */,
 				7B904168254AFEA7006EEB8C /* RemoteGraphicsContextGL.messages.in */,
@@ -11467,6 +11483,9 @@
 				CD8252DA25D4915400862FD8 /* RemoteRemoteCommandListenerProxyMessageReceiver.cpp */,
 				CD8252D925D4915400862FD8 /* RemoteRemoteCommandListenerProxyMessages.h */,
 				CD8252D825D4915300862FD8 /* RemoteRemoteCommandListenerProxyMessagesReplies.h */,
+				F4517D7726FBCCE4004C8475 /* RemoteRenderingBackendMessageReceiver.cpp */,
+				F4517D7A26FBCD38004C8475 /* RemoteRenderingBackendMessages.h */,
+				F4517D7926FBCD38004C8475 /* RemoteRenderingBackendMessagesReplies.h */,
 				0F5947A5187B517600437857 /* RemoteScrollingCoordinatorMessageReceiver.cpp */,
 				0F5947A6187B517600437857 /* RemoteScrollingCoordinatorMessages.h */,
 				1DD2A66B2562021E00FF7B6F /* RemoteSourceBufferProxyMessageReceiver.cpp */,
@@ -12562,6 +12581,7 @@
 				CDAC20B423FB58F20021DEE3 /* RemoteCDMInstanceProxy.h in Headers */,
 				CDAC20CA23FC2F750021DEE3 /* RemoteCDMInstanceSession.h in Headers */,
 				CDAC20C923FC2F750021DEE3 /* RemoteCDMInstanceSessionIdentifier.h in Headers */,
+				F451C0FE2703B263002BA03B /* RemoteDisplayListRecorderProxy.h in Headers */,
 				2D47B56D1810714E003A3AEE /* RemoteLayerBackingStore.h in Headers */,
 				2DDF731518E95060004F5A66 /* RemoteLayerBackingStoreCollection.h in Headers */,
 				1AB16AEA164B3A8800290D62 /* RemoteLayerTreeContext.h in Headers */,
@@ -12590,6 +12610,8 @@
 				1AC1338618590C4600F3EC05 /* RemoteObjectRegistryMessages.h in Headers */,
 				46088A00261FA8BC00E2500D /* RemoteRenderingBackend.h in Headers */,
 				46088A01261FA8C400E2500D /* RemoteRenderingBackendCreationParameters.h in Headers */,
+				F4517D7C26FBCD39004C8475 /* RemoteRenderingBackendMessages.h in Headers */,
+				F4517D7B26FBCD39004C8475 /* RemoteRenderingBackendMessagesReplies.h in Headers */,
 				F414CE2D269DE6EA00BD216A /* RemoteRenderingBackendState.h in Headers */,
 				0F594790187B3B3A00437857 /* RemoteScrollingCoordinator.h in Headers */,
 				0F5947A8187B517600437857 /* RemoteScrollingCoordinatorMessages.h in Headers */,

Added: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp (0 => 283941)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	2021-10-11 22:37:04 UTC (rev 283941)
@@ -0,0 +1,450 @@
+/*
+ * 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. ``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 "RemoteDisplayListRecorderProxy.h"
+
+#if ENABLE(GPU_PROCESS)
+
+#include "RemoteDisplayListRecorderMessages.h"
+#include <WebCore/DisplayList.h>
+#include <WebCore/DisplayListDrawingContext.h>
+#include <WebCore/DisplayListItems.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/ImageBuffer.h>
+#include <WebCore/MediaPlayer.h>
+#include <WebCore/NotImplemented.h>
+#include <wtf/MathExtras.h>
+#include <wtf/text/TextStream.h>
+
+namespace WebKit {
+using namespace WebCore;
+
+RemoteDisplayListRecorderProxy::RemoteDisplayListRecorderProxy(ImageBuffer& imageBuffer, RemoteRenderingBackendProxy& renderingBackend, const FloatRect& initialClip, const AffineTransform& initialCTM, DrawGlyphsRecorder::DeconstructDrawGlyphs deconstructDrawGlyphs)
+    : DisplayList::Recorder({ }, initialClip, initialCTM, deconstructDrawGlyphs)
+    , m_destinationBufferIdentifier(imageBuffer.renderingResourceIdentifier())
+    , m_imageBuffer(makeWeakPtr(imageBuffer))
+    , m_renderingBackend(makeWeakPtr(renderingBackend))
+{
+}
+
+RemoteDisplayListRecorderProxy::RemoteDisplayListRecorderProxy(RemoteDisplayListRecorderProxy& parent, const FloatRect& initialClip, const AffineTransform& initialCTM)
+    : DisplayList::Recorder(parent, { }, initialClip, initialCTM)
+    , m_destinationBufferIdentifier(parent.m_destinationBufferIdentifier)
+    , m_imageBuffer(parent.m_imageBuffer)
+    , m_renderingBackend(parent.m_renderingBackend)
+{
+}
+
+void RemoteDisplayListRecorderProxy::getPixelBuffer(const PixelBufferFormat& outputFormat, const IntRect& sourceRect)
+{
+    send(Messages::RemoteDisplayListRecorder::GetPixelBuffer(sourceRect, outputFormat));
+}
+
+void RemoteDisplayListRecorderProxy::putPixelBuffer(const PixelBuffer& pixelBuffer, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication destFormat)
+{
+    send(Messages::RemoteDisplayListRecorder::PutPixelBuffer(srcRect, destPoint, pixelBuffer, destFormat));
+}
+
+bool RemoteDisplayListRecorderProxy::canDrawImageBuffer(const ImageBuffer& imageBuffer) const
+{
+    return m_renderingBackend && m_renderingBackend->isCached(imageBuffer);
+}
+
+RenderingMode RemoteDisplayListRecorderProxy::renderingMode() const
+{
+    return m_imageBuffer ? m_imageBuffer->renderingMode() : RenderingMode::Unaccelerated;
+}
+
+void RemoteDisplayListRecorderProxy::recordSave()
+{
+    send(Messages::RemoteDisplayListRecorder::Save());
+}
+
+void RemoteDisplayListRecorderProxy::recordRestore()
+{
+    send(Messages::RemoteDisplayListRecorder::Restore());
+}
+
+void RemoteDisplayListRecorderProxy::recordTranslate(float x, float y)
+{
+    send(Messages::RemoteDisplayListRecorder::Translate(x, y));
+}
+
+void RemoteDisplayListRecorderProxy::recordRotate(float angle)
+{
+    send(Messages::RemoteDisplayListRecorder::Rotate(angle));
+}
+
+void RemoteDisplayListRecorderProxy::recordScale(const FloatSize& scale)
+{
+    send(Messages::RemoteDisplayListRecorder::Scale(scale));
+}
+
+void RemoteDisplayListRecorderProxy::recordSetCTM(const AffineTransform& transform)
+{
+    send(Messages::RemoteDisplayListRecorder::SetCTM(transform));
+}
+
+void RemoteDisplayListRecorderProxy::recordConcatenateCTM(const AffineTransform& transform)
+{
+    send(Messages::RemoteDisplayListRecorder::ConcatenateCTM(transform));
+}
+
+void RemoteDisplayListRecorderProxy::recordSetInlineFillColor(SRGBA<uint8_t> color)
+{
+    send(Messages::RemoteDisplayListRecorder::SetInlineFillColor(DisplayList::SetInlineFillColor { color }));
+}
+
+void RemoteDisplayListRecorderProxy::recordSetInlineStrokeColor(SRGBA<uint8_t> color)
+{
+    send(Messages::RemoteDisplayListRecorder::SetInlineStrokeColor(DisplayList::SetInlineStrokeColor { color }));
+}
+
+void RemoteDisplayListRecorderProxy::recordSetStrokeThickness(float thickness)
+{
+    send(Messages::RemoteDisplayListRecorder::SetStrokeThickness(thickness));
+}
+
+void RemoteDisplayListRecorderProxy::recordSetState(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
+{
+    send(Messages::RemoteDisplayListRecorder::SetState(DisplayList::SetState { state, flags }));
+}
+
+void RemoteDisplayListRecorderProxy::recordSetLineCap(LineCap lineCap)
+{
+    send(Messages::RemoteDisplayListRecorder::SetLineCap(lineCap));
+}
+
+void RemoteDisplayListRecorderProxy::recordSetLineDash(const DashArray& array, float dashOffset)
+{
+    send(Messages::RemoteDisplayListRecorder::SetLineDash(DisplayList::SetLineDash { array, dashOffset }));
+}
+
+void RemoteDisplayListRecorderProxy::recordSetLineJoin(LineJoin lineJoin)
+{
+    send(Messages::RemoteDisplayListRecorder::SetLineJoin(lineJoin));
+}
+
+void RemoteDisplayListRecorderProxy::recordSetMiterLimit(float limit)
+{
+    send(Messages::RemoteDisplayListRecorder::SetMiterLimit(limit));
+}
+
+void RemoteDisplayListRecorderProxy::recordClearShadow()
+{
+    send(Messages::RemoteDisplayListRecorder::ClearShadow());
+}
+
+void RemoteDisplayListRecorderProxy::recordClip(const FloatRect& rect)
+{
+    send(Messages::RemoteDisplayListRecorder::Clip(rect));
+}
+
+void RemoteDisplayListRecorderProxy::recordClipOut(const FloatRect& rect)
+{
+    send(Messages::RemoteDisplayListRecorder::ClipOut(rect));
+}
+
+void RemoteDisplayListRecorderProxy::recordClipToImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destinationRect)
+{
+    send(Messages::RemoteDisplayListRecorder::ClipToImageBuffer(imageBufferIdentifier, destinationRect));
+}
+
+void RemoteDisplayListRecorderProxy::recordClipOutToPath(const Path& path)
+{
+    send(Messages::RemoteDisplayListRecorder::ClipOutToPath(path));
+}
+
+void RemoteDisplayListRecorderProxy::recordClipPath(const Path& path, WindRule rule)
+{
+    send(Messages::RemoteDisplayListRecorder::ClipPath(path, rule));
+}
+
+void RemoteDisplayListRecorderProxy::recordBeginClipToDrawingCommands(const FloatRect& destination, DestinationColorSpace colorSpace)
+{
+    send(Messages::RemoteDisplayListRecorder::BeginClipToDrawingCommands(destination, colorSpace));
+}
+
+void RemoteDisplayListRecorderProxy::recordEndClipToDrawingCommands(const FloatRect& destination)
+{
+    send(Messages::RemoteDisplayListRecorder::EndClipToDrawingCommands(destination));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawGlyphs(const Font& font, const GlyphBufferGlyph* glyphs, const GlyphBufferAdvance* advances, unsigned count, const FloatPoint& localAnchor, FontSmoothingMode mode)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawGlyphs(DisplayList::DrawGlyphs { font, glyphs, advances, count, localAnchor, mode }));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawImageBuffer(imageBufferIdentifier, destRect, srcRect, options));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawNativeImage(RenderingResourceIdentifier imageIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawNativeImage(imageIdentifier, imageSize, destRect, srcRect, options));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawPattern(RenderingResourceIdentifier imageIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform& transform, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& options)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawPattern(imageIdentifier, imageSize, destRect, tileRect, transform, phase, spacing, options));
+}
+
+void RemoteDisplayListRecorderProxy::recordBeginTransparencyLayer(float opacity)
+{
+    send(Messages::RemoteDisplayListRecorder::BeginTransparencyLayer(opacity));
+}
+
+void RemoteDisplayListRecorderProxy::recordEndTransparencyLayer()
+{
+    send(Messages::RemoteDisplayListRecorder::EndTransparencyLayer());
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawRect(const FloatRect& rect, float width)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawRect(rect, width));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawLine(const FloatPoint& point1, const FloatPoint& point2)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawLine(point1, point2));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawLinesForText(const FloatPoint& blockLocation, const FloatSize& localAnchor, float thickness, const DashArray& widths, bool printing, bool doubleLines)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawLinesForText(DisplayList::DrawLinesForText { blockLocation, localAnchor, thickness, widths, printing, doubleLines }));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawDotsForDocumentMarker(const FloatRect& rect, const DocumentMarkerLineStyle& style)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawDotsForDocumentMarker(rect, style));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawEllipse(const FloatRect& rect)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawEllipse(rect));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawPath(const Path& path)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawPath(path));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawFocusRingPath(const Path& path, float width, float offset, const Color& color)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawFocusRingPath(path, width, offset, color));
+}
+
+void RemoteDisplayListRecorderProxy::recordDrawFocusRingRects(const Vector<FloatRect>& rects, float width, float offset, const Color& color)
+{
+    send(Messages::RemoteDisplayListRecorder::DrawFocusRingRects(rects, width, offset, color));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillRect(const FloatRect& rect)
+{
+    send(Messages::RemoteDisplayListRecorder::FillRect(rect));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillRectWithColor(const FloatRect& rect, const Color& color)
+{
+    send(Messages::RemoteDisplayListRecorder::FillRectWithColor(rect, color));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillRectWithGradient(const FloatRect& rect, Gradient& gradient)
+{
+    send(Messages::RemoteDisplayListRecorder::FillRectWithGradient(DisplayList::FillRectWithGradient { rect, gradient }));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillCompositedRect(const FloatRect& rect, const Color& color, CompositeOperator op, BlendMode mode)
+{
+    send(Messages::RemoteDisplayListRecorder::FillCompositedRect(rect, color, op, mode));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillRoundedRect(const FloatRoundedRect& roundedRect, const Color& color, BlendMode mode)
+{
+    send(Messages::RemoteDisplayListRecorder::FillRoundedRect(roundedRect, color, mode));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillRectWithRoundedHole(const FloatRect& rect, const FloatRoundedRect& roundedRect, const Color& color)
+{
+    send(Messages::RemoteDisplayListRecorder::FillRectWithRoundedHole(rect, roundedRect, color));
+}
+
+#if ENABLE(INLINE_PATH_DATA)
+
+void RemoteDisplayListRecorderProxy::recordFillLine(const LineData& data)
+{
+    send(Messages::RemoteDisplayListRecorder::FillLine(data));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillArc(const ArcData& data)
+{
+    send(Messages::RemoteDisplayListRecorder::FillArc(data));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillQuadCurve(const QuadCurveData& data)
+{
+    send(Messages::RemoteDisplayListRecorder::FillQuadCurve(data));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillBezierCurve(const BezierCurveData& data)
+{
+    send(Messages::RemoteDisplayListRecorder::FillBezierCurve(data));
+}
+
+#endif // ENABLE(INLINE_PATH_DATA)
+
+void RemoteDisplayListRecorderProxy::recordFillPath(const Path& path)
+{
+    send(Messages::RemoteDisplayListRecorder::FillPath(path));
+}
+
+void RemoteDisplayListRecorderProxy::recordFillEllipse(const FloatRect& rect)
+{
+    send(Messages::RemoteDisplayListRecorder::FillEllipse(rect));
+}
+
+void RemoteDisplayListRecorderProxy::recordGetPixelBuffer(PixelBufferFormat outputFormat, const IntRect& rect)
+{
+    send(Messages::RemoteDisplayListRecorder::GetPixelBuffer(rect, outputFormat));
+}
+
+void RemoteDisplayListRecorderProxy::recordPutPixelBuffer(const PixelBuffer& buffer, const IntRect& srcRect, const IntPoint& destPoint, AlphaPremultiplication premultiplication)
+{
+    send(Messages::RemoteDisplayListRecorder::PutPixelBuffer(srcRect, destPoint, buffer, premultiplication));
+}
+
+void RemoteDisplayListRecorderProxy::recordPaintFrameForMedia(MediaPlayer& player, const FloatRect& destination)
+{
+    send(Messages::RemoteDisplayListRecorder::PaintFrameForMedia(player.identifier(), destination));
+}
+
+void RemoteDisplayListRecorderProxy::recordStrokeRect(const FloatRect& rect, float width)
+{
+    send(Messages::RemoteDisplayListRecorder::StrokeRect(rect, width));
+}
+
+#if ENABLE(INLINE_PATH_DATA)
+
+void RemoteDisplayListRecorderProxy::recordStrokeLine(const LineData& data)
+{
+    send(Messages::RemoteDisplayListRecorder::StrokeLine(data));
+}
+
+void RemoteDisplayListRecorderProxy::recordStrokeArc(const ArcData& data)
+{
+    send(Messages::RemoteDisplayListRecorder::StrokeArc(data));
+}
+
+void RemoteDisplayListRecorderProxy::recordStrokeQuadCurve(const QuadCurveData& data)
+{
+    send(Messages::RemoteDisplayListRecorder::StrokeQuadCurve(data));
+}
+
+void RemoteDisplayListRecorderProxy::recordStrokeBezierCurve(const BezierCurveData& data)
+{
+    send(Messages::RemoteDisplayListRecorder::StrokeBezierCurve(data));
+}
+
+#endif // ENABLE(INLINE_PATH_DATA)
+
+void RemoteDisplayListRecorderProxy::recordStrokePath(const Path& path)
+{
+    send(Messages::RemoteDisplayListRecorder::StrokePath(path));
+}
+
+void RemoteDisplayListRecorderProxy::recordStrokeEllipse(const FloatRect& rect)
+{
+    send(Messages::RemoteDisplayListRecorder::StrokeEllipse(rect));
+}
+
+void RemoteDisplayListRecorderProxy::recordClearRect(const FloatRect& rect)
+{
+    send(Messages::RemoteDisplayListRecorder::ClearRect(rect));
+}
+
+#if USE(CG)
+
+void RemoteDisplayListRecorderProxy::recordApplyStrokePattern()
+{
+    send(Messages::RemoteDisplayListRecorder::ApplyStrokePattern());
+}
+
+void RemoteDisplayListRecorderProxy::recordApplyFillPattern()
+{
+    send(Messages::RemoteDisplayListRecorder::ApplyFillPattern());
+}
+
+#endif // USE(CG)
+
+void RemoteDisplayListRecorderProxy::recordApplyDeviceScaleFactor(float scaleFactor)
+{
+    send(Messages::RemoteDisplayListRecorder::ApplyDeviceScaleFactor(scaleFactor));
+}
+
+void RemoteDisplayListRecorderProxy::recordResourceUse(NativeImage& image)
+{
+    if (UNLIKELY(!m_renderingBackend)) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    m_renderingBackend->recordNativeImageUse(image);
+}
+
+void RemoteDisplayListRecorderProxy::recordResourceUse(Font& font)
+{
+    if (UNLIKELY(!m_renderingBackend)) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    m_renderingBackend->recordFontUse(font);
+}
+
+void RemoteDisplayListRecorderProxy::recordResourceUse(ImageBuffer& imageBuffer)
+{
+    if (UNLIKELY(!m_renderingBackend)) {
+        ASSERT_NOT_REACHED();
+        return;
+    }
+
+    m_renderingBackend->recordImageBufferUse(imageBuffer);
+}
+
+void RemoteDisplayListRecorderProxy::flushContext(GraphicsContextFlushIdentifier identifier)
+{
+    send(Messages::RemoteDisplayListRecorder::FlushContext(identifier));
+}
+
+std::unique_ptr<GraphicsContext> RemoteDisplayListRecorderProxy::createNestedContext(const FloatRect& initialClip, const AffineTransform& initialCTM)
+{
+    return makeUnique<RemoteDisplayListRecorderProxy>(*this, initialClip, initialCTM);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(GPU_PROCESS)

Added: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h (0 => 283941)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2021-10-11 22:37:04 UTC (rev 283941)
@@ -0,0 +1,151 @@
+/*
+ * 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(GPU_PROCESS)
+
+#include "RemoteRenderingBackendProxy.h"
+#include <WebCore/DisplayListRecorder.h>
+#include <WebCore/DrawGlyphsRecorder.h>
+#include <WebCore/GraphicsContext.h>
+#include <wtf/WeakPtr.h>
+
+namespace WebKit {
+
+class RemoteRenderingBackendProxy;
+
+class RemoteDisplayListRecorderProxy : public WebCore::DisplayList::Recorder {
+public:
+    RemoteDisplayListRecorderProxy(WebCore::ImageBuffer&, RemoteRenderingBackendProxy&, const WebCore::FloatRect& initialClip, const WebCore::AffineTransform&, WebCore::DrawGlyphsRecorder::DeconstructDrawGlyphs = WebCore::DrawGlyphsRecorder::DeconstructDrawGlyphs::Yes);
+    RemoteDisplayListRecorderProxy(RemoteDisplayListRecorderProxy& parent, const WebCore::FloatRect& initialClip, const WebCore::AffineTransform& initialCTM);
+
+    ~RemoteDisplayListRecorderProxy() = default;
+
+    void resetNeedsFlush() { m_needsFlush = false; }
+    bool needsFlush() const { return m_needsFlush; }
+
+    void getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect& sourceRect) final;
+    void putPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) final;
+    void flushContext(WebCore::GraphicsContextFlushIdentifier) final;
+
+private:
+    template<typename T>
+    void send(T&& message)
+    {
+        m_needsFlush = true;
+        m_renderingBackend->sendToStream(WTFMove(message), m_destinationBufferIdentifier);
+    }
+
+    friend class DrawGlyphsRecorder;
+
+    bool canDrawImageBuffer(const ImageBuffer&) const final;
+    RenderingMode renderingMode() const final;
+
+    void recordSave() final;
+    void recordRestore() final;
+    void recordTranslate(float x, float y) final;
+    void recordRotate(float angle) final;
+    void recordScale(const WebCore::FloatSize&) final;
+    void recordSetCTM(const WebCore::AffineTransform&) final;
+    void recordConcatenateCTM(const WebCore::AffineTransform&) final;
+    void recordSetInlineFillColor(WebCore::SRGBA<uint8_t>) final;
+    void recordSetInlineStrokeColor(WebCore::SRGBA<uint8_t>) final;
+    void recordSetStrokeThickness(float) final;
+    void recordSetState(const WebCore::GraphicsContextState&, WebCore::GraphicsContextState::StateChangeFlags) final;
+    void recordSetLineCap(WebCore::LineCap) final;
+    void recordSetLineDash(const WebCore::DashArray&, float dashOffset) final;
+    void recordSetLineJoin(WebCore::LineJoin) final;
+    void recordSetMiterLimit(float) final;
+    void recordClearShadow() final;
+    void recordClip(const WebCore::FloatRect&) final;
+    void recordClipOut(const WebCore::FloatRect&) final;
+    void recordClipToImageBuffer(WebCore::RenderingResourceIdentifier imageBufferIdentifier, const WebCore::FloatRect& destinationRect) final;
+    void recordClipOutToPath(const WebCore::Path&) final;
+    void recordClipPath(const WebCore::Path&, WebCore::WindRule) final;
+    void recordBeginClipToDrawingCommands(const WebCore::FloatRect& destination, DestinationColorSpace) final;
+    void recordEndClipToDrawingCommands(const WebCore::FloatRect& destination) final;
+    void recordDrawGlyphs(const WebCore::Font&, const WebCore::GlyphBufferGlyph*, const WebCore::GlyphBufferAdvance*, unsigned count, const WebCore::FloatPoint& localAnchor, WebCore::FontSmoothingMode) final;
+    void recordDrawImageBuffer(WebCore::RenderingResourceIdentifier imageBufferIdentifier, const WebCore::FloatRect& destRect, const WebCore::FloatRect& srcRect, const WebCore::ImagePaintingOptions&) final;
+    void recordDrawNativeImage(WebCore::RenderingResourceIdentifier imageIdentifier, const WebCore::FloatSize& imageSize, const WebCore::FloatRect& destRect, const WebCore::FloatRect& srcRect, const WebCore::ImagePaintingOptions&) final;
+    void recordDrawPattern(WebCore::RenderingResourceIdentifier, const WebCore::FloatSize& imageSize, const WebCore::FloatRect& destRect, const WebCore::FloatRect& tileRect, const WebCore::AffineTransform&, const WebCore::FloatPoint& phase, const WebCore::FloatSize& spacing, const WebCore::ImagePaintingOptions& = { }) final;
+    void recordBeginTransparencyLayer(float) final;
+    void recordEndTransparencyLayer() final;
+    void recordDrawRect(const WebCore::FloatRect&, float) final;
+    void recordDrawLine(const WebCore::FloatPoint& point1, const WebCore::FloatPoint& point2) final;
+    void recordDrawLinesForText(const WebCore::FloatPoint& blockLocation, const WebCore::FloatSize& localAnchor, float thickness, const WebCore::DashArray& widths, bool printing, bool doubleLines) final;
+    void recordDrawDotsForDocumentMarker(const WebCore::FloatRect&, const WebCore::DocumentMarkerLineStyle&) final;
+    void recordDrawEllipse(const WebCore::FloatRect&) final;
+    void recordDrawPath(const WebCore::Path&) final;
+    void recordDrawFocusRingPath(const WebCore::Path&, float width, float offset, const WebCore::Color&) final;
+    void recordDrawFocusRingRects(const Vector<WebCore::FloatRect>&, float width, float offset, const WebCore::Color&) final;
+    void recordFillRect(const WebCore::FloatRect&) final;
+    void recordFillRectWithColor(const WebCore::FloatRect&, const WebCore::Color&) final;
+    void recordFillRectWithGradient(const WebCore::FloatRect&, WebCore::Gradient&) final;
+    void recordFillCompositedRect(const WebCore::FloatRect&, const WebCore::Color&, WebCore::CompositeOperator, WebCore::BlendMode) final;
+    void recordFillRoundedRect(const WebCore::FloatRoundedRect&, const WebCore::Color&, WebCore::BlendMode) final;
+    void recordFillRectWithRoundedHole(const WebCore::FloatRect&, const WebCore::FloatRoundedRect&, const WebCore::Color&) final;
+#if ENABLE(INLINE_PATH_DATA)
+    void recordFillLine(const WebCore::LineData&) final;
+    void recordFillArc(const WebCore::ArcData&) final;
+    void recordFillQuadCurve(const WebCore::QuadCurveData&) final;
+    void recordFillBezierCurve(const WebCore::BezierCurveData&) final;
+#endif
+    void recordFillPath(const WebCore::Path&) final;
+    void recordFillEllipse(const WebCore::FloatRect&) final;
+    void recordGetPixelBuffer(WebCore::PixelBufferFormat outputFormat, const WebCore::IntRect&) final;
+    void recordPutPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication) final;
+    void recordPaintFrameForMedia(MediaPlayer&, const WebCore::FloatRect& destination) final;
+    void recordStrokeRect(const WebCore::FloatRect&, float) final;
+#if ENABLE(INLINE_PATH_DATA)
+    void recordStrokeLine(const WebCore::LineData&) final;
+    void recordStrokeArc(const WebCore::ArcData&) final;
+    void recordStrokeQuadCurve(const WebCore::QuadCurveData&) final;
+    void recordStrokeBezierCurve(const WebCore::BezierCurveData&) final;
+#endif
+    void recordStrokePath(const WebCore::Path&) final;
+    void recordStrokeEllipse(const WebCore::FloatRect&) final;
+    void recordClearRect(const WebCore::FloatRect&) final;
+#if USE(CG)
+    void recordApplyStrokePattern() final;
+    void recordApplyFillPattern() final;
+#endif
+    void recordApplyDeviceScaleFactor(float) final;
+
+    void recordResourceUse(WebCore::NativeImage&) final;
+    void recordResourceUse(WebCore::Font&) final;
+    void recordResourceUse(WebCore::ImageBuffer&) final;
+
+    std::unique_ptr<WebCore::GraphicsContext> createNestedContext(const WebCore::FloatRect& initialClip, const WebCore::AffineTransform& initialCTM) final;
+
+    WebCore::RenderingResourceIdentifier m_destinationBufferIdentifier;
+    WeakPtr<WebCore::ImageBuffer> m_imageBuffer;
+    WeakPtr<RemoteRenderingBackendProxy> m_renderingBackend;
+    bool m_needsFlush { false };
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp (283940 => 283941)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2021-10-11 22:37:04 UTC (rev 283941)
@@ -447,6 +447,30 @@
     return renderingBackendIdentifier();
 }
 
+void RemoteRenderingBackendProxy::recordNativeImageUse(NativeImage& image)
+{
+    m_remoteResourceCacheProxy.recordNativeImageUse(image);
+}
+
+void RemoteRenderingBackendProxy::recordFontUse(Font& font)
+{
+    m_remoteResourceCacheProxy.recordFontUse(font);
+}
+
+void RemoteRenderingBackendProxy::recordImageBufferUse(ImageBuffer& imageBuffer)
+{
+    m_remoteResourceCacheProxy.recordImageBufferUse(imageBuffer);
+}
+
+bool RemoteRenderingBackendProxy::isCached(const ImageBuffer& imageBuffer) const
+{
+    if (auto cachedImageBuffer = m_remoteResourceCacheProxy.cachedImageBuffer(imageBuffer.renderingResourceIdentifier())) {
+        ASSERT(cachedImageBuffer == &imageBuffer);
+        return true;
+    }
+    return false;
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(GPU_PROCESS)

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h (283940 => 283941)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h	2021-10-11 22:30:31 UTC (rev 283940)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h	2021-10-11 22:37:04 UTC (rev 283941)
@@ -88,6 +88,7 @@
     void destroyGetPixelBufferSharedMemory();
 
     void createRemoteImageBuffer(WebCore::ImageBuffer&);
+    bool isCached(const WebCore::ImageBuffer&) const;
         
     // IPC::MessageSender.
     IPC::Connection* messageSenderConnection() const override;
@@ -124,6 +125,22 @@
 
     bool isGPUProcessConnectionClosed() const { return !m_gpuProcessConnection; }
 
+    template<typename T, typename U>
+    void sendToStream(T&& message, ObjectIdentifier<U> identifier)
+    {
+        // FIXME: Not yet implemented.
+    }
+
+    template<typename T>
+    void sendToStream(T&& message)
+    {
+        sendToStream(WTFMove(message), renderingBackendIdentifier());
+    }
+
+    void recordNativeImageUse(WebCore::NativeImage&);
+    void recordFontUse(WebCore::Font&);
+    void recordImageBufferUse(WebCore::ImageBuffer&);
+
 private:
     explicit RemoteRenderingBackendProxy(WebPage&);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to