Bug 219007

Summary: [GPU Process] Clean up recreating the ImageBufferBackend because of GPU crashing
Product: WebKit Reporter: Said Abou-Hallawa <sabouhallawa>
Component: CanvasAssignee: Said Abou-Hallawa <sabouhallawa>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, cdumez, changseok, dino, esprehn+autocc, ews-watchlist, gyuyoung.kim, ryuan.choi, sergio, simon.fraser, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=218924
https://bugs.webkit.org/show_bug.cgi?id=219568
https://bugs.webkit.org/show_bug.cgi?id=219623
Attachments:
Description Flags
Patch
none
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch
simon.fraser: review+
Patch
sabouhallawa: commit-queue-
Patch none

Description Said Abou-Hallawa 2020-11-16 15:20:26 PST
No need to store the backend parameters in RemoteImageBufferProxy. They can be accessed from the current ImageBufferBackend via the ImageBuffer before the backend is cleared.
Comment 1 Said Abou-Hallawa 2020-11-16 16:41:54 PST
Created attachment 414293 [details]
Patch
Comment 2 Simon Fraser (smfr) 2020-11-16 17:57:10 PST
Comment on attachment 414293 [details]
Patch

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

> Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h:187
> +    void commitFlushDisplayList(WebCore::DisplayList::FlushIdentifier flushIdentifier) override

We need to stop using "commit" and "flush" in ways we don't all understand.
Comment 3 Tim Horton 2020-11-16 18:40:09 PST
IMO (but obv. up for discussion):

"submit" for "send display list/work to GPUP", like Wenson fixed elsewhere
"flush" is "wait till all submitted work has actually been completed"
"commit" should be just for the layer tree transactions (but is effectively the same as "submit" for a transaction)

and no combination of the above means anything so we shouldn't see them adjacent to each other :)
Comment 4 Said Abou-Hallawa 2020-11-25 02:09:42 PST
Created attachment 414861 [details]
Patch
Comment 5 Said Abou-Hallawa 2020-11-25 21:49:34 PST
Created attachment 414879 [details]
Patch
Comment 6 Said Abou-Hallawa 2020-11-25 22:00:02 PST
Created attachment 414880 [details]
Patch
Comment 7 Said Abou-Hallawa 2020-11-26 00:47:26 PST
Created attachment 414885 [details]
Patch
Comment 8 Radar WebKit Bug Importer 2020-11-26 03:22:02 PST
<rdar://problem/71747762>
Comment 9 Said Abou-Hallawa 2020-11-26 19:06:21 PST
Created attachment 414912 [details]
Patch
Comment 10 Said Abou-Hallawa 2020-11-27 03:08:05 PST
Created attachment 414935 [details]
Patch
Comment 11 Simon Fraser (smfr) 2020-11-30 10:50:10 PST
Comment on attachment 414935 [details]
Patch

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

> Source/WebCore/platform/graphics/ConcreteImageBuffer.h:297
> +    std::unique_ptr<ImageBufferBackend::Parameters> m_parameters;

Why not just store a copy of the tiny struct? Much simpler.

> Source/WebCore/platform/graphics/ImageBufferBackend.h:166
> +    const Parameters& m_parameters;

Who owns the original data? Would be safer to just store by value.
Comment 12 Said Abou-Hallawa 2020-11-30 12:34:53 PST
Created attachment 415043 [details]
Patch
Comment 13 Said Abou-Hallawa 2020-11-30 12:43:17 PST
Created attachment 415045 [details]
Patch
Comment 14 Said Abou-Hallawa 2020-11-30 12:49:24 PST
Created attachment 415046 [details]
Patch
Comment 15 Said Abou-Hallawa 2020-11-30 13:30:29 PST
Created attachment 415050 [details]
Patch
Comment 16 Said Abou-Hallawa 2020-11-30 13:34:37 PST
ImageBufferBackend::Parameters are saved by value in ImageBufferBackend and ConcreteImageBuffer. Renaming the flush/commit/flush functions was removed from this patch and will be addressed in a different patch.
Comment 17 Said Abou-Hallawa 2020-12-04 01:48:59 PST
Created attachment 415395 [details]
Patch
Comment 18 Simon Fraser (smfr) 2020-12-04 10:54:41 PST
Comment on attachment 415395 [details]
Patch

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

> Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp:124
> +    auto backendSize = this->backendSize();

Doesn't seem worthwhile storing this in a local.

> Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:108
> +    return { static_cast<int>(CGBitmapContextGetWidth(context().platformContext())), static_cast<int>(CGBitmapContextGetHeight(context().platformContext())) };

Let's not fetch context().platformContext() twice.
Comment 19 Said Abou-Hallawa 2020-12-04 11:21:40 PST
Created attachment 415434 [details]
Patch
Comment 20 Said Abou-Hallawa 2020-12-04 12:31:04 PST
Created attachment 415445 [details]
Patch
Comment 21 Said Abou-Hallawa 2020-12-04 12:33:32 PST
Comment on attachment 415395 [details]
Patch

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

>> Source/WebCore/platform/graphics/cg/ImageBufferCGBackend.cpp:124
>> +    auto backendSize = this->backendSize();
> 
> Doesn't seem worthwhile storing this in a local.

Actually it is worthy. sinkIntoNativeImage() destroys the backend. So we can't call backendSize() after calling sinkIntoNativeImage(). I put it back and I added a comment.
Comment 22 EWS 2020-12-04 14:30:50 PST
Committed r270458: <https://trac.webkit.org/changeset/270458>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 415445 [details].