Title: [289415] branches/safari-613-branch/Source/WebKit
Revision
289415
Author
[email protected]
Date
2022-02-08 11:59:52 -0800 (Tue, 08 Feb 2022)

Log Message

Cherry-pick r288090. rdar://problem/87601499

    Frequent GPU process jetsams due to RemoteRenderingBackendProxy not claiming ownership of SharedMemory buffers
    https://bugs.webkit.org/show_bug.cgi?id=235226

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

    Claim memory from SharedBitmaps and SharedMemory that RemoteRenderingBackendProxy
    asks and receives from RemoteRenderingBackend. This is not very good,
    as GPUP allocates most of the memory and thus might jetsam
    before WP claims them. However, that is a bigger change to be done
    after this one.

    No new tests, hard to test currently.

    * Shared/ShareableBitmap.cpp:
    (WebKit::ShareableBitmap::Handle::takeOwnershipOfMemory const):
    * Shared/ShareableBitmap.h:
    * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
    (WebKit::RemoteRenderingBackendProxy::getShareableBitmap):
    (WebKit::RemoteRenderingBackendProxy::getFilteredImage):
    * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
    (WebKit::RemoteResourceCacheProxy::recordNativeImageUse):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288090 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebKit/ChangeLog (289414 => 289415)


--- branches/safari-613-branch/Source/WebKit/ChangeLog	2022-02-08 19:55:33 UTC (rev 289414)
+++ branches/safari-613-branch/Source/WebKit/ChangeLog	2022-02-08 19:59:52 UTC (rev 289415)
@@ -1,3 +1,56 @@
+2022-02-08  Russell Epstein  <[email protected]>
+
+        Cherry-pick r288090. rdar://problem/87601499
+
+    Frequent GPU process jetsams due to RemoteRenderingBackendProxy not claiming ownership of SharedMemory buffers
+    https://bugs.webkit.org/show_bug.cgi?id=235226
+    
+    Patch by Kimmo Kinnunen <[email protected]> on 2022-01-17
+    Reviewed by Simon Fraser.
+    
+    Claim memory from SharedBitmaps and SharedMemory that RemoteRenderingBackendProxy
+    asks and receives from RemoteRenderingBackend. This is not very good,
+    as GPUP allocates most of the memory and thus might jetsam
+    before WP claims them. However, that is a bigger change to be done
+    after this one.
+    
+    No new tests, hard to test currently.
+    
+    * Shared/ShareableBitmap.cpp:
+    (WebKit::ShareableBitmap::Handle::takeOwnershipOfMemory const):
+    * Shared/ShareableBitmap.h:
+    * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
+    (WebKit::RemoteRenderingBackendProxy::getShareableBitmap):
+    (WebKit::RemoteRenderingBackendProxy::getFilteredImage):
+    * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
+    (WebKit::RemoteResourceCacheProxy::recordNativeImageUse):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288090 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-17  Kimmo Kinnunen  <[email protected]>
+
+            Frequent GPU process jetsams due to RemoteRenderingBackendProxy not claiming ownership of SharedMemory buffers
+            https://bugs.webkit.org/show_bug.cgi?id=235226
+
+            Reviewed by Simon Fraser.
+
+            Claim memory from SharedBitmaps and SharedMemory that RemoteRenderingBackendProxy
+            asks and receives from RemoteRenderingBackend. This is not very good,
+            as GPUP allocates most of the memory and thus might jetsam
+            before WP claims them. However, that is a bigger change to be done
+            after this one.
+
+            No new tests, hard to test currently.
+
+            * Shared/ShareableBitmap.cpp:
+            (WebKit::ShareableBitmap::Handle::takeOwnershipOfMemory const):
+            * Shared/ShareableBitmap.h:
+            * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
+            (WebKit::RemoteRenderingBackendProxy::getShareableBitmap):
+            (WebKit::RemoteRenderingBackendProxy::getFilteredImage):
+            * WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:
+            (WebKit::RemoteResourceCacheProxy::recordNativeImageUse):
+
 2022-02-07  Russell Epstein  <[email protected]>
 
         Cherry-pick r289150. rdar://problem/88521016

Modified: branches/safari-613-branch/Source/WebKit/Shared/ShareableBitmap.cpp (289414 => 289415)


--- branches/safari-613-branch/Source/WebKit/Shared/ShareableBitmap.cpp	2022-02-08 19:55:33 UTC (rev 289414)
+++ branches/safari-613-branch/Source/WebKit/Shared/ShareableBitmap.cpp	2022-02-08 19:59:52 UTC (rev 289415)
@@ -41,6 +41,11 @@
 {
 }
 
+void ShareableBitmap::Handle::takeOwnershipOfMemory(MemoryLedger ledger) const
+{
+    m_handle.takeOwnershipOfMemory(ledger);
+}
+
 void ShareableBitmap::Handle::encode(IPC::Encoder& encoder) const
 {
     SharedMemory::IPCHandle ipcHandle(WTFMove(m_handle), numBytesForSize(m_size, m_configuration));

Modified: branches/safari-613-branch/Source/WebKit/Shared/ShareableBitmap.h (289414 => 289415)


--- branches/safari-613-branch/Source/WebKit/Shared/ShareableBitmap.h	2022-02-08 19:55:33 UTC (rev 289414)
+++ branches/safari-613-branch/Source/WebKit/Shared/ShareableBitmap.h	2022-02-08 19:59:52 UTC (rev 289415)
@@ -58,6 +58,9 @@
 
         bool isNull() const { return m_handle.isNull(); }
 
+        // Take ownership of the memory for process memory accounting purposes.
+        void takeOwnershipOfMemory(MemoryLedger) const;
+
         void clear();
 
         void encode(IPC::Encoder&) const;

Modified: branches/safari-613-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp (289414 => 289415)


--- branches/safari-613-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2022-02-08 19:55:33 UTC (rev 289414)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2022-02-08 19:59:52 UTC (rev 289415)
@@ -175,6 +175,7 @@
         sendSyncToStream(Messages::RemoteRenderingBackend::SemaphoreForGetPixelBuffer(), Messages::RemoteRenderingBackend::SemaphoreForGetPixelBuffer::Reply(semaphore));
 
     if (!handle.handle.isNull()) {
+        handle.handle.takeOwnershipOfMemory(MemoryLedger::Graphics);
         m_getPixelBufferSharedMemory = SharedMemory::map(handle.handle, SharedMemory::Protection::ReadOnly);
         m_getPixelBufferSharedMemoryLength = handle.dataSize;
     }
@@ -220,6 +221,7 @@
     auto sendResult = sendSyncToStream(Messages::RemoteRenderingBackend::GetShareableBitmapForImageBuffer(imageBuffer, preserveResolution), Messages::RemoteRenderingBackend::GetShareableBitmapForImageBuffer::Reply(handle));
     if (handle.isNull())
         return { };
+    handle.takeOwnershipOfMemory(MemoryLedger::Graphics);
     ASSERT_UNUSED(sendResult, sendResult);
     return ShareableBitmap::create(handle);
 }
@@ -233,6 +235,7 @@
     if (handle.isNull())
         return { };
 
+    handle.takeOwnershipOfMemory(MemoryLedger::Graphics);
     auto bitmap = ShareableBitmap::create(handle);
     if (!bitmap)
         return { };

Modified: branches/safari-613-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp (289414 => 289415)


--- branches/safari-613-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp	2022-02-08 19:55:33 UTC (rev 289414)
+++ branches/safari-613-branch/Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp	2022-02-08 19:59:52 UTC (rev 289415)
@@ -103,6 +103,7 @@
     if (handle.isNull())
         return;
 
+    handle.takeOwnershipOfMemory(MemoryLedger::Graphics);
     m_nativeImages.add(image.renderingResourceIdentifier(), image);
 
     // Set itself as an observer to NativeImage, so releaseNativeImage()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to