-
Notifications
You must be signed in to change notification settings - Fork 294
Separate interning text run #3369
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
Conversation
6b3c530
to
823a663
Compare
Looks like there is a reftest failure on CI:
Any chance you could do a talos run before review, just to give an idea what effect it has on dl_mutate (even just to make sure it doesn't regress, for now, since we probably won't get big wins from this initial work)? |
Here is the try run with talos results. I see some small improvement and regression which is curious. https://treeherder.mozilla.org/#/jobs?repo=try&revision=752295ab260070f973c22dcb167cd2bef18e48bd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 6 of 12 files at r1.
Reviewable status: 6 of 12 files reviewed, 2 unresolved discussions (waiting on @djg)
webrender/src/clip.rs, line 101 at r1 (raw file):
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub struct ClipUidMarker; pub type ClipUid = intern::ItemUid<ClipUidMarker>;
This would become simpler if we use a global uid type (mentioned below).
webrender/src/intern.rs, line 76 at r1 (raw file):
/// Implement for a marker struct to associate the type of Uid marker to use /// with `intern::Handle<..>` pub trait UidMarker: Copy + Clone {
Having the item uids require this trait and phantom marker feels a bit overengineered to me. How about we just share one uid concrete type among all interners, and don't make them generic. That might aid in debugging too, since a uid is globally unique and would never overlap with a uid from a different interner type.
(partial review only so far, will work through this today). |
☔ The latest upstream changes (presumably #3368) made this pull request unmergeable. Please resolve the merge conflicts. |
Thanks @gw3583 |
823a663
to
6497007
Compare
There was a problem hiding this 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 12 files reviewed, 2 unresolved discussions (waiting on @gw3583)
webrender/src/clip.rs, line 101 at r1 (raw file):
Previously, gw3583 (Glenn Watson) wrote…
This would become simpler if we use a global uid type (mentioned below).
Done.
webrender/src/intern.rs, line 76 at r1 (raw file):
Previously, gw3583 (Glenn Watson) wrote…
Having the item uids require this trait and phantom marker feels a bit overengineered to me. How about we just share one uid concrete type among all interners, and don't make them generic. That might aid in debugging too, since a uid is globally unique and would never overlap with a uid from a different interner type.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 8 files at r2.
Reviewable status: 6 of 12 files reviewed, 2 unresolved discussions (waiting on @gw3583)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 12 files at r1, 1 of 8 files at r2.
Reviewable status: 8 of 12 files reviewed, 8 unresolved discussions (waiting on @gw3583 and @djg)
webrender/src/display_list_flattener.rs, line 1233 at r2 (raw file):
); //cur_instance.kind = PrimitiveInstanceKind::Picture { pic_index: current_pic_index };
Why is this change needed?
webrender/src/display_list_flattener.rs, line 1264 at r2 (raw file):
current_pic_index = filter_pic_index; //cur_instance.kind = PrimitiveInstanceKind::Picture { pic_index: current_pic_index };
same
webrender/src/display_list_flattener.rs, line 1302 at r2 (raw file):
current_pic_index = blend_pic_index; // cur_instance.kind = PrimitiveInstanceKind::Picture { pic_index: blend_pic_index }; match cur_instance.kind {
same
webrender/src/picture.rs, line 573 at r2 (raw file):
); let prim_rect = match prim_instance.kind {
This is not quite right for Pictures (their rect is built dynamically), but this wasn't handled correctly previously anyway - I've got a fix for it in my local branch.
webrender/src/picture.rs, line 1253 at r2 (raw file):
}; let prim_data = match prim_instance.kind {
Maybe make this a helper method on FrameResources? Seems like it'll be used in a few places.
webrender/src/scene_builder.rs, line 173 at r2 (raw file):
} // Access to `DocumentResources` interners by `Internable`
What is this trait needed for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 12 files at r1, 3 of 8 files at r2.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @gw3583 and @djg)
webrender/src/display_list_flattener.rs, line 2236 at r2 (raw file):
} pub trait AsInstanceKind<H> {
Is there a reason to have these as separate traits rather than a "Primitive" trait or similar?
webrender/src/prim_store/text_run.rs, line 29 at r2 (raw file):
#[derive(Debug, Clone, Eq, PartialEq, Hash)] pub struct TextRunKey { pub is_backface_visible: bool,
It's probably worth having a set of "common" structs that are embedded within each key / template etc for the data that is shared between all the different types?
webrender/src/prim_store/text_run.rs, line 80 at r2 (raw file):
#[cfg_attr(feature = "replay", derive(Deserialize))] pub struct TextRunTemplate { pub is_backface_visible: bool,
Same here for common data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @gw3583 and @djg)
webrender/src/display_list_flattener.rs, line 1233 at r2 (raw file):
Previously, gw3583 (Glenn Watson) wrote…
Why is this change needed?
Because PrimitiveInstanceKind:Picture now contains a data_handle. data_handle is Copy
so I might try adding it the Picture { ... }
here, instead of updating pic_index in-place.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @gw3583)
webrender/src/display_list_flattener.rs, line 2236 at r2 (raw file):
Previously, gw3583 (Glenn Watson) wrote…
Is there a reason to have these as separate traits rather than a "Primitive" trait or similar?
Because there implemented on different types. I can move BuildKey
into the the Internable
trait as is it related to generating the key for interning. AsInstanceKind
is used for getting a PrimitiveInstanceKind
and is implemented on the key that's the source, eg TextRunKey
. CreateShadow
and IsVisible
are properties of the primitive and can be combined into a Primitive
trait.
webrender/src/picture.rs, line 573 at r2 (raw file):
Previously, gw3583 (Glenn Watson) wrote…
This is not quite right for Pictures (their rect is built dynamically), but this wasn't handled correctly previously anyway - I've got a fix for it in my local branch.
Do you need to post me the fix to incorporate?
webrender/src/picture.rs, line 1253 at r2 (raw file):
Previously, gw3583 (Glenn Watson) wrote…
Maybe make this a helper method on FrameResources? Seems like it'll be used in a few places.
Done.
webrender/src/scene_builder.rs, line 173 at r2 (raw file):
Previously, gw3583 (Glenn Watson) wrote…
What is this trait needed for?
It's used by the generic version of DisplayListFlattener::create_primitive
to obtain the correct interner for primitive.
let interner = self.resources.interner_mut(); // Uses type deduction to work out the which store +
let prim_data_handle = // |
interner // |
.intern(&prim_key, || { ... }); // << From the types required here ----------------+
webrender/src/prim_store/text_run.rs, line 29 at r2 (raw file):
Previously, gw3583 (Glenn Watson) wrote…
It's probably worth having a set of "common" structs that are embedded within each key / template etc for the data that is shared between all the different types?
OK, I had that in a version but on IRC you advised against it. I think having common structs can help clean up some pattern matching mess.
webrender/src/prim_store/text_run.rs, line 80 at r2 (raw file):
Previously, gw3583 (Glenn Watson) wrote…
Same here for common data.
Done.
6497007
to
6c697ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 3 of 12 files reviewed, 11 unresolved discussions (waiting on @gw3583)
webrender/src/display_list_flattener.rs, line 2236 at r2 (raw file):
Previously, djg (Dan Glastonbury) wrote…
Because there implemented on different types. I can move
BuildKey
into the theInternable
trait as is it related to generating the key for interning.AsInstanceKind
is used for getting aPrimitiveInstanceKind
and is implemented on the key that's the source, egTextRunKey
.CreateShadow
andIsVisible
are properties of the primitive and can be combined into aPrimitive
trait.
One thing I found that is having CreateShadow
being a separate trait means that we can use the compiled to help us. ie.
impl CreateShadow for LinearGradient {
fn create_shadow(&self, shadow: &Shadow) -> Self {
PrimitiveKeyKind::LinearGradient { .. } |
panic!("bug: this prim is not supported in shadow contexts");
}
}
We don't need the panic!
implementation and can have the compiler error when trying to create a shadow for LinearGradient
because the CreateShadow
trait doesn't exists for LinearGradient
.
☔ The latest upstream changes (presumably #3381) made this pull request unmergeable. Please resolve the merge conflicts. |
@gw3583 Ping |
Sorry, all-hands jetlag and that - I was going to take a more detailed look in the morning, but I think it probably looks good in general now, or the remaining bits could be done as follow ups. Did we work out what effect this has on talos? |
Probably worth getting @kvark to take a quick look too, if he has time. |
I'm currently working through removing the conflict with servo/master. Update shortly. @gw3583 It had a slight improvement on talos, but I wasn't expecting much of a change yet. |
@djg Yea, I wouldn't expect a large improvement until we separate solid rects. As long as it doesn't regress, we're good for now 👍 |
6c697ab
to
3f368dc
Compare
☔ The latest upstream changes (presumably #3384) made this pull request unmergeable. Please resolve the merge conflicts. |
Sorry, this got conflicts again - I think it should be good to go once those conflicts are resolved? |
3f368dc
to
e3ccda7
Compare
@gw3583 Apparently there is one comment to resolve? |
I think it's fine to get this merged now, to avoid any more rebase issues. We should be able to fix up any remaining changes as follow ups. |
@bors-servo r+ |
📌 Commit e3ccda7 has been approved by |
Separate interning text run First part of separating Primitives into separate interned data. <!-- 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/3369) <!-- Reviewable:end -->
☀️ Test successful - status-appveyor, status-taskcluster |
…449ec591527a (WR PR #3369). r=kats servo/webrender#3369 Differential Revision: https://phabricator.services.mozilla.com/D13936 --HG-- extra : moz-landing-system : lando
…449ec591527a (WR PR #3369). r=kats servo/webrender#3369 Differential Revision: https://phabricator.services.mozilla.com/D13936
…449ec591527a (WR PR #3369). r=kats servo/webrender#3369 Differential Revision: https://phabricator.services.mozilla.com/D13936 UltraBlame original commit: 690bea1cb27f8288c479bcea354474a17268ad96
…449ec591527a (WR PR #3369). r=kats servo/webrender#3369 Differential Revision: https://phabricator.services.mozilla.com/D13936 UltraBlame original commit: 690bea1cb27f8288c479bcea354474a17268ad96
…449ec591527a (WR PR #3369). r=kats servo/webrender#3369 Differential Revision: https://phabricator.services.mozilla.com/D13936 UltraBlame original commit: 690bea1cb27f8288c479bcea354474a17268ad96
…449ec591527a (WR PR #3369). r=kats servo/webrender#3369 Differential Revision: https://phabricator.services.mozilla.com/D13936
First part of separating Primitives into separate interned data.
This change is