Closed Bug 1418895 Opened 2 years ago Closed 2 years ago
Very slow mask painting when using an SVG in mask-image
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.
2 years ago
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
Attachment #8931490 - Flags: review?(tnikkel) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/mozilla-inbound/rev/dee67ed7eb78 VectorImage::Draw should imply FLAG_BYPASS_SURFACE_CACHE for DrawTargetRecording. r=tnikkel
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.