Closed Bug 1422950 Opened 6 years ago Closed 6 years ago

Spend less time in FindReferenceFrameFor with gfx.webrender.hit-test enabled

Categories

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

Other Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: kats, Assigned: kats)

References

Details

(Whiteboard: [wr-mvp] [gfx-noted])

Attachments

(1 file)

One of the things that turned up when profiling with gfx.webrender.hit-test enabled (see bug 1422868) was that we're spending a lot of time in FindReferenceFrameFor. This is called from [1] as part of the ToReferenceFrame call. One of the reasons this is slow is because this call doesn't enter the fast path at [2]. The reason for that is we're running this code after the gecko display list is fully built, and at that point the nsDisplayListBuilder's mCurrentFrame is pointing to some constant thing, rather than the frame that the nsDisplayCompositorHitTestInfo was created for. If we move the mArea stuff (specifically the call ToReferenceFrame) into the nsDisplayCompositorHitTestInfo constructor, then we'll take advantage of the fast-path because mCurrentFrame will be pointing to the right frame.

Before: https://perfht.ml/2ANgO7O
After: https://perfht.ml/2AMfnX9

[1] https://searchfox.org/mozilla-central/rev/477ac066b565ae0eb3519875581a62dfb1430e98/layout/painting/nsDisplayList.cpp#4998
[2] https://searchfox.org/mozilla-central/rev/477ac066b565ae0eb3519875581a62dfb1430e98/layout/painting/nsDisplayList.cpp#1685
Whiteboard: [gfx-noted][wr-mvp][triage] → [wr-reserve] [gfx-noted]
Comment on attachment 8934277 [details]
Bug 1422950 - Move the area calculation to the display item constructor to hit the ToReferenceFrame fastpath.

https://reviewboard.mozilla.org/r/205188/#review210752


C/C++ static analysis found 1 defect in this patch.

You can run this analysis locally with: `./mach static-analysis check path/to/file.cpp`


::: layout/painting/nsDisplayList.cpp:4948
(Diff revision 1)
>  
>  nsDisplayCompositorHitTestInfo::nsDisplayCompositorHitTestInfo(nsDisplayListBuilder* aBuilder,
>                                                                 nsIFrame* aFrame,
>                                                                 mozilla::gfx::CompositorHitTestInfo aHitTestInfo,
> -                                                               uint32_t aIndex)
> +                                                               uint32_t aIndex,
> +                                                               mozilla::Maybe<nsRect> aArea)

Error: Type 'mozilla::maybe<nsrect>' must not be used as parameter [clang-tidy: mozilla-non-memmovable-template-arg]
Comment on attachment 8934277 [details]
Bug 1422950 - Move the area calculation to the display item constructor to hit the ToReferenceFrame fastpath.

https://reviewboard.mozilla.org/r/205188/#review210758
Attachment #8934277 - Flags: review?(mstange) → review+
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/aaaa51a8bf64
Move the area calculation to the display item constructor to hit the ToReferenceFrame fastpath. r=mstange
Whiteboard: [wr-reserve] [gfx-noted] → [wr-mvp] [gfx-noted]
https://hg.mozilla.org/mozilla-central/rev/aaaa51a8bf64
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: