Closed Bug 1599214 Opened 5 years ago Closed 4 years ago

https://wattenberger.com/guide/scaling-svg has bad blob behaviour because of nsSVGPatternFrame::PaintPattern

Categories

(Core :: Graphics: WebRender, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: jrmuizel, Assigned: jrmuizel)

References

(Blocks 1 open bug)

Details

(Keywords: perf)

Attachments

(1 file, 2 obsolete files)

Blocks: wr-73, wr-perf
Keywords: perf
OS: Unspecified → All
Priority: -- → P3
Hardware: Unspecified → All
Version: unspecified → Trunk
Blocks: wr-74
No longer blocks: wr-73

Can you take a look and let us know what you think is up with this?

Flags: needinfo?(nical.bugzilla)

Here's a stack for CreateSimilarDrawTarget where we make a (width = 8983, height = 8983) surface:

frame #0: 0x00000001104f67d8 XUL`mozilla::gfx::DrawTargetRecording::CreateSimilarDrawTarget(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::SurfaceFormat) const [inlined] RefPtr<mozilla::gfx::DrawTarget>::RefPtr(this=<unavailable>) at RefPtr.h:88:9 [opt]
    frame #1: 0x00000001104f67d8 XUL`mozilla::gfx::DrawTargetRecording::CreateSimilarDrawTarget(mozilla::gfx::IntSizeTyped<mozilla::gfx::UnknownUnits> const&, mozilla::gfx::SurfaceFormat) const [inlined] RefPtr<mozilla::gfx::DrawTarget>::RefPtr(this=<unavailable>) at RefPtr.h:90 [opt]
    frame #2: 0x00000001104f67d8 XUL`mozilla::gfx::DrawTargetRecording::CreateSimilarDrawTarget(this=0x00007f824fd9ca90, aSize=0x00007ffee5bdc510, aFormat=B8G8R8A8) const at DrawTargetRecording.cpp:536 [opt]
    frame #3: 0x000000011256af21 XUL`nsSVGPatternFrame::PaintPattern(this=<unavailable>, aDrawTarget=0x00007f824fd9ca90, patternMatrix=0x00007ffee5bdc610, aContextMatrix=0x40c18b5560000000, aSource=0x00007f82f9a96ca0, aFillOrStroke=00 00 00 00 00 00 00 00, aGraphicOpacity=1, aOverrideBounds=None, None, None, None, aImgParams=0x00007ffee5bdc9b0) at nsSVGPatternFrame.cpp:329:40 [opt]
    frame #4: 0x000000011256c4a9 XUL`nsSVGPatternFrame::GetPaintServerPattern(this=<unavailable>, aSource=<unavailable>, aDrawTarget=<unavailable>, aContextMatrix=<unavailable>, aFillOrStroke=<unavailable>, aGraphicOpacity=<unavailable>, aImgParams=<unavailable>, aOverrideBounds=None, None, None, None) at nsSVGPatternFrame.cpp:684:7 [opt]
  * frame #5: 0x000000011257404b XUL`nsSVGUtils::MakeFillPatternFor(aFrame=0x00007f82f9a96ca0, aContext=0x00007f824fd9cb50, aOutPattern=<unavailable>, aImgParams=0x00007ffee5bdc9b0, aContextPaint=<unavailable>) at nsSVGUtils.cpp:1384:13 [opt]
    frame #6: 0x000000011253659f XUL`mozilla::SVGGeometryFrame::Render(this=<unavailable>, aContext=0x00007f824fd9cb50, aRenderComponents=3, aTransform=0x0000000000000000, aImgParams=0x00007ffee5bdc9b0) at SVGGeometryFrame.cpp:699:5 [opt]
    frame #7: 0x0000000112536250 XUL`mozilla::SVGGeometryFrame::PaintSVG(this=0x00007f82f9a96ca0, aContext=0x00007f824fd9cb50, aTransform=0x00007ffee5bdc980, aImgParams=0x00007ffee5bdc9b0, aDirtyRect=<unavailable>) at SVGGeometryFrame.cpp:264:5 [opt]
    frame #8: 0x0000000112535a68 XUL`nsDisplaySVGGeometry::Paint(this=0x00007f82f9ab6198, aBuilder=<unavailable>, aCtx=<unavailable>) at SVGGeometryFrame.cpp:120:43 [opt]
    frame #9: 0x0000000110682e62 XUL`mozilla::layers::DIGroup::PaintItemRange(this=0x00007f824fd9c348, aGrouper=0x00007ffee5bdcff8, aStartItem=0x00007f82f9ab6198, aEndItem=0x0000000000000000, aContext=0x00007f824fd9cb50, aRecorder=0x00007f824fd9c640, aRootManager=0x00007f8308081148, aResources=0x00007ffee5bde788) at WebRenderCommandBuilder.cpp:824:26 [opt]

Replaying this for every tile is obviously problematic.

Summary: https://wattenberger.com/guide/scaling-svg has bad blob behaviour → https://wattenberger.com/guide/scaling-svg has bad blob behaviour because of nsSVGPatternFrame::PaintPattern

If we can convert this CreateSimilarDrawTarget to a CreateClippedDrawTarget that should solve the problem. I'm not sure how easy that will be to do.

Attached file Standalone version
Assignee: nobody → nical.bugzilla
Status: NEW → ASSIGNED

Jeff already did the investigation, let's see if naively replacing with ClippedDrawTarget works out (looked OK at a glance on a debug build).

https://treeherder.mozilla.org/#/jobs?repo=try&revision=2cc4e49e332bdb2e90a2e984449a9dc8ac576e0e

Flags: needinfo?(nical.bugzilla)

Looks like not.

CreateClippedDrawTarget is only usable as a more sophisticated version of PushLayer. It assumes that it is painted at 1-1 device scale without tiling. I wouldn't be surprised if these assumptions do not hold for PaintPattern.

Attachment #9119078 - Attachment is obsolete: true
Assignee: nical.bugzilla → jmuizelaar
No longer blocks: wr-74

There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:jrmuizel, could you have a look please?
For more information, please visit auto_nag documentation.

Flags: needinfo?(jmuizelaar)
Depends on: 1617493
Flags: needinfo?(jmuizelaar)

This works fine now because of bug 1617493

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Attachment #9119077 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: