New issue
Advanced search Search tips

Issue 724261 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Jun 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug
Proj-XR



Sign in to add a comment

webvr hmd.rAf slower than window.rAf when not presenting

Reported by steph...@sketchfab.com, May 18 2017

Issue description

Steps to reproduce the problem:
With the hmd rAf:
https://sketchfab.com/models/9d1e91bbcfe54ffa9e39658c8cc45684?vr_force_raf=1

With window rAf:
https://sketchfab.com/models/9d1e91bbcfe54ffa9e39658c8cc45684

What is the expected behavior?
Same performance for both links

https://w3c.github.io/webvr/spec/1.1/#dom-vrdisplay-requestanimationframe

"When not presenting this function acts identically to how window.requestAnimationFrame acts."

What went wrong?
Using the hmd requestAnimationFrame (when *not* in vr) is slower than using the classic one.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 58.0.3029.83  Channel: stable
OS Version: 7.1.2
Flash Version: 

Tested on nexus 5x without any experimental flags (sketchfab.com has the webvr token).
 
Cc: klausw@chromium.org
Status: Available (was: Unconfirmed)
Thanks for the report. We're currently doing some hacky scheduling that doesn't go through Chrome's normal frame scheduling path in order to hook up the high accuracy pose data VR APIs give us without making getFrameData perform slow synchronous IPCs to get the pose.

We're working on making scheduling better and dealing with pose data differently, so this will get better in the future.
+cc klausw
In the short term we should probably just figure out how to get the NonPresentingGvrDelegate to listen to the BeginFrameSource and send VSyncs at the same time, though that won't totally solve the issue, as normal chrome scheduling still won't be blocked on vrDisplay rAF.

In the medium term if we get poses sent through shared memory, we can piggy-back off of the document rAF like we did back in M56 and still avoid the sync IPC.

Or maybe we should just piggy-back off document rAF now, and send new poses with each beginFrame, to be queued up in the renderer for the next rAF call... This would add a small amount of extra pose latency to magic window but would remove the performance differences between vrDisplay.rAF and window.rAF.

I guess the unfortunate thing here is that we'd have to add extra complexity to VrDisplay, which would need to have separate vsync logic for presenting and non-presenting.
Owner: mthiesse@chromium.org
Status: Started (was: Available)
Labels: Proj-VR
Project Member

Comment 5 by bugdroid1@chromium.org, Jun 16 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/093bef3900d7050734958c49e8a4e6945a36705d

commit 093bef3900d7050734958c49e8a4e6945a36705d
Author: Michael Thiessen <mthiesse@chromium.org>
Date: Fri Jun 16 01:49:32 2017

VR: Remove NonPresentingGvrDelegate, connect Magic Window to Document rAF, bind submitFrame directly to presenting thread.

Some background information:
Magic Window is what we call non-presenting webVR, because it looks
like your display is a 'window' into a another space. Magic Window is
effectively just using device orientation with webGL, but using webVR
APIs to read orientation.

We remove the need for a NonPresentingGvrDelegate in 2 ways.
1. Magic Window uses the document rAF to schedule VrDisplay.rAF callbacks.
2. Magic Window asks the display for poses rather than getting them in
VSync callbacks.

We then move SubmitFrame and UpdateLayerBounds into what used to be
the VrVsyncProvider, and is now the VRPresentationProvider.

This all has a number of benefits:
1. Huge reduction in code complexity. No reconnecting of VSync providers.
Only one type of GvrDelegate, fewer empty functions sitting around.
2. Better performance for Magic Window. Frame drawing is properly aligned
with the document rAF. VRDisplay.rAF and document.rAF are now equivalent
when not presenting.
3. Better performance for Presentation. No hops through the UI thread in
order to submit WebVR frames.


Sorry for this being 2 CLs in one. Trying to separate these changes out
proved to be a major pain and probably not worth the effort as these
refactorings are mutually dependent.


Bug:  724261 
Change-Id: If657133afb5a5bcd9d8d67ce44a963f3cb570c31
Reviewed-on: https://chromium-review.googlesource.com/524474
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Biao She <bshe@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#479897}
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/BUILD.gn
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/gl_browser_interface.h
[delete] https://crrev.com/9ab6f1801d197cda79b2f1dbf8f81d4f8d5f4884/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.cc
[delete] https://crrev.com/9ab6f1801d197cda79b2f1dbf8f81d4f8d5f4884/chrome/browser/android/vr_shell/non_presenting_gvr_delegate.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_gl_thread.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_gl_thread.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_metrics_util.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_metrics_util.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_shell.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_shell.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_shell_delegate.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_shell_delegate.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_shell_gl.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/chrome/browser/android/vr_shell/vr_shell_gl.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/BUILD.gn
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/android/gvr/gvr_delegate.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/android/gvr/gvr_delegate.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/android/gvr/gvr_delegate_provider.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/android/gvr/gvr_device.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/android/gvr/gvr_device.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/openvr/openvr_device.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/openvr/openvr_device.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/test/fake_vr_device.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/test/fake_vr_device.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/vr_device.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/vr_display_impl.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/vr_display_impl.h
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/vr_display_impl_unittest.cc
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/device/vr/vr_service.mojom
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/third_party/WebKit/LayoutTests/vr/resources/mock-vr-service.js
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/third_party/WebKit/Source/modules/vr/DEPS
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
[modify] https://crrev.com/093bef3900d7050734958c49e8a4e6945a36705d/third_party/WebKit/Source/modules/vr/VRDisplay.h

Status: Fixed (was: Started)
 Issue 734208  tracks the addition of an automated test to catch regressions of this issue.
Components: Blink>WebXR

Sign in to add a comment