Closed Bug 1430040 Opened 2 years ago Closed 10 months ago

Shut down VR process when there is no VR content

Categories

(Core :: WebVR, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla66
Tracking Status
firefox66 --- fixed

People

(Reporter: daoshengmu, Assigned: daoshengmu)

References

(Blocks 1 open bug)

Details

Attachments

(4 files)

We can give a timer to measure if there is no VR content for a while and help the process shut down automatically. When there is a new VR content come in, we will launch a new process for serving it.
Blocks: 1362578
Bug 1466700 (Refactor gfxVROculus.cpp to use gfxVRExternal interface) has included the timer functionality that determines when it is appropriate to shut down the VR thread.  We can also use this signal to shut down the VR process.

We should be able to add a hook to the bottom of VRService::Stop() to stop the VR process.

VRSystemManagerExternal picks up VRDisplayState::mMinRestartInterval from the shmem to determine when it is safe to re-start the service.

It will be necessary to ensure that VRService::Refresh() is called often to check for the shutdown conditions.
Assignee: nobody → dmu
These patches work properly when "dom.vr.process:true" and "dom.vr.external;true" for launching and shutdown VR process according to if we viewing VR content.

The remaining works are:

1. VRService memory leak problem, that should happen from VRServiceManager. (https://treeherder.mozilla.org/#/jobs?repo=try&revision=6511e053aaa3bc2d4565baf6e3f1b3a5573fd04e&selectedJob=218255028)
2. Forward the VR controller manifest files' name to the parent process and let the parent process maintain the file string to avoid the manifest files be deleted when VR process is shutdown.
3. When SteamVR runtime is not running, then going to a WebVR page, the shmem memory seems to be not ready yet and cause crashes.
I have made VR process will only be launched when visiting VR pages, and it will shutdown after exiting from VR pages. One thing we need to investigate is it will show "WebVR supported, but no VR display" after VR process is relaunched. But, it will be good after refreshing the page.
Blocks: 1504354
Blocks: 1515938
Update for clang-format correction (Some style still looks strange for me...). And avoid to handle OpenVR VREvent_ProcessQuit event, it will make the parent process close the shmem.
Attachment #9032835 - Attachment description: Bug 1430040 - Part 1: Adjust VR process IPC channels to make VR process can be spawn and shutdwon in runtime. → Bug 1430040 - Part 1: Adjust VR process IPC channels to allow VR process to be spawned and shutdown at runtime.
Pushed by dmu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a18c59a93e05
Part 1: Adjust VR process IPC channels to allow VR process to be spawned and shutdown at runtime. r=kip,mattwoodrow
https://hg.mozilla.org/integration/autoland/rev/b9639fb9f845
Part 2: According to VRDisplay's state to decide if spawn or shutdown VR process in VRManager. r=kip
https://hg.mozilla.org/integration/autoland/rev/2f31f4f0cad3
Part 3: Closing Shmem only when VR process is shutdown. r=kip
https://hg.mozilla.org/integration/autoland/rev/ec8667678f3a
Part 4: Make the parent process keep the OpenVR controller manifest info when VR process is enabled. r=kip
Duplicate of this bug: 1504354
Depends on: 1518148
You need to log in before you can comment on or make changes to this bug.