Bug 217550

Summary: [GPU Process][Resource caching 1/7]: Replace "ImageBufferIdentifier" by a generic identifier named "RemoteResourceIdentifier"
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: Layout and RenderingAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, bfulgham, ews-watchlist, gyuyoung.kim, ryuan.choi, sergio, simon.fraser, webkit-bug-importer, youennf, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 217342, 217554    
Attachments:
Description Flags
Patch none

Description Said Abou-Hallawa 2020-10-09 18:34:36 PDT
GPU Process needs to manage all the drawing resources and the drawing buffers/layers the same way. For example an HTMLCanvasElement is backed by a drawing buffer called ImageBuffer. All the drawing to the context of this HTMLCanvasElement is supposed to be done in this ImageBuffer. But at the same time this HTMLCanvasElement can be treated as a drawing resources when it is drawn to another HTMLCanvasElement through the method drawImage().

So RemoteResourceIdentifier will be the identifier of the ImageBuffer when drawing is happening to its context in the GPU process. And it will be the identifier of the image which will be drawn to anther buffer or layer in the GPU Process. The goal is to avoid copying the image from Web Process to GPU Process and use RemoteResourceIdentifier instead.
Comment 1 Said Abou-Hallawa 2020-10-09 18:57:30 PDT
Created attachment 410994 [details]
Patch
Comment 2 youenn fablet 2020-10-12 03:26:42 PDT
Comment on attachment 410994 [details]
Patch

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

> Source/WebCore/ChangeLog:10
> +        be used drawing a remote NativeImage to a remote ImageBuffer or DOM layer.

RemoteResourceIdentifier seems very generic and it seems the identifier is all about images.
Are there plans to use this identifier in non images cases?
How about some more specific names like RemoteImageIdentifier instead?
Comment 3 Simon Fraser (smfr) 2020-10-12 13:46:14 PDT
Comment on attachment 410994 [details]
Patch

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

>> Source/WebCore/ChangeLog:10
>> +        be used drawing a remote NativeImage to a remote ImageBuffer or DOM layer.
> 
> RemoteResourceIdentifier seems very generic and it seems the identifier is all about images.
> Are there plans to use this identifier in non images cases?
> How about some more specific names like RemoteImageIdentifier instead?

It's going to get used for fonts as well.

> Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:75
> +    WebCore::RemoteResourceIdentifier m_remoteResourceIdentifier { WebCore::RemoteResourceIdentifier::generate() };

It's weird for RemoteImageBufferMessageHandler to be the one that creates the identifiers and positively wrong for the WebProcess to be creating identifiers because they have to be unique in the GPU process.
Comment 4 Simon Fraser (smfr) 2020-10-12 13:55:01 PDT
Comment on attachment 410994 [details]
Patch

r+ but let's fix the identifier creation in a followup.
Comment 5 Said Abou-Hallawa 2020-10-12 15:21:11 PDT
Comment on attachment 410994 [details]
Patch

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

>> Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:75
>> +    WebCore::RemoteResourceIdentifier m_remoteResourceIdentifier { WebCore::RemoteResourceIdentifier::generate() };
> 
> It's weird for RemoteImageBufferMessageHandler to be the one that creates the identifiers and positively wrong for the WebProcess to be creating identifiers because they have to be unique in the GPU process.

Logged bug 217638 to track this issue.
Comment 6 EWS 2020-10-12 15:28:21 PDT
Committed r268372: <https://trac.webkit.org/changeset/268372>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 410994 [details].
Comment 7 Radar WebKit Bug Importer 2020-10-12 15:29:19 PDT
<rdar://problem/70226333>