Open Bug 1829753 Opened 3 years ago Updated 4 months ago

Canvas2d stroke may have performance issues on sites like earth.nullschool.net

Categories

(Core :: Graphics: Canvas2D, defect)

defect

Tracking

()

People

(Reporter: twisniewski, Unassigned)

References

(Blocks 1 open bug, )

Details

In this performance profile (reported on webcompat.com) it appears that the stroke function is eating up a lot of time and causing perf issues while zooming in on the globe at earth.nullschool.net. The reporter claims it may not have been the case in the past, though it's unclear whether that's because the site changed or there was a regression.

I will bring this up in weekly triage meeting to find an owner.

What I observe in profile is that we're spending a lot of time in Direct2D, so either the per primitive overhead in Direct2D is getting bad (i.e. a lot of geometry that is clipped away or something) or it's filling a lot of pixels (which would be on GPU so that seems a bit unlikely), I don't have much experience with Direct2D so I can't speculate further.

Blocks: gfx-triage
Severity: -- → S2
No longer blocks: gfx-triage
Severity: S2 → S3

I think the first thing to try is increase the size of the ring-buffer, since we're blocking via a bunch of codepaths at mozilla::layers::CanvasEventRingBuffer::WaitForReadCount.

@bobowen: Is this easy to try?

Flags: needinfo?(bobowencode)

(In reply to Kelsey Gilbert [:jgilbert] from comment #2)

I think the first thing to try is increase the size of the ring-buffer, since we're blocking via a bunch of codepaths at mozilla::layers::CanvasEventRingBuffer::WaitForReadCount.

@bobowen: Is this easy to try?

Yes, you can double (or any power of two) the figure here.

I'm not sure it will help too much, we mainly seem to be waiting while the canvas threads are taking snapshots for getImageData calls.
In any case, if we are waiting for Direct2D calls then the buffer will soon fill up, generally this only replaces waiting for the same calls in the content process in the non-remote case (although there are some exceptions).
Performance seems to be similar when I turn off remote canvas, although pulling image data back is one of the only things that is generally a bit slower with remote canvas.

Flags: needinfo?(bobowencode)
You need to log in before you can comment on or make changes to this bug.