зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1392216 - Part 3: VRPuppet dispatch submit frame result to VRListener thread; r=kip
MozReview-Commit-ID: K5ivNAkB89I --HG-- extra : rebase_source : d4a87c12f5268a7aebe68e81c58c753eb60bfbc8
This commit is contained in:
Родитель
48b5ded13e
Коммит
9210bba13b
|
@ -89,7 +89,6 @@ If this fails, something is seriously wrong. -->
|
|||
return;
|
||||
}
|
||||
|
||||
vrDisplay.requestAnimationFrame(onAnimationFrame);
|
||||
gl.clearColor(0.0, 1.0, 0.0, 1.0);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
|
@ -121,6 +120,7 @@ If this fails, something is seriously wrong. -->
|
|||
img.src = submitResult.base64Image;
|
||||
}
|
||||
}
|
||||
vrDisplay.requestAnimationFrame(onAnimationFrame);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
|
|
|
@ -62,7 +62,6 @@ If this fails, something is seriously wrong. -->
|
|||
return;
|
||||
}
|
||||
|
||||
vrDisplay.requestAnimationFrame(onAnimationFrame);
|
||||
gl.clearColor(0.0, 1.0, 0.0, 1.0);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
|
||||
|
@ -89,6 +88,7 @@ If this fails, something is seriously wrong. -->
|
|||
img.src = submitResult.base64Image;
|
||||
}
|
||||
}
|
||||
vrDisplay.requestAnimationFrame(onAnimationFrame);
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# WebVR Reftests
|
||||
# Please confirm there is no other VR display connected. Otherwise, VRPuppetDisplay can't be attached.
|
||||
default-preferences pref(dom.vr.puppet.enabled,true) pref(dom.vr.test.enabled,true) pref(dom.vr.require-gesture,false) pref(dom.vr.puppet.submitframe,1)
|
||||
default-preferences pref(dom.vr.puppet.enabled,true) pref(dom.vr.test.enabled,true) pref(dom.vr.require-gesture,false) pref(dom.vr.puppet.submitframe,1) pref(dom.vr.display.rafMaxDuration,200)
|
||||
|
||||
# VR SubmitFrame is only implemented for D3D11.1 and MacOSX now.
|
||||
# Our Windows 7 test machines don't support D3D11.1, so we run these tests on Windows 8+ only.
|
||||
|
|
|
@ -369,6 +369,7 @@ private:
|
|||
DECL_GFX_PREF(Live, "dom.vr.require-gesture", VRRequireGesture, bool, true);
|
||||
DECL_GFX_PREF(Live, "dom.vr.puppet.enabled", VRPuppetEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "dom.vr.puppet.submitframe", VRPuppetSubmitFrame, uint32_t, 0);
|
||||
DECL_GFX_PREF(Live, "dom.vr.display.rafMaxDuration", VRDisplayRafMaxDuration, uint32_t, 50);
|
||||
DECL_GFX_PREF(Live, "dom.w3c_pointer_events.enabled", PointerEventsEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "dom.w3c_touch_events.enabled", TouchEventsEnabled, int32_t, 0);
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "VRDisplayHost.h"
|
||||
#include "gfxPrefs.h"
|
||||
#include "gfxVR.h"
|
||||
#include "ipc/VRLayerParent.h"
|
||||
#include "mozilla/layers/TextureHost.h"
|
||||
|
@ -197,7 +198,7 @@ VRDisplayHost::NotifyVSync()
|
|||
/**
|
||||
* We will trigger a new frame immediately after a successful frame texture
|
||||
* submission. If content fails to call VRDisplay.submitFrame after
|
||||
* kVRDisplayRAFMaxDuration milliseconds has elapsed since the last
|
||||
* dom.vr.display.rafMaxDuration milliseconds has elapsed since the last
|
||||
* VRDisplay.requestAnimationFrame, we act as a "watchdog" and kick-off
|
||||
* a new VRDisplay.requestAnimationFrame to avoid a render loop stall and
|
||||
* to give content a chance to recover.
|
||||
|
@ -209,13 +210,7 @@ VRDisplayHost::NotifyVSync()
|
|||
* potentially extreme frame rates. To ensure that content has a chance to
|
||||
* resume its presentation when the frames are accepted once again, we rely
|
||||
* on this "watchdog" to act as a VR refresh driver cycling at a rate defined
|
||||
* by kVRDisplayRAFMaxDuration.
|
||||
*
|
||||
* kVRDisplayRAFMaxDuration is the number of milliseconds since last frame
|
||||
* start before triggering a new frame. When content is failing to submit
|
||||
* frames on time or the lower level VR platform API's are rejecting frames,
|
||||
* kVRDisplayRAFMaxDuration determines the rate at which RAF callbacks
|
||||
* will be called.
|
||||
* by dom.vr.display.rafMaxDuration.
|
||||
*
|
||||
* This number must be larger than the slowest expected frame time during
|
||||
* normal VR presentation, but small enough not to break content that
|
||||
|
@ -223,12 +218,10 @@ VRDisplayHost::NotifyVSync()
|
|||
*
|
||||
* The slowest expected refresh rate for a VR display currently is an
|
||||
* Oculus CV1 when ASW (Asynchronous Space Warp) is enabled, at 45hz.
|
||||
* A kVRDisplayRAFMaxDuration value of 50 milliseconds results in a 20hz
|
||||
* A dom.vr.display.rafMaxDuration value of 50 milliseconds results in a 20hz
|
||||
* rate, which avoids inadvertent triggering of the watchdog during
|
||||
* Oculus ASW even if every second frame is dropped.
|
||||
*/
|
||||
const double kVRDisplayRAFMaxDuration = 50;
|
||||
|
||||
bool bShouldStartFrame = false;
|
||||
|
||||
if (mDisplayInfo.mPresentingGroups == 0) {
|
||||
|
@ -242,7 +235,7 @@ VRDisplayHost::NotifyVSync()
|
|||
bShouldStartFrame = true;
|
||||
} else {
|
||||
TimeDuration duration = TimeStamp::Now() - mLastFrameStart;
|
||||
if (duration.ToMilliseconds() > kVRDisplayRAFMaxDuration) {
|
||||
if (duration.ToMilliseconds() > gfxPrefs::VRDisplayRafMaxDuration()) {
|
||||
bShouldStartFrame = true;
|
||||
}
|
||||
}
|
||||
|
@ -274,7 +267,6 @@ VRDisplayHost::SubmitFrame(VRLayerParent* aLayer,
|
|||
return;
|
||||
}
|
||||
mFrameStarted = false;
|
||||
|
||||
switch (aTexture.type()) {
|
||||
|
||||
#if defined(XP_WIN)
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "gfxUtils.h"
|
||||
#include "gfxVRPuppet.h"
|
||||
#include "VRManager.h"
|
||||
#include "VRThread.h"
|
||||
|
||||
#include "mozilla/dom/GamepadEventTypes.h"
|
||||
#include "mozilla/dom/GamepadBinding.h"
|
||||
|
@ -377,7 +378,11 @@ VRDisplayPuppet::SubmitFrame(ID3D11Texture2D* aSource,
|
|||
mContext->Unmap(mappedTexture, 0);
|
||||
// Dispatch the base64 encoded string to the DOM side. Then, it will be decoded
|
||||
// and convert to a PNG image there.
|
||||
vm->DispatchSubmitFrameResult(mDisplayInfo.mDisplayID, result);
|
||||
MessageLoop* loop = VRListenerThreadHolder::Loop();
|
||||
loop->PostTask(NewRunnableMethod<const uint32_t, VRSubmitFrameResultInfo>(
|
||||
"VRManager::DispatchSubmitFrameResult",
|
||||
vm, &VRManager::DispatchSubmitFrameResult, mDisplayInfo.mDisplayID, result
|
||||
));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
|
@ -518,7 +523,11 @@ VRDisplayPuppet::SubmitFrame(MacIOSurface* aMacIOSurface,
|
|||
}
|
||||
// Dispatch the base64 encoded string to the DOM side. Then, it will be decoded
|
||||
// and convert to a PNG image there.
|
||||
vm->DispatchSubmitFrameResult(mDisplayInfo.mDisplayID, result);
|
||||
MessageLoop* loop = VRListenerThreadHolder::Loop();
|
||||
loop->PostTask(NewRunnableMethod<const uint32_t, VRSubmitFrameResultInfo>(
|
||||
"VRManager::DispatchSubmitFrameResult",
|
||||
vm, &VRManager::DispatchSubmitFrameResult, mDisplayInfo.mDisplayID, result
|
||||
));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ VRLayerParent::RecvSubmitFrame(const layers::SurfaceDescriptor &aTexture,
|
|||
// Because VR compositor still shares the same graphics device with Compositor thread.
|
||||
// We have to post sumbit frame tasks to Compositor thread.
|
||||
// TODO: Move SubmitFrame to Bug 1392217.
|
||||
loop->PostTask(NewRunnableMethod<VRDisplayHost*, const layers::SurfaceDescriptor&, uint64_t,
|
||||
loop->PostTask(NewRunnableMethod<VRDisplayHost*, const layers::SurfaceDescriptor, uint64_t,
|
||||
const gfx::Rect&, const gfx::Rect&>(
|
||||
"gfx::VRLayerParent::SubmitFrame",
|
||||
this,
|
||||
|
|
|
@ -5336,6 +5336,10 @@ pref("dom.vr.puppet.enabled", false);
|
|||
// Allow displaying the result of vr submitframe (0: disable, 1: store the
|
||||
// result as a base64 image, 2: show it on the screen).
|
||||
pref("dom.vr.puppet.submitframe", 0);
|
||||
// The number of milliseconds since last frame start before triggering a new frame.
|
||||
// When content is failing to submit frames on time or the lower level VR platform API's
|
||||
// are rejecting frames, it determines the rate at which RAF callbacks will be called.
|
||||
pref("dom.vr.display.rafMaxDuration", 50);
|
||||
// VR test system.
|
||||
pref("dom.vr.test.enabled", false);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче