Closed Bug 1247678 Opened 8 years ago Closed 8 years ago

Firefox unusable on site with box-shadow

Categories

(Core :: Graphics, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dvander, Unassigned)

References

()

Details

(Keywords: perf, Whiteboard: gfx-noted)

The site in the URL is totally unusable in Firefox once you scroll. Even with APZ, checkerboarding happens 100% of the time. Paints seem to take anywhere from two to five *seconds* on average. Chrome is fine, Edge has a little jank but it's scrollable.

The Gecko profiler seems to think all the time is spent waiting on a lock, which doesn't seem right. I attached a debugger and hit Break to see what was going on. It looks like a box-shadow/blur operation is super expensive:

https://dxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxBlur.cpp?from=gfxBlur.cpp#122

Breaking on this call and stepping over results in a 2-3 second pause on an opt build. The width and height of the operation is 1772x18775.

Seems to happen on OS X as well as Windows.
This is slow due to us hitting the slow path here - https://dxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxBlur.cpp?from=gfxBlur.cpp#944

We could potentially fix it as mentioned here - https://bugzilla.mozilla.org/show_bug.cgi?id=1227216#c9

Layout is giving us a huge 10000x+ box shadow, with a mildly small box shadow and a large offset as that's bigger than the min box shadow.
Whiteboard: gfx-noted,perf
Keywords: perf
Whiteboard: gfx-noted,perf → gfx-noted
We could at least clamp the box shadow radius to values that we can handle within an acceptable time.

How much bigger than the actual rendered area is our cached surface? If it's much bigger, we shouldn't try to cache anything.
(In reply to Markus Stange [:mstange] from comment #2)
> We could at least clamp the box shadow radius to values that we can handle
> within an acceptable time.
> 

The box shadow radius itself isn't that big here, it's only 28x28. The destination rect and shadow rect here are very large. [1]

(lldb) p aDestinationRect
(mozilla::gfx::Rect) $26 = {
  mozilla::gfx::BaseRect<float, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::MarginTyped<mozilla::gfx::UnknownUnits, float> > = (x = -28, y = -28, width = 1336, height = 10067)
}

(lldb) p aShadowClipRect
(mozilla::gfx::Rect) $27 = {
  mozilla::gfx::BaseRect<float, mozilla::gfx::RectTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::PointTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::SizeTyped<mozilla::gfx::UnknownUnits, float>, mozilla::gfx::MarginTyped<mozilla::gfx::UnknownUnits, float> > = (x = -20, y = 20, width = 1320, height = 10051)
}

> How much bigger than the actual rendered area is our cached surface? If it's
> much bigger, we shouldn't try to cache anything.

We don't cache anything when we use the destination rect. [2]

[1] https://dxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxBlur.cpp?case=true&from=gfxBlur.cpp#917
[2] https://dxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxBlur.cpp?case=true&from=gfxBlur.cpp#1006
See Also: → 1250947
This is much better now!
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.