Skip to content

Use a test VRDisplay that renders to a GL window - #22953

Merged
bors-servo merged 1 commit into
servo:masterfrom
asajeffrey:webvr-glwindow
Mar 5, 2019
Merged

bors-servo merged 1 commit into
servo:masterfrom
asajeffrey:webvr-glwindow

Conversation

@asajeffrey

@asajeffrey asajeffrey commented Feb 28, 2019 •

Copy link
Copy Markdown
Contributor

Add a dom.webvr.test pref that registers a new VR display, which registers to a GL window.

The matching webvr PR is servo/rust-webvr#66.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix Support a test WebVR/XR display #22795
  • These changes do not require tests because we need a followup PR to support reftests which use the VR display

This change is Reviewable

@asajeffrey asajeffrey added S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. A-webvr labels Feb 28, 2019
@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @paulrouget: components/compositing/compositor.rs, components/compositing/Cargo.toml, ports/servo/glutin_app/window.rs, components/compositing/windowing.rs, components/compositing/compositor_thread.rs and 2 more

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 28, 2019
@asajeffrey

Copy link
Copy Markdown
Contributor Author

r? @paulrouget

@highfive highfive assigned paulrouget and unassigned emilio Feb 28, 2019
Comment thread components/compositing/compositor.rs Outdated
if self.window.get_animation_state() == windowing::AnimationState::Animating {
self.composite_if_necessary(CompositingReason::Animation);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe skip this change, and call hearbeat in perform_updates? perform_updates is the "heartbeart" of the compositor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The reason for doing this is that the main GL window is the one with vsync enabled, so the VR heartbeat needs to be called immediately after swapping the main window buffers. Hence having composite_specific_target calling the hearbeats between self.window.present() (which swaps the main window buffers) and self.process_animations(). If we want to prioritize the VR heartbeats over the main page's animations (which I think we do) then the heartbeats need to be in composite_specific_target.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Right, I agree about doing the work after the vsync-swap-buffer.

But I'm not sure why process_animations is something we should care about? Isn't just a tick sent to the constellation?

This is the current tasks performed by Servo:

  1. WR render
  2. swap buffer (blocking, vsync)
  3. tick animations

We are adding:

  1. VR heartbeat
  2. VR swap buffer (which is part of heartbeat)

You're suggesting:

  1. WR render
  2. Servo swap_buffer (blocking, vsync)
  3. VR heartbeat
  4. VR swap
  5. Servo tick animations

Is that right?

Would it be basically equivalent to:

  1. WR render
  2. Servo Swap_buffer (blocking, vsync)
  3. Servo tick animations
  4. VR heartbeat
  5. VR swap

If so, we can move the call to heartbeat at the end of perform_updates.

But it would be better to move the heartbeat work before the blocking swap_buffer;

  1. VR heartbeat
  2. WR render
  3. Servo Swap_buffer (blocking, vsync)
  4. VR swap
  5. Servo tick animations

But that would require extracting the swap_buffer call from VR heartbeat.

Does it make sense?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I see what you mean, process_animations() isn't doing that much (a bunch of hash table lookups and channel sends) so we can probably afford to run it before the heartbeat.

Not sure why extracting the VR swap buffer from the VR heartbeat would help, moving the heartbeat into perform_updates would simplify things though.

Comment thread components/compositing/windowing.rs Outdated
/// run the event loop at the vsync interval.
fn set_animation_state(&self, _state: AnimationState);
/// Get the animation state
fn get_animation_state(&self) -> AnimationState;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this should be needed. The compositor doesn't need to know the animation state. See previous comment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we move the heartbeat call, I think we can drop this.

@asajeffrey asajeffrey left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thiiiiiink we need the hearbeats to be called when compositing, to get the vsync right.

Comment thread components/compositing/compositor.rs Outdated
if self.window.get_animation_state() == windowing::AnimationState::Animating {
self.composite_if_necessary(CompositingReason::Animation);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The reason for doing this is that the main GL window is the one with vsync enabled, so the VR heartbeat needs to be called immediately after swapping the main window buffers. Hence having composite_specific_target calling the hearbeats between self.window.present() (which swaps the main window buffers) and self.process_animations(). If we want to prioritize the VR heartbeats over the main page's animations (which I think we do) then the heartbeats need to be in composite_specific_target.

@asajeffrey

Copy link
Copy Markdown
Contributor Author

@paulrouget OK, I moved the heartbeat calls and got rid of get_animation_state().

@paulrouget

Copy link
Copy Markdown
Contributor

r=me with Cargo.toml updated.

@asajeffrey
asajeffrey force-pushed the webvr-glwindow branch 2 times, most recently from a6651ac to eec3e8c Compare March 5, 2019 15:59
@asajeffrey asajeffrey removed the S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. label Mar 5, 2019
@asajeffrey

Copy link
Copy Markdown
Contributor Author

@bors-servo r=paulrouget

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit eec3e8c has been approved by paulrouget

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 5, 2019
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit eec3e8c with merge 66de1e5...

bors-servo pushed a commit that referenced this pull request Mar 5, 2019
Use a test VRDisplay that renders to a GL window

<!-- Please describe your changes on the following line: -->

Add a `dom.webvr.test` pref that registers a new VR display, which registers to a GL window.

The matching webvr PR is servo/rust-webvr#66.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #22795
- [X] These changes do not require tests because we need a followup PR to support reftests which use the VR display

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22953)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - magicleap

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Mar 5, 2019
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Oh how ironic, it's the magicleap build that is broken...

error[E0432]: unresolved import `servo::webvr::VRMainThreadHeartbeat`
  --> ports/libsimpleservo/api/src/lib.rs:24:40
   |
24 | use servo::webvr::{VRExternalShmemPtr, VRMainThreadHeartbeat, VRServiceManager};
   |                                        ^^^^^^^^^^^^^^^^^^^^^ no `VRMainThreadHeartbeat` in `webvr`

error: aborting due to previous error

@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Mar 5, 2019
@asajeffrey

Copy link
Copy Markdown
Contributor Author

@bors-servo r=paulrouget

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 6ee951a has been approved by paulrouget

@highfive highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 5, 2019
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 6ee951a with merge b4366e0...

bors-servo pushed a commit that referenced this pull request Mar 5, 2019
Use a test VRDisplay that renders to a GL window

<!-- Please describe your changes on the following line: -->

Add a `dom.webvr.test` pref that registers a new VR display, which registers to a GL window.

The matching webvr PR is servo/rust-webvr#66.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #22795
- [X] These changes do not require tests because we need a followup PR to support reftests which use the VR display

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22953)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - status-taskcluster

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Mar 5, 2019
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Mar 5, 2019
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Sigh, test-tidy. @bors-servo r=paulrouget

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit cc2d203 has been approved by paulrouget

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Mar 5, 2019
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit cc2d203 with merge ac913a6...

