Skip to content
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

Separate brush segment descriptors from clip mask instances. #3289

Merged
merged 2 commits into from Nov 12, 2018

Conversation

gw3583
Copy link
Contributor

@gw3583 gw3583 commented Nov 9, 2018

As part of interning primitives, we can move the segmenting
process to occur when a primitive is newly interned (which is
a significant optimization opportunity). We can do this since
segmentation only occurs on clip nodes with the same spatial
node as the primitive, thus the segmentation cannot be changed
due to scrolling or transform animation.

However, the presence of a clip mask per segment may still
change each frame, due to clips from other positioning nodes.

To handle this, we need to split the per-frame clip mask instance
information from the brush segment descriptors.

This is also a necessary step to allow borders to be interned,
which rely on pre-generated segment descriptors.

At the same time, make the size of a RenderTaskId smaller in
release builds, and tidy up FrameId::invalid().


This change is Reviewable

@gw3583
Copy link
Contributor Author

gw3583 commented Nov 9, 2018

r? @kvark or @nical

@gw3583
Copy link
Contributor Author

gw3583 commented Nov 9, 2018

This also seems to give a small but noticeable performance win on some of the talos tests.

Try run is not complete but looks good so far:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=4e7481e1ced995bf0119a53472481a487ab28044

@gw3583
Copy link
Contributor Author

gw3583 commented Nov 9, 2018

Mentioned in the comments but repeating here too - the work here to maintain per-instance data between prepare_prims and batching should be temporary. In the near-ish future we should be able to unify those passes, and avoid storing any of this data.

@gw3583
Copy link
Contributor Author

gw3583 commented Nov 9, 2018

Try run looks good.

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 good, I have a few non-blocking concerns.

we can move the segmenting process to occur when a primitive is newly interned

where is this done?

Reviewed 10 of 10 files at r1.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @gw3583)


webrender/src/batch.rs, line 1419 at r1 (raw file):

        // If a got a valid (or OPAQUE) clip task address, add the segment.
        if let Some(clip_task_address) = clip_task_address {

nit: just return early if it's None?


webrender/src/batch.rs, line 2209 at r1 (raw file):

}

impl PrimitiveStore {

does this have to be in batch module as opposed to the prim_store as all the rest of PrimitiveStore logic?


webrender/src/frame_builder.rs, line 197 at r1 (raw file):

        }

        self.prim_store.begin_frame();

nit: rename to something more specific, e.g. reset_clip_instances?


webrender/src/prim_store.rs, line 887 at r1 (raw file):

                if !clip_chain.needs_mask ||
                   (!self.may_need_clip_mask && !clip_chain.has_non_local_clips) {
                    clip_mask_instances.push(ClipMaskKind::None);

does this function always end up just pushing one ClipMaskKind? could it instead just return it?


webrender/src/render_task.rs, line 57 at r1 (raw file):

    #[cfg(debug_assertions)]
    pub frame_id: FrameId,

does it need to be pub?

@bors-servo
Copy link
Contributor

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

As part of interning primitives, we can move the segmenting
process to occur when a primitive is newly interned (which is
a significant optimization opportunity). We can do this since
segmentation only occurs on clip nodes with the same spatial
node as the primitive, thus the segmentation cannot be changed
due to scrolling or transform animation.

However, the presence of a clip mask per segment may still
change each frame, due to clips from other positioning nodes.

To handle this, we need to split the per-frame clip mask instance
information from the brush segment descriptors.

This is also a necessary step to allow borders to be interned,
which rely on pre-generated segment descriptors.

At the same time, make the size of a RenderTaskId smaller in
release builds, and tidy up FrameId::invalid().
Copy link
Contributor Author

@gw3583 gw3583 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 of 10 files reviewed, 3 unresolved discussions (waiting on @kvark)


webrender/src/batch.rs, line 1419 at r1 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

nit: just return early if it's None?

Done


webrender/src/batch.rs, line 2209 at r1 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

does this have to be in batch module as opposed to the prim_store as all the rest of PrimitiveStore logic?

It references a few symbols that are related to batching only, so I didn't think it made sense to be in prim_store. Instead, I've changed it to be a free helper function.


webrender/src/frame_builder.rs, line 197 at r1 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

nit: rename to something more specific, e.g. reset_clip_instances?

Done


webrender/src/prim_store.rs, line 887 at r1 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

does this function always end up just pushing one ClipMaskKind? could it instead just return it?

Indeed, that's much tidier. 👍


webrender/src/render_task.rs, line 57 at r1 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

does it need to be pub?

Nope, fixed.

@gw3583
Copy link
Contributor Author

gw3583 commented Nov 11, 2018

@kvark Those comments all made sense and have been fixed. Also rebased.

@gw3583
Copy link
Contributor Author

gw3583 commented Nov 12, 2018

@bors-servo r=kvark

@bors-servo
Copy link
Contributor

📌 Commit 47f5cf1 has been approved by kvark

@bors-servo
Copy link
Contributor

⌛ Testing commit 47f5cf1 with merge c7a0d33...

bors-servo pushed a commit that referenced this pull request Nov 12, 2018
Separate brush segment descriptors from clip mask instances.

As part of interning primitives, we can move the segmenting
process to occur when a primitive is newly interned (which is
a significant optimization opportunity). We can do this since
segmentation only occurs on clip nodes with the same spatial
node as the primitive, thus the segmentation cannot be changed
due to scrolling or transform animation.

However, the presence of a clip mask per segment may still
change each frame, due to clips from other positioning nodes.

To handle this, we need to split the per-frame clip mask instance
information from the brush segment descriptors.

This is also a necessary step to allow borders to be interned,
which rely on pre-generated segment descriptors.

At the same time, make the size of a RenderTaskId smaller in
release builds, and tidy up FrameId::invalid().

<!-- 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/3289)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - status-appveyor, status-taskcluster
Approved by: kvark
Pushing c7a0d33 to master...

@bors-servo bors-servo merged commit 47f5cf1 into servo:master Nov 12, 2018
bors-servo pushed a commit that referenced this pull request Nov 22, 2018
Add default deserializer for frame_id

Since frame ID is debug-only, it's not serialized when capturing from a release-built Firefox, making us unable to replay it with debug Wrench. This PR fixes this (broken recently by #3289).

r? anyone

<!-- 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/3339)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Nov 22, 2018
Add default deserializer for frame_id

Since frame ID is debug-only, it's not serialized when capturing from a release-built Firefox, making us unable to replay it with debug Wrench. This PR fixes this (broken recently by #3289).

r? anyone

<!-- 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/3339)
<!-- Reviewable:end -->
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.

None yet

3 participants