Skip to content

Introduce ClipChain #1833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2017
Merged

Introduce ClipChain #1833

merged 1 commit into from
Oct 14, 2017

Conversation

mrobinson
Copy link
Member

@mrobinson mrobinson commented Oct 9, 2017

Clip chains are a linked list of ClipWorkItems that are used to avoid
having to recalculate the stack of clips necessary to render items when
switching between different ClipScrollNodes. The ClipChains are
calculated once on a per node basis during update_transform.


This change is Reviewable

@mrobinson mrobinson requested a review from glennw October 9, 2017 17:45
@mrobinson
Copy link
Member Author

I did a bit of performance testing for this change. For nasty situations (a thousand deep nested clip), ClipScrollNode::update_all_transforms now takes about as long as ClipScrollNode::update_all_transforms and FrameBuilder::recalculate_clip_scroll_nodes together (as one would expect). Meanwhile a per-clip node cost has been eliminated, meaning that rendering should be slightly faster overall.

@glennw
Copy link
Member

glennw commented Oct 10, 2017

I didn't get to this today, sorry. I'll look at it first thing tomorrow.

The CI seems to be failing on mac - it might be a float accuracy issue with the clip changes that requires re-generating the reference images?

@mrobinson
Copy link
Member Author

@glennw I'm pretty sure the failure here is due to your recent fix for the behavior of inner_rect. To keep this fix, I'll need to implement the thing we discussed which was the id assignment for each axis-aligned group of coordinate spaces. I've almost got that finished, but I need to fix one more issue. Hopefully I can have an updated PR for this tomorrow.

@glennw
Copy link
Member

glennw commented Oct 11, 2017

OK, I'll hold off on reviewing until the updated patch. @kvark pointed out to me that one of my assumptions in that fix was incorrect - so if there's a better way to fix it that still passes the new reftest, go for it.

@mrobinson
Copy link
Member Author

@glennw Okay. I think the branch is ready now. The good thing about the change is that now we can start using the coordinate_system_id for more kinds of optimizations.

Copy link
Member

@kvark kvark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, minus one moment.


// We cannot apply any kind of optimization based on inner rectangles when the
// clips exists in another axis-aligned coordinate system.
if node.work_item.has_compatible_coordinate_system(current_coordinate_system_id) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct. Inner rects are valid regardless of the coordinate systems.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a replacement for the workaround in #1820. Would it be better for me to add a FIXME and open an issue?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, please

@glennw
Copy link
Member

glennw commented Oct 12, 2017

This looks good to me - but we should do a gecko/servo try run before merging too.

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #1845) made this pull request unmergeable. Please resolve the merge conflicts.

@mrobinson
Copy link
Member Author

Here's the try run for this PR: https://treeherder.mozilla.org/#/jobs?repo=try&revision=8e48d88f50d99977ba93d86b7a36dd9c58c9d5cd&selectedJob=136489766

There are a few tests failing, but it seems like the differences are subpixel. Yet, this PR should change rendering at all. I will investigate a bit more.

@glennw
Copy link
Member

glennw commented Oct 12, 2017

@mrobinson Looking at the reference image that was updated here. There appears to be AA being applied along the axis-aligned edges of the rectangle. That shouldn't be occurring - those edges should be pixel perfect. It's quite possible that fixing that will fix the gecko reftest errors, I think.

I wonder if an extra clip / mask is being applied that wasn't previously?

@glennw
Copy link
Member

glennw commented Oct 12, 2017

It's probably worth fixing that ref test in wrench before looking into the gecko failures, since they are probably the same issue.

@mrobinson
Copy link
Member Author

Okay. After looking at this a bit I found two bugs in my original PR. The first was that the condition for the inner_rect workaround was reversed (!). Additionally the outer bounds of the clip were not being passed properly down the ClipScrollTree hierarchy. I have fixed these issues and have done the rebase.

Here is the try run: https://treeherder.mozilla.org/#/jobs?repo=try&revision=604e9e610ea14c65039f2a5b9e258ce23585b982&selectedJob=136791157

