Title: [293522] trunk/Source
Revision
293522
Author
[email protected]
Date
2022-04-27 12:01:04 -0700 (Wed, 27 Apr 2022)

Log Message

Avoid sending a flush IPC to the GPU process when destroying a RemoteImageBuffer
https://bugs.webkit.org/show_bug.cgi?id=239799

Reviewed by Said Abou-Hallawa.

After r280652, destroying a RemoteImageBufferProxy would always send a flush to the GPU
process, even if there had be no drawing since the previous flush.

Fix to only send a flush and wait when necessary.

Roughly 8% progression on MotionMark Images subtest on iPhone.

Source/WebCore:

* platform/graphics/ImageBuffer.h:
(WebCore::ImageBuffer::flushDrawingContextAsync):

Source/WebKit:

* WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
(WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (293521 => 293522)


--- trunk/Source/WebCore/ChangeLog	2022-04-27 18:56:04 UTC (rev 293521)
+++ trunk/Source/WebCore/ChangeLog	2022-04-27 19:01:04 UTC (rev 293522)
@@ -1,3 +1,20 @@
+2022-04-27  Simon Fraser  <[email protected]>
+
+        Avoid sending a flush IPC to the GPU process when destroying a RemoteImageBuffer
+        https://bugs.webkit.org/show_bug.cgi?id=239799
+
+        Reviewed by Said Abou-Hallawa.
+
+        After r280652, destroying a RemoteImageBufferProxy would always send a flush to the GPU
+        process, even if there had be no drawing since the previous flush.
+
+        Fix to only send a flush and wait when necessary.
+
+        Roughly 8% progression on MotionMark Images subtest on iPhone.
+
+        * platform/graphics/ImageBuffer.h:
+        (WebCore::ImageBuffer::flushDrawingContextAsync):
+
 2022-04-27  Tim Nguyen  <[email protected]>
 
         [css-text] Make word-wrap CSS property an alias of overflow-wrap

Modified: trunk/Source/WebCore/platform/graphics/ImageBuffer.h (293521 => 293522)


--- trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2022-04-27 18:56:04 UTC (rev 293521)
+++ trunk/Source/WebCore/platform/graphics/ImageBuffer.h	2022-04-27 19:01:04 UTC (rev 293522)
@@ -98,7 +98,7 @@
     virtual GraphicsContext* drawingContext() { return nullptr; }
     virtual bool prefersPreparationForDisplay() { return false; }
     virtual void flushDrawingContext() { }
-    virtual void flushDrawingContextAsync() { }
+    virtual bool flushDrawingContextAsync() { return false; }
     virtual void didFlush(GraphicsContextFlushIdentifier) { }
 
     virtual FloatSize logicalSize() const = 0;

Modified: trunk/Source/WebKit/ChangeLog (293521 => 293522)


--- trunk/Source/WebKit/ChangeLog	2022-04-27 18:56:04 UTC (rev 293521)
+++ trunk/Source/WebKit/ChangeLog	2022-04-27 19:01:04 UTC (rev 293522)
@@ -1,3 +1,20 @@
+2022-04-27  Simon Fraser  <[email protected]>
+
+        Avoid sending a flush IPC to the GPU process when destroying a RemoteImageBuffer
+        https://bugs.webkit.org/show_bug.cgi?id=239799
+
+        Reviewed by Said Abou-Hallawa.
+
+        After r280652, destroying a RemoteImageBufferProxy would always send a flush to the GPU
+        process, even if there had be no drawing since the previous flush.
+
+        Fix to only send a flush and wait when necessary.
+
+        Roughly 8% progression on MotionMark Images subtest on iPhone.
+
+        * WebProcess/GPU/graphics/RemoteImageBufferProxy.h:
+        (WebKit::RemoteImageBufferProxy::waitForDidFlushWithTimeout):
+
 2022-04-27  Aditya Keerthi  <[email protected]>
 
         [iOS] Focus changes unexpectedly when scrolling to a found text range

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


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2022-04-27 18:56:04 UTC (rev 293521)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h	2022-04-27 19:01:04 UTC (rev 293522)
@@ -126,13 +126,14 @@
 #if !LOG_DISABLED
         auto startTime = MonotonicTime::now();
 #endif
-        LOG_WITH_STREAM(SharedDisplayLists, stream << "Waiting for Flush{" << m_sentFlushIdentifier << "} in Image(" << m_renderingResourceIdentifier << ")");
+        LOG_WITH_STREAM(SharedDisplayLists, stream << "RemoteImageBufferProxy " << m_renderingResourceIdentifier << " waitForDidFlushWithTimeout: waiting for flush {" << m_sentFlushIdentifier);
         while (numberOfTimeouts < maximumNumberOfTimeouts && hasPendingFlush()) {
             if (!m_remoteRenderingBackendProxy->waitForDidFlush())
                 ++numberOfTimeouts;
         }
-        LOG_WITH_STREAM(SharedDisplayLists, stream << "Done waiting: " << MonotonicTime::now() - startTime << "; " << numberOfTimeouts << " timeout(s)");
 
+        LOG_WITH_STREAM(SharedDisplayLists, stream << "RemoteImageBufferProxy " << m_renderingResourceIdentifier << " waitForDidFlushWithTimeout: done waiting " << (MonotonicTime::now() - startTime).milliseconds() << "ms; " << numberOfTimeouts << " timeout(s)");
+
         if (UNLIKELY(numberOfTimeouts >= maximumNumberOfTimeouts))
             RELEASE_LOG_FAULT(SharedDisplayLists, "Exceeded timeout while waiting for flush in remote rendering backend: %" PRIu64 ".", m_remoteRenderingBackendProxy->renderingBackendIdentifier().toUInt64());
     }
