Bug 234321

Summary: [GPU Process] Can't getImageData on canvas larger than 4096x4096
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: New BugsAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, changseok, esprehn+autocc, ews-watchlist, gyuyoung.kim, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=235169
Attachments:
Description Flags
Patch
none
Patch
thorton: review+
Patch for committing
none
Patch for committing none

Description Myles C. Maxfield 2021-12-14 15:44:23 PST
[GPU Process] Can't getImageData on canvas larger than 4096x4096
Comment 1 Myles C. Maxfield 2021-12-14 15:45:26 PST
Created attachment 447170 [details]
Patch
Comment 2 Myles C. Maxfield 2021-12-14 15:45:30 PST
<rdar://problem/83575501>
Comment 3 Myles C. Maxfield 2021-12-15 16:47:41 PST
Looks like iOS needs a different policy than macOS.
Comment 4 Myles C. Maxfield 2021-12-16 18:04:03 PST
static inline size_t maxCanvasArea()
{
    if (maxCanvasAreaForTesting)
        return *maxCanvasAreaForTesting;

    // Firefox limits width/height to 32767 pixels, but slows down dramatically before it
    // reaches that limit. We limit by area instead, giving us larger maximum dimensions,
    // in exchange for a smaller maximum canvas size. The maximum canvas size is in device pixels.
#if PLATFORM(IOS_FAMILY)
    return 4096 * 4096;
#else
    return 16384 * 16384;
#endif
}
Comment 5 Myles C. Maxfield 2021-12-16 18:39:19 PST
Created attachment 447408 [details]
Patch
Comment 6 Tim Horton 2021-12-16 18:47:29 PST
Comment on attachment 447408 [details]
Patch

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

> Source/WebCore/ChangeLog:9
> +        We already have a policy about how big canvases can be. Simply export tat policy

“tat”
Comment 7 Myles C. Maxfield 2021-12-17 01:18:48 PST
Looks like window.internals.setMaxCanvasPixelMemory() doesn’t make it to the GPU Process 🤔
Comment 8 Myles C. Maxfield 2022-01-07 17:45:06 PST
Created attachment 448651 [details]
Patch for committing
Comment 9 Myles C. Maxfield 2022-01-07 17:46:14 PST
Created attachment 448652 [details]
Patch for committing
Comment 10 Myles C. Maxfield 2022-01-07 19:19:13 PST
Committed r287805 (245857@trunk): <https://commits.webkit.org/245857@trunk>