Bug 1237689 - Enable Oculus hardware latency tester r=daoshengmu

- Generate and pass sequential frame indexes into the ovr_GetTrackingState call and the corresponding call to ovr_SubmitFrame

MozReview-Commit-ID: 5tJl5YJt7Eo
This commit is contained in:
kearwood
2016-01-08 18:50:10 -08:00
parent 5e4623997b
commit ccf22e27a5
20 changed files with 73 additions and 14 deletions

View File

@@ -1117,7 +1117,8 @@ ContainerLayer::ContainerLayer(LayerManager* aManager, void* aImplData)
mMayHaveReadbackChild(false), mMayHaveReadbackChild(false),
mChildrenChanged(false), mChildrenChanged(false),
mEventRegionsOverride(EventRegionsOverride::NoOverride), mEventRegionsOverride(EventRegionsOverride::NoOverride),
mVRDeviceID(0) mVRDeviceID(0),
mInputFrameID(0)
{ {
MOZ_COUNT_CTOR(ContainerLayer); MOZ_COUNT_CTOR(ContainerLayer);
mContentFlags = 0; // Clear NO_TEXT, NO_TEXT_OVER_TRANSPARENT mContentFlags = 0; // Clear NO_TEXT, NO_TEXT_OVER_TRANSPARENT
@@ -1279,7 +1280,8 @@ ContainerLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs)
mInheritedXScale, mInheritedYScale, mInheritedXScale, mInheritedYScale,
mPresShellResolution, mScaleToResolution, mPresShellResolution, mScaleToResolution,
mEventRegionsOverride, mEventRegionsOverride,
mVRDeviceID); mVRDeviceID,
mInputFrameID);
} }
bool bool
@@ -2146,7 +2148,7 @@ ContainerLayer::PrintInfo(std::stringstream& aStream, const char* aPrefix)
aStream << " [force-ehr]"; aStream << " [force-ehr]";
} }
if (mVRDeviceID) { if (mVRDeviceID) {
aStream << nsPrintfCString(" [hmd=%lu]", mVRDeviceID).get(); aStream << nsPrintfCString(" [hmd=%lu] [hmdframe=%l]", mVRDeviceID, mInputFrameID).get();
} }
} }

View File

