<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[270203] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/270203">270203</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2020-11-27 12:07:40 -0800 (Fri, 27 Nov 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListcpp">trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemBuffercpp">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemTypecpp">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemTypeh">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemscpp">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemsh">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListReplayercpp">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListReplayerh">trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicsRemoteImageBufferh">trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.h</a></li>
<li><a href="#trunkSourceWebKitGPUProcessgraphicsRemoteRenderingBackendcpp">trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessGPUgraphicsRemoteImageBufferProxyh">trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebCoreDisplayListTestscpp">trunk/Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,85 @@
</span><ins>+2020-11-27  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        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:
+
</ins><span class="cx"> 2020-11-27  Simon Fraser  <simon.fraser@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [LFC Display] Clean up CSS stacking context painting code
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.cpp (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -278,8 +278,12 @@
</span><span class="cx">         return append<FillEllipse>(item.get<FillEllipse>());
</span><span class="cx">     case ItemType::FlushContext:
</span><span class="cx">         return append<FlushContext>(item.get<FlushContext>());
</span><del>-    case ItemType::MetaCommandSwitchToItemBuffer:
-        return append<MetaCommandSwitchToItemBuffer>(item.get<MetaCommandSwitchToItemBuffer>());
</del><ins>+    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>());
</ins><span class="cx">     case ItemType::PutImageData:
</span><span class="cx">         return append<PutImageData>(item.get<PutImageData>());
</span><span class="cx">     case ItemType::PaintFrameForMedia:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemBuffercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemBuffer.cpp (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -226,7 +226,9 @@
</span><span class="cx">         get<FlushContext>().apply(context);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    case ItemType::MetaCommandSwitchToItemBuffer:
</del><ins>+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+    case ItemType::MetaCommandChangeItemBuffer:
+    case ItemType::MetaCommandEnd:
</ins><span class="cx">         return;
</span><span class="cx">     case ItemType::PutImageData: {
</span><span class="cx">         get<PutImageData>().apply(context);
</span><span class="lines">@@ -454,10 +456,18 @@
</span><span class="cx">         static_assert(std::is_trivially_destructible<FlushContext>::value);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    case ItemType::MetaCommandSwitchToItemBuffer: {
-        static_assert(std::is_trivially_destructible<MetaCommandSwitchToItemBuffer>::value);
</del><ins>+    case ItemType::MetaCommandChangeDestinationImageBuffer: {
+        static_assert(std::is_trivially_destructible<MetaCommandChangeDestinationImageBuffer>::value);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+    case ItemType::MetaCommandChangeItemBuffer: {
+        static_assert(std::is_trivially_destructible<MetaCommandChangeItemBuffer>::value);
+        return;
+    }
+    case ItemType::MetaCommandEnd: {
+        static_assert(std::is_trivially_destructible<MetaCommandEnd>::value);
+        return;
+    }
</ins><span class="cx">     case ItemType::PaintFrameForMedia: {
</span><span class="cx">         static_assert(std::is_trivially_destructible<PaintFrameForMedia>::value);
</span><span class="cx">         return;
</span><span class="lines">@@ -705,10 +715,18 @@
</span><span class="cx">         new (itemOffset) FlushContext(get<FlushContext>());
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    case ItemType::MetaCommandSwitchToItemBuffer: {
-        new (itemOffset) MetaCommandSwitchToItemBuffer(get<MetaCommandSwitchToItemBuffer>());
</del><ins>+    case ItemType::MetaCommandChangeDestinationImageBuffer: {
+        new (itemOffset) MetaCommandChangeDestinationImageBuffer(get<MetaCommandChangeDestinationImageBuffer>());
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><ins>+    case ItemType::MetaCommandChangeItemBuffer: {
+        new (itemOffset) MetaCommandChangeItemBuffer(get<MetaCommandChangeItemBuffer>());
+        return;
+    }
+    case ItemType::MetaCommandEnd: {
+        new (itemOffset) MetaCommandEnd(get<MetaCommandEnd>());
+        return;
+    }
</ins><span class="cx">     case ItemType::PaintFrameForMedia: {
</span><span class="cx">         new (itemOffset) PaintFrameForMedia(get<PaintFrameForMedia>());
</span><span class="cx">         return;
</span><span class="lines">@@ -860,7 +878,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ItemBuffer::swapWritableBufferIfNeeded(size_t numberOfBytes)
</span><span class="cx"> {
</span><del>-    auto sizeForBufferSwitchItem = paddedSizeOfTypeAndItemInBytes(ItemType::MetaCommandSwitchToItemBuffer);
</del><ins>+    auto sizeForBufferSwitchItem = paddedSizeOfTypeAndItemInBytes(ItemType::MetaCommandChangeItemBuffer);
</ins><span class="cx">     if (m_writtenNumberOfBytes + numberOfBytes + sizeForBufferSwitchItem <= m_writableBuffer.capacity)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -867,7 +885,7 @@
</span><span class="cx">     auto nextBuffer = createItemBuffer(numberOfBytes + sizeForBufferSwitchItem);
</span><span class="cx">     bool hadPreviousBuffer = m_writableBuffer;
</span><span class="cx">     if (hadPreviousBuffer)
</span><del>-        uncheckedAppend<MetaCommandSwitchToItemBuffer>(nextBuffer.identifier);
</del><ins>+        uncheckedAppend<MetaCommandChangeItemBuffer>(nextBuffer.identifier);
</ins><span class="cx">     auto previousBuffer = std::exchange(m_writableBuffer, { });
</span><span class="cx">     previousBuffer.capacity = std::exchange(m_writtenNumberOfBytes, 0);
</span><span class="cx">     if (hadPreviousBuffer)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.cpp (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -126,8 +126,12 @@
</span><span class="cx">         return sizeof(FillEllipse);
</span><span class="cx">     case ItemType::FlushContext:
</span><span class="cx">         return sizeof(FlushContext);
</span><del>-    case ItemType::MetaCommandSwitchToItemBuffer:
-        return sizeof(MetaCommandSwitchToItemBuffer);
</del><ins>+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+        return sizeof(MetaCommandChangeDestinationImageBuffer);
+    case ItemType::MetaCommandChangeItemBuffer:
+        return sizeof(MetaCommandChangeItemBuffer);
+    case ItemType::MetaCommandEnd:
+        return sizeof(MetaCommandEnd);
</ins><span class="cx">     case ItemType::PutImageData:
</span><span class="cx">         return sizeof(PutImageData);
</span><span class="cx">     case ItemType::PaintFrameForMedia:
</span><span class="lines">@@ -180,7 +184,9 @@
</span><span class="cx">     case ItemType::ClipToDrawingCommands:
</span><span class="cx">     case ItemType::ConcatenateCTM:
</span><span class="cx">     case ItemType::FlushContext:
</span><del>-    case ItemType::MetaCommandSwitchToItemBuffer:
</del><ins>+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+    case ItemType::MetaCommandChangeItemBuffer:
+    case ItemType::MetaCommandEnd:
</ins><span class="cx">     case ItemType::Restore:
</span><span class="cx">     case ItemType::Rotate:
</span><span class="cx">     case ItemType::Save:
</span><span class="lines">@@ -291,7 +297,9 @@
</span><span class="cx"> #endif
</span><span class="cx">     case ItemType::FillRect:
</span><span class="cx">     case ItemType::FlushContext:
</span><del>-    case ItemType::MetaCommandSwitchToItemBuffer:
</del><ins>+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+    case ItemType::MetaCommandChangeItemBuffer:
+    case ItemType::MetaCommandEnd:
</ins><span class="cx">     case ItemType::PaintFrameForMedia:
</span><span class="cx">     case ItemType::Restore:
</span><span class="cx">     case ItemType::Rotate:
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemTypeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItemType.h (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -76,7 +76,9 @@
</span><span class="cx">     FillPath,
</span><span class="cx">     FillEllipse,
</span><span class="cx">     FlushContext,
</span><del>-    MetaCommandSwitchToItemBuffer,
</del><ins>+    MetaCommandEnd,
+    MetaCommandChangeDestinationImageBuffer,
+    MetaCommandChangeItemBuffer,
</ins><span class="cx">     PutImageData,
</span><span class="cx">     PaintFrameForMedia,
</span><span class="cx">     StrokeRect,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.cpp (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1002,12 +1002,23 @@
</span><span class="cx">     return ts;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static TextStream& operator<<(TextStream& ts, const MetaCommandSwitchToItemBuffer& item)
</del><ins>+static TextStream& operator<<(TextStream& ts, const MetaCommandChangeItemBuffer& item)
</ins><span class="cx"> {
</span><span class="cx">     ts.dumpProperty("identifier", item.identifier());
</span><span class="cx">     return ts;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static TextStream& operator<<(TextStream& ts, const MetaCommandChangeDestinationImageBuffer& item)
+{
+    ts.dumpProperty("identifier", item.identifier());
+    return ts;
+}
+
+static TextStream& operator<<(TextStream& ts, const MetaCommandEnd&)
+{
+    return ts;
+}
+
</ins><span class="cx"> static TextStream& operator<<(TextStream& ts, ItemType type)
</span><span class="cx"> {
</span><span class="cx">     switch (type) {
</span><span class="lines">@@ -1057,7 +1068,9 @@
</span><span class="cx">     case ItemType::FillPath: ts << "fill-path"; break;
</span><span class="cx">     case ItemType::FillEllipse: ts << "fill-ellipse"; break;
</span><span class="cx">     case ItemType::FlushContext: ts << "flush-context"; break;
</span><del>-    case ItemType::MetaCommandSwitchToItemBuffer: ts << "meta-command-switch-to-item-buffer"; break;
</del><ins>+    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;
</ins><span class="cx">     case ItemType::PutImageData: ts << "put-image-data"; break;
</span><span class="cx">     case ItemType::PaintFrameForMedia: ts << "paint-frame-for-media"; break;
</span><span class="cx">     case ItemType::StrokeRect: ts << "stroke-rect"; break;
</span><span class="lines">@@ -1213,9 +1226,15 @@
</span><span class="cx">     case ItemType::FlushContext:
</span><span class="cx">         ts << item.get<FlushContext>();
</span><span class="cx">         break;
</span><del>-    case ItemType::MetaCommandSwitchToItemBuffer:
-        ts << item.get<MetaCommandSwitchToItemBuffer>();
</del><ins>+    case ItemType::MetaCommandChangeDestinationImageBuffer:
+        ts << item.get<MetaCommandChangeDestinationImageBuffer>();
</ins><span class="cx">         break;
</span><ins>+    case ItemType::MetaCommandChangeItemBuffer:
+        ts << item.get<MetaCommandChangeItemBuffer>();
+        break;
+    case ItemType::MetaCommandEnd:
+        ts << item.get<MetaCommandEnd>();
+        break;
</ins><span class="cx">     case ItemType::PutImageData:
</span><span class="cx">         ts << item.get<PutImageData>();
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListItemsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListItems.h (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -2232,14 +2232,14 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> // FIXME: This should be refactored so that the command to "switch to the next item buffer"
</span><del>-// is not itself a drawing item.
-class MetaCommandSwitchToItemBuffer {
</del><ins>+// is not itself a display list item.
+class MetaCommandChangeItemBuffer {
</ins><span class="cx"> public:
</span><del>-    static constexpr ItemType itemType = ItemType::MetaCommandSwitchToItemBuffer;
</del><ins>+    static constexpr ItemType itemType = ItemType::MetaCommandChangeItemBuffer;
</ins><span class="cx">     static constexpr bool isInlineItem = true;
</span><span class="cx">     static constexpr bool isDrawingItem = false;
</span><span class="cx"> 
</span><del>-    MetaCommandSwitchToItemBuffer(ItemBufferIdentifier identifier)
</del><ins>+    MetaCommandChangeItemBuffer(ItemBufferIdentifier identifier)
</ins><span class="cx">         : m_identifier(identifier)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="lines">@@ -2250,6 +2250,30 @@
</span><span class="cx">     ItemBufferIdentifier m_identifier;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+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;
+};
+
</ins><span class="cx"> TextStream& operator<<(TextStream&, ItemHandle);
</span><span class="cx"> 
</span><span class="cx"> } // namespace DisplayList
</span><span class="lines">@@ -2307,7 +2331,9 @@
</span><span class="cx">     WebCore::DisplayList::ItemType::FillPath,
</span><span class="cx">     WebCore::DisplayList::ItemType::FillEllipse,
</span><span class="cx">     WebCore::DisplayList::ItemType::FlushContext,
</span><del>-    WebCore::DisplayList::ItemType::MetaCommandSwitchToItemBuffer,
</del><ins>+    WebCore::DisplayList::ItemType::MetaCommandEnd,
+    WebCore::DisplayList::ItemType::MetaCommandChangeDestinationImageBuffer,
+    WebCore::DisplayList::ItemType::MetaCommandChangeItemBuffer,
</ins><span class="cx">     WebCore::DisplayList::ItemType::PutImageData,
</span><span class="cx">     WebCore::DisplayList::ItemType::PaintFrameForMedia,
</span><span class="cx">     WebCore::DisplayList::ItemType::StrokeRect,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListReplayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.cpp (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -109,6 +109,20 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         LOG_WITH_STREAM(DisplayLists, stream << "applying " << i++ << " " << item);
</span><ins>+
+        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;
+        }
+
</ins><span class="cx">         if (auto reasonForStopping = applyItem(item)) {
</span><span class="cx">             result.reasonForStopping = *reasonForStopping;
</span><span class="cx">             break;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsdisplaylistsDisplayListReplayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListReplayer.h (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -41,6 +41,8 @@
</span><span class="cx"> enum class StopReplayReason : uint8_t {
</span><span class="cx">     ReplayedAllItems,
</span><span class="cx">     MissingCachedResource,
</span><ins>+    ChangeDestinationImageBuffer,
+    EndOfDisplayList,
</ins><span class="cx">     DecodingFailure // FIXME: Propagate decoding errors to display list replay clients through this enum as well.
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="lines">@@ -47,6 +49,7 @@
</span><span class="cx"> struct ReplayResult {
</span><span class="cx">     std::unique_ptr<DisplayList> trackedDisplayList;
</span><span class="cx">     size_t numberOfBytesRead { 0 };
</span><ins>+    Optional<RenderingResourceIdentifier> nextDestinationImageBuffer;
</ins><span class="cx">     StopReplayReason reasonForStopping { StopReplayReason::ReplayedAllItems };
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,20 @@
</span><span class="cx"> 2020-11-27  Wenson Hsieh  <wenson_hsieh@apple.com>
</span><span class="cx"> 
</span><ins>+        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  <wenson_hsieh@apple.com>
+
</ins><span class="cx">         Remove some extraneous PLATFORM(IOS_FAMILY) guards in WKContentViewInteraction
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=219289
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicsRemoteImageBufferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.h (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -92,8 +92,8 @@
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (item.is<WebCore::DisplayList::MetaCommandSwitchToItemBuffer>()) {
-            auto nextBufferIdentifier = item.get<WebCore::DisplayList::MetaCommandSwitchToItemBuffer>().identifier();
</del><ins>+        if (item.is<WebCore::DisplayList::MetaCommandChangeItemBuffer>()) {
+            auto nextBufferIdentifier = item.get<WebCore::DisplayList::MetaCommandChangeItemBuffer>().identifier();
</ins><span class="cx">             m_remoteRenderingBackend.setNextItemBufferToRead(nextBufferIdentifier);
</span><span class="cx">             return true;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebKitGPUProcessgraphicsRemoteRenderingBackendcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -315,7 +315,9 @@
</span><span class="cx"> #endif
</span><span class="cx">     case DisplayList::ItemType::FillRect:
</span><span class="cx">     case DisplayList::ItemType::FlushContext:
</span><del>-    case DisplayList::ItemType::MetaCommandSwitchToItemBuffer:
</del><ins>+    case DisplayList::ItemType::MetaCommandChangeDestinationImageBuffer:
+    case DisplayList::ItemType::MetaCommandChangeItemBuffer:
+    case DisplayList::ItemType::MetaCommandEnd:
</ins><span class="cx">     case DisplayList::ItemType::PaintFrameForMedia:
</span><span class="cx">     case DisplayList::ItemType::Restore:
</span><span class="cx">     case DisplayList::ItemType::Rotate:
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessGPUgraphicsRemoteImageBufferProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -305,7 +305,9 @@
</span><span class="cx"> #endif
</span><span class="cx">         case WebCore::DisplayList::ItemType::FillRect:
</span><span class="cx">         case WebCore::DisplayList::ItemType::FlushContext:
</span><del>-        case WebCore::DisplayList::ItemType::MetaCommandSwitchToItemBuffer:
</del><ins>+        case WebCore::DisplayList::ItemType::MetaCommandChangeDestinationImageBuffer:
+        case WebCore::DisplayList::ItemType::MetaCommandChangeItemBuffer:
+        case WebCore::DisplayList::ItemType::MetaCommandEnd:
</ins><span class="cx">         case WebCore::DisplayList::ItemType::PaintFrameForMedia:
</span><span class="cx">         case WebCore::DisplayList::ItemType::Restore:
</span><span class="cx">         case WebCore::DisplayList::ItemType::Rotate:
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog    2020-11-27 18:56:34 UTC (rev 270202)
+++ trunk/Tools/ChangeLog       2020-11-27 20:07:40 UTC (rev 270203)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2020-11-27  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        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):
+
</ins><span class="cx"> 2020-11-27  Aakash Jain  <aakash_jain@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [build.webkit.org] use lz4 compression for improving buildbot performance
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebCoreDisplayListTestscpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebCore/DisplayListTests.cpp (270202 => 270203)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -121,7 +121,7 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx"> #endif
</span><del>-        case ItemType::MetaCommandSwitchToItemBuffer:
</del><ins>+        case ItemType::MetaCommandChangeItemBuffer:
</ins><span class="cx">             break;
</span><span class="cx">         default: {
</span><span class="cx">             observedUnexpectedItem = true;
</span></span></pre>
</div>
</div>

</body>
</html>