Commit b2a17033 authored by Bill Orr's avatar Bill Orr Committed by Commit Bot

Create a mock implementation of the OpenVR API

This change supports testing of Chrome on bots where we don't want to
install or use real OpenVR/SteamVR, in order to catch regressions in
Chrome.

This change also fixes a few issues found in preliminary tests.

BUG=780668

Change-Id: I885762e18b48961038454856743f9e7ae621001e
Reviewed-on: https://chromium-review.googlesource.com/795056
Commit-Queue: Bill Orr <billorr@chromium.org>
Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#523323}
parent 269a3a39
...@@ -70,9 +70,7 @@ if (enable_vr) { ...@@ -70,9 +70,7 @@ if (enable_vr) {
"//third_party/WebKit/public:blink_headers", "//third_party/WebKit/public:blink_headers",
] ]
ldflags = [ "-landroid" ] ldflags = [ "-landroid" ]
libs = [ libs = [ "//third_party/gvr-android-sdk/libgvr_shim_static_${current_cpu}.a" ]
"//third_party/gvr-android-sdk/libgvr_shim_static_${current_cpu}.a",
]
configs += [ "//third_party/gvr-android-sdk:libgvr_config" ] configs += [ "//third_party/gvr-android-sdk:libgvr_config" ]
} }
...@@ -153,6 +151,28 @@ if (enable_vr) { ...@@ -153,6 +151,28 @@ if (enable_vr) {
} }
} }
if (enable_openvr) {
shared_library("openvr_mock") {
output_name = "mock_vr_clients/bin/vrclient"
if (target_cpu == "x64" && is_win) {
output_name = "mock_vr_clients/bin/vrclient_x64"
}
sources = [
"openvr/test/fake_openvr_impl_api.cc",
]
libs = [
"d3d11.lib",
"DXGI.lib",
]
deps = [
"//base",
]
}
}
if (enable_gvr_services) { if (enable_gvr_services) {
java_sources_needing_jni = java_sources_needing_jni =
[ "android/java/src/org/chromium/device/vr/NonPresentingGvrContext.java" ] [ "android/java/src/org/chromium/device/vr/NonPresentingGvrContext.java" ]
......
...@@ -16,6 +16,10 @@ OpenVRDeviceProvider::OpenVRDeviceProvider() = default; ...@@ -16,6 +16,10 @@ OpenVRDeviceProvider::OpenVRDeviceProvider() = default;
OpenVRDeviceProvider::~OpenVRDeviceProvider() { OpenVRDeviceProvider::~OpenVRDeviceProvider() {
device::GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory( device::GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory(
device::GAMEPAD_SOURCE_OPENVR); device::GAMEPAD_SOURCE_OPENVR);
// We must set device_ to null before calling VR_Shutdown, because VR_Shutdown
// will unload OpenVR's dll, and device_ (or its render loop) are potentially
// still using it.
device_ = nullptr;
vr::VR_Shutdown(); vr::VR_Shutdown();
} }
......
include_rules = [
"+third_party/openvr/src",
]
This diff is collapsed.
...@@ -30,7 +30,6 @@ bool D3D11TextureHelper::CopyTextureToBackBuffer(bool flipY) { ...@@ -30,7 +30,6 @@ bool D3D11TextureHelper::CopyTextureToBackBuffer(bool flipY) {
return false; return false;
HRESULT hr = render_state_.keyed_mutex_->AcquireSync(1, kAcquireWaitMS); HRESULT hr = render_state_.keyed_mutex_->AcquireSync(1, kAcquireWaitMS);
DCHECK(SUCCEEDED(hr) && hr != WAIT_TIMEOUT && hr != WAIT_ABANDONED);
if (FAILED(hr) || hr == WAIT_TIMEOUT || hr == WAIT_ABANDONED) { if (FAILED(hr) || hr == WAIT_TIMEOUT || hr == WAIT_ABANDONED) {
// We failed to acquire the lock. We'll drop this frame, but subsequent // We failed to acquire the lock. We'll drop this frame, but subsequent
// frames won't be affected. // frames won't be affected.
......
...@@ -737,12 +737,19 @@ void VRDisplay::submitFrame() { ...@@ -737,12 +737,19 @@ void VRDisplay::submitFrame() {
client->DrawingBufferClientRestoreFramebufferBinding(); client->DrawingBufferClientRestoreFramebufferBinding();
client->DrawingBufferClientRestoreRenderbufferBinding(); client->DrawingBufferClientRestoreRenderbufferBinding();
// We decompose the cloned handle, and use it to create a mojo::ScopedHandle // We can fail to obtain a GpuMemoryBuffer if we don't have GPU support, or
// which will own cleanup of the handle, and will be passed over IPC. // for some out-of-memory situations.
// TODO(billorr): Consider whether we should just drop the frame or exit
// presentation.
if (gpu_memory_buffer) {
// We decompose the cloned handle, and use it to create a
// mojo::ScopedHandle which will own cleanup of the handle, and will be
// passed over IPC.
gfx::GpuMemoryBufferHandle gpu_handle = gfx::GpuMemoryBufferHandle gpu_handle =
CloneHandleForIPC(gpu_memory_buffer->GetHandle()); CloneHandleForIPC(gpu_memory_buffer->GetHandle());
vr_presentation_provider_->SubmitFrameWithTextureHandle( vr_presentation_provider_->SubmitFrameWithTextureHandle(
vr_frame_id_, mojo::WrapPlatformFile(gpu_handle.handle.GetHandle())); vr_frame_id_, mojo::WrapPlatformFile(gpu_handle.handle.GetHandle()));
}
#else #else
NOTIMPLEMENTED(); NOTIMPLEMENTED();
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment