Title: [293770] trunk
Revision
293770
Author
[email protected]
Date
2022-05-04 03:31:55 -0700 (Wed, 04 May 2022)

Log Message

DisplayList::Recorder has redundant, unused flushContext
https://bugs.webkit.org/show_bug.cgi?id=239999

Patch by Kimmo Kinnunen <[email protected]> on 2022-05-04
Reviewed by Simon Fraser.

Remove DisplayList::Recorder::flushContext(GraphicsContextFlushIdentifier)
It was unused.
Source/WebCore:

"Flush context" is not a display list item. It is a command for the graphics
context, issued a underlying resource is being used outside the graphics context
abstraction. As display list is working inside the abstraction, there's nothing
that could possibly use the underlying resources between flush and the next
item.

GraphicsContextFlushIdentifier cannot possibly be constructed in sensible way
at WebCore level.

* platform/graphics/displaylists/DisplayListItems.h:
* platform/graphics/displaylists/DisplayListRecorder.h:
* platform/graphics/displaylists/DisplayListRecorderImpl.h:

Source/WebKit:

It has wrong signature for proper operation for the concrete classes.

* WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293769 => 293770)


--- trunk/Source/WebCore/ChangeLog	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebCore/ChangeLog	2022-05-04 10:31:55 UTC (rev 293770)
@@ -1,3 +1,27 @@
+2022-05-04  Kimmo Kinnunen  <[email protected]>
+
+        DisplayList::Recorder has redundant, unused flushContext
+        https://bugs.webkit.org/show_bug.cgi?id=239999
+
+        Reviewed by Simon Fraser.
+
+        Remove DisplayList::Recorder::flushContext(GraphicsContextFlushIdentifier)
+        It was unused.
+
+        "Flush context" is not a display list item. It is a command for the graphics
+        context, issued a underlying resource is being used outside the graphics context
+        abstraction. As display list is working inside the abstraction, there's nothing
+        that could possibly use the underlying resources between flush and the next
+        item.
+
+        GraphicsContextFlushIdentifier cannot possibly be constructed in sensible way
+        at WebCore level.
+
+
+        * platform/graphics/displaylists/DisplayListItems.h:
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        * platform/graphics/displaylists/DisplayListRecorderImpl.h:
+
 2022-05-04  Megan Gardner  <[email protected]>
 
         Enable TextCheckingType::Correction on MacCatalyst.

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp (293769 => 293770)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2022-05-04 10:31:55 UTC (rev 293770)
@@ -20,7 +20,7 @@
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
@@ -291,8 +291,6 @@
         return append<FillPath>(item.get<FillPath>());
     case ItemType::FillEllipse:
         return append<FillEllipse>(item.get<FillEllipse>());
-    case ItemType::FlushContext:
-        return append<FlushContext>(item.get<FlushContext>());
 #if ENABLE(VIDEO)
     case ItemType::PaintFrameForMedia:
         return append<PaintFrameForMedia>(item.get<PaintFrameForMedia>());

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp (293769 => 293770)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2022-05-04 10:31:55 UTC (rev 293770)
@@ -189,9 +189,6 @@
     case ItemType::FillEllipse:
         get<FillEllipse>().apply(context);
         return;
-    case ItemType::FlushContext:
-        get<FlushContext>().apply(context);
-        return;
 #if ENABLE(VIDEO)
     case ItemType::PaintFrameForMedia:
         get<PaintFrameForMedia>().apply(context);
@@ -376,9 +373,6 @@
     case ItemType::FillRect:
         static_assert(std::is_trivially_destructible<FillRect>::value);
         return;
-    case ItemType::FlushContext:
-        static_assert(std::is_trivially_destructible<FlushContext>::value);
-        return;
 #if ENABLE(VIDEO)
     case ItemType::PaintFrameForMedia:
         static_assert(std::is_trivially_destructible<PaintFrameForMedia>::value);
@@ -565,8 +559,6 @@
 #endif
     case ItemType::FillRect:
         return copyInto<FillRect>(itemOffset, *this);
-    case ItemType::FlushContext:
-        return copyInto<FlushContext>(itemOffset, *this);
 #if ENABLE(VIDEO)
     case ItemType::PaintFrameForMedia:
         return copyInto<PaintFrameForMedia>(itemOffset, *this);

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp (293769 => 293770)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2022-05-04 10:31:55 UTC (rev 293770)
@@ -130,8 +130,6 @@
         return sizeof(FillPath);
     case ItemType::FillEllipse:
         return sizeof(FillEllipse);
-    case ItemType::FlushContext:
-        return sizeof(FlushContext);
 #if ENABLE(VIDEO)
     case ItemType::PaintFrameForMedia:
         return sizeof(PaintFrameForMedia);
@@ -189,7 +187,6 @@
     case ItemType::ClipOutToPath:
     case ItemType::ClipPath:
     case ItemType::ConcatenateCTM:
-    case ItemType::FlushContext:
     case ItemType::Restore:
     case ItemType::Rotate:
     case ItemType::Save:
@@ -328,7 +325,6 @@
     case ItemType::FillBezierCurve:
 #endif
     case ItemType::FillRect:
-    case ItemType::FlushContext:
 #if ENABLE(VIDEO)
     case ItemType::PaintFrameForMedia:
 #endif

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h (293769 => 293770)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h	2022-05-04 10:31:55 UTC (rev 293770)
@@ -78,7 +78,6 @@
 #endif
     FillPath,
     FillEllipse,
-    FlushContext,
 #if ENABLE(VIDEO)
     PaintFrameForMedia,
 #endif

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp (293769 => 293770)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2022-05-04 10:31:55 UTC (rev 293770)
@@ -20,7 +20,7 @@
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include "config.h"
@@ -991,17 +991,6 @@
     return ts;
 }
 
-void FlushContext::apply(GraphicsContext&) const
-{
-    // Handled by client.
-}
-
-static TextStream& operator<<(TextStream& ts, const FlushContext& item)
-{
-    ts.dumpProperty("identifier", item.identifier());
-    return ts;
-}
-
 static TextStream& operator<<(TextStream& ts, ItemType type)
 {
     switch (type) {
@@ -1053,7 +1042,6 @@
 #endif
     case ItemType::FillPath: ts << "fill-path"; break;
     case ItemType::FillEllipse: ts << "fill-ellipse"; break;
-    case ItemType::FlushContext: ts << "flush-context"; break;
 #if ENABLE(VIDEO)
     case ItemType::PaintFrameForMedia: ts << "paint-frame-for-media"; break;
 #endif
@@ -1218,9 +1206,6 @@
     case ItemType::FillEllipse:
         ts << item.get<FillEllipse>();
         break;
-    case ItemType::FlushContext:
-        ts << item.get<FlushContext>();
-        break;
 #if ENABLE(VIDEO)
     case ItemType::PaintFrameForMedia:
         ts << item.get<PaintFrameForMedia>();

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2022-05-04 10:31:55 UTC (rev 293770)
@@ -20,7 +20,7 @@
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #pragma once
@@ -33,7 +33,6 @@
 #include "GlyphBuffer.h"
 #include "Gradient.h"
 #include "GraphicsContext.h"
-#include "GraphicsContextFlushIdentifier.h"
 #include "Image.h"
 #include "MediaPlayerIdentifier.h"
 #include "Pattern.h"
@@ -441,7 +440,7 @@
         , m_destinationRect(destinationRect)
     {
     }
-    
+
     RenderingResourceIdentifier imageBufferIdentifier() const { return m_imageBufferIdentifier; }
     FloatRect destinationRect() const { return m_destinationRect; }
     bool isValid() const { return m_imageBufferIdentifier.isValid(); }
@@ -1975,26 +1974,6 @@
     float m_scaleFactor { 1 };
 };
 
-class FlushContext {
-public:
-    static constexpr ItemType itemType = ItemType::FlushContext;
-    static constexpr bool isInlineItem = true;
-    static constexpr bool isDrawingItem = false;
-
-    explicit FlushContext(GraphicsContextFlushIdentifier identifier)
-        : m_identifier(identifier)
-    {
-    }
-
-    GraphicsContextFlushIdentifier identifier() const { return m_identifier; }
-    bool isValid() const { return m_identifier.isValid(); }
-
-    WEBCORE_EXPORT void apply(GraphicsContext&) const;
-
-private:
-    GraphicsContextFlushIdentifier m_identifier;
-};
-
 using DisplayListItem = std::variant
     < ApplyDeviceScaleFactor
     , BeginTransparencyLayer
@@ -2029,7 +2008,6 @@
     , FillRectWithGradient
     , FillRectWithRoundedHole
     , FillRoundedRect
-    , FlushContext
     , Restore
     , Rotate
     , Save
@@ -2130,7 +2108,6 @@
 #endif
     WebCore::DisplayList::ItemType::FillPath,
     WebCore::DisplayList::ItemType::FillEllipse,
-    WebCore::DisplayList::ItemType::FlushContext,
 #if ENABLE(VIDEO)
     WebCore::DisplayList::ItemType::PaintFrameForMedia,
 #endif

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2022-05-04 10:31:55 UTC (rev 293770)
@@ -56,7 +56,6 @@
 
     virtual void convertToLuminanceMask() = 0;
     virtual void transformToColorSpace(const DestinationColorSpace&) = 0;
-    virtual void flushContext(GraphicsContextFlushIdentifier) = 0;
 
 protected:
     virtual void recordSave() = 0;

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h	2022-05-04 10:31:55 UTC (rev 293770)
@@ -42,7 +42,6 @@
 
     void convertToLuminanceMask() final { }
     void transformToColorSpace(const DestinationColorSpace&) final { }
-    void flushContext(GraphicsContextFlushIdentifier identifier) final { append<FlushContext>(identifier); }
 
 private:
     void recordSave() final;

Modified: trunk/Source/WebKit/ChangeLog (293769 => 293770)


--- trunk/Source/WebKit/ChangeLog	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebKit/ChangeLog	2022-05-04 10:31:55 UTC (rev 293770)
@@ -1,3 +1,16 @@
+2022-05-04  Kimmo Kinnunen  <[email protected]>
+
+        DisplayList::Recorder has redundant, unused flushContext
+        https://bugs.webkit.org/show_bug.cgi?id=239999
+
+        Reviewed by Simon Fraser.
+
+        Remove DisplayList::Recorder::flushContext(GraphicsContextFlushIdentifier)
+        It was unused.
+        It has wrong signature for proper operation for the concrete classes.
+
+        * WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h:
+
 2022-05-04  Youenn Fablet  <[email protected]>
 
         LibWebRTCCodecs does no longer need a pixel conformer

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


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.h	2022-05-04 10:31:55 UTC (rev 293770)
@@ -47,7 +47,7 @@
 
     void convertToLuminanceMask() final;
     void transformToColorSpace(const WebCore::DestinationColorSpace&) final;
-    void flushContext(WebCore::GraphicsContextFlushIdentifier) final;
+    void flushContext(WebCore::GraphicsContextFlushIdentifier);
 
 private:
     template<typename T>

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp (293769 => 293770)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp	2022-05-04 10:12:32 UTC (rev 293769)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/cg/DisplayListTestsCG.cpp	2022-05-04 10:31:55 UTC (rev 293770)
@@ -148,13 +148,13 @@
     auto cgContext = adoptCF(CGBitmapContextCreate(nullptr, contextWidth, contextHeight, 8, 4 * contextWidth, colorSpace.get(), kCGImageAlphaPremultipliedLast));
     GraphicsContextCG context { cgContext.get() };
 
-    auto runTestWithInvalidIdentifier = [&](GraphicsContextFlushIdentifier identifier) {
+    auto runTestWithInvalidIdentifier = [&](RenderingResourceIdentifier identifier) {
         EXPECT_FALSE(identifier.isValid());
 
         DisplayList list;
         ReadingClient reader;
         list.setItemBufferReadingClient(&reader);
-        list.append<FlushContext>(identifier);
+        list.append<ClipToImageBuffer>(identifier, FloatRect { });
 
         Replayer replayer { context, list };
         auto result = replayer.replay();
@@ -163,8 +163,8 @@
         EXPECT_EQ(result.reasonForStopping, StopReplayReason::InvalidItemOrExtent);
     };
 
-    runTestWithInvalidIdentifier(GraphicsContextFlushIdentifier { });
-    runTestWithInvalidIdentifier(GraphicsContextFlushIdentifier { WTF::HashTableDeletedValue });
+    runTestWithInvalidIdentifier(RenderingResourceIdentifier { });
+    runTestWithInvalidIdentifier(RenderingResourceIdentifier { WTF::HashTableDeletedValue });
 }
 
 } // namespace TestWebKitAPI
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to