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

DocumentAPI support on the Renderer side #2050

Merged
merged 3 commits into from Nov 21, 2017
Merged

DocumentAPI support on the Renderer side #2050

merged 3 commits into from Nov 21, 2017

Conversation

@kvark
Copy link
Member

kvark commented Nov 16, 2017

This is a second batch of changes related to Document API, following #1509.

The idea is to allow Gecko to have separate documents for the chrome UI, page content, and bottom status bar, as opposed to using different pipelines in the same document. This change would allow minimal scene rebuilds per frame when UI is affected.

WIP TODO:

cc @glennw @mstange @jrmuizel


This change is Reviewable

@bors-servo
Copy link
Contributor

bors-servo commented Nov 16, 2017

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

@kvark kvark force-pushed the kvark:document branch from 606a92a to 532bff5 Nov 17, 2017
@kvark
Copy link
Member Author

kvark commented Nov 18, 2017

The performance aspect here is difficult to get right, since it relies on a frame semantics change. Old logic used to clear everything if either requested, or the frame size is less than the viewport. The new logic is:

  • main framebuffer color is cleared if the background color is provided in the options
  • each rendered document unconditionally clears the depth to 1.0 for its affected area
  • each document can also clear the affected color area, if the clear color is provided for it

Thus, we may end up clearing twice with the new logic. I expect the WR client to be careful about the clear colors and don't specify both the framebuffer and document/frame clear color unless necessary.

Aside from this aspect, the PR should be ready to review/merge now.

@kvark kvark changed the title [WIP] DocumentAPI support on the Renderer side DocumentAPI support on the Renderer side Nov 18, 2017
@kvark
Copy link
Member Author

kvark commented Nov 18, 2017

Actually, something wonky is going on at the start of the new document example. Investigating...

@kvark kvark force-pushed the kvark:document branch 2 times, most recently from 31d276f to e45c6db Nov 18, 2017
@kvark
Copy link
Member Author

kvark commented Nov 18, 2017

Ok, it turned out to be this: cc41e04#diff-f5062b694b9fe53fc1757ed483d577d9R2788

Some squashing is expected, but otherwise should be ready to review now.

@kvark kvark force-pushed the kvark:document branch from bb4c463 to 88126ab Nov 19, 2017
@kvark
Copy link
Member Author

kvark commented Nov 19, 2017

@glennw
Copy link
Member

glennw commented Nov 19, 2017

Reviewed 3 of 12 files at r1, 18 of 22 files at r2, 4 of 5 files at r3, 1 of 1 files at r4.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@glennw glennw self-requested a review Nov 19, 2017
Copy link
Member

glennw left a comment

Looks good! Squash if you want and r=me.

@glennw
Copy link
Member

glennw commented Nov 19, 2017

Also - before merging, it'd be good to have patches available for Servo and Gecko to deal with the API changes, to simplify the update process.

Copy link
Collaborator

nical left a comment

Great stuff!

@@ -884,8 +886,9 @@ pub struct DynamicProperties {

pub trait RenderNotifier: Send {
fn clone(&self) -> Box<RenderNotifier>;
fn new_frame_ready(&self);
fn new_scroll_frame_ready(&self, composite_needed: bool);
fn wakeup(&self);

This comment has been minimized.

Copy link
@nical

nical Nov 20, 2017

Collaborator

Nittiest of all nits: I'd prefer wake_up

fn new_frame_ready(&self);
fn new_scroll_frame_ready(&self, composite_needed: bool);
fn wakeup(&self);
fn new_document_ready(&self, DocumentId);

This comment has been minimized.

Copy link
@nical

nical Nov 20, 2017

Collaborator

While you are modifying this interface, maybe it'd be a good time to merge new_document_ready and new_scroll_document_ready into a single one that has enough parameters (id, did_scroll, composite_needed) to avoid contortions like in #1963 when the scrolled and non-scrolled paths are merged.

This comment has been minimized.

Copy link
@kvark

kvark Nov 20, 2017

Author Member

Agreed.

@kvark kvark force-pushed the kvark:document branch from 88126ab to ecb4283 Nov 20, 2017
@kvark
Copy link
Member Author

kvark commented Nov 20, 2017

Thanks for the reviews! Concerns are addressed now.
Latest try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=1b91c4648c732ad90544488cc992caf0564ebaa9
Gecko changes: everything under gfx/webrender_bindings in https://hg.mozilla.org/try/rev/1b91c4648c732ad90544488cc992caf0564ebaa9
Servo changes: kvark/servo@ffbc3a7

@bors-servo
Copy link
Contributor

bors-servo commented Nov 20, 2017

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

@glennw
Copy link
Member

glennw commented Nov 20, 2017

@kvark Thanks for the update patches! Want to rebase this again and we'll get it merged before it bitrots again? :)

Naming refactor of RenderedDocument
DocumentLayer index for rendering order
@kvark kvark force-pushed the kvark:document branch from ecb4283 to b19a91f Nov 20, 2017
Refactor FrameBuilder usage on the RenderBackend side to avoid None
Simplified RenderedDocument
Fix for building an empty frame
Refactored RenderNotifier according to review comments
Added an optimization to avoid clearing the whole screen if one of the documents does it
@kvark kvark force-pushed the kvark:document branch from b19a91f to 07ebcdf Nov 20, 2017
@kvark
Copy link
Member Author

kvark commented Nov 20, 2017

Rebased, added an optimization to avoid redundant clears (in a simple case of 1 document), and pushed another try push - https://treeherder.mozilla.org/#/jobs?repo=try&revision=376c737901e3a27405808e5a828126e60bd91cc5

@glennw
Copy link
Member

glennw commented Nov 20, 2017

@kvark Looks like there are some failures in that try push, but they seem the same (or similar) to ones we've had with recent PRs. I'm not sure if those are relevant or not in this case?

@kvark
Copy link
Member Author

kvark commented Nov 20, 2017

@glennw those 10 are expected, same as with your #2052: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e71afa7f78443212f702971f0a4eb05e27bf7b80
Edit: unless I screwed up something there too :)

@glennw
Copy link
Member

glennw commented Nov 20, 2017

@bors-servo r+ 🚀 💥

@bors-servo
Copy link
Contributor

bors-servo commented Nov 20, 2017

📌 Commit 07ebcdf has been approved by glennw

@bors-servo
Copy link
Contributor

bors-servo commented Nov 21, 2017

Testing commit 07ebcdf with merge 0864d35...

bors-servo added a commit that referenced this pull request Nov 21, 2017
DocumentAPI support on the Renderer side

This is a second batch of changes related to Document API, following #1509.

The idea is to allow Gecko to have separate documents for the chrome UI, page content, and bottom status bar, as opposed to using different pipelines in the same document. This change would allow minimal scene rebuilds per frame when UI is affected.

WIP TODO:
- [x] strict ordering API: 532bff5
- [x] Servo patch and test runs: kvark/servo@0263fa8
- [x] Firefox patch and try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=f939fbdab0231e6328061c12903db0c45847dd18
  - ~~`box-shadow/boxshadow-skiprect.html`~~ (from #1943)
  - ~~`css-filter-chains/moz-element.html`~~ (same as in #2053)
  - ~~`transform/animate-layer-scale-inherit-1.html`~~ (from #2043)
- [x] example
- [x] `FrameBuilder` and `RenderedDocument` refactor
https://tools.taskcluster.net/groups/DEvThfCaQWmt5Hp806GDLg/tasks/VLCZI7hVTQCc1xrDR3PgOQ/details#
- [x] review comments

cc  @glennw  @mstange @jrmuizel

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

bors-servo commented Nov 21, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: glennw
Pushing 0864d35 to master...

@bors-servo bors-servo merged commit 07ebcdf into servo:master Nov 21, 2017
4 of 5 checks passed
4 of 5 checks passed
code-review/reviewable 8 files, 2 discussions left (glennw, nical)
Details
Taskcluster (pull_request) TaskGroup: success
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@kvark kvark deleted the kvark:document branch Nov 21, 2017
bors-servo added a commit that referenced this pull request Nov 26, 2017
Flexible render target pool

This is a follow-up to #2050, also a more generic solution in place of the fix in #2039.

With multiple documents, we can't rely on stack-based render target re-use, since each document would expect a different stack and will force the wasteful re-allocation of render targets. With this PR, we'll first do a pass to re-use all perfectly matching targets for all documents. Then when each document is rendered, it will grab the remaining targets and re-initialize some parts of them, if needed. This scheme should guarantee efficient re-use of render target space for multiple documents, which are supposed to be used in Gecko for chrome, status bar, main page, and more.

Note: target selection doesn't take the depth surface into account at the moment, so these may sometimes re-allocate inefficiently. This is something to keep an eye on and potentially follow-up.

r? @glennw

<!-- 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/2098)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.