@@ -149,7 +150,7 @@
                 ++numberOfTimeoutsOrFailures;
         }
         if (numberOfTimeoutsOrFailures == maximumTimeoutOrFailureCount) {
-            LOG_WITH_STREAM(SharedDisplayLists, stream << "Exceeded max number of timeouts waiting for image buffer " << m_renderingResourceIdentifier << " backend creation");
+            LOG_WITH_STREAM(SharedDisplayLists, stream << "RemoteImageBufferProxy " << m_renderingResourceIdentifier << " ensureBackendCreated: exceeded max number of timeouts");
             RELEASE_LOG_FAULT(SharedDisplayLists, "Exceeded max number of timeouts waiting for image buffer backend creation in remote rendering backend %" PRIu64 ".", m_remoteRenderingBackendProxy->renderingBackendIdentifier().toUInt64());
         }
         return m_backend.get();
@@ -286,21 +287,26 @@
             return;
 
         TraceScope tracingScope(FlushRemoteImageBufferStart, FlushRemoteImageBufferEnd);
-        flushDrawingContextAsync();
-        waitForDidFlushWithTimeout();
+
+        bool shouldWait = flushDrawingContextAsync();
+        LOG_WITH_STREAM(SharedDisplayLists, stream << "RemoteImageBufferProxy " << m_renderingResourceIdentifier << " flushDrawingContext: shouldWait " << shouldWait);
+        if (shouldWait)
+            waitForDidFlushWithTimeout();
     }
 
-    void flushDrawingContextAsync() final
+    bool flushDrawingContextAsync() final
     {
         if (UNLIKELY(!m_remoteRenderingBackendProxy))
-            return;
+            return false;
 
-        if (m_remoteDisplayList.needsFlush() || !hasPendingFlush()) {
-            m_sentFlushIdentifier = WebCore::GraphicsContextFlushIdentifier::generate();
-            m_remoteDisplayList.flushContext(m_sentFlushIdentifier);
-        }
-
+        if (!m_remoteDisplayList.needsFlush())
+            return hasPendingFlush();
+        
+        m_sentFlushIdentifier = WebCore::GraphicsContextFlushIdentifier::generate();
+        LOG_WITH_STREAM(SharedDisplayLists, stream << "RemoteImageBufferProxy " << m_renderingResourceIdentifier << " flushDrawingContextAsync - flush " << m_sentFlushIdentifier);
+        m_remoteDisplayList.flushContext(m_sentFlushIdentifier);
         m_remoteDisplayList.resetNeedsFlush();
+        return true;
     }
 
     void recordNativeImageUse(WebCore::NativeImage& image)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to