[Skia] CanvasRenderingContext2D putImageData is slow in FF 47 on Mac OSX

RESOLVED WONTFIX

Status

()

Core
Canvas: 2D
RESOLVED WONTFIX
2 years ago
2 years ago

People

(Reporter: daoshengmu, Unassigned)

Tracking

47 Branch
Unspecified
Mac OS X
Points:
---

Firefox Tracking Flags

(firefox47 affected)

Details

(Whiteboard: [gfx-noted])

(Reporter)

Description

2 years ago
I notice canvas2d putImageData is quiet slow while enable gfx.canvas.azure.accelerated. I provide a sample test, http://jsfiddle.net/f0887pca/embedded/result/

We can compare it between enable and disable gfx.canvas.azure.accelerated. (On my MacOSX 10.11 MBP 13" late 2013 model, the result is 330 vs 17 ms)

Updated

2 years ago
Whiteboard: [gfx-noted]
(In reply to Daosheng Mu[:daoshengmu] from comment #0)
> I notice canvas2d putImageData is quiet slow while enable
> gfx.canvas.azure.accelerated. I provide a sample test,
> http://jsfiddle.net/f0887pca/embedded/result/
> 
> We can compare it between enable and disable gfx.canvas.azure.accelerated.
> (On my MacOSX 10.11 MBP 13" late 2013 model, the result is 330 vs 17 ms)

There are two problems with this test. The first is that you don't actually have any code in the second loop for the fillRect case between where you're doing time measurements, so you're not actually measuring anything there.

The second is that putImageData is always going to be slower than a simple solid color fill, since it will in the worst case have to do GPU uploads of the image data. We do try to de-optimize canvases from GPU back to software already if you do a large number of putImageData or getImageData calls on them. The 1x1 case could maybe be optimized despite this, but it is questionable whether we really care enough about this case to optimize it?
(Reporter)

Comment 2

2 years ago
I think my first sample test is not good because it has too much dirty code. I give another one, https://jsfiddle.net/14pxqgtt/1/embedded/result/. As you mentioned, GPU render is much sensitive in draw call than software render. The strength of GPU render is color filling. 

But, I still notice similar phenomenon in my sample. It is not so significant, but I would like to keep finding if there is something I can improve it. In my sample test, the image size is 100 x 100 and emits draw calls ten times.

Skia   enable   vs   disable
      1.450 ms       0.655 ms
(Reporter)

Comment 3

2 years ago
Currently, I have some finding. That should happen difference at DrawTargetSkia::CopySurface. 

Comparison between CPU and GPU mode:
                            0.150 ms vs 0.419 ms
at mCanvas->drawBitmapRect  0.122 ms vs 0.387 ms
(Reporter)

Comment 4

2 years ago
Well. I notice it depends on ImageData size. If I change the size to be larger than 300 x 300, GPU mode would be better.
 
CPU
DrawTargetSkia::CopySurface 0.760
mCanvas->drawBitmapRect 0.735

GPU
DrawTargetSkia::CopySurface 0.362
mCanvas->drawBitmapRect 0.249

I think this bug is not worth to move forward.
(Reporter)

Updated

2 years ago
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.