Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5779)

Unified Diff: chrome/browser/android/vr_shell/vr_shell_gl.cc

Issue 2897583002: WebVR unstuffing: delay "rendered" notification (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 65cc835187302e13ebd1d9266e54d0b50d144d13..ebc784c4bfb900c7642c7e26af55114794d0faf7 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -423,15 +423,6 @@ void VrShellGl::OnWebVRFrameAvailable() {
TRACE_EVENT1("gpu", "VrShellGl::OnWebVRFrameAvailable", "frame", frame_index);
pending_frames_.pop();
- // It is legal for the WebVR client to submit a new frame now, since
- // we've consumed the image. TODO(klausw): would timing be better if
- // we move the "rendered" notification after draw, or suppress
- // the next vsync until that's done?
-
- if (submit_client_) {
- submit_client_->OnSubmitFrameRendered();
- }
-
DrawFrame(frame_index);
}
@@ -1066,6 +1057,14 @@ void VrShellGl::DrawFrame(int16_t frame_index) {
surface_->SwapBuffers();
}
+ // Report rendering completion to WebVR so that it's permitted to submit
+ // a fresh frame. We could do this earlier, as soon as the frame got pulled
+ // off the transfer surface, but that appears to result in overstuffed
+ // buffers.
+ if (submit_client_) {
+ submit_client_->OnSubmitFrameRendered();
+ }
+
#if DCHECK_IS_ON()
// After saving the timestamp, fps will be available via GetFPS().
// TODO(vollick): enable rendering of this framerate in a HUD.
@@ -1466,7 +1465,6 @@ void VrShellGl::OnVSync() {
SendVSync(time, base::ResetAndReturn(&callback_));
} else {
pending_vsync_ = true;
- pending_time_ = time;
}
if (!ShouldDrawWebVr()) {
DrawFrame(-1);
@@ -1490,7 +1488,8 @@ void VrShellGl::GetVSync(const GetVSyncCallback& callback) {
return;
}
pending_vsync_ = false;
- SendVSync(pending_time_, callback);
+ base::TimeDelta time = base::TimeTicks::Now() - vsync_timebase_;
mthiesse 2017/05/23 00:14:17 I don't think we want to do this with the timestam
+ SendVSync(time, callback);
}
void VrShellGl::UpdateVSyncInterval(int64_t timebase_nanos,
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698