Of the unexpected results:

  1. Some are due sticky fixes I made recently
  2. Two unexpected passes appear to be intermittent tests deviations
  3. One is an accessibility failure that looks completely unrelated

@kvark
Copy link
Member

kvark commented Oct 13, 2017

@mrobinson awesome, thank you!
@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit fed7c88 has been approved by kvark

@bors-servo
Copy link
Contributor

⌛ Testing commit fed7c88 with merge 7b5553d...

bors-servo pushed a commit that referenced this pull request Oct 13, 2017
Introduce ClipChain

Clip chains are a linked list of ClipWorkItems that are used to avoid
having to recalculate the stack of clips necessary to render items when
switching between different ClipScrollNodes. The ClipChains are
calculated once on a per node basis during update_transform.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1833)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - status-travis

@kvark
Copy link
Member

kvark commented Oct 13, 2017

Downloading euclid v0.15.2
warning: spurious network error (2 tries remaining): failed to get 200 response from https://crates.io/api/v1/crates/euclid/0.15.2/download, got 503
warning: spurious network error (1 tries remaining): failed to get 200 response from https://crates.io/api/v1/crates/euclid/0.15.2/download, got 503
error: unable to get packages from source

@bors-servo retry

@bors-servo
Copy link
Contributor

⌛ Testing commit fed7c88 with merge ce81770...

bors-servo pushed a commit that referenced this pull request Oct 13, 2017
Introduce ClipChain

Clip chains are a linked list of ClipWorkItems that are used to avoid
having to recalculate the stack of clips necessary to render items when
switching between different ClipScrollNodes. The ClipChains are
calculated once on a per node basis during update_transform.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1833)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - status-travis

@bors-servo
Copy link
Contributor

☔ The latest upstream changes (presumably #1869) made this pull request unmergeable. Please resolve the merge conflicts.

Clip chains are a linked list of ClipWorkItems that are used to avoid
having to recalculate the stack of clips necessary to render items when
switching between different ClipScrollNodes. The ClipChains are
calculated once on a per node basis during update_transform.

In order to make this happen we need to start tracking when
ClipScrollNodes share axis-aligned coordinate spaces. We can use these
ids to render rectangular clips into masks when necessary.
@mrobinson
Copy link
Member Author

mrobinson commented Oct 14, 2017

The failure looks like it was related to the merge conflict. I rebased the branch.

@mrobinson
Copy link
Member Author

@bors-servo r=kvark

@bors-servo
Copy link
Contributor

📌 Commit 9822f69 has been approved by kvark

@bors-servo
Copy link
Contributor

⌛ Testing commit 9822f69 with merge d97dc8e...

bors-servo pushed a commit that referenced this pull request Oct 14, 2017
Introduce ClipChain

Clip chains are a linked list of ClipWorkItems that are used to avoid
having to recalculate the stack of clips necessary to render items when
switching between different ClipScrollNodes. The ClipChains are
calculated once on a per node basis during update_transform.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1833)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

💔 Test failed - status-travis

@mrobinson
Copy link
Member Author

@bors-servo retry

  • "The job exceeded the maximum time limit for jobs, and has been terminated." Seems that this was an issue with the build infrastructure.

@bors-servo
Copy link
Contributor

⌛ Testing commit 9822f69 with merge 0b52dd7...

bors-servo pushed a commit that referenced this pull request Oct 14, 2017
Introduce ClipChain

Clip chains are a linked list of ClipWorkItems that are used to avoid
having to recalculate the stack of clips necessary to render items when
switching between different ClipScrollNodes. The ClipChains are
calculated once on a per node basis during update_transform.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1833)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-appveyor, status-travis
Approved by: kvark
Pushing 0b52dd7 to master...

@bors-servo bors-servo merged commit 9822f69 into servo:master Oct 14, 2017
@mrobinson mrobinson deleted the clip-chain branch December 8, 2017 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants