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 upStore the built state in the PipelineInfo #2865
Conversation
|
This is desired for https://bugzilla.mozilla.org/show_bug.cgi?id=1473352 |
|
@stacktrace The building is triggered, as you say, by having the pipeline connected to the root pipeline. This connection is defined by Gecko essentially, so it has all the info it needs to answer the question if a pipeline was actually built. Can you confirm that this is just needed because it's more convenient to track this on our side? |
|
Agreed - this is mostly for convenience because we can have multiple scene build requests in flight at the same time and it to track it on the gecko side means we'd have to duplicate a bunch of stuff there. It seemed easier/more reliable to do it this way. |
|
(Also it's a little complicated on the Gecko side because the knowledge of whether the content display list was attached is buried deep in the display list creation, and extracting that and associating it with data from the content process is messy) |
| @@ -1833,7 +1833,10 @@ impl Renderer { | |||
|
|
|||
| /// Returns the Epoch of the current frame in a pipeline. | |||
| pub fn current_epoch(&self, pipeline_id: PipelineId) -> Option<Epoch> { | |||
| self.pipeline_info.epochs.get(&pipeline_id).cloned() | |||
| self.pipeline_info.epochs | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
staktrace
Jul 5, 2018
Author
Contributor
Yes, knowing the epoch lets us know which gecko transaction has been completed, and lets us fire the MozAfterPaint event on the gecko side, which is the desired goal of this change.
This comment has been minimized.
This comment has been minimized.
kvark
Jul 5, 2018
Member
but if the pipeline isn't built, it's not painted either, so how does MozAfterPaint make sense?
This comment has been minimized.
This comment has been minimized.
staktrace
Jul 5, 2018
Author
Contributor
Because Gecko. You could consider it a bug, but in this case it's easier to bug-compatible with gecko than rewrite large chunks of the gecko frontend :(
This comment has been minimized.
This comment has been minimized.
mstange
Jul 5, 2018
Contributor
Yeah it should really be called MozAfterPrepareToComposite or MozReadyToCompositeInstantly.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mstange
Jul 5, 2018
•
Contributor
Actually, sorry, I was mixing up MozAfterPaint with MozLayerTreeReady. I concur with kats now; Gecko is being stupid and is using MozAfterPaint in a confused way, and matching the bug is an easy way out.
| @@ -99,7 +99,7 @@ pub struct ScenePipeline { | |||
| pub struct Scene { | |||
| pub root_pipeline_id: Option<PipelineId>, | |||
| pub pipelines: FastHashMap<PipelineId, Arc<ScenePipeline>>, | |||
| pub pipeline_epochs: FastHashMap<PipelineId, Epoch>, | |||
| pub pipeline_epochs: FastHashMap<PipelineId, (Epoch, BuildState)>, | |||
This comment has been minimized.
This comment has been minimized.
kvark
Jul 5, 2018
Member
hmm, this seems misplaced. Scene is the source for building, it's not supposed to know about build artifacts (like this flag)
This comment has been minimized.
This comment has been minimized.
staktrace
Jul 5, 2018
Author
Contributor
Ok. I should be able to take this out, will update the patch.
This comment has been minimized.
This comment has been minimized.
staktrace
Jul 5, 2018
Author
Contributor
@kvark Would the frame builder be a better place for this? The flattener can construct the map with all the built and unbuilt entries, pass it to the frame builder, and the render_backend can read it from the frame builder in updated_pipeline_info instead of the from the scene.
This comment has been minimized.
This comment has been minimized.
| // attached to the root pipeline via iframe items. | ||
| #[repr(C)] | ||
| #[derive(Copy, Clone, Debug, Deserialize, Serialize)] | ||
| pub struct BuildState(pub bool); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
This is turning out more complicated than I thought. Right now there is code in update_epoch that sends a This patch as-is doesn't preserve this behaviour correctly, although it's simple enough to modify the patch to do so. The problem is preserving this behaviour without putting the BuildState on the scene's copy of the |
I realized we can do this by checking if |
|
Interesting! What if we store the pipeline epoch in the pipeline itself? This way, we can trivially find out if the pipeline was added with a display list by comparing it's epoch with the map key. |
|
So yeah, I don't think we need the distinction between "built" and "not built" pipelines on the gecko side. As long as all the pipeline epochs get propagated from the pending scene to the new scene things are good. Here's a try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=31c488c1216646ac325e71f2cd527ea8debd79c6 The WR patch is much simpler, as it is mostly just code deletion now. I don't know if servo relies on the pipeline info only containing epochs for built scenes or not, that's the only potential concern. But really the code as it is now is not really providing a easily-describable set of epochs in the pipeline info because of this |
|
Haven't seen such a clean try push in a while :) Looking at the Servo code briefly, I'm not seeing them using the epochs. |
|
|
Store the built state in the PipelineInfo This adds a flag to the entries in the PipelineInfo that records whether or not a pipeline was actually built at a given epoch. It is possible for pipelines to have display lists that are not built if they are not connected to the root pipeline via a chain of iframe items, and in some cases Gecko needs to be able to distinguish between whether a pipeline was built or not during a particular render. <!-- 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/2865) <!-- Reviewable:end -->
|
|
Without this patch, the pipeline_epoch info on the new scene contains just the pipelines that were "built" as part of the scene build, plus pipelines on for which update_epoch was called. This is kind of random, and there doesn't appear to be any real reason to omit some of the pipelines. For gecko it is desirable to the epoch information for all pipelines, even the ones that weren't built, and for consistency we can just always propagate the epoch info over to the new scene during the scene build.
|
Trivial merge error; I rebased the patch and took out the now-unneeded "use Epoch". ^ |
|
@bors-servo r+ |
|
|
Store the built state in the PipelineInfo This adds a flag to the entries in the PipelineInfo that records whether or not a pipeline was actually built at a given epoch. It is possible for pipelines to have display lists that are not built if they are not connected to the root pipeline via a chain of iframe items, and in some cases Gecko needs to be able to distinguish between whether a pipeline was built or not during a particular render. <!-- 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/2865) <!-- Reviewable:end -->
|
|
staktrace commentedJul 4, 2018
•
edited by larsbergstrom
This adds a flag to the entries in the PipelineInfo that records whether
or not a pipeline was actually built at a given epoch. It is possible
for pipelines to have display lists that are not built if they are not
connected to the root pipeline via a chain of iframe items, and in some
cases Gecko needs to be able to distinguish between whether a pipeline
was built or not during a particular render.
This change is