RESOLVED FIXED Bug 230886
[GPU Process] REGRESSION: Drawing a large SVG image on a canvas may take too much memory
https://bugs.webkit.org/show_bug.cgi?id=230886
Summary [GPU Process] REGRESSION: Drawing a large SVG image on a canvas may take too ...
kaput.sts
Reported 2021-09-28 02:45:52 PDT
It seems that when downscaling a HTML canvas by factor F, and drawing an image with SVG source, upscaled by factor F, iOS 15 Safari crashes when F is large enough, even though these two factors should cancel out (1/F * F = 1). I think it will draw the SVG to an intermediate texture F times the size of the SVG, in this case (F*1000)^2 pixels => kaboom. This is a regression because it works on all other browsers, and works fine in iOS 13 and 14 Safari. To reproduce, visit https://codepen.io/Ziriax/full/LYLgYxp
Attachments
Simple test case (Should show a green rectangle) (874 bytes, text/html)
2021-10-22 15:58 PDT, Said Abou-Hallawa
no flags
Patch (6.38 KB, patch)
2021-10-22 16:09 PDT, Said Abou-Hallawa
no flags
kaput.sts
Comment 1 2021-09-28 02:50:04 PDT
It seems Safari TP on OSX also crashes
Sam Sneddon [:gsnedders]
Comment 2 2021-09-28 09:31:15 PDT
GPU process, maybe?
Radar WebKit Bug Importer
Comment 3 2021-09-28 10:20:39 PDT
Alexey Proskuryakov
Comment 4 2021-09-29 13:12:57 PDT
I cannot reproduce this on macOS 12 beta with Safari 15.1 on Apple Silicon, nor with STP 132, for what it's worth.
Sam Sneddon [:gsnedders]
Comment 5 2021-09-30 05:00:12 PDT
I can see vastly higher memory usage on macOS 12 beta with Safari 15.1 on Intel and vastly worse performance than Firefox Nightly or Chrome Canary. On the whole my assumption is the crash is "simply" OOM. I'd presume that Firefox and Chrome are cancelling out the factors and therefore they don't actually do anything.
Simon Fraser (smfr)
Comment 6 2021-09-30 10:12:13 PDT
GPU Process forced us to draw SVGs into an image buffer and then draw that to the canvas. That's probably the cause of the regression.
kaput.sts
Comment 7 2021-10-04 04:15:38 PDT
I see, that was what I expected. So some extra logic should be added to compute the minimal size of such an intermediate texture. If the world canvas transform is known, and the dimensions of the canvas, that is not too difficult IMHO?
Said Abou-Hallawa
Comment 8 2021-10-22 15:58:42 PDT
Created attachment 442208 [details] Simple test case (Should show a green rectangle)
Said Abou-Hallawa
Comment 9 2021-10-22 16:09:26 PDT
EWS
Comment 10 2021-10-22 21:07:19 PDT
Committed r284740 (243449@main): <https://commits.webkit.org/243449@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 442212 [details].
Said Abou-Hallawa
Comment 11 2021-11-02 14:05:47 PDT
*** Bug 231796 has been marked as a duplicate of this bug. ***
Roman Nikitin
Comment 12 2021-11-09 06:24:57 PST
Could you tip when it will be in the new safari version?
Sam Sneddon [:gsnedders]
Comment 13 2021-11-15 09:36:07 PST
(In reply to Roman Nikitin from comment #12) > Could you tip when it will be in the new safari version? Apple does not comment on future releases.
Note You need to log in before you can comment on or make changes to this bug.