Bug 1306427 - Remove pose parameter from VRDisplay.submitFrame
MozReview-Commit-ID: 4ZxUL9etXAU
--- a/dom/vr/VRDisplay.cpp
+++ b/dom/vr/VRDisplay.cpp
@@ -602,24 +602,20 @@ VRDisplay::GetLayers(nsTArray<VRLayer>&
if (mPresentation) {
mPresentation->GetDOMLayers(result);
} else {
result = nsTArray<VRLayer>();
}
}
void
-VRDisplay::SubmitFrame(const Optional<NonNull<VRPose>>& aPose)
+VRDisplay::SubmitFrame()
{
if (mPresentation) {
- if (aPose.WasPassed()) {
- mPresentation->SubmitFrame(aPose.Value().FrameID());
- } else {
- mPresentation->SubmitFrame(0);
- }
+ mPresentation->SubmitFrame();
}
}
int32_t
VRDisplay::RequestAnimationFrame(FrameRequestCallback& aCallback,
ErrorResult& aError)
{
gfx::VRManagerChild* vm = gfx::VRManagerChild::Get();
--- a/dom/vr/VRDisplay.h
+++ b/dom/vr/VRDisplay.h
@@ -259,17 +259,17 @@ public:
// XXX When we start sending depth buffers to VRLayer's we will want
// to communicate this with the VRDisplayHost
mDepthFar = aDepthFar;
}
already_AddRefed<Promise> RequestPresent(const nsTArray<VRLayer>& aLayers, ErrorResult& aRv);
already_AddRefed<Promise> ExitPresent(ErrorResult& aRv);
void GetLayers(nsTArray<VRLayer>& result);
- void SubmitFrame(const Optional<NonNull<VRPose>>& aPose);
+ void SubmitFrame();
int32_t RequestAnimationFrame(mozilla::dom::FrameRequestCallback& aCallback,
mozilla::ErrorResult& aError);
void CancelAnimationFrame(int32_t aHandle, mozilla::ErrorResult& aError);
protected:
VRDisplay(nsPIDOMWindowInner* aWindow, gfx::VRDisplayClient* aClient);
virtual ~VRDisplay();
--- a/dom/webidl/VRDisplay.webidl
+++ b/dom/webidl/VRDisplay.webidl
@@ -264,10 +264,10 @@ interface VRDisplay : EventTarget {
sequence<VRLayer> getLayers();
/**
* The VRLayer provided to the VRDisplay will be captured and presented
* in the HMD. Calling this function has the same effect on the source
* canvas as any other operation that uses its source image, and canvases
* created without preserveDrawingBuffer set to true will be cleared.
*/
- void submitFrame(optional VRPose pose);
+ void submitFrame();
};
--- a/gfx/vr/VRDisplayHost.cpp
+++ b/gfx/vr/VRDisplayHost.cpp
@@ -67,16 +67,22 @@ VRDisplayHost::RemoveLayer(VRLayerParent
#if defined(XP_WIN)
void
VRDisplayHost::SubmitFrame(VRLayerParent* aLayer, const int32_t& aInputFrameID,
PTextureParent* aTexture, const gfx::Rect& aLeftEyeRect,
const gfx::Rect& aRightEyeRect)
{
+ // aInputFrameID is no longer controlled by content with the WebVR 1.1 API
+ // update; however, we will later use this code to enable asynchronous
+ // submission of multiple layers to be composited. This will enable
+ // us to build browser UX that remains responsive even when content does
+ // not consistently submit frames.
+
int32_t inputFrameID = aInputFrameID;
if (inputFrameID == 0) {
inputFrameID = mInputFrameID;
}
if (inputFrameID < 0) {
// Sanity check to prevent invalid memory access on builds with assertions
// disabled.
inputFrameID = 0;
--- a/gfx/vr/VRDisplayPresentation.cpp
+++ b/gfx/vr/VRDisplayPresentation.cpp
@@ -98,15 +98,15 @@ VRDisplayPresentation::GetDOMLayers(nsTA
}
VRDisplayPresentation::~VRDisplayPresentation()
{
DestroyLayers();
mDisplayClient->PresentationDestroyed();
}
-void VRDisplayPresentation::SubmitFrame(int32_t aInputFrameID)
+void VRDisplayPresentation::SubmitFrame()
{
for (VRLayerChild *layer : mLayers) {
- layer->SubmitFrame(aInputFrameID);
+ layer->SubmitFrame();
break; // Currently only one layer supported, submit only the first
}
}
--- a/gfx/vr/VRDisplayPresentation.h
+++ b/gfx/vr/VRDisplayPresentation.h
@@ -15,17 +15,17 @@ class VRDisplayClient;
class VRLayerChild;
class VRDisplayPresentation final
{
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayPresentation)
public:
VRDisplayPresentation(VRDisplayClient *aDisplayClient, const nsTArray<dom::VRLayer>& aLayers);
- void SubmitFrame(int32_t aInputFrameID);
+ void SubmitFrame();
void GetDOMLayers(nsTArray<dom::VRLayer>& result);
private:
~VRDisplayPresentation();
void CreateLayers();
void DestroyLayers();
RefPtr<VRDisplayClient> mDisplayClient;
--- a/gfx/vr/VRManager.cpp
+++ b/gfx/vr/VRManager.cpp
@@ -272,22 +272,22 @@ VRManager::GetDisplay(const uint32_t& aD
RefPtr<gfx::VRDisplayHost> display;
if (mVRDisplays.Get(aDisplayID, getter_AddRefs(display))) {
return display;
}
return nullptr;
}
void
-VRManager::SubmitFrame(VRLayerParent* aLayer, const int32_t& aInputFrameID,
- layers::PTextureParent* aTexture, const gfx::Rect& aLeftEyeRect,
- const gfx::Rect& aRightEyeRect)
+VRManager::SubmitFrame(VRLayerParent* aLayer, layers::PTextureParent* aTexture,
+ const gfx::Rect& aLeftEyeRect,
+ const gfx::Rect& aRightEyeRect)
{
TextureHost* th = TextureHost::AsTextureHost(aTexture);
mLastFrame = th;
RefPtr<VRDisplayHost> display = GetDisplay(aLayer->GetDisplayID());
if (display) {
- display->SubmitFrame(aLayer, aInputFrameID, aTexture, aLeftEyeRect, aRightEyeRect);
+ display->SubmitFrame(aLayer, 0, aTexture, aLeftEyeRect, aRightEyeRect);
}
}
} // namespace gfx
} // namespace mozilla
--- a/gfx/vr/VRManager.h
+++ b/gfx/vr/VRManager.h
@@ -35,18 +35,18 @@ public:
void RemoveVRManagerParent(VRManagerParent* aVRManagerParent);
void NotifyVsync(const TimeStamp& aVsyncTimestamp);
void NotifyVRVsync(const uint32_t& aDisplayID);
void RefreshVRDisplays(bool aMustDispatch = false);
RefPtr<gfx::VRDisplayHost> GetDisplay(const uint32_t& aDisplayID);
void GetVRDisplayInfo(nsTArray<VRDisplayInfo>& aDisplayInfo);
- void SubmitFrame(VRLayerParent* aLayer, const int32_t& aInputFrameID,
- layers::PTextureParent* aTexture, const gfx::Rect& aLeftEyeRect,
+ void SubmitFrame(VRLayerParent* aLayer, layers::PTextureParent* aTexture,
+ const gfx::Rect& aLeftEyeRect,
const gfx::Rect& aRightEyeRect);
protected:
VRManager();
~VRManager();
private:
RefPtr<layers::TextureHost> mLastFrame;
--- a/gfx/vr/ipc/PVRLayer.ipdl
+++ b/gfx/vr/ipc/PVRLayer.ipdl
@@ -11,17 +11,17 @@ include protocol PTexture;
namespace mozilla {
namespace gfx {
async protocol PVRLayer
{
manager PVRManager;
parent:
- async SubmitFrame(int32_t aInputFrameID, PTexture aTexture);
+ async SubmitFrame(PTexture aTexture);
async Destroy();
child:
async __delete__();
};
} // gfx
} // mozilla
--- a/gfx/vr/ipc/VRLayerChild.cpp
+++ b/gfx/vr/ipc/VRLayerChild.cpp
@@ -42,17 +42,17 @@ VRLayerChild::Initialize(dom::HTMLCanvas
mCanvasElement = aCanvasElement;
mCanvasElement->StartVRPresentation();
VRManagerChild *vrmc = VRManagerChild::Get();
vrmc->RunFrameRequestCallbacks();
}
void
-VRLayerChild::SubmitFrame(int32_t aInputFrameID)
+VRLayerChild::SubmitFrame()
{
if (!mCanvasElement) {
return;
}
mShSurfClient = mCanvasElement->GetVRFrame();
if (!mShSurfClient) {
return;
@@ -67,17 +67,17 @@ VRLayerChild::SubmitFrame(int32_t aInput
mFront = mShSurfClient;
mShSurfClient = nullptr;
mFront->SetAddedToCompositableClient();
VRManagerChild* vrmc = VRManagerChild::Get();
mFront->SyncWithObject(vrmc->GetSyncObject());
MOZ_ALWAYS_TRUE(mFront->InitIPDLActor(vrmc));
- SendSubmitFrame(aInputFrameID, mFront->GetIPDLActor());
+ SendSubmitFrame(mFront->GetIPDLActor());
}
void
VRLayerChild::ClearSurfaces()
{
mFront = nullptr;
mShSurfClient = nullptr;
}
--- a/gfx/vr/ipc/VRLayerChild.h
+++ b/gfx/vr/ipc/VRLayerChild.h
@@ -29,17 +29,17 @@ class SurfaceFactory;
namespace gfx {
class VRLayerChild : public PVRLayerChild {
NS_INLINE_DECL_REFCOUNTING(VRLayerChild)
public:
VRLayerChild(uint32_t aVRDisplayID, VRManagerChild* aVRManagerChild);
void Initialize(dom::HTMLCanvasElement* aCanvasElement);
- void SubmitFrame(int32_t aInputFrameID);
+ void SubmitFrame();
protected:
virtual ~VRLayerChild();
void ClearSurfaces();
uint32_t mVRDisplayID;
RefPtr<dom::HTMLCanvasElement> mCanvasElement;
--- a/gfx/vr/ipc/VRLayerParent.cpp
+++ b/gfx/vr/ipc/VRLayerParent.cpp
@@ -41,20 +41,19 @@ void
VRLayerParent::Destroy()
{
if (mIPCOpen) {
Unused << PVRLayerParent::Send__delete__(this);
}
}
bool
-VRLayerParent::RecvSubmitFrame(const int32_t& aInputFrameID,
- PTextureParent* texture)
+VRLayerParent::RecvSubmitFrame(PTextureParent* texture)
{
VRManager* vm = VRManager::Get();
- vm->SubmitFrame(this, aInputFrameID, texture, mLeftEyeRect, mRightEyeRect);
+ vm->SubmitFrame(this, texture, mLeftEyeRect, mRightEyeRect);
return true;
}
} // namespace gfx
} // namespace mozilla
--- a/gfx/vr/ipc/VRLayerParent.h
+++ b/gfx/vr/ipc/VRLayerParent.h
@@ -15,18 +15,17 @@
namespace mozilla {
namespace gfx {
class VRLayerParent : public PVRLayerParent {
NS_INLINE_DECL_REFCOUNTING(VRLayerParent)
public:
VRLayerParent(uint32_t aVRDisplayID, const Rect& aLeftEyeRect, const Rect& aRightEyeRect);
- virtual bool RecvSubmitFrame(const int32_t& aInputFrameID,
- PTextureParent* texture) override;
+ virtual bool RecvSubmitFrame(PTextureParent* texture) override;
virtual bool RecvDestroy() override;
uint32_t GetDisplayID() const { return mVRDisplayID; }
protected:
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual ~VRLayerParent();
void Destroy();