Closed Bug 1410493 Opened 7 years ago Closed 7 years ago

Update to Oculus SDK 1.9

Categories

(Core :: WebVR, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: kip, Assigned: kip)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The Oculus 1.9 SDK includes new frame submission functions to replace ovr_SubmitFrame which has now been deprecated.  These functions will enable us to better meet sub-frame timing requirements with our recent multithreading changes.

Additionally, there are new functions to prepare for Oculus Dash and VR focus handling.

We should be using the latest API to replicate issues found by Oculus related to session management and to make it easier to diagnose bugs such as Bug 1407423 (WebVR content does not present when using Oculus Home before launching Firefox).
Blocks: 1411055
Oculus SDK 1.7+ changed the way eye offsets are returned.  They are now returned with a quaternion orientation as well as offset.  This patch includes some refactoring to enable the view matrices to be calculated on the VR thread where the full information is available rather than in the content process.  The OpenVR implementation has also been updated to take advantage of this in this patch.

Additionally, this also enables the IPD adjustment on the Oculus to be reflected immediately in the view matrices and the eye offsets without restarting the browser or interrupting content.
I need to make sure this passes tests and that it doesn't regress OpenVR headsets, then will be ready to pass on for review.
Attachment #8922577 - Flags: review?(dmu)
Comment on attachment 8922577 [details]
Bug 1410493 - Update Oculus SDK from 1.5 to 1.9, update IPD during VR presentation

https://reviewboard.mozilla.org/r/193688/#review199374

lgtm! just need to do some fixes about the memcpy. Kindly reminder, Bug 1406327 is already at auto-land. Please make sure there is no others conflicts. Thanks.

::: dom/vr/VRDisplay.cpp:917
(Diff revision 2)
>    const gfx::VRFieldOfView leftFOV = aInfo.mEyeFOV[gfx::VRDisplayInfo::Eye_Left];
>    mLeftProjection = leftFOV.ConstructProjectionMatrix(aDepthNear, aDepthFar, true);
>    const gfx::VRFieldOfView rightFOV = aInfo.mEyeFOV[gfx::VRDisplayInfo::Eye_Right];
>    mRightProjection = rightFOV.ConstructProjectionMatrix(aDepthNear, aDepthFar, true);
> +  memcpy(mLeftView.components, aState.leftViewMatrix, sizeof(float) * 16);
> +  memcpy(mRightView.components, aState.rightViewMatrix, sizeof(float) * 16);

How about using sizeof(aState.leftViewMatrix) instead of sizeof(float) * 16.

::: gfx/vr/gfxVR.cpp:142
(Diff revision 2)
> +  if (flags & VRDisplayCapabilityFlags::Cap_Orientation) {
> +    matHead.SetRotationFromQuaternion(gfx::Quaternion(orientation[0], orientation[1],
> +                                                      orientation[2], orientation[3]));
> +  }
> +  matHead.PreTranslate(-position[0], -position[1], -position[2]);
> +

Do I miss something? I don't see the declaration of "position[]" and "orientation[]".

::: gfx/vr/gfxVR.cpp:148
(Diff revision 2)
> +  gfx::Matrix4x4 matView = matHead * aHeadToEyeTransforms[VRDisplayInfo::Eye_Left];
> +  matView.Normalize();
> +  memcpy(leftViewMatrix, matView.components, sizeof(float) * 16);
> +  matView = matHead * aHeadToEyeTransforms[VRDisplayInfo::Eye_Right];
> +  matView.Normalize();
> +  memcpy(rightViewMatrix, matView.components, sizeof(float) * 16);

How about sizeof(matView.components) instead of sizeof(float) * 16?

::: gfx/vr/gfxVROculus.cpp:1211
(Diff revision 2)
> -                                              { r.x, r.y, r.z } };
> -
>    const VRHMDSensorState& sensorState = mDisplayInfo.GetSensorState();
> +  gfx::Matrix4x4 matView[2];
> +  memcpy(matView[0].components, sensorState.leftViewMatrix, sizeof(float) * 16);
> +  memcpy(matView[1].components, sensorState.rightViewMatrix, sizeof(float) * 16);

sizeof(sensorState.leftViewMatrix) instead of sizeof(float) * 16.

::: gfx/vr/gfxVROpenVR.cpp:124
(Diff revision 2)
> +    if (aHeadToEyeTransforms) {
> +      Matrix4x4 pose;
> +      // NOTE! eyeToHead.m is a 3x4 matrix, not 4x4.  But
> +      // because of its arrangement, we can copy the 12 elements in and
> +      // then transpose them to the right place.
> +      memcpy(&pose._11, &eyeToHead.m, sizeof(float) * 12);

sizeof(eyeToHead.m) instead of sizeof(float) * 12
Attachment #8922577 - Flags: review?(dmu) → review+
Comment on attachment 8922577 [details]
Bug 1410493 - Update Oculus SDK from 1.5 to 1.9, update IPD during VR presentation

https://reviewboard.mozilla.org/r/193688/#review199374

> Do I miss something? I don't see the declaration of "position[]" and "orientation[]".

These were set higher in the function, before this patch applied
Pushed by kgilbert@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ab9b6d55ac11
Update Oculus SDK from 1.5 to 1.9, update IPD during VR presentation r=daoshengmu
https://hg.mozilla.org/mozilla-central/rev/ab9b6d55ac11
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: