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

Issue 2584343002: WIP: working copy-no-compositor path

Created:
4 years ago by klausw
Modified:
3 years, 9 months ago
CC:
chromium-reviews, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, yzshen+watch_chromium.org, abarth-chromium, haraken, Aaron Boodman, feature-vr-reviews_chromium.org, agrieve+watch_chromium.org, blink-reviews, darin (slow to review)
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

WIP: working copy-no-compositor path Prerequisite patches: https://codereview.chromium.org/2586803003/ "Enable creation of offscreen contexts which own their backing surface." https://codereview.chromium.org/2456213002/ "WebVR: implement SetSurfaceHandleCHROMIUM extension for gvr_device." - use dynamic 55%-of-1:1 WebVR content render resolution - delete corner pixel frame index hack. - delete fullscreen hack. - disable background compositor via document->view->hide() - draw WebVR content directly to Surface via Blink-side rebinding - add return value to SubmitFrame, track outstanding frames, skip if >1. - detect and suppress reused or invalid poses - new rAF throttling, per-frame layer bounds - dynamic resolution adjustment can happen before or after getting pose, adjust accordingly. - use pose age prediction for rendering - use GetSurfaceHandle to resize, make async - async getPose - 60fps frame limiter BUG=655722 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel

Patch Set 1 #

Patch Set 2 : Rebase to 356cd8379b3f2b06bd17716f88a2568791b4c60a #

Patch Set 3 : Fix fake VR device, rebase, add dependency #

Patch Set 4 : StatTracker destructor, delete old magic numbers, mojo export #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+1454 lines, -368 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java View 1 3 chunks +3 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java View 1 4 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/android/vr_shell/vr_shell.h View 1 2 3 chunks +12 lines, -5 lines 0 comments Download
M chrome/browser/android/vr_shell/vr_shell.cc View 1 6 chunks +35 lines, -16 lines 1 comment Download
M chrome/browser/android/vr_shell/vr_shell_delegate.cc View 1 6 chunks +15 lines, -8 lines 0 comments Download
M chrome/browser/android/vr_shell/vr_shell_gl.h View 1 2 10 chunks +36 lines, -7 lines 0 comments Download
M chrome/browser/android/vr_shell/vr_shell_gl.cc View 1 2 3 17 chunks +384 lines, -116 lines 4 comments Download
M device/vr/BUILD.gn View 1 2 3 1 chunk +3 lines, -0 lines 0 comments Download
M device/vr/android/gvr/gvr_delegate.h View 1 2 2 chunks +9 lines, -7 lines 2 comments Download
M device/vr/android/gvr/gvr_device.h View 1 2 3 4 chunks +26 lines, -1 line 0 comments Download
M device/vr/android/gvr/gvr_device.cc View 1 2 3 8 chunks +147 lines, -29 lines 2 comments Download
M device/vr/android/gvr/gvr_device_provider.h View 1 1 chunk +1 line, -0 lines 0 comments Download
M device/vr/android/gvr/gvr_device_provider.cc View 1 2 1 chunk +9 lines, -0 lines 0 comments Download
M device/vr/test/fake_vr_device.h View 1 2 1 chunk +5 lines, -1 line 0 comments Download
M device/vr/test/fake_vr_device.cc View 1 2 1 chunk +6 lines, -1 line 0 comments Download
M device/vr/vr_device.h View 1 chunk +5 lines, -1 line 0 comments Download
M device/vr/vr_device.cc View 2 chunks +6 lines, -0 lines 0 comments Download
M device/vr/vr_device_manager.h View 2 chunks +2 lines, -2 lines 0 comments Download
M device/vr/vr_device_manager.cc View 2 chunks +5 lines, -1 line 0 comments Download
M device/vr/vr_display_impl.h View 1 chunk +5 lines, -2 lines 0 comments Download
M device/vr/vr_display_impl.cc View 1 3 chunks +22 lines, -7 lines 0 comments Download
M device/vr/vr_service.mojom View 4 chunks +15 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/frame/FrameView.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/modules/vr/NavigatorVR.cpp View 1 4 chunks +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/vr/VRController.cpp View 1 2 chunks +5 lines, -1 line 0 comments Download
M third_party/WebKit/Source/modules/vr/VRDisplay.h View 1 2 3 6 chunks +59 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/modules/vr/VRDisplay.cpp View 1 2 3 34 chunks +583 lines, -149 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h View 1 2 chunks +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp View 1 3 chunks +37 lines, -2 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 12 (6 generated)
artem.bolgar
https://codereview.chromium.org/2584343002/diff/60001/device/vr/android/gvr/gvr_delegate.h File device/vr/android/gvr/gvr_delegate.h (right): https://codereview.chromium.org/2584343002/diff/60001/device/vr/android/gvr/gvr_delegate.h#newcode21 device/vr/android/gvr/gvr_delegate.h:21: class DEVICE_VR_EXPORT GvrDelegate { Shouldn't this class have a ...
3 years, 10 months ago (2017-02-14 03:34:29 UTC) #5
artem.bolgar
https://codereview.chromium.org/2584343002/diff/60001/chrome/browser/android/vr_shell/vr_shell_gl.cc File chrome/browser/android/vr_shell/vr_shell_gl.cc (right): https://codereview.chromium.org/2584343002/diff/60001/chrome/browser/android/vr_shell/vr_shell_gl.cc#newcode844 chrome/browser/android/vr_shell/vr_shell_gl.cc:844: callback.Run(0); You can't do this here. The callback may ...
3 years, 10 months ago (2017-02-14 05:04:24 UTC) #7
artem.bolgar
On a side note: It would be nice to abstract whole VrShell a bit more, ...
3 years, 10 months ago (2017-02-14 05:07:03 UTC) #8
artem.bolgar
https://codereview.chromium.org/2584343002/diff/60001/chrome/browser/android/vr_shell/vr_shell_gl.cc File chrome/browser/android/vr_shell/vr_shell_gl.cc (right): https://codereview.chromium.org/2584343002/diff/60001/chrome/browser/android/vr_shell/vr_shell_gl.cc#newcode188 chrome/browser/android/vr_shell/vr_shell_gl.cc:188: } It seems like WebVR surface (maybe others too) ...
3 years, 9 months ago (2017-02-28 20:15:53 UTC) #9
mthiesse
https://codereview.chromium.org/2584343002/diff/60001/chrome/browser/android/vr_shell/vr_shell_gl.cc File chrome/browser/android/vr_shell/vr_shell_gl.cc (right): https://codereview.chromium.org/2584343002/diff/60001/chrome/browser/android/vr_shell/vr_shell_gl.cc#newcode188 chrome/browser/android/vr_shell/vr_shell_gl.cc:188: } On 2017/02/28 20:15:52, artem.bolgar wrote: > It seems ...
3 years, 9 months ago (2017-02-28 20:22:48 UTC) #11
artem.bolgar
3 years, 9 months ago (2017-02-28 21:40:22 UTC) #12
https://codereview.chromium.org/2584343002/diff/60001/chrome/browser/android/...
File chrome/browser/android/vr_shell/vr_shell.cc (right):

https://codereview.chromium.org/2584343002/diff/60001/chrome/browser/android/...
chrome/browser/android/vr_shell/vr_shell.cc:183: gl_thread_.reset();
gl_thread_.reset() kills VrShellGl instance along with the WebVR SurfaceTexture
(if it was in use). However, the GPU and VRDisplay still use that and therefore,
you most likely will see the similar to 'BufferQueueProducer:
[SurfaceTexture-3-16381-2] dequeueBuffer: BufferQueue has been abandoned' error
message in the logcat each time you exit WebVR. You may destroy the WebVR
SurfaceTexture after the VRDisplay calls
m_renderingContext->setSurfaceHandle(0).

What I did to fix the problem (I hope, there is a better/easier way, though):
1) Added OnExitWebVR() => (); into 'interface VRDisplayClient'
2) Implemented it the following way:

void VRDisplay::OnExitWebVR(const OnExitWebVRCallback& callback) {
  VLOG(1) << __FUNCTION__;
  if (m_surfaceHandle && m_renderingContext) {
    m_renderingContext->setSurfaceHandle(0);
    VLOG(1) << " setSurfaceHandle(0); was just called";
    m_surfaceHandle = 0;
  }
  callback.Run();
}

3) In vr_shell.cc I've changed the dtor by adding creation of the callback (from
VrShellGl and passing it to delegate_->device_provider():

VrShell::~VrShell() {
  VLOG(1) << __FUNCTION__ << ": Destructor for presenting delegate";

  // must be done before killing GL thread, otherwise you'll get "BufferQueue
has been abandoned" error in logcat.
  GLThread* thread = static_cast<GLThread*>(gl_thread_.get());
  base::Callback<void()> cleanupCallback =
thread->GetVrShellGlUnsafe()->GetWebVrSurfaceCleanupCallback();

....  gl_thread_.reset();

  if (delegate_->device_provider()) {
    delegate_->device_provider()->OnWebVrCleanup(cleanupCallback);
  }


4) In vr_shell_gl.cc I've implemented a WebVRCleaner callback:

// A class that performs async cleanup of WebVR surface. The Clean method is
called by the VRDisplay class
// once WebVR surface is not used anymore.
class WebVRCleaner {
public:
  WebVRCleaner(scoped_refptr<gl::SurfaceTexture>& webvr_surface_texture) :
webvr_surface_texture_(webvr_surface_texture) {}
  ~WebVRCleaner() { DVLOG(1) << __FUNCTION__; }

  void Clean() {
    DVLOG(1) << __FUNCTION__;
    webvr_surface_texture_ = nullptr;
  }

  scoped_refptr<gl::SurfaceTexture> webvr_surface_texture_;
};

base::Callback<void()> VrShellGl::GetWebVrSurfaceCleanupCallback() {
  VLOG(1) << __FUNCTION__;
  WebVRCleaner* cleaner = new WebVRCleaner(webvr_surface_texture_);
  return base::Bind(&WebVRCleaner::Clean, base::Owned(cleaner));
}

5) Added:
 
void GvrDeviceProvider::OnWebVrCleanup(const WebVrCleanupCallback&
cleanupCallback) {
  VLOG(1) << __FUNCTION__;
  if (!vr_device_) {
    cleanupCallback.Run();
    return;
  }

  vr_device_->OnExitWebVR(cleanupCallback);
}

and 

void VRDevice::OnExitWebVR(const OnExitWebVRCallback& callback) {
  for (const auto& display : displays_) {
    display->client()->OnExitWebVR(callback);
    break; // really need only one display for now //??? @revise
  }
}

Thus, destruction of the VrShell will cause async call to content process, that
will reset the surface and then will call the callback that holds a last ref to
the corresponding SurfaceHandle and will destroy it with no errors. A bit too
complicated, would be glad to see a better solution.

Powered by Google App Engine
This is Rietveld 408576698