Page MenuHomePhabricator

Bug 1589669 - Fix snapping and rounding errors causing picture caching invalidation when zoomed in.
ClosedPublic

Authored by ktaeleman on Dec 12 2019, 10:44 PM.

Details

Summary
  • Fix crash due to shift left causing overflow (debug only)
  • Remove rounding of scrolling offsets and snap to view space instead of

world space

Diff Detail

Repository
rMOZILLACENTRAL mozilla-central
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Build Status
Buildable 149483
Build 225618: arc lint + arc unit

Event Timeline

ktaeleman created this revision.Dec 12 2019, 10:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 12 2019, 10:44 PM
phab-bot requested review of this revision.Dec 12 2019, 10:45 PM
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: Restricted Project.
aosmond added inline comments.Dec 13 2019, 2:13 PM
gfx/layers/apz/src/APZCTreeManager.cpp
731

\o/

gfx/wr/webrender/src/picture.rs
3250

How does this produce a different result?

gfx/wr/webrender/src/spatial_node.rs
439

I expect this will break snapping in non-deterministic ways. We used the content transform to snap everything during scene building, so the fractional offset cannot change. This is also inconsistent with how update_transform snaps the offset.

That said, I understand the bug now. I think you should apply the scale to the relative offset (that is to say, added_offset), snap, and then add that to the current transform's offset.

aosmond requested changes to this revision.Dec 13 2019, 2:13 PM
This revision now requires changes to proceed.Dec 13 2019, 2:13 PM

Also, can you post the try results for Linux and Windows? If there is any fuzz necessary, I'd like to review that as well. I've made plenty of mistakes fuzzing real issues this year that I had to painstakingly figure out later :(.

aosmond added inline comments.Dec 13 2019, 2:26 PM
gfx/wr/webrender/src/spatial_node.rs
439

Addendum: This is also inconsistent with how update_transform snaps the offset *for ReferenceFrames* around line 353.

botond accepted this revision.Dec 13 2019, 5:37 PM

The APZ change looks good to me. Will defer to Andrew for the WR changes.

ktaeleman planned changes to this revision.Dec 13 2019, 7:09 PM
ktaeleman marked 2 inline comments as done.
ktaeleman added inline comments.
gfx/wr/webrender/src/picture.rs
3250

When zoom values are between 0-1.0, this used to blow up due to the log2() becoming negative and causing overflow on the shift left. This corrects that calculation

gfx/wr/webrender/src/spatial_node.rs
352

@botond and @aosmond : I'm not sure what the correct behavior here would be. I've not noticed anything wrong in this scenario, but I don't understand the context of this code.

ktaeleman updated this revision to Diff 211203.Dec 20 2019, 4:20 PM
ktaeleman retitled this revision from Bug 1589669 - Picture Caching doesn't work well when zoomed in on android. to Bug 1589669 - Fix snapping and rounding errors causing picture caching invalidation when zoomed in..
ktaeleman marked an inline comment as done.
ktaeleman marked 2 inline comments as done.Dec 20 2019, 4:21 PM

Sorry, too many distractions made this take way too long.

Try results here:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=54d83f11d4b57a98c81094ef1456235b2a7e6d45

aosmond accepted this revision.Dec 20 2019, 5:03 PM
This revision is now accepted and ready to land.Dec 20 2019, 5:03 PM
rgurzau reopened this revision.Dec 23 2019, 6:34 PM
This revision is now accepted and ready to land.Dec 23 2019, 6:34 PM
ktaeleman updated this revision to Diff 211808.Dec 23 2019, 7:23 PM