Title: [289492] trunk/Source
Revision
289492
Author
commit-qu...@webkit.org
Date
2022-02-09 11:35:24 -0800 (Wed, 09 Feb 2022)

Log Message

DisplayListRecorder implementations are not able to obtain extra information out of source ImageBuffers
https://bugs.webkit.org/show_bug.cgi?id=236296

Patch by Kimmo Kinnunen <kkinnu...@apple.com> on 2022-02-09
Reviewed by Wenson Hsieh.

Source/WebCore:

Pass ImageBuffer& to various recording commands instead of the resource identifier.
This way implementations of DisplayListRecorder can obtain additional information
about the ImageBuffer, such as dependency information. This additional information is
not neccessarily needed for in-process display lists.

* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawFilteredImageBuffer):
(WebCore::DisplayList::Recorder::drawImageBuffer):
(WebCore::DisplayList::Recorder::clipToImageBuffer):
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
(WebCore::DisplayList::RecorderImpl::recordClipToImageBuffer):
(WebCore::DisplayList::RecorderImpl::recordDrawFilteredImageBuffer):
(WebCore::DisplayList::RecorderImpl::recordDrawImageBuffer):
* platform/graphics/displaylists/DisplayListRecorderImpl.h:

Source/WebKit:

RecorderImpl now passes ImageBuffers to the DisplayListRecorder calls.
Use the ImageBuffer& to get the resource identifier.
In future commits these places will obtain the read references, which
record the depenedency information needed for RemoteImageBuffers
created in multiple threads.

* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::recordClipToImageBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawFilteredImageBuffer):
(WebKit::RemoteDisplayListRecorderProxy::recordDrawImageBuffer):
* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (289491 => 289492)


--- trunk/Source/WebCore/ChangeLog	2022-02-09 19:31:06 UTC (rev 289491)
+++ trunk/Source/WebCore/ChangeLog	2022-02-09 19:35:24 UTC (rev 289492)
@@ -1,3 +1,26 @@
+2022-02-09  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+        DisplayListRecorder implementations are not able to obtain extra information out of source ImageBuffers
+        https://bugs.webkit.org/show_bug.cgi?id=236296
+
+        Reviewed by Wenson Hsieh.
+
+        Pass ImageBuffer& to various recording commands instead of the resource identifier.
+        This way implementations of DisplayListRecorder can obtain additional information
+        about the ImageBuffer, such as dependency information. This additional information is
+        not neccessarily needed for in-process display lists.
+
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::drawFilteredImageBuffer):
+        (WebCore::DisplayList::Recorder::drawImageBuffer):
+        (WebCore::DisplayList::Recorder::clipToImageBuffer):
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/graphics/displaylists/DisplayListRecorderImpl.cpp:
+        (WebCore::DisplayList::RecorderImpl::recordClipToImageBuffer):
+        (WebCore::DisplayList::RecorderImpl::recordDrawFilteredImageBuffer):
+        (WebCore::DisplayList::RecorderImpl::recordDrawImageBuffer):
+        * platform/graphics/displaylists/DisplayListRecorderImpl.h:
+
 2022-02-09  Chris Dumez  <cdu...@apple.com>
 
         Worker scripts should always be decoded as UTF-8

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp (289491 => 289492)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2022-02-09 19:31:06 UTC (rev 289491)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2022-02-09 19:35:24 UTC (rev 289492)
@@ -159,7 +159,7 @@
     }
 
     if (!sourceImage) {
-        recordDrawFilteredImageBuffer({ }, sourceImageRect, filter);
+        recordDrawFilteredImageBuffer(nullptr, sourceImageRect, filter);
         return;
     }
 
@@ -168,7 +168,7 @@
         return;
     }
 
-    recordDrawFilteredImageBuffer(sourceImage->renderingResourceIdentifier(), sourceImageRect, filter);
+    recordDrawFilteredImageBuffer(sourceImage, sourceImageRect, filter);
 }
 
 void Recorder::drawGlyphs(const Font& font, const GlyphBufferGlyph* glyphs, const GlyphBufferAdvance* advances, unsigned numGlyphs, const FloatPoint& startPoint, FontSmoothingMode smoothingMode)
@@ -192,7 +192,7 @@
         return;
     }
 
-    recordDrawImageBuffer(imageBuffer.renderingResourceIdentifier(), destRect, srcRect, options);
+    recordDrawImageBuffer(imageBuffer, destRect, srcRect, options);
 }
 
 void Recorder::drawNativeImage(NativeImage& image, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
@@ -483,7 +483,7 @@
 void Recorder::clipToImageBuffer(ImageBuffer& imageBuffer, const FloatRect& destRect)
 {
     recordResourceUse(imageBuffer);
-    recordClipToImageBuffer(imageBuffer.renderingResourceIdentifier(), destRect);
+    recordClipToImageBuffer(imageBuffer, destRect);
 }
 
 GraphicsContext::ClipToDrawingCommandsResult Recorder::clipToDrawingCommands(const FloatRect& destination, const DestinationColorSpace& colorSpace, Function<void(GraphicsContext&)>&& drawingFunction)

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h (289491 => 289492)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-02-09 19:31:06 UTC (rev 289491)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-02-09 19:35:24 UTC (rev 289492)
@@ -86,14 +86,14 @@
     virtual void recordClearShadow() = 0;
     virtual void recordClip(const FloatRect&) = 0;
     virtual void recordClipOut(const FloatRect&) = 0;
-    virtual void recordClipToImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destinationRect) = 0;
+    virtual void recordClipToImageBuffer(ImageBuffer&, const FloatRect& destinationRect) = 0;
     virtual void recordClipOutToPath(const Path&) = 0;
     virtual void recordClipPath(const Path&, WindRule) = 0;
     virtual void recordBeginClipToDrawingCommands(const FloatRect& destination, DestinationColorSpace) = 0;
     virtual void recordEndClipToDrawingCommands(const FloatRect& destination) = 0;
-    virtual void recordDrawFilteredImageBuffer(std::optional<RenderingResourceIdentifier> sourceImageIdentifier, const FloatRect& sourceImageRect, Filter&) = 0;
+    virtual void recordDrawFilteredImageBuffer(ImageBuffer*, const FloatRect& sourceImageRect, Filter&) = 0;
     virtual void recordDrawGlyphs(const Font&, const GlyphBufferGlyph*, const GlyphBufferAdvance*, unsigned count, const FloatPoint& localAnchor, FontSmoothingMode) = 0;
-    virtual void recordDrawImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) = 0;
+    virtual void recordDrawImageBuffer(ImageBuffer&, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) = 0;
     virtual void recordDrawNativeImage(RenderingResourceIdentifier imageIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) = 0;
     virtual void recordDrawPattern(RenderingResourceIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) = 0;
     virtual void recordBeginTransparencyLayer(float) = 0;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp (289491 => 289492)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp	2022-02-09 19:31:06 UTC (rev 289491)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp	2022-02-09 19:35:24 UTC (rev 289492)
@@ -168,9 +168,9 @@
     append<ClipOut>(clipRect);
 }
 
-void RecorderImpl::recordClipToImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destinationRect)
+void RecorderImpl::recordClipToImageBuffer(ImageBuffer& imageBuffer, const FloatRect& destinationRect)
 {
-    append<ClipToImageBuffer>(imageBufferIdentifier, destinationRect);
+    append<ClipToImageBuffer>(imageBuffer.renderingResourceIdentifier(), destinationRect);
 }
 
 void RecorderImpl::recordClipOutToPath(const Path& path)
@@ -193,9 +193,12 @@
     append<EndClipToDrawingCommands>(destination);
 }
 
-void RecorderImpl::recordDrawFilteredImageBuffer(std::optional<RenderingResourceIdentifier> sourceImageIdentifier, const FloatRect& sourceImageRect, Filter& filter)
+void RecorderImpl::recordDrawFilteredImageBuffer(ImageBuffer* sourceImage, const FloatRect& sourceImageRect, Filter& filter)
 {
-    append<DrawFilteredImageBuffer>(sourceImageIdentifier, sourceImageRect, filter);
+    std::optional<RenderingResourceIdentifier> identifier;
+    if (sourceImage)
+        identifier = sourceImage->renderingResourceIdentifier();
+    append<DrawFilteredImageBuffer>(WTFMove(identifier), sourceImageRect, filter);
 }
 
 void RecorderImpl::recordDrawGlyphs(const Font& font, const GlyphBufferGlyph* glyphs, const GlyphBufferAdvance* advances, unsigned count, const FloatPoint& localAnchor, FontSmoothingMode mode)
@@ -203,9 +206,9 @@
     append<DrawGlyphs>(font, glyphs, advances, count, localAnchor, mode);
 }
 
-void RecorderImpl::recordDrawImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
+void RecorderImpl::recordDrawImageBuffer(ImageBuffer& imageBuffer, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
 {
-    append<DrawImageBuffer>(imageBufferIdentifier, destRect, srcRect, options);
+    append<DrawImageBuffer>(imageBuffer.renderingResourceIdentifier(), destRect, srcRect, options);
 }
 
 void RecorderImpl::recordDrawNativeImage(RenderingResourceIdentifier imageIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h (289491 => 289492)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h	2022-02-09 19:31:06 UTC (rev 289491)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h	2022-02-09 19:35:24 UTC (rev 289492)
@@ -67,14 +67,14 @@
     void recordClearShadow() final;
     void recordClip(const FloatRect&) final;
     void recordClipOut(const FloatRect&) final;
-    void recordClipToImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destinationRect) final;
+    void recordClipToImageBuffer(ImageBuffer&, const FloatRect& destinationRect) final;
     void recordClipOutToPath(const Path&) final;
     void recordClipPath(const Path&, WindRule) final;
     void recordBeginClipToDrawingCommands(const FloatRect& destination, DestinationColorSpace) final;
     void recordEndClipToDrawingCommands(const FloatRect& destination) final;
-    void recordDrawFilteredImageBuffer(std::optional<RenderingResourceIdentifier> sourceImageIdentifier, const FloatRect& sourceImageRect, Filter&) final;
+    void recordDrawFilteredImageBuffer(ImageBuffer*, const FloatRect& sourceImageRect, Filter&) final;
     void recordDrawGlyphs(const Font&, const GlyphBufferGlyph*, const GlyphBufferAdvance*, unsigned count, const FloatPoint& localAnchor, FontSmoothingMode) final;
-    void recordDrawImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) final;
+    void recordDrawImageBuffer(ImageBuffer&, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) final;
     void recordDrawNativeImage(RenderingResourceIdentifier imageIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions&) final;
     void recordDrawPattern(RenderingResourceIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& tileRect, const AffineTransform&, const FloatPoint& phase, const FloatSize& spacing, const ImagePaintingOptions& = { }) final;
     void recordBeginTransparencyLayer(float) final;

Modified: trunk/Source/WebKit/ChangeLog (289491 => 289492)


--- trunk/Source/WebKit/ChangeLog	2022-02-09 19:31:06 UTC (rev 289491)
+++ trunk/Source/WebKit/ChangeLog	2022-02-09 19:35:24 UTC (rev 289492)
@@ -1,3 +1,22 @@
+2022-02-09  Kimmo Kinnunen  <kkinnu...@apple.com>
+
+        DisplayListRecorder implementations are not able to obtain extra information out of source ImageBuffers
+        https://bugs.webkit.org/show_bug.cgi?id=236296
+
+        Reviewed by Wenson Hsieh.
+
+        RecorderImpl now passes ImageBuffers to the DisplayListRecorder calls.
+        Use the ImageBuffer& to get the resource identifier.
+        In future commits these places will obtain the read references, which
+        record the depenedency information needed for RemoteImageBuffers
+        created in multiple threads.
+
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
+        (WebKit::RemoteDisplayListRecorderProxy::recordClipToImageBuffer):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawFilteredImageBuffer):
+        (WebKit::RemoteDisplayListRecorderProxy::recordDrawImageBuffer):
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
+
 2022-02-09  Eliot Hsu  <eliot_...@apple.com>
 
         Move Safe Browsing knowledge into SafariSafeBrowsing framework

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp (289491 => 289492)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	2022-02-09 19:31:06 UTC (rev 289491)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp	2022-02-09 19:35:24 UTC (rev 289492)
@@ -175,9 +175,9 @@
     send(Messages::RemoteDisplayListRecorder::ClipOut(rect));
 }
 
-void RemoteDisplayListRecorderProxy::recordClipToImageBuffer(RenderingResourceIdentifier imageBufferIdentifier, const FloatRect& destinationRect)
+void RemoteDisplayListRecorderProxy::recordClipToImageBuffer(ImageBuffer& imageBuffer, const FloatRect& destinationRect)
 {
-    send(Messages::RemoteDisplayListRecorder::ClipToImageBuffer(imageBufferIdentifier, destinationRect));
+    send(Messages::RemoteDisplayListRecorder::ClipToImageBuffer(imageBuffer.renderingResourceIdentifier(), destinationRect));
 }
 
 void RemoteDisplayListRecorderProxy::recordClipOutToPath(const Path& path)
@@ -200,9 +200,12 @@
     send(Messages::RemoteDisplayListRecorder::EndClipToDrawingCommands(destination));
 }
 
-void RemoteDisplayListRecorderProxy::recordDrawFilteredImageBuffer(std::optional<RenderingResourceIdentifier> sourceImageIdentifier, const FloatRect& sourceImageRect, Filter& filter)
+void RemoteDisplayListRecorderProxy::recordDrawFilteredImageBuffer(ImageBuffer* sourceImage, const FloatRect& sourceImageRect, Filter& filter)
 {
-    send(Messages::RemoteDisplayListRecorder::DrawFilteredImageBuffer(sourceImageIdentifier, sourceImageRect, IPC::FilterReference(Ref<Filter> { filter })));
+    std::optional<RenderingResourceIdentifier> identifier;
+    if (sourceImage)
+        identifier = sourceImage->renderingResourceIdentifier();
+    send(Messages::RemoteDisplayListRecorder::DrawFilteredImageBuffer(WTFMove(identifier), sourceImageRect, IPC::FilterReference(Ref<Filter> { filter })));
 }
 
 void RemoteDisplayListRecorderProxy::recordDrawGlyphs(const Font& font, const GlyphBufferGlyph* glyphs, const GlyphBufferAdvance* advances, unsigned count, const FloatPoint& localAnchor, FontSmoothingMode mode)
@@ -210,9 +213,9 @@
     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)
+void RemoteDisplayListRecorderProxy::recordDrawImageBuffer(ImageBuffer& imageBuffer, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
 {
-    send(Messages::RemoteDisplayListRecorder::DrawImageBuffer(imageBufferIdentifier, destRect, srcRect, options));
+    send(Messages::RemoteDisplayListRecorder::DrawImageBuffer(imageBuffer.renderingResourceIdentifier(), destRect, srcRect, options));
 }
 
 void RemoteDisplayListRecorderProxy::recordDrawNativeImage(RenderingResourceIdentifier imageIdentifier, const FloatSize& imageSize, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h (289491 => 289492)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-02-09 19:31:06 UTC (rev 289491)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-02-09 19:35:24 UTC (rev 289492)
@@ -86,14 +86,14 @@
     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 recordClipToImageBuffer(WebCore::ImageBuffer&, 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, WebCore::DestinationColorSpace) final;
     void recordEndClipToDrawingCommands(const WebCore::FloatRect& destination) final;
-    void recordDrawFilteredImageBuffer(std::optional<WebCore::RenderingResourceIdentifier> sourceImageIdentifier, const WebCore::FloatRect& sourceImageRect, WebCore::Filter&) final;
+    void recordDrawFilteredImageBuffer(WebCore::ImageBuffer*, const WebCore::FloatRect& sourceImageRect, WebCore::Filter&) 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 recordDrawImageBuffer(WebCore::ImageBuffer&, 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;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to