Bug 228225 - [GPU Process] Start tracking resource uses for ImageBuffers
Summary: [GPU Process] Start tracking resource uses for ImageBuffers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on: 228222 228495
Blocks: 228216
  Show dependency treegraph
 
Reported: 2021-07-23 01:10 PDT by Myles C. Maxfield
Modified: 2021-07-28 14:48 PDT (History)
7 users (show)

See Also:


Attachments
Patch for reviewing (17.96 KB, patch)
2021-07-23 01:16 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch for EWS (42.69 KB, patch)
2021-07-23 01:17 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (16.49 KB, patch)
2021-07-26 21:23 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (8.16 KB, patch)
2021-07-27 17:05 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (12.37 KB, patch)
2021-07-28 00:04 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (12.38 KB, patch)
2021-07-28 00:14 PDT, Myles C. Maxfield
sabouhallawa: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2021-07-23 01:10:19 PDT
[GPU Process] Start tracking resource uses for ImageBuffers
Comment 1 Myles C. Maxfield 2021-07-23 01:16:53 PDT
Created attachment 434073 [details]
Patch for reviewing
Comment 2 Myles C. Maxfield 2021-07-23 01:17:58 PDT
Created attachment 434074 [details]
Patch for EWS
Comment 3 Myles C. Maxfield 2021-07-26 21:23:26 PDT
Created attachment 434268 [details]
Patch
Comment 4 Myles C. Maxfield 2021-07-27 17:05:41 PDT
Created attachment 434388 [details]
Patch
Comment 5 Said Abou-Hallawa 2021-07-27 22:20:52 PDT
Comment on attachment 434388 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=434388&action=review

> Source/WebCore/platform/graphics/displaylists/DisplayListRecorder.cpp:207
> +    imageBuffer.incrementUseCounter();

I think this should be similar to drawNativeImage() and appendDrawGlyphsItemWithCachedFont()

if (m_delegate)
    recordImageBufferUse(imageBuffer);

> Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h:75
> +        m_remoteRenderingBackendProxy->releaseRemoteResource(m_renderingResourceIdentifier, m_useCount);

I think this call can be moved to RemoteResourceCacheProxy::releaseImageBuffer() and you can know the useCount from ImageBufferHashMap which can have the definition:

struct ImageBufferState {
    WeakPtr<WebCore::ImageBuffer> imageBuffer;
    uint64_t useCount;
};
using ImageBufferHashMap = HashMap<WebCore::RenderingResourceIdentifier, ImageBufferState>;

> Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h:329
> +    void incrementUseCounter() final
> +    {
> +        ++m_useCount;
> +    }

void recordImageBufferUse(WebCore::ImageBuffer& imageBuffer)
{
    // Similar to what we do in recordFontUse
}

> Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h:358
> +    uint64_t m_useCount { 0 };

I think all the useCount in WebProcess should be managed by RemoteResourceCacheProxy.
Comment 6 Myles C. Maxfield 2021-07-28 00:04:19 PDT
Created attachment 434406 [details]
Patch
Comment 7 Myles C. Maxfield 2021-07-28 00:14:15 PDT
Created attachment 434408 [details]
Patch
Comment 8 Said Abou-Hallawa 2021-07-28 12:59:19 PDT
Comment on attachment 434408 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=434408&action=review

> Source/WebKit/WebProcess/GPU/graphics/RemoteResourceCacheProxy.cpp:204
> +        item.imageBuffer->clearBackend();

Do we need to reset the useCount to '0' if GPUP is relaunched?
Comment 9 Myles C. Maxfield 2021-07-28 14:47:06 PDT
Committed r280401 (240042@main): <https://commits.webkit.org/240042@main>
Comment 10 Radar WebKit Bug Importer 2021-07-28 14:48:21 PDT
<rdar://problem/81237219>