Closed Bug 1484076 Opened Last year Closed 8 months ago

VR process for OSX

Categories

(Core :: WebVR, enhancement)

enhancement
Not set

Tracking

()

RESOLVED WONTFIX

People

(Reporter: daoshengmu, Unassigned)

References

Details

Attachments

(3 files, 1 obsolete file)

I notice on OSX, we don't have GPU process. So, VR process can talk to the parent process directly by making PVRGPU connection between VR and the main process as Bug 1430038.
Depends on: 1430038
MozReview-Commit-ID: IpH05p1rEV8
For following up this bug, we need to apply the patches from Bug 1430038 and Bug 1481327. Then, at about:config, set "dom.vr.external.enabled;true, dom.vr.process.enabled;true, dom.vr.service.enabled;true, dom.vr.enabled;true". It works on MBP, even in the immersive mode, we can get 90 FPS.
After applying this patch, typing "export MallocNanoZone=1 && ./mach run" in the terminal. It will be workable for VRProcess on macOS.
glandium,
Is there a way to only export MallocNanoZone for a process? We have problem with our VR process need to communicate with the 3rd service, and it needs us make MallocNanoZone=1.
Flags: needinfo?(mh+mozilla)
You'd need to extend GeckoChildProcessHost to allow to set specific environment variables (something similar to AddFdToRemap, but for environment variables, I guess) and set MallocNanoZone in VRProcessParent::Launch. You should check with IPC peers, though.

BTW, while looking at what the code does to launch subprocesses, I found that mProcess is leaked in VRProcessManager::DestroyProcess.
Flags: needinfo?(mh+mozilla)
Here is the workable flow for now.

1. Using SteamVR release or beta
2. export MallocNanoZone
3. ./mach run (It needs to be at a separate line)
2. dom.vr.process = 0
3. go to https://webvr.info/samples/XX-vr-controllers.html

We can use shmem in the main process successfully, and it will crash after entering the immersive mode. It would be a new regression. For VR process enable (dom.vr.process = 0), the screen would halt without update, it looks like get shmem handle fail. Btw, if we don't export MallocNanoZone first, the VR process enable mode would roll back to use gfxVROpenVR in SteamVR beta(?).
While `dom.vr.service.enabled;true, dom.vr.process.enabled;false`
it will crash at
OpenVRSession::SubmitFrame()
mVRCompositor->Submit()


But if we make it,
export MallocNanoZone=0 or 1
`dom.vr.service.enabled;false, dom.vr.process.enabled;false`

It uses gfxVROpenVR instead of OpenVRSession, and it is workable.
Depends on: 1497787
I have confirmed VR process works properly on MacOS after applying my patches. The shmem function also works by using GetLastPoses() to get headset's orientation. The only thing is VRCompositor->WaitGetPoses() crash, https://steamcommunity.com/app/358720/discussions/0/3335371283863233748/. It only happens at the multi-process mode. It looks like a SteamVR issue.
Blocks: 1362578
No longer depends on: 1430038
MozReview-Commit-ID: HIP0lk00vxA

Bug 1484076 - Part 2: Using shmem for VRService in MacOS.

MozReview-Commit-ID: AAgD2joKtfJ
MozReview-Commit-ID: HIP0lk00vxA
MozReview-Commit-ID: AAgD2joKtfJ
Attachment #9016865 - Attachment is obsolete: true
(In reply to Mike Hommey [:glandium] from comment #5)
> You'd need to extend GeckoChildProcessHost to allow to set specific
> environment variables (something similar to AddFdToRemap, but for
> environment variables, I guess) and set MallocNanoZone in
> VRProcessParent::Launch. You should check with IPC peers, though.
> 
> BTW, while looking at what the code does to launch subprocesses, I found
> that mProcess is leaked in VRProcessManager::DestroyProcess.

The mProcess will be deleted by DeleteTask before the main process shutdown. I will dig it into more deep when we start to work on managing the VRProcess lifetime by detecting if accessing VR content. 

 	xul.dll!mozilla::gfx::VRProcessParent::~VRProcessParent() Line 46	C++
 	xul.dll!mozilla::gfx::VRProcessParent::~VRProcessParent() Line 42	C++
 	xul.dll!DeleteTask<mozilla::ipc::GeckoChildProcessHost>::Run() Line 206	C++
 	xul.dll!MessageLoop::RunTask(already_AddRefed<nsIRunnable> aTask) Line 452	C++
 	xul.dll!MessageLoop::DeferOrRunPendingTask(MessageLoop::PendingTask && pending_task) Line 459	C++
>	xul.dll!MessageLoop::DoWork() Line 534	C++

We have no plan to enable VR process on Mac OS. We can close it and continue to work on it at an another bug.

Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.