Title: [271079] trunk/Source
Revision
271079
Author
[email protected]
Date
2020-12-23 13:57:37 -0800 (Wed, 23 Dec 2020)

Log Message

[GPU Process]: Don't call flushDrawingContext() in the middle of recording drawing commands
https://bugs.webkit.org/show_bug.cgi?id=220126

Reviewed by Simon Fraser.

Source/WebCore:

Avoid calling flushDrawingContext() except when the drawing is finished
and the backend of the ImageBuffer is about to be used.

Rename flushDrawingContextAndCommit() to flushDrawingContextAsync(). The
difference between flushDrawingContext() and flushDrawingContextAsync()
is the former waits for the flush reply message.

* html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::prepareForDisplay):
* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::flushDrawingContextAsync):
(WebCore::ImageBuffer::flushDrawingContextAndCommit): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.cpp:
(WebCore::DisplayList::Recorder::drawImageBuffer):
(WebCore::DisplayList::Recorder::didAppendItemOfType): Deleted.
* platform/graphics/displaylists/DisplayListRecorder.h:
(WebCore::DisplayList::Recorder::Delegate::willAppendItemOfType):
(WebCore::DisplayList::Recorder::append):
(WebCore::DisplayList::Recorder::Delegate::didAppendItemOfType): Deleted.

Source/WebKit:

There is no need to replay back the DrawImageBuffer immediately after it
was recorded. The worry was the source ImageBuffer may change before
replaying back the DrawImageBuffer into the destination ImageBuffer. But
this should not happen with the shared memory buffer because the order
of drawing among multiple ImageBuffer is preserved.

* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::display):
* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (271078 => 271079)


--- trunk/Source/WebCore/ChangeLog	2020-12-23 21:27:44 UTC (rev 271078)
+++ trunk/Source/WebCore/ChangeLog	2020-12-23 21:57:37 UTC (rev 271079)
@@ -1,3 +1,30 @@
+2020-12-23  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process]: Don't call flushDrawingContext() in the middle of recording drawing commands
+        https://bugs.webkit.org/show_bug.cgi?id=220126
+
+        Reviewed by Simon Fraser.
+
+        Avoid calling flushDrawingContext() except when the drawing is finished
+        and the backend of the ImageBuffer is about to be used.
+
+        Rename flushDrawingContextAndCommit() to flushDrawingContextAsync(). The
+        difference between flushDrawingContext() and flushDrawingContextAsync()
+        is the former waits for the flush reply message.
+
+        * html/canvas/CanvasRenderingContext2DBase.cpp:
+        (WebCore::CanvasRenderingContext2DBase::prepareForDisplay):
+        * platform/graphics/ImageBuffer.h:
+        (WebCore::ImageBuffer::flushDrawingContextAsync):
+        (WebCore::ImageBuffer::flushDrawingContextAndCommit): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorder.cpp:
+        (WebCore::DisplayList::Recorder::drawImageBuffer):
+        (WebCore::DisplayList::Recorder::didAppendItemOfType): Deleted.
+        * platform/graphics/displaylists/DisplayListRecorder.h:
+        (WebCore::DisplayList::Recorder::Delegate::willAppendItemOfType):
+        (WebCore::DisplayList::Recorder::append):
+        (WebCore::DisplayList::Recorder::Delegate::didAppendItemOfType): Deleted.
+
 2020-12-23  Peng Liu  <[email protected]>
 
         [Media in GPU Process][MSE] Clean up SourceBufferPrivateRemote and implement functions with new IPC messages

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp (271078 => 271079)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2020-12-23 21:27:44 UTC (rev 271078)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp	2020-12-23 21:57:37 UTC (rev 271079)
@@ -2042,7 +2042,7 @@
 void CanvasRenderingContext2DBase::prepareForDisplay()
 {
     if (auto buffer = canvasBase().buffer())
-        buffer->flushDrawingContextAndCommit();
+        buffer->flushDrawingContextAsync();
 }
 
 bool CanvasRenderingContext2DBase::needsPreparationForDisplay() const

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (271078 => 271079)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2020-12-23 21:27:44 UTC (rev 271078)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2020-12-23 21:57:37 UTC (rev 271079)
@@ -79,7 +79,7 @@
     virtual DisplayList::DrawingContext* drawingContext() { return nullptr; }
     virtual bool prefersPreparationForDisplay() { return false; }
     virtual void flushDrawingContext() { }
-    virtual void flushDrawingContextAndCommit() { }
+    virtual void flushDrawingContextAsync() { }
     virtual void didFlush(DisplayList::FlushIdentifier) { }
 
     virtual void changeDestinationImageBuffer(RenderingResourceIdentifier) { }

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2020-12-23 21:27:44 UTC (rev 271078)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp	2020-12-23 21:57:37 UTC (rev 271079)
@@ -126,12 +126,6 @@
     }
 }
 
-void Recorder::didAppendItemOfType(ItemType type)
-{
-    if (m_delegate)
-        m_delegate->didAppendItemOfType(type);
-}
-
 void Recorder::updateState(const GraphicsContextState& state, GraphicsContextState::StateChangeFlags flags)
 {
     currentState().stateChange.accumulate(state, flags);
@@ -182,7 +176,6 @@
 
 void Recorder::drawImageBuffer(WebCore::ImageBuffer& imageBuffer, const FloatRect& destRect, const FloatRect& srcRect, const ImagePaintingOptions& options)
 {
-    imageBuffer.flushDrawingContext();
     m_displayList.cacheImageBuffer(imageBuffer);
     append<DrawImageBuffer>(imageBuffer.renderingResourceIdentifier(), destRect, srcRect, options);
 }

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


--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2020-12-23 21:27:44 UTC (rev 271078)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.h	2020-12-23 21:57:37 UTC (rev 271079)
@@ -65,7 +65,6 @@
     public:
         virtual ~Delegate() { }
         virtual void willAppendItemOfType(ItemType) { }
-        virtual void didAppendItemOfType(ItemType) { }
         virtual void cacheNativeImage(NativeImage&) { }
         virtual bool isCachedImageBuffer(const ImageBuffer&) const { return false; }
         virtual void cacheFont(Font&) { }
@@ -155,7 +154,6 @@
     {
         willAppendItemOfType(T::itemType);
         m_displayList.append<T>(std::forward<Args>(args)...);
-        didAppendItemOfType(T::itemType);
 
         if constexpr (T::isDrawingItem) {
             if (LIKELY(!m_displayList.tracksDrawingItemExtents()))
@@ -172,7 +170,6 @@
     }
 
     WEBCORE_EXPORT void willAppendItemOfType(ItemType);
-    WEBCORE_EXPORT void didAppendItemOfType(ItemType);
 
     void appendStateChangeItem(const GraphicsContextStateChange&, GraphicsContextState::StateChangeFlags);
 

Modified: trunk/Source/WebKit/ChangeLog (271078 => 271079)


--- trunk/Source/WebKit/ChangeLog	2020-12-23 21:27:44 UTC (rev 271078)
+++ trunk/Source/WebKit/ChangeLog	2020-12-23 21:57:37 UTC (rev 271079)
@@ -1,3 +1,20 @@
+2020-12-23  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process]: Don't call flushDrawingContext() in the middle of recording drawing commands
+        https://bugs.webkit.org/show_bug.cgi?id=220126
+
+        Reviewed by Simon Fraser.
+
+        There is no need to replay back the DrawImageBuffer immediately after it
+        was recorded. The worry was the source ImageBuffer may change before 
+        replaying back the DrawImageBuffer into the destination ImageBuffer. But
+        this should not happen with the shared memory buffer because the order
+        of drawing among multiple ImageBuffer is preserved.
+
+        * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::display):
+        * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+
 2020-12-23  Peng Liu  <[email protected]>
 
         [Media in GPU Process][MSE] Clean up SourceBufferPrivateRemote and implement functions with new IPC messages

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (271078 => 271079)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2020-12-23 21:27:44 UTC (rev 271078)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2020-12-23 21:57:37 UTC (rev 271079)
@@ -315,8 +315,7 @@
 
     m_layer->owner()->platformCALayerLayerDidDisplay(m_layer);
 
-    // FIXME: This method has a weird name. This is "submit work".
-    m_frontBuffer.imageBuffer->flushDrawingContextAndCommit();
+    m_frontBuffer.imageBuffer->flushDrawingContextAsync();
 
     m_frontBufferFlusher = m_frontBuffer.imageBuffer->createFlusher();
 

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


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2020-12-23 21:27:44 UTC (rev 271078)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2020-12-23 21:57:37 UTC (rev 271079)
@@ -195,11 +195,11 @@
             return;
 
         TraceScope tracingScope(FlushRemoteImageBufferStart, FlushRemoteImageBufferEnd);
-        flushDrawingContextAndCommit();
+        flushDrawingContextAsync();
         waitForDidFlushWithTimeout();
     }
 
-    void flushDrawingContextAndCommit() override
+    void flushDrawingContextAsync() override
     {
         if (UNLIKELY(!m_remoteRenderingBackendProxy))
             return;
@@ -258,12 +258,6 @@
             m_remoteRenderingBackendProxy->didAppendData(handle, numberOfBytes, didChangeItemBuffer, m_renderingResourceIdentifier);
     }
 
-    void didAppendItemOfType(WebCore::DisplayList::ItemType type) override
-    {
-        if (type == WebCore::DisplayList::ItemType::DrawImageBuffer)
-            flushDrawingContext();
-    }
-
     void cacheFont(WebCore::Font& font) override
     {
         if (m_remoteRenderingBackendProxy)
@@ -384,7 +378,6 @@
     Condition m_receivedFlushIdentifierChangedCondition;
     WebCore::DisplayList::FlushIdentifier m_receivedFlushIdentifier;
     WeakPtr<RemoteRenderingBackendProxy> m_remoteRenderingBackendProxy;
-    size_t m_itemCountInCurrentDisplayList { 0 };
 };
 
 template<typename BackendType>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to