@@ -2143,10 +2143,18 @@ public:
*/ */
void SetVRDeviceID(uint32_t aVRDeviceID) { void SetVRDeviceID(uint32_t aVRDeviceID) {
mVRDeviceID = aVRDeviceID; mVRDeviceID = aVRDeviceID;
Mutated();
} }
uint32_t GetVRDeviceID() { uint32_t GetVRDeviceID() {
return mVRDeviceID; return mVRDeviceID;
} }
void SetInputFrameID(int32_t aInputFrameID) {
mInputFrameID = aInputFrameID;
Mutated();
}
int32_t GetInputFrameID() {
return mInputFrameID;
}
/** /**
* Replace the current effective transform with the given one, * Replace the current effective transform with the given one,
@@ -2223,6 +2231,7 @@ protected:
bool mChildrenChanged; bool mChildrenChanged;
EventRegionsOverride mEventRegionsOverride; EventRegionsOverride mEventRegionsOverride;
uint32_t mVRDeviceID; uint32_t mVRDeviceID;
int32_t mInputFrameID;
}; };
/** /**

View File

@@ -25,6 +25,7 @@
#include "nsDebug.h" // for printf_stderr, NS_ASSERTION #include "nsDebug.h" // for printf_stderr, NS_ASSERTION
#include "nsXULAppAPI.h" // for XRE_GetProcessType, etc #include "nsXULAppAPI.h" // for XRE_GetProcessType, etc
#include "TextureClientSharedSurface.h" #include "TextureClientSharedSurface.h"
#include "VRManagerChild.h"
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::gl; using namespace mozilla::gl;
@@ -125,6 +126,7 @@ CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
t->mTextureClient = mBuffer; t->mTextureClient = mBuffer;
t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mBuffer->GetSize()); t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mBuffer->GetSize());
t->mFrameID = mFrameID; t->mFrameID = mFrameID;
t->mInputFrameID = VRManagerChild::Get()->GetInputFrameID();
GetForwarder()->UseTextures(this, textures); GetForwarder()->UseTextures(this, textures);
mBuffer->SyncWithObject(GetForwarder()->GetSyncObject()); mBuffer->SyncWithObject(GetForwarder()->GetSyncObject());
} }
@@ -481,6 +483,11 @@ CanvasClientSharedSurface::Updated()
t->mTextureClient = mFront; t->mTextureClient = mFront;
t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mFront->GetSize()); t->mPictureRect = nsIntRect(nsIntPoint(0, 0), mFront->GetSize());
t->mFrameID = mFrameID; t->mFrameID = mFrameID;
// XXX TODO - This reference to VRManagerChild will be moved with the
// implementation of the WebVR 1.0 API, which will enable
// the inputFrameID to be passed through Javascript with
// the new VRDisplay API.
t->mInputFrameID = VRManagerChild::Get()->GetInputFrameID();
forwarder->UseTextures(this, textures); forwarder->UseTextures(this, textures);
} }

View File

@@ -194,6 +194,7 @@ public:
gfx::IntRect mPictureRect; gfx::IntRect mPictureRect;
int32_t mFrameID; int32_t mFrameID;
int32_t mProducerID; int32_t mProducerID;
int32_t mInputFrameID;
}; };
virtual void UseTextureHost(const nsTArray<TimedTexture>& aTextures); virtual void UseTextureHost(const nsTArray<TimedTexture>& aTextures);
virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack, virtual void UseComponentAlphaTextures(TextureHost* aTextureOnBlack,
@@ -235,6 +236,8 @@ public:
return nullptr; return nullptr;
} }
virtual int32_t GetLastInputFrameID() const { return -1; }
protected: protected:
TextureInfo mTextureInfo; TextureInfo mTextureInfo;
uint64_t mAsyncID; uint64_t mAsyncID;

View File

@@ -139,8 +139,11 @@ template<class ContainerT> void
ContainerRenderVR(ContainerT* aContainer, ContainerRenderVR(ContainerT* aContainer,
LayerManagerComposite* aManager, LayerManagerComposite* aManager,
const gfx::IntRect& aClipRect, const gfx::IntRect& aClipRect,
RefPtr<gfx::VRHMDInfo> aHMD) RefPtr<gfx::VRHMDInfo> aHMD,
int32_t aInputFrameID)
{ {
int32_t inputFrameID = -1;
RefPtr<CompositingRenderTarget> surface; RefPtr<CompositingRenderTarget> surface;
Compositor* compositor = aManager->GetCompositor(); Compositor* compositor = aManager->GetCompositor();
@@ -265,6 +268,14 @@ ContainerRenderVR(ContainerT* aContainer,
surfaceRect.width, surfaceRect.height)); surfaceRect.width, surfaceRect.height));
layerToRender->RenderLayer(surfaceRect); layerToRender->RenderLayer(surfaceRect);
CompositableHost *ch = layerToRender->GetCompositableHost();
if (ch) {
int32_t compositableInputFrameID = ch->GetLastInputFrameID();
if (compositableInputFrameID != -1) {
inputFrameID = compositableInputFrameID;
}
}
if (restoreTransform) { if (restoreTransform) {
layer->ReplaceEffectiveTransform(childTransform); layer->ReplaceEffectiveTransform(childTransform);
} }
@@ -282,7 +293,7 @@ ContainerRenderVR(ContainerT* aContainer,
compositor->SetRenderTarget(previousTarget); compositor->SetRenderTarget(previousTarget);
if (vrRendering) { if (vrRendering) {
vrRendering->SubmitFrame(aContainer->mVRRenderTargetSet); vrRendering->SubmitFrame(aContainer->mVRRenderTargetSet, inputFrameID);
DUMP("<<< ContainerRenderVR [used vrRendering] [%p]\n", aContainer); DUMP("<<< ContainerRenderVR [used vrRendering] [%p]\n", aContainer);
if (!gfxPrefs::VRMirrorTextures()) { if (!gfxPrefs::VRMirrorTextures()) {
return; return;
@@ -696,7 +707,7 @@ ContainerRender(ContainerT* aContainer,
RefPtr<gfx::VRHMDInfo> hmdInfo = gfx::VRManager::Get()->GetDevice(aContainer->GetVRDeviceID()); RefPtr<gfx::VRHMDInfo> hmdInfo = gfx::VRManager::Get()->GetDevice(aContainer->GetVRDeviceID());
if (hmdInfo && hmdInfo->GetConfiguration().IsValid()) { if (hmdInfo && hmdInfo->GetConfiguration().IsValid()) {
ContainerRenderVR(aContainer, aManager, aClipRect, hmdInfo); ContainerRenderVR(aContainer, aManager, aClipRect, hmdInfo, aContainer->GetInputFrameID());
aContainer->mPrepared = nullptr; aContainer->mPrepared = nullptr;
return; return;
} }

View File

@@ -32,6 +32,7 @@ ImageHost::ImageHost(const TextureInfo& aTextureInfo)
, mImageContainer(nullptr) , mImageContainer(nullptr)
, mLastFrameID(-1) , mLastFrameID(-1)
, mLastProducerID(-1) , mLastProducerID(-1)
, mLastInputFrameID(-1)
, mBias(BIAS_NONE) , mBias(BIAS_NONE)
, mLocked(false) , mLocked(false)
{} {}
@@ -84,6 +85,7 @@ ImageHost::UseTextureHost(const nsTArray<TimedTexture>& aTextures)
img.mPictureRect = t.mPictureRect; img.mPictureRect = t.mPictureRect;
img.mFrameID = t.mFrameID; img.mFrameID = t.mFrameID;
img.mProducerID = t.mProducerID; img.mProducerID = t.mProducerID;
img.mInputFrameID = t.mInputFrameID;
} }
// Recycle any leftover mTextureSources and call PrepareTextureSource on all // Recycle any leftover mTextureSources and call PrepareTextureSource on all
// images. // images.
@@ -357,6 +359,7 @@ ImageHost::Composite(LayerComposite* aLayer,
} }
mLastFrameID = img->mFrameID; mLastFrameID = img->mFrameID;
mLastProducerID = img->mProducerID; mLastProducerID = img->mProducerID;
mLastInputFrameID = img->mInputFrameID;
} }
aEffectChain.mPrimaryEffect = effect; aEffectChain.mPrimaryEffect = effect;
gfx::Rect pictureRect(0, 0, img->mPictureRect.width, img->mPictureRect.height); gfx::Rect pictureRect(0, 0, img->mPictureRect.width, img->mPictureRect.height);

View File

@@ -100,6 +100,7 @@ public:
int32_t GetLastFrameID() const { return mLastFrameID; } int32_t GetLastFrameID() const { return mLastFrameID; }
int32_t GetLastProducerID() const { return mLastProducerID; } int32_t GetLastProducerID() const { return mLastProducerID; }
virtual int32_t GetLastInputFrameID() const override { return mLastInputFrameID; }
enum Bias { enum Bias {
// Don't apply bias to frame times // Don't apply bias to frame times
@@ -118,6 +119,7 @@ protected:
gfx::IntRect mPictureRect; gfx::IntRect mPictureRect;
int32_t mFrameID; int32_t mFrameID;
int32_t mProducerID; int32_t mProducerID;
int32_t mInputFrameID;
}; };
/** /**
@@ -135,6 +137,7 @@ protected:
ImageContainerParent* mImageContainer; ImageContainerParent* mImageContainer;
int32_t mLastFrameID; int32_t mLastFrameID;
int32_t mLastProducerID; int32_t mLastProducerID;
int32_t mLastInputFrameID;
/** /**
* Bias to apply to the next frame. * Bias to apply to the next frame.
*/ */

View File

@@ -113,13 +113,14 @@ public:
struct TimedTextureClient { struct TimedTextureClient {
TimedTextureClient() TimedTextureClient()
: mTextureClient(nullptr), mFrameID(0), mProducerID(0) {} : mTextureClient(nullptr), mFrameID(0), mProducerID(0), mInputFrameID(0) {}
TextureClient* mTextureClient; TextureClient* mTextureClient;
TimeStamp mTimeStamp; TimeStamp mTimeStamp;
nsIntRect mPictureRect; nsIntRect mPictureRect;
int32_t mFrameID; int32_t mFrameID;
int32_t mProducerID; int32_t mProducerID;
int32_t mInputFrameID;
}; };
/** /**
* Tell the CompositableHost on the compositor side what textures to use for * Tell the CompositableHost on the compositor side what textures to use for

View File

@@ -182,6 +182,7 @@ CompositableParentManager::ReceiveCompositableUpdate(const CompositableOperation
t->mPictureRect = timedTexture.picture(); t->mPictureRect = timedTexture.picture();
t->mFrameID = timedTexture.frameID(); t->mFrameID = timedTexture.frameID();
t->mProducerID = timedTexture.producerID(); t->mProducerID = timedTexture.producerID();
t->mInputFrameID = timedTexture.inputFrameID();
MOZ_ASSERT(ValidatePictureRect(t->mTexture->GetSize(), t->mPictureRect)); MOZ_ASSERT(ValidatePictureRect(t->mTexture->GetSize(), t->mPictureRect));
MaybeFence maybeFence = timedTexture.fence(); MaybeFence maybeFence = timedTexture.fence();

View File

@@ -191,7 +191,7 @@ ImageBridgeChild::UseTextures(CompositableClient* aCompositable,
textures.AppendElement(TimedTexture(nullptr, t.mTextureClient->GetIPDLActor(), textures.AppendElement(TimedTexture(nullptr, t.mTextureClient->GetIPDLActor(),
fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t()), fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t()),
t.mTimeStamp, t.mPictureRect, t.mTimeStamp, t.mPictureRect,
t.mFrameID, t.mProducerID)); t.mFrameID, t.mProducerID, t.mInputFrameID));
} }
mTxn->AddNoSwapEdit(OpUseTexture(nullptr, aCompositable->GetIPDLActor(), mTxn->AddNoSwapEdit(OpUseTexture(nullptr, aCompositable->GetIPDLActor(),
textures)); textures));

View File

@@ -414,6 +414,7 @@ LayerTransactionParent::RecvUpdate(InfallibleTArray<Edit>&& cset,
containerLayer->SetScaleToResolution(attrs.scaleToResolution(), containerLayer->SetScaleToResolution(attrs.scaleToResolution(),
attrs.presShellResolution()); attrs.presShellResolution());
containerLayer->SetEventRegionsOverride(attrs.eventRegionsOverride()); containerLayer->SetEventRegionsOverride(attrs.eventRegionsOverride());
containerLayer->SetInputFrameID(attrs.inputFrameID());
if (attrs.hmdDeviceID()) { if (attrs.hmdDeviceID()) {
containerLayer->SetVRDeviceID(attrs.hmdDeviceID()); containerLayer->SetVRDeviceID(attrs.hmdDeviceID());

View File

@@ -252,6 +252,7 @@ struct ContainerLayerAttributes {
bool scaleToResolution; bool scaleToResolution;
EventRegionsOverride eventRegionsOverride; EventRegionsOverride eventRegionsOverride;
uint32_t hmdDeviceID; uint32_t hmdDeviceID;
int32_t inputFrameID;
}; };
struct ColorLayerAttributes { LayerColor color; IntRect bounds; }; struct ColorLayerAttributes { LayerColor color; IntRect bounds; };
struct CanvasLayerAttributes { Filter filter; IntRect bounds; }; struct CanvasLayerAttributes { Filter filter; IntRect bounds; };
@@ -396,6 +397,7 @@ struct TimedTexture {
IntRect picture; IntRect picture;
uint32_t frameID; uint32_t frameID;
uint32_t producerID; uint32_t producerID;
int32_t inputFrameID;
}; };
/** /**

View File

@@ -396,7 +396,7 @@ ShadowLayerForwarder::UseTextures(CompositableClient* aCompositable,
textures.AppendElement(TimedTexture(nullptr, t.mTextureClient->GetIPDLActor(), textures.AppendElement(TimedTexture(nullptr, t.mTextureClient->GetIPDLActor(),
fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t()), fence.IsValid() ? MaybeFence(fence) : MaybeFence(null_t()),
t.mTimeStamp, t.mPictureRect, t.mTimeStamp, t.mPictureRect,
t.mFrameID, t.mProducerID)); t.mFrameID, t.mProducerID, t.mInputFrameID));
if ((t.mTextureClient->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) if ((t.mTextureClient->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD)
&& t.mTextureClient->HasInternalBuffer()) { && t.mTextureClient->HasInternalBuffer()) {

View File

@@ -161,6 +161,7 @@ struct VRDeviceInfo
struct VRHMDSensorState { struct VRHMDSensorState {
double timestamp; double timestamp;
int32_t inputFrameID;
VRStateValidFlags flags; VRStateValidFlags flags;
float orientation[4]; float orientation[4];
float position[3]; float position[3];
@@ -244,7 +245,7 @@ public:
virtual already_AddRefed<RenderTargetSet> CreateRenderTargetSet(layers::Compositor *aCompositor, const IntSize& aSize) = 0; virtual already_AddRefed<RenderTargetSet> CreateRenderTargetSet(layers::Compositor *aCompositor, const IntSize& aSize) = 0;
virtual void DestroyRenderTargetSet(RenderTargetSet *aRTSet) = 0; virtual void DestroyRenderTargetSet(RenderTargetSet *aRTSet) = 0;
virtual void SubmitFrame(RenderTargetSet *aRTSet) = 0; virtual void SubmitFrame(RenderTargetSet *aRTSet, int32_t aInputFrameID) = 0;
protected: protected:
VRHMDRenderingSupport() { } VRHMDRenderingSupport() { }
}; };

View File

@@ -246,6 +246,7 @@ FromFovPort(const ovrFovPort& aFOV)
HMDInfoOculus::HMDInfoOculus(ovrSession aSession) HMDInfoOculus::HMDInfoOculus(ovrSession aSession)
: VRHMDInfo(VRHMDType::Oculus, false) : VRHMDInfo(VRHMDType::Oculus, false)
, mSession(aSession) , mSession(aSession)
, mInputFrameID(0)
{ {
MOZ_ASSERT(sizeof(HMDInfoOculus::DistortionVertex) == sizeof(VRDistortionVertex), MOZ_ASSERT(sizeof(HMDInfoOculus::DistortionVertex) == sizeof(VRDistortionVertex),
"HMDInfoOculus::DistortionVertex must match the size of VRDistortionVertex"); "HMDInfoOculus::DistortionVertex must match the size of VRDistortionVertex");
@@ -345,7 +346,7 @@ HMDInfoOculus::KeepSensorTracking()
void void
HMDInfoOculus::NotifyVsync(const mozilla::TimeStamp& aVsyncTimestamp) HMDInfoOculus::NotifyVsync(const mozilla::TimeStamp& aVsyncTimestamp)
{ {
++mInputFrameID;
} }
void void
@@ -518,7 +519,7 @@ HMDInfoOculus::DestroyRenderTargetSet(RenderTargetSet *aRTSet)
} }
void void
HMDInfoOculus::SubmitFrame(RenderTargetSet *aRTSet) HMDInfoOculus::SubmitFrame(RenderTargetSet *aRTSet, int32_t aInputFrameID)
{ {
RenderTargetSetOculus *rts = static_cast<RenderTargetSetOculus*>(aRTSet); RenderTargetSetOculus *rts = static_cast<RenderTargetSetOculus*>(aRTSet);
MOZ_ASSERT(rts->hmd != nullptr); MOZ_ASSERT(rts->hmd != nullptr);
@@ -547,7 +548,7 @@ HMDInfoOculus::SubmitFrame(RenderTargetSet *aRTSet)
do_CalcEyePoses(rts->hmd->mLastTrackingState.HeadPose.ThePose, hmdToEyeViewOffset, layer.RenderPose); do_CalcEyePoses(rts->hmd->mLastTrackingState.HeadPose.ThePose, hmdToEyeViewOffset, layer.RenderPose);
ovrLayerHeader *layers = &layer.Header; ovrLayerHeader *layers = &layer.Header;
ovrResult orv = ovr_SubmitFrame(mSession, 0, nullptr, &layers, 1); ovrResult orv = ovr_SubmitFrame(mSession, aInputFrameID, nullptr, &layers, 1);
//printf_stderr("Submitted frame %d, result: %d\n", rts->textureSet->CurrentIndex, orv); //printf_stderr("Submitted frame %d, result: %d\n", rts->textureSet->CurrentIndex, orv);
if (orv != ovrSuccess) { if (orv != ovrSuccess) {
// not visible? failed? // not visible? failed?

View File

@@ -45,7 +45,7 @@ public:
/* VRHMDRenderingSupport */ /* VRHMDRenderingSupport */
already_AddRefed<RenderTargetSet> CreateRenderTargetSet(layers::Compositor *aCompositor, const IntSize& aSize) override; already_AddRefed<RenderTargetSet> CreateRenderTargetSet(layers::Compositor *aCompositor, const IntSize& aSize) override;
void DestroyRenderTargetSet(RenderTargetSet *aRTSet) override; void DestroyRenderTargetSet(RenderTargetSet *aRTSet) override;
void SubmitFrame(RenderTargetSet *aRTSet) override; void SubmitFrame(RenderTargetSet *aRTSet, int32_t aInputFrameID) override;
ovrSession GetOculusSession() const { return mSession; } ovrSession GetOculusSession() const { return mSession; }
@@ -68,6 +68,7 @@ protected:
ovrHmdDesc mDesc; ovrHmdDesc mDesc;
ovrFovPort mFOVPort[2]; ovrFovPort mFOVPort[2];
ovrTrackingState mLastTrackingState; ovrTrackingState mLastTrackingState;
int mInputFrameID;
}; };
} // namespace impl } // namespace impl

View File

@@ -24,6 +24,7 @@ void ReleaseVRManagerParentSingleton() {
} }
VRManagerChild::VRManagerChild() VRManagerChild::VRManagerChild()
: mInputFrameID(-1)
{ {
MOZ_COUNT_CTOR(VRManagerChild); MOZ_COUNT_CTOR(VRManagerChild);
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@@ -157,6 +158,7 @@ VRManagerChild::RecvUpdateDeviceSensors(nsTArray<VRSensorUpdate>&& aDeviceSensor
for (auto& device: mDevices) { for (auto& device: mDevices) {
if (device->GetDeviceInfo().GetDeviceID() == sensorUpdate.mDeviceID) { if (device->GetDeviceInfo().GetDeviceID() == sensorUpdate.mDeviceID) {
device->UpdateSensorState(sensorUpdate.mSensorState); device->UpdateSensorState(sensorUpdate.mSensorState);
mInputFrameID = sensorUpdate.mSensorState.inputFrameID;
break; break;
} }
} }
@@ -182,5 +184,11 @@ VRManagerChild::RefreshVRDevicesWithCallback(dom::Navigator* aNavigator)
return success; return success;
} }
int
VRManagerChild::GetInputFrameID()
{
return mInputFrameID;
}
} // namespace gfx } // namespace gfx
} // namespace mozilla } // namespace mozilla

View File

@@ -25,6 +25,7 @@ class VRManagerChild : public PVRManagerChild
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(VRManagerChild) NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(VRManagerChild)
int GetInputFrameID();
bool GetVRDevices(nsTArray<RefPtr<VRDeviceProxy> >& aDevices); bool GetVRDevices(nsTArray<RefPtr<VRDeviceProxy> >& aDevices);
bool RefreshVRDevicesWithCallback(dom::Navigator* aNavigator); bool RefreshVRDevicesWithCallback(dom::Navigator* aNavigator);
static VRManagerChild* StartUpInChildProcess(Transport* aTransport, static VRManagerChild* StartUpInChildProcess(Transport* aTransport,
@@ -52,6 +53,7 @@ private:
nsTArray<RefPtr<VRDeviceProxy> > mDevices; nsTArray<RefPtr<VRDeviceProxy> > mDevices;
nsTArray<dom::Navigator*> mNavigatorCallbacks; nsTArray<dom::Navigator*> mNavigatorCallbacks;
int32_t mInputFrameID;
}; };
} // namespace mozilla } // namespace mozilla

View File

@@ -127,6 +127,7 @@ struct ParamTraits<mozilla::gfx::VRHMDSensorState>
static void Write(Message* aMsg, const paramType& aParam) static void Write(Message* aMsg, const paramType& aParam)
{ {
WriteParam(aMsg, aParam.timestamp); WriteParam(aMsg, aParam.timestamp);
WriteParam(aMsg, aParam.inputFrameID);
WriteParam(aMsg, aParam.flags); WriteParam(aMsg, aParam.flags);
WriteParam(aMsg, aParam.orientation[0]); WriteParam(aMsg, aParam.orientation[0]);
WriteParam(aMsg, aParam.orientation[1]); WriteParam(aMsg, aParam.orientation[1]);
@@ -152,6 +153,7 @@ struct ParamTraits<mozilla::gfx::VRHMDSensorState>
static bool Read(const Message* aMsg, void** aIter, paramType* aResult) static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
{ {
if (!ReadParam(aMsg, aIter, &(aResult->timestamp)) || if (!ReadParam(aMsg, aIter, &(aResult->timestamp)) ||
!ReadParam(aMsg, aIter, &(aResult->inputFrameID)) ||
!ReadParam(aMsg, aIter, &(aResult->flags)) || !ReadParam(aMsg, aIter, &(aResult->flags)) ||
!ReadParam(aMsg, aIter, &(aResult->orientation[0])) || !ReadParam(aMsg, aIter, &(aResult->orientation[0])) ||
!ReadParam(aMsg, aIter, &(aResult->orientation[1])) || !ReadParam(aMsg, aIter, &(aResult->orientation[1])) ||

View File

@@ -6428,6 +6428,7 @@ nsDisplayVR::BuildLayer(nsDisplayListBuilder* aBuilder,
newContainerParameters, nullptr, flags); newContainerParameters, nullptr, flags);
container->SetVRDeviceID(mHMD->GetDeviceInfo().GetDeviceID()); container->SetVRDeviceID(mHMD->GetDeviceInfo().GetDeviceID());
container->SetInputFrameID(mHMD->GetSensorState().inputFrameID);
container->SetUserData(nsIFrame::LayerIsPrerenderedDataKey(), container->SetUserData(nsIFrame::LayerIsPrerenderedDataKey(),
/*the value is irrelevant*/nullptr); /*the value is irrelevant*/nullptr);