Bug 65207
Summary: | [Chromium] Canvas 2D putImageData method is slow with GPU acceleration enabled | ||
---|---|---|---|
Product: | WebKit | Reporter: | Justin Novosad <junov> |
Component: | Layout and Rendering | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | bsalomon, schenney, scottmg, senorblanco, vangelis |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
URL: | http://jsperf.com/fillrect-vs-putimagedata |
Justin Novosad
putImageData is slow for several reasons:
1) A new texture is allocated on the GPU every time a putImageData is called. It would be preferable to use a texture from a pool of recyclable textures.(functionality already available in skia)
2) RGBA to BGRA swizzling is done on the CPU. Swizzling is free on the GPU
3) Alpha pre-multiplication is performed on the CPU. The GPU can do it faster
4) A temporary copy of thepixel data ismade in RAM for the purposes of swizzling, premultiplication and image cropping. The transient copy could be eliminated by writing directly to the transfer buffer.
Benchmark: http://jsperf.com/fillrect-vs-putimagedata
Results for putImageData test with Chrome 13.0.782.99 beta
On HP Z600, linux, nVidia Quadro FX 380
software canvas: 1,870,324 Ops per second
GPU-accelerated canvas: 19,751 Ops per second (ouch!)
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Scott Graham
The large delta looks to be gone in 14.x.
Justin Novosad
As a matter of fact, performance is more or less on par between gpu and software implementations in Chrome 14. This is because item 1) was recently implemented in Skia. However Items 2) 3) and 4) are still valid optimization opportunities that will require changes in WebKit code. With those improvements, the GPU-accelerated implementation should eventually be even faster.
Stephen Chenney
*** This bug has been marked as a duplicate of bug 65622 ***