Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upMake the API transaction-based #1963
Conversation
|
This is a work in progress, it's not too far from being ready but there are still a few unresolved TODOs in the code. For now I haven't removed the RenderApi methods that are in Transaction, so that we can hopefully first land this, update gecko and servo and then remove the deprecated APIs. Hopefully that should decouple the task of updating WebRender and moving to the new API. |
|
I haven't looked at this in super detail, but the general patch looks good - the bits I looked at so far make sense to me. |
242785c
to
66b646e
|
Gecko try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=9224869560da7e7c60097b52ba966c0c8c3a2195 The PR is in a good state to be reviewed now. |
| /// The unique id for WR resource identification. | ||
| static NEXT_NAMESPACE_ID: AtomicUsize = ATOMIC_USIZE_INIT; | ||
|
|
||
| struct DocumentOp { |
This comment has been minimized.
This comment has been minimized.
| @@ -422,23 +444,22 @@ impl RenderBackend { | |||
| // rebuild of the frame! | |||
| if let Some(property_bindings) = property_bindings { | |||
| doc.scene.properties.set_properties(property_bindings); | |||
| doc.build_scene(&mut self.resource_cache); | |||
| op.build = true; | |||
This comment has been minimized.
This comment has been minimized.
kvark
Nov 6, 2017
Member
we should probably do the same for scroll & render events, instead of having and_render boolean
| self.result_tx.send(msg).unwrap(); | ||
| profile_counters.reset(); | ||
|
|
||
| if !op.scroll { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nical
Nov 6, 2017
Author
Collaborator
Yeah, the whole RenderNotifier trait is kinda arbitrary and modelled around the previous control flow. It should really be a single method with parameters saying how much has changed (scroll, scene, frame, etc.).
I was trying to do this PR without making it a breaking change to make the wr update easier for once (and come back with a breaking cleanup once the APIs are not used anymore). But it'd be good to simplify the RenderNotifier API and avoid this kind of dance.
| /// | ||
| /// This mechanism ensures that: | ||
| /// - no other message can be interleaved between two commands that need to be applied together. | ||
| /// - no redundant work is performed if two commands in the same tranasction cause the scen or |
This comment has been minimized.
This comment has been minimized.
|
|
|
Needs a rebase. |
|
@nical Are you still working on this? |
|
I do plan to finish this but unless there we identify cases that we care about for Austin where this can help performance, it is not in the list of high priority items until the workweek. |
|
Closing for now - let's re-open once we're ready to resume work on this. |
|
@glennw I don't see much value in closing the issue if it's still to be worked on. Our goal for now is to have performance up, not close as many issues as we can. |
|
Resuming work on this (rebase in progress). |
f7e7ba6
to
1f1cfdf
|
looking good so far Reviewed 7 of 7 files at r2. webrender/src/render_backend.rs, line 488 at r2 (raw file):
we need to clear up that semantics bit, it's inherited from long ago. perhaps, nop-scroll was used like a "wakeup" so now we can remove it since we have explicit wakeup Comments from Reviewable |
|
I got the PR to build again but before merging I'd like to revive the gecko side as well and do some testing. I may move the resource updates in a separate array because they will likely need some special handling for the async scene building stuff. |
19b4c66
to
75cc81d
|
The PR is in a reviewable state now. There are some more cosmethic changes that would be nice to have (such as making SetDisplayList less of a uber-message, and make epochs truly up to the api user, but that can wait. There might be some reorg inside of the Transaction struct to help with the upcoming async scene building, but that should be doable without changing the API itself. Next is deciding:
These can be decided later too. |
|
Reviewed 4 of 4 files at r4. Comments from Reviewable |
| DocumentMsg::GenerateFrame(property_bindings) => { | ||
| profile_scope!("GenerateFrame"); | ||
| DocumentMsg::UpdateDynamicProperties(property_bindings) => { | ||
| // Ideally, when there are property bindings present, |
This comment has been minimized.
This comment has been minimized.
glennw
Jan 8, 2018
Member
This comment and code is obsolete, as of #2043. We shouldn't need to rebuild the scene when the property bindings change.
|
Looks good to me! I'll delegate r+ and leave it to nical to determine if we need a gecko try run for this change, and merge when ready (unless @kvark has any remaining questions). @bors-servo delegate+ |
|
|
|
I had some test timeouts which ended up me messing up the gecko side integration. Works now! @bors-servo r+ |
|
|
Make the API transaction-based The idea is to replace individual `DocumentMsg`s in the api messages by vectors of `DocumentMsg` to provide a way to express the constraint that several DocumentMsg must be handled atomically without any other message interleaving in between. This also lets us avoid redundant work when we build transactions that contain several operations that would cause the frame and/or scene to be rebuilt. At the API level, users create a `Transaction` object and accumulate commands like `set_display_list`, `scroll` or `update_resources` into it and only touch the `RenderApi` at the end when calling `send_transaction`. <!-- 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/1963) <!-- Reviewable:end -->
|
@nical Please post the gecko integration patch to bug 1428766 so I can include it in my testing try pushes after this merges. Thanks! |
|
@staktrace I tried to make this PR non-breaking so that we can (hopefully) land the integration patches after the wr update (or that's the theory/intent anyway). |
|
Ah cool, that works too :) |
|
|
Move code to the new transaction API. Cleaning up after #1963. <!-- 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/2298) <!-- Reviewable:end -->
Move code to the new transaction API. Cleaning up after #1963. <!-- 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/2298) <!-- Reviewable:end -->
nical commentedOct 30, 2017
•
edited by larsbergstrom
The idea is to replace individual
DocumentMsgs in the api messages by vectors ofDocumentMsgto provide a way to express the constraint that several DocumentMsg must be handled atomically without any other message interleaving in between.This also lets us avoid redundant work when we build transactions that contain several operations that would cause the frame and/or scene to be rebuilt.
At the API level, users create a
Transactionobject and accumulate commands likeset_display_list,scrollorupdate_resourcesinto it and only touch theRenderApiat the end when callingsend_transaction.This change is