New issue
Advanced search Search tips

Issue 701444 link

Starred by 1 user

Issue metadata

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

Blocking:
issue 701465



Sign in to add a comment

WebVR: input lag / render pauses due to broken event processing

Project Member Reported by dbbrooks@chromium.org, Mar 14 2017

Issue description

Chrome Version: 59.0.3040.0
OS: Pixel (repros on other devices as well)
VRCore: 1.3.148407064

happens when using both daydream and cardboard headsets

What steps will reproduce the problem? (steps are for cardboard, but daydream has similar result)
(1) go to https://webvr.info/samples/03-vr-presentation.html and 
(2) Click enter VR
(3) In binocular mode, touch the screen.

What is the expected result? The color of the background should change.

What happens instead? The color of the background does not change. And after exiting binocular view, you can see the colors rapidly flicker like all the clicks were stored until exit.


 
Looks like an M59 regression, VR Shell is correctly sending the input events, but they're queueing up and not getting sent to the renderer for some reason. When you exit VR all of the queued up taps get sent at once.
If you wait long enough in VR, the queued input events get sent eventually (1-10 seconds later), at least on the 6P.
For whatever reason, seems to work find on the LG G3 running 59.0.3041.0.
Not reproducible in 59.0.3037.0, which is the last working Canary before Klaus' patch went in, so it's likely related to that.

Comment 5 by klausw@chromium.org, Mar 14 2017

Investigating. FWIW, touching the screen is expected to have no effect while in Daydream View mode, it suppresses touch events due to using capacitive nubs for calibrating screen position. But clicking the controller's touchpad should generate an emulated screen tap.

Comment 6 by klausw@chromium.org, Mar 14 2017

Labels: -Pri-3 Pri-1
Owner: klausw@chromium.org
Status: Started (was: Untriaged)

Comment 7 by klausw@chromium.org, Mar 15 2017

Proposed fix in https://codereview.chromium.org/2748293002 :

If we call GetVSync inline from a rAF context, we can end up with the next VSync already being ready and scheduled when we exit, and then we'll process several frames in a row without ever yielding back to the main event loop, causing input processing delay.

Comment 8 by klausw@chromium.org, Mar 15 2017

BTW, the broken logic had the side effect of effectively suppressing normal frame lifecycle processing for the compositor, so it made WebVR presentation more efficient. With the fix, it's doing significant work every frame, and we'll really want the compositing path suppression as per  issue 698923 .

Comment 9 by klausw@chromium.org, Mar 15 2017

Trace + screenshot of the malfunctioning scheduling attached, note it's running back to back OnVSync frames within a single TaskQueueManager::RunTask without ever yielding execution back to the toplevel.
traceEvents-BAD-20170314a.html
8.8 MB View Download
Add screenshot.
trace-inputlatency-20170315.png
222 KB View Download
Project Member

Comment 11 by bugdroid1@chromium.org, Mar 15 2017

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

commit ff386cfefd3fe0f9cef72ff28f7c7f09d972608d
Author: klausw <klausw@chromium.org>
Date: Wed Mar 15 20:29:19 2017

WebVR: process animations from posted task to yield for other events

If we call GetVSync inline from OnVSync, we can end up with the next
VSync already being ready and scheduled when we exit, and then we'll process
several frames in a row without ever yielding back to the main event loop,
causing input processing delay.

BUG= 701444 

Review-Url: https://codereview.chromium.org/2748293002
Cr-Commit-Position: refs/heads/master@{#457189}

[modify] https://crrev.com/ff386cfefd3fe0f9cef72ff28f7c7f09d972608d/chrome/browser/android/vr_shell/vr_shell_gl.cc
[modify] https://crrev.com/ff386cfefd3fe0f9cef72ff28f7c7f09d972608d/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
[modify] https://crrev.com/ff386cfefd3fe0f9cef72ff28f7c7f09d972608d/third_party/WebKit/Source/modules/vr/VRDisplay.h

Blocking: 701465
Status: Fixed (was: Started)
Project Member

Comment 14 by bugdroid1@chromium.org, Mar 17 2017

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

commit efd3d31152e48d1089175b9256c56bccbe6d9792
Author: klausw <klausw@chromium.org>
Date: Fri Mar 17 00:13:12 2017

WebVR: move animation state check to deferred task

The animation controller or document may have disappeared
in between scheduling the callback and executing it.

BUG= 701444 
R=bajones, mthiesse

Review-Url: https://codereview.chromium.org/2752343002
Cr-Commit-Position: refs/heads/master@{#457618}

[modify] https://crrev.com/efd3d31152e48d1089175b9256c56bccbe6d9792/third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Labels: -M-59 Merge-Request-58 M-58
Status: Started (was: Fixed)
Reopening since M58 is also affected by this issue. As per OmahaProxy: Commit a316edeb... initially landed in 58.0.2995.0

This also causes a serious performance regression on complex WebVR site such as Sketchfab's Mars One, https://sketchfab.com/models/83ced347037f47aba8473147d65df074. Traces show pauses of hundreds of milliseconds in RealSwapBuffers, apparently as a side effect of event handling being backed up.

Traces attached to compare. They are for M56 (as baseline), M58-beta, and a test build for branch-heads/3029 + the two cherry-picked patches from this bug.

Requesting merge back to M58 due to the regression. The change has been tested extensively in Canary. Please contact me if you have questions or concerns about this merge.
traceEvents-M56.html
8.4 MB View Download
traceEvents-M58-beta.html
4.3 MB View Download
traceEvents-M58+701444.html
7.8 MB View Download
Project Member

Comment 16 by sheriffbot@chromium.org, Mar 23 2017

Labels: -Merge-Request-58 Hotlist-Merge-Approved Merge-Approved-58
Your change meets the bar and is auto-approved for M58. Please go ahead and merge the CL to branch 3029 manually. Please contact milestone owner if you have questions.
Owners: amineer@(Android), cmasso@(iOS), bhthompson@(ChromeOS), govind@(Desktop)

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Cc: klausw@chromium.org
 Issue 703417  has been merged into this issue.
Project Member

Comment 18 by bugdroid1@chromium.org, Mar 23 2017

Labels: -merge-approved-58 merge-merged-3029
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/40b2aa9268c6ff790dd6691bac26b5e15799852e

commit 40b2aa9268c6ff790dd6691bac26b5e15799852e
Author: klausw <klausw@chromium.org>
Date: Thu Mar 23 20:55:09 2017

WebVR: process animations from posted task to yield for other events

If we call GetVSync inline from OnVSync, we can end up with the next
VSync already being ready and scheduled when we exit, and then we'll process
several frames in a row without ever yielding back to the main event loop,
causing input processing delay.

BUG= 701444 
NOTRY=true
NOPRESUBMIT=true

Review-Url: https://codereview.chromium.org/2748293002
Cr-Commit-Position: refs/heads/master@{#457189}
(cherry picked from commit ff386cfefd3fe0f9cef72ff28f7c7f09d972608d)

Review-Url: https://codereview.chromium.org/2774673003
Cr-Commit-Position: refs/branch-heads/3029@{#394}
Cr-Branched-From: 939b32ee5ba05c396eef3fd992822fcca9a2e262-refs/heads/master@{#454471}

[modify] https://crrev.com/40b2aa9268c6ff790dd6691bac26b5e15799852e/chrome/browser/android/vr_shell/vr_shell_gl.cc
[modify] https://crrev.com/40b2aa9268c6ff790dd6691bac26b5e15799852e/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
[modify] https://crrev.com/40b2aa9268c6ff790dd6691bac26b5e15799852e/third_party/WebKit/Source/modules/vr/VRDisplay.h

Project Member

Comment 19 by bugdroid1@chromium.org, Mar 23 2017

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

commit 1598a6bafc5d202e1fe34a2976ea12c37e80214b
Author: klausw <klausw@chromium.org>
Date: Thu Mar 23 21:01:40 2017

WebVR: move animation state check to deferred task

The animation controller or document may have disappeared
in between scheduling the callback and executing it.

BUG= 701444 
R=bajones, mthiesse
NOTRY=true
NOPRESUBMIT=true

Review-Url: https://codereview.chromium.org/2752343002
Cr-Commit-Position: refs/heads/master@{#457618}
(cherry picked from commit efd3d31152e48d1089175b9256c56bccbe6d9792)

Review-Url: https://codereview.chromium.org/2771913002
Cr-Commit-Position: refs/branch-heads/3029@{#395}
Cr-Branched-From: 939b32ee5ba05c396eef3fd992822fcca9a2e262-refs/heads/master@{#454471}

[modify] https://crrev.com/1598a6bafc5d202e1fe34a2976ea12c37e80214b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Status: Fixed (was: Started)
Merged, closing. This issue should not have affected M57, and is fixed for M58 and ToT/M59.
To clarify, it'll be fixed for a future M58 build that includes it. Current M58 beta is affected.
Summary: WebVR: input lag / render pauses due to broken event processing (was: Clicks don't register in binocular view mode)
See also issue 705145 where older devices still suffer from >1s pauses in Cardboard mode. It appears that there are two separate issues for M58 and the patches from this bug fixed one of them.
Components: Blink>WebXR

Sign in to add a comment