Bug 234321 - [GPU Process] Can't getImageData on canvas larger than 4096x4096
Summary: [GPU Process] Can't getImageData on canvas larger than 4096x4096
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:
Blocks:
 
Reported: 2021-12-14 15:44 PST by Myles C. Maxfield
Modified: 2022-01-12 17:39 PST (History)
7 users (show)

See Also:


Attachments
Patch (3.92 KB, patch)
2021-12-14 15:45 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (6.25 KB, patch)
2021-12-16 18:39 PST, Myles C. Maxfield
thorton: review+
Details | Formatted Diff | Diff
Patch for committing (7.73 KB, patch)
2022-01-07 17:45 PST, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch for committing (7.73 KB, patch)
2022-01-07 17:46 PST, Myles C. Maxfield
no flags 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-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>