bors-servo pushed a commit that referenced this pull request Mar 5, 2019
Use a test VRDisplay that renders to a GL window

<!-- Please describe your changes on the following line: -->

Add a `dom.webvr.test` pref that registers a new VR display, which registers to a GL window.

The matching webvr PR is servo/rust-webvr#66.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #22795
- [X] These changes do not require tests because we need a followup PR to support reftests which use the VR display

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22953)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel-css

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Mar 5, 2019
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit cc2d203 with merge 55347aa...

bors-servo pushed a commit that referenced this pull request Mar 5, 2019
Use a test VRDisplay that renders to a GL window

<!-- Please describe your changes on the following line: -->

Add a `dom.webvr.test` pref that registers a new VR display, which registers to a GL window.

The matching webvr PR is servo/rust-webvr#66.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #22795
- [X] These changes do not require tests because we need a followup PR to support reftests which use the VR display

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22953)
<!-- Reviewable:end -->
@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Mar 5, 2019
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android-mac, arm32, arm64, linux-rel-css, linux-rel-wpt, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, magicleap, status-taskcluster
Approved by: paulrouget
Pushing 55347aa to master...

@bors-servo
bors-servo merged commit cc2d203 into servo:master Mar 5, 2019
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support a test WebVR/XR display

6 participants