Closed Bug 802321 Opened 12 years ago Closed 12 years ago

Repeated, unnecessary invalidation of transformed element as it scrolls

Categories

(Core :: Layout, defect)

17 Branch
x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: jwatt, Assigned: mattwoodrow)

References

Details

(Keywords: perf)

Attachments

(7 files, 1 obsolete file)

Attached file testcase
This is another case of the issue that was fixed in bug 800198. It seems like we are still needlessly invalidating transformed elements as we scroll. In this case the over-invalidation seems to be triggered when a rotation is involved.
Ugh. In this testcase, when scrolling the div down very slowly we also seem to needlessly invalidate the entire content area over and over again. Curiously that doesn't seem to happen when we scroll down a bit faster, and doesn't seem to happen at all when scrolling up (well, with the exception of when we hit bug 801918).
Blocks: dlbi
Summary: Over-invalidation of transformed element as it scrolls → Repeated, unnecessary invalidation of transformed element as it scrolls
Blocks: 801949
This SVG version has slightly different behavior.
Rounding bugs are fun.
Attachment #672026 - Flags: review?(roc)
Comment on attachment 672026 [details] [diff] [review]
Use FuzzyEquals to compare matrices in LayerTreeInvalidation

Review of attachment 672026 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/thebes/gfx3DMatrix.cpp
@@ +131,5 @@
> +  return ::FuzzyEqual(_11, o._11) && ::FuzzyEqual(_12, o._12) && ::FuzzyEqual(_13, o._13) && ::FuzzyEqual(_14, o._14) &&
> +         ::FuzzyEqual(_21, o._21) && ::FuzzyEqual(_22, o._22) && ::FuzzyEqual(_23, o._23) && ::FuzzyEqual(_24, o._24) &&
> +         ::FuzzyEqual(_31, o._31) && ::FuzzyEqual(_32, o._32) && ::FuzzyEqual(_33, o._33) && ::FuzzyEqual(_34, o._34) &&
> +         ::FuzzyEqual(_41, o._41) && ::FuzzyEqual(_42, o._42) && ::FuzzyEqual(_43, o._43) && ::FuzzyEqual(_44, o._44);
> +}

Use mozilla::gfx::FuzzyEqual from Tools.h.

Is 1e-4 actually needed here or can we go lower?
Attached file alternate testcase
Attached file alternate testcase 2
Attached file alternate testcase 3
These three alternate testcases (created along the way while I was reducing http://www.jasondavies.com/factorisation-diagrams/ to the first two testcase I attached) don't seem to be fixed by your patch, Matt. :(
(In reply to Robert O'Callahan (:roc) (Mozilla Corporation) from comment #4)
> Comment on attachment 672026 [details] [diff] [review]
> Use FuzzyEquals to compare matrices in LayerTreeInvalidation
> 
> Review of attachment 672026 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: gfx/thebes/gfx3DMatrix.cpp
> @@ +131,5 @@
> > +  return ::FuzzyEqual(_11, o._11) && ::FuzzyEqual(_12, o._12) && ::FuzzyEqual(_13, o._13) && ::FuzzyEqual(_14, o._14) &&
> > +         ::FuzzyEqual(_21, o._21) && ::FuzzyEqual(_22, o._22) && ::FuzzyEqual(_23, o._23) && ::FuzzyEqual(_24, o._24) &&
> > +         ::FuzzyEqual(_31, o._31) && ::FuzzyEqual(_32, o._32) && ::FuzzyEqual(_33, o._33) && ::FuzzyEqual(_34, o._34) &&
> > +         ::FuzzyEqual(_41, o._41) && ::FuzzyEqual(_42, o._42) && ::FuzzyEqual(_43, o._43) && ::FuzzyEqual(_44, o._44);
> > +}
> 
> Use mozilla::gfx::FuzzyEqual from Tools.h.

Ok.

> 
> Is 1e-4 actually needed here or can we go lower?

The error margin I recorded when debugging it was 0.00000096, and it didn't work using 1e-6, so I'm guessing that it must get slightly higher at times.

Maybe 1e-5 if it's important?
Attachment #672026 - Attachment is obsolete: true
Attachment #672026 - Flags: review?(roc)
Attachment #672087 - Flags: review?(roc)
The invalidations were due to the bounds of the nsDisplayTransform changing when we scrolled past a certain point. Rounding bugs yet again.

Lets just not compare geometries for inactive layers at all, since we still have LayerTreeInvalidation happening.
Attachment #672088 - Flags: review?(roc)
Comment on attachment 672087 [details] [diff] [review]
Use FuzzyEquals to compare matrices in LayerTreeInvalidation v2

Review of attachment 672087 [details] [diff] [review]:
-----------------------------------------------------------------

::: gfx/thebes/gfx3DMatrix.cpp
@@ +129,5 @@
> +         gfx::FuzzyEqual(_13, o._13, 1e-4) && gfx::FuzzyEqual(_14, o._14, 1e-4) &&
> +         gfx::FuzzyEqual(_21, o._21, 1e-4) && gfx::FuzzyEqual(_22, o._22, 1e-4) && 
> +         gfx::FuzzyEqual(_23, o._23, 1e-4) && gfx::FuzzyEqual(_24, o._24, 1e-4) &&
> +         gfx::FuzzyEqual(_31, o._31, 1e-4) && gfx::FuzzyEqual(_32, o._32, 1e-4) && 
> +         gfx::FuzzyEqual(_33, o._33, 1e-4) && gfx::FuzzyEqual(_34, o._34, 1e04) &&

Nice typo. I suggest replacing 1e-4 with a static const float declared right here.
Attachment #672087 - Flags: review?(roc) → review+
Keywords: perf
https://hg.mozilla.org/mozilla-central/rev/4a69dfa3ed05
https://hg.mozilla.org/mozilla-central/rev/48aff95d2d29
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: