Title: [270203] trunk
Revision
270203
Author
[email protected]
Date
2020-11-27 12:07:40 -0800 (Fri, 27 Nov 2020)

Log Message

Introduce new display list meta commands in preparation for webkit.org/b/219091
https://bugs.webkit.org/show_bug.cgi?id=219262

Reviewed by Ryosuke Niwa.

Source/WebCore:

Introduces two new display list items: `MetaCommandChangeDestinationImageBuffer` and `MetaCommandEnd`. These
meta commands will be used in a future patch to synchronize display list drawing commands between multiple
destination image buffers when using the GPU process by allowing `RemoteRenderingBackend` to process display
data that contains commands targeting more than one destination image buffer.

`MetaCommandChangeDestinationImageBuffer` is used to inform the replayer that the destination image buffer (in
which commands are replayed) should be changed to the new image buffer indicated by the rendering resource
identifier in the item. When replaying, we'll bail with `StopReplayReason::ChangeDestinationImageBuffer` and set
`nextDestinationImageBuffer` to the identifier of this next buffer.

`MetaCommandEnd` is used to inform the replayer that it should expect no more display list items; in a future
patch, `RemoteRenderingBackend` will take this as a cue to immediately stop waiting for more display list data
and go to sleep.

A stream of display list data will eventually consist of data targeting one or more destination image buffers,
separated by `MetaCommandChangeDestinationImageBuffer` items, and may span one or more item buffers, separated
by `MetaCommandChangeItemBuffer` items; finally, it will conclude with a `MetaCommandEnd` item.
The below diagram depicts one such stream of display list data, where we have two destination image buffers
(denoted by A and B), and display list item data spanning two item buffers (denoted by 1 and 2).

Wakeup message initiates display list processing with Image Buffer A and Item Buffer 1
    |
    |                                           MetaCommandChangeItemBuffer(2)
    |                                                        |
    |     MetaCommandChangeDestinationImageBuffer(B)         |
    |                       |                                |
    |                       |                                |
    v                       v                                v
    +-----------------------+--------------------------------++
    | +--------------------+ +------------------------------+ |
    | | Destination        | | Destination                  | | Item Buffer 1
    | | Image Buffer A     | | Image Buffer B               | |
    | +--------------------+ +------------------------------+ |
    +---------------------------------------------------------+

    +---------------------------------------------------------+
    | +--------------+ +-----------------------+              |
    | | Dst. Image   | | Destination Image     |  Unused      | Item Buffer 2
    | | Buffer B     | | Buffer A              |  Capacity    |
    | +--------------+ +-----------------------+              |
    +-----------------+-------------------------+-------------+
                      ^                         ^
                      |                         |
                      |                         |
                      |                     MetaCommandEnd
                      |
    MetaCommandChangeDestinationImageBuffer(A)

Additionally, rename `MetaCommandSwitchToItemBuffer` to `MetaCommandChangeItemBuffer`, such that it is
consistent with the new `MetaCommandChangeDestinationImageBuffer` item.

* platform/graphics/displaylists/DisplayList.cpp:
(WebCore::DisplayList::DisplayList::append):
* platform/graphics/displaylists/DisplayListItemBuffer.cpp:
(WebCore::DisplayList::ItemHandle::apply):
(WebCore::DisplayList::ItemHandle::destroy):
(WebCore::DisplayList::ItemHandle::copyTo const):
(WebCore::DisplayList::ItemBuffer::swapWritableBufferIfNeeded):
* platform/graphics/displaylists/DisplayListItemType.cpp:
(WebCore::DisplayList::sizeOfItemInBytes):
(WebCore::DisplayList::isDrawingItem):
(WebCore::DisplayList::isInlineItem):
* platform/graphics/displaylists/DisplayListItemType.h:
* platform/graphics/displaylists/DisplayListItems.cpp:
(WebCore::DisplayList::operator<<):
* platform/graphics/displaylists/DisplayListItems.h:
(WebCore::DisplayList::MetaCommandChangeItemBuffer::MetaCommandChangeItemBuffer):
(WebCore::DisplayList::MetaCommandChangeDestinationImageBuffer::MetaCommandChangeDestinationImageBuffer):
(WebCore::DisplayList::MetaCommandChangeDestinationImageBuffer::identifier const):
(WebCore::DisplayList::MetaCommandSwitchToItemBuffer::MetaCommandSwitchToItemBuffer): Deleted.
(WebCore::DisplayList::MetaCommandSwitchToItemBuffer::identifier const): Deleted.
* platform/graphics/displaylists/DisplayListReplayer.cpp:
(WebCore::DisplayList::Replayer::replay):
* platform/graphics/displaylists/DisplayListReplayer.h:

Source/WebKit:

See WebCore ChangeLog for more information. Additionally, rename `MetaCommandSwitchToItemBuffer` to
`MetaCommandChangeItemBuffer`, for consistency with the new `MetaCommandChangeDestinationImageBuffer` item.

* GPUProcess/graphics/RemoteImageBuffer.h:
* GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::decodeItem):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:

Tools:

Rename `MetaCommandSwitchToItemBuffer`.

* TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp:
(TestWebKitAPI::TEST):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (270202 => 270203)


--- trunk/Source/WebCore/ChangeLog	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebCore/ChangeLog	2020-11-27 20:07:40 UTC (rev 270203)
@@ -1,3 +1,85 @@
+2020-11-27  Wenson Hsieh  <[email protected]>
+
+        Introduce new display list meta commands in preparation for webkit.org/b/219091
+        https://bugs.webkit.org/show_bug.cgi?id=219262
+
+        Reviewed by Ryosuke Niwa.
+
+        Introduces two new display list items: `MetaCommandChangeDestinationImageBuffer` and `MetaCommandEnd`. These
+        meta commands will be used in a future patch to synchronize display list drawing commands between multiple
+        destination image buffers when using the GPU process by allowing `RemoteRenderingBackend` to process display
+        data that contains commands targeting more than one destination image buffer.
+
+        `MetaCommandChangeDestinationImageBuffer` is used to inform the replayer that the destination image buffer (in
+        which commands are replayed) should be changed to the new image buffer indicated by the rendering resource
+        identifier in the item. When replaying, we'll bail with `StopReplayReason::ChangeDestinationImageBuffer` and set
+        `nextDestinationImageBuffer` to the identifier of this next buffer.
+
+        `MetaCommandEnd` is used to inform the replayer that it should expect no more display list items; in a future
+        patch, `RemoteRenderingBackend` will take this as a cue to immediately stop waiting for more display list data
+        and go to sleep.
+
+        A stream of display list data will eventually consist of data targeting one or more destination image buffers,
+        separated by `MetaCommandChangeDestinationImageBuffer` items, and may span one or more item buffers, separated
+        by `MetaCommandChangeItemBuffer` items; finally, it will conclude with a `MetaCommandEnd` item.
+        The below diagram depicts one such stream of display list data, where we have two destination image buffers
+        (denoted by A and B), and display list item data spanning two item buffers (denoted by 1 and 2).
+
+        Wakeup message initiates display list processing with Image Buffer A and Item Buffer 1
+            |
+            |                                           MetaCommandChangeItemBuffer(2)
+            |                                                        |
+            |     MetaCommandChangeDestinationImageBuffer(B)         |
+            |                       |                                |
+            |                       |                                |
+            v                       v                                v
+            +-----------------------+--------------------------------++
+            | +--------------------+ +------------------------------+ |
+            | | Destination        | | Destination                  | | Item Buffer 1
+            | | Image Buffer A     | | Image Buffer B               | |
+            | +--------------------+ +------------------------------+ |
+            +---------------------------------------------------------+
+
+            +---------------------------------------------------------+
+            | +--------------+ +-----------------------+              |
+            | | Dst. Image   | | Destination Image     |  Unused      | Item Buffer 2
+            | | Buffer B     | | Buffer A              |  Capacity    |
+            | +--------------+ +-----------------------+              |
+            +-----------------+-------------------------+-------------+
+                              ^                         ^
+                              |                         |
+                              |                         |
+                              |                     MetaCommandEnd
+                              |
+            MetaCommandChangeDestinationImageBuffer(A)
+
+        Additionally, rename `MetaCommandSwitchToItemBuffer` to `MetaCommandChangeItemBuffer`, such that it is
+        consistent with the new `MetaCommandChangeDestinationImageBuffer` item.
+
+        * platform/graphics/displaylists/DisplayList.cpp:
+        (WebCore::DisplayList::DisplayList::append):
+        * platform/graphics/displaylists/DisplayListItemBuffer.cpp:
+        (WebCore::DisplayList::ItemHandle::apply):
+        (WebCore::DisplayList::ItemHandle::destroy):
+        (WebCore::DisplayList::ItemHandle::copyTo const):
+        (WebCore::DisplayList::ItemBuffer::swapWritableBufferIfNeeded):
+        * platform/graphics/displaylists/DisplayListItemType.cpp:
+        (WebCore::DisplayList::sizeOfItemInBytes):
+        (WebCore::DisplayList::isDrawingItem):
+        (WebCore::DisplayList::isInlineItem):
+        * platform/graphics/displaylists/DisplayListItemType.h:
+        * platform/graphics/displaylists/DisplayListItems.cpp:
+        (WebCore::DisplayList::operator<<):
+        * platform/graphics/displaylists/DisplayListItems.h:
+        (WebCore::DisplayList::MetaCommandChangeItemBuffer::MetaCommandChangeItemBuffer):
+        (WebCore::DisplayList::MetaCommandChangeDestinationImageBuffer::MetaCommandChangeDestinationImageBuffer):
+        (WebCore::DisplayList::MetaCommandChangeDestinationImageBuffer::identifier const):
+        (WebCore::DisplayList::MetaCommandSwitchToItemBuffer::MetaCommandSwitchToItemBuffer): Deleted.
+        (WebCore::DisplayList::MetaCommandSwitchToItemBuffer::identifier const): Deleted.
+        * platform/graphics/displaylists/DisplayListReplayer.cpp:
+        (WebCore::DisplayList::Replayer::replay):
+        * platform/graphics/displaylists/DisplayListReplayer.h:
+
 2020-11-27  Simon Fraser  <[email protected]>
 
         [LFC Display] Clean up CSS stacking context painting code

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp	2020-11-27 20:07:40 UTC (rev 270203)
@@ -278,8 +278,12 @@
         return append<FillEllipse>(item.get<FillEllipse>());
     case ItemType::FlushContext:
         return append<FlushContext>(item.get<FlushContext>());
-    case ItemType::MetaCommandSwitchToItemBuffer:
-        return append<MetaCommandSwitchToItemBuffer>(item.get<MetaCommandSwitchToItemBuffer>());
+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+        return append<MetaCommandChangeDestinationImageBuffer>(item.get<MetaCommandChangeDestinationImageBuffer>());
+    case ItemType::MetaCommandChangeItemBuffer:
+        return append<MetaCommandChangeItemBuffer>(item.get<MetaCommandChangeItemBuffer>());
+    case ItemType::MetaCommandEnd:
+        return append<MetaCommandEnd>(item.get<MetaCommandEnd>());
     case ItemType::PutImageData:
         return append<PutImageData>(item.get<PutImageData>());
     case ItemType::PaintFrameForMedia:

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp	2020-11-27 20:07:40 UTC (rev 270203)
@@ -226,7 +226,9 @@
         get<FlushContext>().apply(context);
         return;
     }
-    case ItemType::MetaCommandSwitchToItemBuffer:
+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+    case ItemType::MetaCommandChangeItemBuffer:
+    case ItemType::MetaCommandEnd:
         return;
     case ItemType::PutImageData: {
         get<PutImageData>().apply(context);
@@ -454,10 +456,18 @@
         static_assert(std::is_trivially_destructible<FlushContext>::value);
         return;
     }
-    case ItemType::MetaCommandSwitchToItemBuffer: {
-        static_assert(std::is_trivially_destructible<MetaCommandSwitchToItemBuffer>::value);
+    case ItemType::MetaCommandChangeDestinationImageBuffer: {
+        static_assert(std::is_trivially_destructible<MetaCommandChangeDestinationImageBuffer>::value);
         return;
     }
+    case ItemType::MetaCommandChangeItemBuffer: {
+        static_assert(std::is_trivially_destructible<MetaCommandChangeItemBuffer>::value);
+        return;
+    }
+    case ItemType::MetaCommandEnd: {
+        static_assert(std::is_trivially_destructible<MetaCommandEnd>::value);
+        return;
+    }
     case ItemType::PaintFrameForMedia: {
         static_assert(std::is_trivially_destructible<PaintFrameForMedia>::value);
         return;
@@ -705,10 +715,18 @@
         new (itemOffset) FlushContext(get<FlushContext>());
         return;
     }
-    case ItemType::MetaCommandSwitchToItemBuffer: {
-        new (itemOffset) MetaCommandSwitchToItemBuffer(get<MetaCommandSwitchToItemBuffer>());
+    case ItemType::MetaCommandChangeDestinationImageBuffer: {
+        new (itemOffset) MetaCommandChangeDestinationImageBuffer(get<MetaCommandChangeDestinationImageBuffer>());
         return;
     }
+    case ItemType::MetaCommandChangeItemBuffer: {
+        new (itemOffset) MetaCommandChangeItemBuffer(get<MetaCommandChangeItemBuffer>());
+        return;
+    }
+    case ItemType::MetaCommandEnd: {
+        new (itemOffset) MetaCommandEnd(get<MetaCommandEnd>());
+        return;
+    }
     case ItemType::PaintFrameForMedia: {
         new (itemOffset) PaintFrameForMedia(get<PaintFrameForMedia>());
         return;
@@ -860,7 +878,7 @@
 
 void ItemBuffer::swapWritableBufferIfNeeded(size_t numberOfBytes)
 {
-    auto sizeForBufferSwitchItem = paddedSizeOfTypeAndItemInBytes(ItemType::MetaCommandSwitchToItemBuffer);
+    auto sizeForBufferSwitchItem = paddedSizeOfTypeAndItemInBytes(ItemType::MetaCommandChangeItemBuffer);
     if (m_writtenNumberOfBytes + numberOfBytes + sizeForBufferSwitchItem <= m_writableBuffer.capacity)
         return;
 
@@ -867,7 +885,7 @@
     auto nextBuffer = createItemBuffer(numberOfBytes + sizeForBufferSwitchItem);
     bool hadPreviousBuffer = m_writableBuffer;
     if (hadPreviousBuffer)
-        uncheckedAppend<MetaCommandSwitchToItemBuffer>(nextBuffer.identifier);
+        uncheckedAppend<MetaCommandChangeItemBuffer>(nextBuffer.identifier);
     auto previousBuffer = std::exchange(m_writableBuffer, { });
     previousBuffer.capacity = std::exchange(m_writtenNumberOfBytes, 0);
     if (hadPreviousBuffer)

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp	2020-11-27 20:07:40 UTC (rev 270203)
@@ -126,8 +126,12 @@
         return sizeof(FillEllipse);
     case ItemType::FlushContext:
         return sizeof(FlushContext);
-    case ItemType::MetaCommandSwitchToItemBuffer:
-        return sizeof(MetaCommandSwitchToItemBuffer);
+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+        return sizeof(MetaCommandChangeDestinationImageBuffer);
+    case ItemType::MetaCommandChangeItemBuffer:
+        return sizeof(MetaCommandChangeItemBuffer);
+    case ItemType::MetaCommandEnd:
+        return sizeof(MetaCommandEnd);
     case ItemType::PutImageData:
         return sizeof(PutImageData);
     case ItemType::PaintFrameForMedia:
@@ -180,7 +184,9 @@
     case ItemType::ClipToDrawingCommands:
     case ItemType::ConcatenateCTM:
     case ItemType::FlushContext:
-    case ItemType::MetaCommandSwitchToItemBuffer:
+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+    case ItemType::MetaCommandChangeItemBuffer:
+    case ItemType::MetaCommandEnd:
     case ItemType::Restore:
     case ItemType::Rotate:
     case ItemType::Save:
@@ -291,7 +297,9 @@
 #endif
     case ItemType::FillRect:
     case ItemType::FlushContext:
-    case ItemType::MetaCommandSwitchToItemBuffer:
+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+    case ItemType::MetaCommandChangeItemBuffer:
+    case ItemType::MetaCommandEnd:
     case ItemType::PaintFrameForMedia:
     case ItemType::Restore:
     case ItemType::Rotate:

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h	2020-11-27 20:07:40 UTC (rev 270203)
@@ -76,7 +76,9 @@
     FillPath,
     FillEllipse,
     FlushContext,
-    MetaCommandSwitchToItemBuffer,
+    MetaCommandEnd,
+    MetaCommandChangeDestinationImageBuffer,
+    MetaCommandChangeItemBuffer,
     PutImageData,
     PaintFrameForMedia,
     StrokeRect,

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp	2020-11-27 20:07:40 UTC (rev 270203)
@@ -1002,12 +1002,23 @@
     return ts;
 }
 
-static TextStream& operator<<(TextStream& ts, const MetaCommandSwitchToItemBuffer& item)
+static TextStream& operator<<(TextStream& ts, const MetaCommandChangeItemBuffer& item)
 {
     ts.dumpProperty("identifier", item.identifier());
     return ts;
 }
 
+static TextStream& operator<<(TextStream& ts, const MetaCommandChangeDestinationImageBuffer& item)
+{
+    ts.dumpProperty("identifier", item.identifier());
+    return ts;
+}
+
+static TextStream& operator<<(TextStream& ts, const MetaCommandEnd&)
+{
+    return ts;
+}
+
 static TextStream& operator<<(TextStream& ts, ItemType type)
 {
     switch (type) {
@@ -1057,7 +1068,9 @@
     case ItemType::FillPath: ts << "fill-path"; break;
     case ItemType::FillEllipse: ts << "fill-ellipse"; break;
     case ItemType::FlushContext: ts << "flush-context"; break;
-    case ItemType::MetaCommandSwitchToItemBuffer: ts << "meta-command-switch-to-item-buffer"; break;
+    case ItemType::MetaCommandChangeDestinationImageBuffer: ts << "meta-command-change-destination-image-buffer"; break;
+    case ItemType::MetaCommandChangeItemBuffer: ts << "meta-command-change-item-buffer"; break;
+    case ItemType::MetaCommandEnd: ts << "meta-command-end"; break;
     case ItemType::PutImageData: ts << "put-image-data"; break;
     case ItemType::PaintFrameForMedia: ts << "paint-frame-for-media"; break;
     case ItemType::StrokeRect: ts << "stroke-rect"; break;
@@ -1213,9 +1226,15 @@
     case ItemType::FlushContext:
         ts << item.get<FlushContext>();
         break;
-    case ItemType::MetaCommandSwitchToItemBuffer:
-        ts << item.get<MetaCommandSwitchToItemBuffer>();
+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+        ts << item.get<MetaCommandChangeDestinationImageBuffer>();
         break;
+    case ItemType::MetaCommandChangeItemBuffer:
+        ts << item.get<MetaCommandChangeItemBuffer>();
+        break;
+    case ItemType::MetaCommandEnd:
+        ts << item.get<MetaCommandEnd>();
+        break;
     case ItemType::PutImageData:
         ts << item.get<PutImageData>();
         break;

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h	2020-11-27 20:07:40 UTC (rev 270203)
@@ -2232,14 +2232,14 @@
 };
 
 // FIXME: This should be refactored so that the command to "switch to the next item buffer"
-// is not itself a drawing item.
-class MetaCommandSwitchToItemBuffer {
+// is not itself a display list item.
+class MetaCommandChangeItemBuffer {
 public:
-    static constexpr ItemType itemType = ItemType::MetaCommandSwitchToItemBuffer;
+    static constexpr ItemType itemType = ItemType::MetaCommandChangeItemBuffer;
     static constexpr bool isInlineItem = true;
     static constexpr bool isDrawingItem = false;
 
-    MetaCommandSwitchToItemBuffer(ItemBufferIdentifier identifier)
+    MetaCommandChangeItemBuffer(ItemBufferIdentifier identifier)
         : m_identifier(identifier)
     {
     }
@@ -2250,6 +2250,30 @@
     ItemBufferIdentifier m_identifier;
 };
 
+class MetaCommandEnd {
+public:
+    static constexpr ItemType itemType = ItemType::MetaCommandEnd;
+    static constexpr bool isInlineItem = true;
+    static constexpr bool isDrawingItem = false;
+};
+
+class MetaCommandChangeDestinationImageBuffer {
+public:
+    static constexpr ItemType itemType = ItemType::MetaCommandChangeDestinationImageBuffer;
+    static constexpr bool isInlineItem = true;
+    static constexpr bool isDrawingItem = false;
+
+    MetaCommandChangeDestinationImageBuffer(RenderingResourceIdentifier identifier)
+        : m_identifier(identifier)
+    {
+    }
+
+    RenderingResourceIdentifier identifier() const { return m_identifier; }
+
+private:
+    RenderingResourceIdentifier m_identifier;
+};
+
 TextStream& operator<<(TextStream&, ItemHandle);
 
 } // namespace DisplayList
@@ -2307,7 +2331,9 @@
     WebCore::DisplayList::ItemType::FillPath,
     WebCore::DisplayList::ItemType::FillEllipse,
     WebCore::DisplayList::ItemType::FlushContext,
-    WebCore::DisplayList::ItemType::MetaCommandSwitchToItemBuffer,
+    WebCore::DisplayList::ItemType::MetaCommandEnd,
+    WebCore::DisplayList::ItemType::MetaCommandChangeDestinationImageBuffer,
+    WebCore::DisplayList::ItemType::MetaCommandChangeItemBuffer,
     WebCore::DisplayList::ItemType::PutImageData,
     WebCore::DisplayList::ItemType::PaintFrameForMedia,
     WebCore::DisplayList::ItemType::StrokeRect,

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp (270202 => 270203)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp	2020-11-27 20:07:40 UTC (rev 270203)
@@ -109,6 +109,20 @@
         }
 
         LOG_WITH_STREAM(DisplayLists, stream << "applying " << i++ << " " << item);
+
+        if (item.is<MetaCommandChangeDestinationImageBuffer>()) {
+            result.numberOfBytesRead += itemSizeInBuffer;
+            result.reasonForStopping = StopReplayReason::ChangeDestinationImageBuffer;
+            result.nextDestinationImageBuffer = item.get<MetaCommandChangeDestinationImageBuffer>().identifier();
+            break;
+        }
+
+        if (item.is<MetaCommandEnd>()) {
+            result.numberOfBytesRead += itemSizeInBuffer;
+            result.reasonForStopping = StopReplayReason::EndOfDisplayList;
+            break;
+        }
+
         if (auto reasonForStopping = applyItem(item)) {
             result.reasonForStopping = *reasonForStopping;
             break;

Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h (270202 => 270203)


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h	2020-11-27 20:07:40 UTC (rev 270203)
@@ -41,6 +41,8 @@
 enum class StopReplayReason : uint8_t {
     ReplayedAllItems,
     MissingCachedResource,
+    ChangeDestinationImageBuffer,
+    EndOfDisplayList,
     DecodingFailure // FIXME: Propagate decoding errors to display list replay clients through this enum as well.
 };
 
@@ -47,6 +49,7 @@
 struct ReplayResult {
     std::unique_ptr<DisplayList> trackedDisplayList;
     size_t numberOfBytesRead { 0 };
+    Optional<RenderingResourceIdentifier> nextDestinationImageBuffer;
     StopReplayReason reasonForStopping { StopReplayReason::ReplayedAllItems };
 };
 

Modified: trunk/Source/WebKit/ChangeLog (270202 => 270203)


--- trunk/Source/WebKit/ChangeLog	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebKit/ChangeLog	2020-11-27 20:07:40 UTC (rev 270203)
@@ -1,5 +1,20 @@
 2020-11-27  Wenson Hsieh  <[email protected]>
 
+        Introduce new display list meta commands in preparation for webkit.org/b/219091
+        https://bugs.webkit.org/show_bug.cgi?id=219262
+
+        Reviewed by Ryosuke Niwa.
+
+        See WebCore ChangeLog for more information. Additionally, rename `MetaCommandSwitchToItemBuffer` to
+        `MetaCommandChangeItemBuffer`, for consistency with the new `MetaCommandChangeDestinationImageBuffer` item.
+
+        * GPUProcess/graphics/RemoteImageBuffer.h:
+        * GPUProcess/graphics/RemoteRenderingBackend.cpp:
+        (WebKit::RemoteRenderingBackend::decodeItem):
+        * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+
+2020-11-27  Wenson Hsieh  <[email protected]>
+
         Remove some extraneous PLATFORM(IOS_FAMILY) guards in WKContentViewInteraction
         https://bugs.webkit.org/show_bug.cgi?id=219289
 

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.h (270202 => 270203)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.h	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.h	2020-11-27 20:07:40 UTC (rev 270203)
@@ -92,8 +92,8 @@
             return true;
         }
 
-        if (item.is<WebCore::DisplayList::MetaCommandSwitchToItemBuffer>()) {
-            auto nextBufferIdentifier = item.get<WebCore::DisplayList::MetaCommandSwitchToItemBuffer>().identifier();
+        if (item.is<WebCore::DisplayList::MetaCommandChangeItemBuffer>()) {
+            auto nextBufferIdentifier = item.get<WebCore::DisplayList::MetaCommandChangeItemBuffer>().identifier();
             m_remoteRenderingBackend.setNextItemBufferToRead(nextBufferIdentifier);
             return true;
         }

Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (270202 => 270203)


--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp	2020-11-27 20:07:40 UTC (rev 270203)
@@ -315,7 +315,9 @@
 #endif
     case DisplayList::ItemType::FillRect:
     case DisplayList::ItemType::FlushContext:
-    case DisplayList::ItemType::MetaCommandSwitchToItemBuffer:
+    case DisplayList::ItemType::MetaCommandChangeDestinationImageBuffer:
+    case DisplayList::ItemType::MetaCommandChangeItemBuffer:
+    case DisplayList::ItemType::MetaCommandEnd:
     case DisplayList::ItemType::PaintFrameForMedia:
     case DisplayList::ItemType::Restore:
     case DisplayList::ItemType::Rotate:

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


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2020-11-27 20:07:40 UTC (rev 270203)
@@ -305,7 +305,9 @@
 #endif
         case WebCore::DisplayList::ItemType::FillRect:
         case WebCore::DisplayList::ItemType::FlushContext:
-        case WebCore::DisplayList::ItemType::MetaCommandSwitchToItemBuffer:
+        case WebCore::DisplayList::ItemType::MetaCommandChangeDestinationImageBuffer:
+        case WebCore::DisplayList::ItemType::MetaCommandChangeItemBuffer:
+        case WebCore::DisplayList::ItemType::MetaCommandEnd:
         case WebCore::DisplayList::ItemType::PaintFrameForMedia:
         case WebCore::DisplayList::ItemType::Restore:
         case WebCore::DisplayList::ItemType::Rotate:

Modified: trunk/Tools/ChangeLog (270202 => 270203)


--- trunk/Tools/ChangeLog	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Tools/ChangeLog	2020-11-27 20:07:40 UTC (rev 270203)
@@ -1,3 +1,15 @@
+2020-11-27  Wenson Hsieh  <[email protected]>
+
+        Introduce new display list meta commands in preparation for webkit.org/b/219091
+        https://bugs.webkit.org/show_bug.cgi?id=219262
+
+        Reviewed by Ryosuke Niwa.
+
+        Rename `MetaCommandSwitchToItemBuffer`.
+
+        * TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp:
+        (TestWebKitAPI::TEST):
+
 2020-11-27  Aakash Jain  <[email protected]>
 
         [build.webkit.org] use lz4 compression for improving buildbot performance

Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp (270202 => 270203)


--- trunk/Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp	2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp	2020-11-27 20:07:40 UTC (rev 270203)
@@ -121,7 +121,7 @@
             break;
         }
 #endif
-        case ItemType::MetaCommandSwitchToItemBuffer:
+        case ItemType::MetaCommandChangeItemBuffer:
             break;
         default: {
             observedUnexpectedItem = true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to