Closed Bug 1481327 Opened 5 years ago Closed 5 years ago

Handle VRService shmem between GPU and VR process

Categories

(Core :: WebVR, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla63
Tracking Status
firefox63 --- fixed

People

(Reporter: daoshengmu, Assigned: daoshengmu)

References

Details

Attachments

(2 files, 3 obsolete files)

In Bug 1430038, I was trying to open memory in GPU process, and duplicate its memory handle by VR process handle. But, I always get `ERROR_INVALID_HANDLE` in Windows.

VR Service process:
OpenFileMapping() -> Get a HANDLE for the virtual file ... Perhaps, we can try tto use CreateFileMapping()?
MapViewOfFile() -> Get a pointer to the memory backed by the file
DuplicateHandle() -> Get a HANDLE for the other process to use

GPU process:
MapViewOfFile() -> Get a pointer to the memory shared by the other process by the HANDLE from the other process.

When each process is done, they call CloseHandle() on their own HANDLE.

------

We need to figure out the reason, and give a cross-platform solution.
Blocks: 1362578
MozReview-Commit-ID: CdyIFim7zE1
We shouldn't let VRManager::ManagerInit() be called in the parent process, https://dxr.mozilla.org/mozilla-central/rev/4e56a2f51ad739ca52046723448f3129a58f1666/gfx/thebes/gfxPlatform.cpp#511, is it because we still wanna support non-e10s mode? At least, we should check if it is XRE_MultiProcess().
I follow the Comment 0 to make CreateFileMapping(), then DuplicateHandle from GPU process to VR process.

But, it always gets ERROR_INVALID_HANDLE from GetLastError();
MozReview-Commit-ID: 9xkrl271uNe
We find only the named shared memory mechanism works to get the file mapping. Duplicate handle approach always gets failed in multiple processes. I would like to use named shared memory mechanism to confirm the VR functionalities, then will come back to investigate it again.
Doing debug about WebVR reftest get stuck in try servers. I was trying to do this in local, but SteamVR runtime always pop-up and the tests can't be execute properly. After uninstalling the SteamVR, the tests work for the m-c build. Continue to investigating the WebVR refest issue after applying my patches.
MozReview-Commit-ID: DA300lYAuC1
Attachment #8998688 - Attachment is obsolete: true
Attachment #8998395 - Attachment is obsolete: true
MozReview-Commit-ID: Hs4sluLoYBn
MozReview-Commit-ID: DA300lYAuC1
Attachment #9001519 - Attachment is obsolete: true
Try looks good, https://treeherder.mozilla.org/#/jobs?repo=try&revision=ac3dada2e2d3164d57aa9084600de668d94ab790, although reftest in Windows try server are stuck, but the latest m-c build also gets this stuck. Anyway, I have verified WebVR reftest in local, they are good.
Assignee: nobody → dmu
Comment on attachment 9001526 [details]
Bug 1481327 - Part 1: Launch VR service in VR process.

:kip (Kearwood Gilbert) has approved the revision.
Attachment #9001526 - Flags: review+
Comment on attachment 9001521 [details]
Bug 1481327 - Part 2: Handle VR process shared memory.

:kip (Kearwood Gilbert) has approved the revision.
Attachment #9001521 - Flags: review+
Comment on attachment 9001526 [details]
Bug 1481327 - Part 1: Launch VR service in VR process.

Andrew McCreight [:mccr8] has approved the revision.
Attachment #9001526 - Flags: review+
Pushed by kgilbert@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/17e156ebb40a
Part 1: Launch VR service in VR process., r=kip,r=mccr8
https://hg.mozilla.org/integration/mozilla-inbound/rev/58a3875a8cb1
Part 2: Handle VR process shared memory.,r=kip
https://hg.mozilla.org/mozilla-central/rev/17e156ebb40a
https://hg.mozilla.org/mozilla-central/rev/58a3875a8cb1
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla63
Depends on: 1485388
Depends on: 1430038
I think I have figured out how to use the duplicate handle approach in Windows. We need to call CreateFileMappingA() with NULL string id at the parent process, then must call DuplicateHandle() at the parent process instead of at the child process. Following, forward the duplicate handle to the child process to ask the child process call MapViewOfFile() with the duplicate handle.
See Also: → 1490350
You need to log in before you can comment on or make changes to this bug.