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.
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();
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.
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.
Comment on attachment 9001526 [details] Bug 1481327 - Part 1: Launch VR service in VR process. :kip (Kearwood Gilbert) has approved the revision.
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.
Pushed by firstname.lastname@example.org: 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
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.
You need to log in before you can comment on or make changes to this bug.