Closed Bug 1418895 Opened 2 years ago Closed 2 years ago

Very slow mask painting when using an SVG in mask-image

Categories

(Core :: Graphics: WebRender, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox57 --- unaffected
firefox59 --- fixed

People

(Reporter: mstange, Assigned: aosmond)

References

(Blocks 1 open bug)

Details

(Whiteboard: [wr-mvp])

Attachments

(2 files)

Attached file testcase
Profile from testcase: https://perfht.ml/2jGMswY

Steps to reproduce:
 1. Enable WebRender and blob-images.
 2. Go to https://qz.com/ .
 3. Notice that painting in the upper part of the page is really slow.


There's an element with mask-image: url(somesvg.svg). When we prepare the WebRender image for the nsDisplayMask, we use a DrawTargetRecording and call nsCSSRendering::PaintStyleImageLayerWithSC. This draws the SVG image into the DrawTargetRecording using mozilla::image::VectorImage::Draw, which draws it as a surface. This causes us to put all the pixels of that surface into the command stream.
Whiteboard: [wr-mvp] [triage]
Whiteboard: [wr-mvp] [triage] → [wr-reserve]
In a pinch, I can impute imgIContainer::FLAG_BYPASS_SURFACE_CACHE in VectorImage::Draw if the gfxContext::GetDrawTarget is a recording backend. This will cause us to record the commands as expected. In an ideal world we'd probably store SourceSurfaceRecording in the SurfaceCache, and replay that upon the given DrawTargetRecording, but it looks like DrawTargetRecording doesn't actually support that at this time.
Assignee: nobody → aosmond
Status: NEW → ASSIGNED
Priority: P3 → P1
Whiteboard: [wr-reserve] → [wr-mvp]
Attachment #8931490 - Flags: review?(tnikkel) → review+
Pushed by aosmond@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/dee67ed7eb78
VectorImage::Draw should imply FLAG_BYPASS_SURFACE_CACHE for DrawTargetRecording. r=tnikkel
https://hg.mozilla.org/mozilla-central/rev/dee67ed7eb78
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
This patch made an amazingly huge difference in the performance of that website!
QA Whiteboard: [good first verify]
You need to log in before you can comment on or make changes to this bug.