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

webgl: Don't dirty canvas element while in immersive mode. #26077

Merged
merged 1 commit into from Apr 1, 2020

Conversation

@jdm
Copy link
Member

jdm commented Mar 31, 2020

There are various WebGL APIs that are supposed to trigger a frame composite at the end of the event loop when they're used. We enforce this via dirtying the canvas element and ensuring that reflow occurs for normal content. This is redundant when we're using immersive mode and incurs extra work by the layout thread and compositor that inhibits the immersive rendering performance.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix (part of) #26019
  • These changes do not require tests because we do not have infrastructure to test immersive mode on CI.
@highfive
Copy link

highfive commented Mar 31, 2020

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/webglrenderingcontext.rs, components/script/dom/window.rs, components/script/dom/navigator.rs
  • @KiChjang: components/script/dom/webglrenderingcontext.rs, components/script/dom/window.rs, components/script/dom/navigator.rs
@highfive
Copy link

highfive commented Mar 31, 2020

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!
@jdm
Copy link
Member Author

jdm commented Mar 31, 2020

@highfive highfive assigned Manishearth and unassigned nox Mar 31, 2020
@jdm jdm added this to In progress in babylon.js perf issues via automation Mar 31, 2020
@jdm jdm added this to In progress in HoloLens Mar 31, 2020
Copy link
Member

asajeffrey left a comment

LGTM but with a tiny bit of FUD about future interactions with DOMToTexture.

// Dirtying the canvas is unnecessary if we're actively displaying immersive
// XR content right now.
if self.global().as_window().in_immersive_xr_session() {
return;

This comment has been minimized.

@asajeffrey

asajeffrey Mar 31, 2020

Member

I'm a bit worried that when we come to put DOMToTexture nodes into XR sessions, we'll forget that we did this.

@jdm
Copy link
Member Author

jdm commented Mar 31, 2020

@bors-servo r=asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented Mar 31, 2020

📌 Commit ab75808 has been approved by asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented Apr 1, 2020

Testing commit ab75808 with merge 2c0bbcf...

@bors-servo
Copy link
Contributor

bors-servo commented Apr 1, 2020

☀️ Test successful - status-taskcluster
Approved by: asajeffrey
Pushing 2c0bbcf to master...

@bors-servo bors-servo merged commit 2c0bbcf into servo:master Apr 1, 2020
2 checks passed
2 checks passed
Community-TC (pull_request) TaskGroup: success
Details
homu Test successful
Details
babylon.js perf issues automation moved this from In progress to Done Apr 1, 2020
@atouchet atouchet moved this from In progress to Done in HoloLens Apr 1, 2020
bors-servo added a commit that referenced this pull request Apr 13, 2020
Dirty canvas when exiting immersive sessions

Fixes #26162, fixes servo/webxr#155

We basically end up in a situation where the main thread is asleep. It's unclear to me why it doesn't wake up after attempts to interact with the screen, but we stopped dirtying the canvas during the immersive session (#26077) so the main thread wasn't awake initially.

This is probably not the cleanest fix -- we really should not be ending up in situations where the main thread is perma-asleep -- however, we should be dirtying the canvas after exiting immersive mode _anyway_ since the contents need to be shown to the user, so this fix is still valid, even if it's not fixing the root cause.
bors-servo added a commit that referenced this pull request Apr 13, 2020
Dirty canvas when exiting immersive sessions

Fixes #26162, fixes servo/webxr#155

We basically end up in a situation where the main thread is asleep. It's unclear to me why it doesn't wake up after attempts to interact with the screen, but we stopped dirtying the canvas during the immersive session (#26077) so the main thread wasn't awake initially.

This is probably not the cleanest fix -- we really should not be ending up in situations where the main thread is perma-asleep -- however, we should be dirtying the canvas after exiting immersive mode _anyway_ since the contents need to be shown to the user, so this fix is still valid, even if it's not fixing the root cause.
bors-servo added a commit that referenced this pull request Apr 14, 2020
Dirty canvas when exiting immersive sessions

Fixes #26162, fixes servo/webxr#155

We basically end up in a situation where the main thread is asleep. It's unclear to me why it doesn't wake up after attempts to interact with the screen, but we stopped dirtying the canvas during the immersive session (#26077) so the main thread wasn't awake initially.

This is probably not the cleanest fix -- we really should not be ending up in situations where the main thread is perma-asleep -- however, we should be dirtying the canvas after exiting immersive mode _anyway_ since the contents need to be shown to the user, so this fix is still valid, even if it's not fixing the root cause.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
HoloLens
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

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