Bug 256535

Summary: [GPU Process][Filters] Top level SVGFilter should own its FilterResults
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: Layout and RenderingAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 232845    

Description Said Abou-Hallawa 2023-05-09 11:18:37 PDT
This will allow caching the FilterResults along with the SVGFilter in RemoteResourceCache. The solution has to consider the following cases for the SVGFilter & FilterResults:

a. SVGFilter is created in WebProcess:
    1. Rendering in WebProcess:
        i. Top level SVGFilter: SVGFilter creates its FilterResults. SVGFilter caches its FilterResults (will be implemented by this bug).
       ii. Referenced SVGFilter: SVGFilter should not create FilterResults.
    2. Rendering in GPUProcess:
        i. Top level SVGFilter: SVGFilter should not create FilterResults (will be fixed by this bug).
       ii. Referenced SVGFilter: SVGFilter should not create FilterResults.
b. SVGFilter is created in GPUProcess:
    1. Rendering in GPUProcess:
        i. Top level SVGFilter: SVGFilter creates its FilterResults (Memory has to be attributed to WebProcess). SVGFilter caches its FilterResults (will be implemented in another bug).
       ii. Referenced SVGFilter: SVGFilter should not create FilterResults.

To do that GraphicsContext::drawFilteredImageBuffer() has to take FilterResultsEnsurer which returns FilterResults&. drawFilteredImageBuffer() will call it only when the FilterResults is needed.  SVGFilter::ensureResults() will return FilterResults& and it takes FilterResultsCreator. FilterResultsCreator will return a std::unique_ptr<FilterResults> which SVGFilter will maintain.
Comment 1 Radar WebKit Bug Importer 2023-05-09 11:19:25 PDT
<rdar://problem/109107572>
Comment 2 Said Abou-Hallawa 2023-05-09 11:45:30 PDT
Pull request: https://github.com/apple/WebKit/pull/587
Comment 3 Said Abou-Hallawa 2023-05-09 13:46:42 PDT
Pull request: https://github.com/WebKit/WebKit/pull/13652
Comment 4 Said Abou-Hallawa 2023-05-09 18:22:20 PDT
Pull request: https://github.com/WebKit/WebKit/pull/13676
Comment 5 EWS 2023-05-11 18:50:44 PDT
Committed 263996@main (b860110f0ae4): <https://commits.webkit.org/263996@main>

Reviewed commits have been landed. Closing PR #13676 and removing active labels.