Skip to content

Commit

Permalink
Support VR perf tests on Windows
Browse files Browse the repository at this point in the history
Adds support for running the existing VR Telemetry benchmarks on
Windows. Currently only supports the Oculus runtime, which requires
special hardware and software to be installed, but additional runtime
support will be added in follow-up CLs.

Bug: 939178
Change-Id: I71056b1da9aa07a374602757f5ddfafcfc972316
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1521797
Reviewed-by: Caleb Rouleau <crouleau@chromium.org>
Reviewed-by: Andrew Grieve <agrieve@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641697}
  • Loading branch information
bsheedy authored and Commit Bot committed Mar 18, 2019
1 parent 30f1e55 commit 3b8ce26
Show file tree
Hide file tree
Showing 13 changed files with 420 additions and 244 deletions.
6 changes: 2 additions & 4 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -757,15 +757,13 @@ group("gn_all") {
"//chrome/browser/vr:vr_common_perftests",
"//chrome/browser/vr:vr_common_unittests",
"//chrome/browser/vr:vr_pixeltests",
"//tools/perf/contrib/vr_benchmarks:vr_perf_tests",
]
if (is_desktop_linux && use_ozone) {
deps += [ "//chrome/browser/vr/testapp:vr_testapp" ]
}
if (is_android) {
deps += [
"//chrome/browser/android/vr:vr_android_unittests",
"//tools/perf/contrib/vr_benchmarks:vr_perf_tests",
]
deps += [ "//chrome/browser/android/vr:vr_android_unittests" ]
}
}

Expand Down
32 changes: 19 additions & 13 deletions tools/perf/contrib/vr_benchmarks/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,47 @@

import("//chrome/browser/vr/features.gni")

assert(is_android)

group("vr_perf_tests") {
testonly = true
data = [
"./data/",
"./desktop_runtimes/",
"./__init__.py",
"./shared_android_vr_page_state.py",
"./shared_vr_page_state.py",
"./vr_benchmarks.py",
"./vr_browsing_mode_pages.py",
"./vr_sample_page.py",
"./vr_story_set.py",
"./webvr_sample_pages.py",
"./webvr_wpr_pages.py",
"./webxr_sample_pages.py",
"//chrome/android/shared_preference_files/test/",
"//third_party/gvr-android-sdk/test-apks/vr_services/vr_services_current.apk",
"//third_party/gvr-android-sdk/test-apks/vr_keyboard/vr_keyboard_current.apk",
"//chrome/test/data/xr/webvr_info/samples/",
"//third_party/webxr_test_pages/webxr-samples",
]
data_deps = [
"//chrome/android:vr_nfc_simulator_apk",
"//testing:run_perf_test",
]

# We'll only ever use the assets if it's a Chrome-branded build. We don't have
# a way of checking whether the files are actually present to copy, but the
# script will deal with that.
if (use_vr_assets_component) {
data_deps += [ ":generate_vr_assets_profile" ]
}
deps = [
"//tools/perf:perf",
]

if (is_android) {
data += [
"//chrome/android/shared_preference_files/test/",
"//third_party/gvr-android-sdk/test-apks/vr_services/vr_services_current.apk",
"//third_party/gvr-android-sdk/test-apks/vr_keyboard/vr_keyboard_current.apk",
]

data_deps += [ "//chrome/android:vr_nfc_simulator_apk" ]

# We'll only ever use the assets if it's a Chrome-branded build. We don't have
# a way of checking whether the files are actually present to copy, but the
# script will deal with that.
if (use_vr_assets_component) {
data_deps += [ ":generate_vr_assets_profile" ]
}
}
}

# Copies files to the gen/ directory and creates a manifest so that the VR
Expand Down
Empty file.
39 changes: 39 additions & 0 deletions tools/perf/contrib/vr_benchmarks/desktop_runtimes/base_runtime.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

class DesktopRuntimeBase(object):
"""Interface for all desktop VR runtimes."""

def __init__(self, finder_options):
self._finder_options = finder_options

def Setup(self):
"""Called once before any stories are run."""
self._finder_options.browser_options.AppendExtraBrowserArgs(
'--enable-features=%s' % self.GetFeatureName())
self._SetupInternal()

def _SetupInternal(self):
raise NotImplementedError(
'No runtime setup defined for %s' % self.__class__.__name__)

def WillRunStory(self):
"""Called before each story is run."""
self._WillRunStoryInternal()

def _WillRunStoryInternal(self):
raise NotImplementedError(
'No runtime pre-story defined for %s' % self.__class__.__name__)

def TearDown(self):
"""Called once after all stories are run."""
self._TearDownInternal()

def _TearDownInternal(self):
raise NotImplementedError(
'No runtime tear down defined for %s' % self.__class__.__name__)

def GetFeatureName(self):
raise NotImplementedError(
'No feature defined for %s' % self.__class__.__name__)
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import logging
import os
import subprocess
from contrib.vr_benchmarks.desktop_runtimes import base_runtime


# pylint: disable=abstract-method
class _BaseOculusRuntime(base_runtime.DesktopRuntimeBase):
"""Base class for all Oculus runtimes."""

def __init__(self, *args, **kwargs):
super(_BaseOculusRuntime, self).__init__(*args, **kwargs)

def GetFeatureName(self):
return 'OculusVR'


class OculusRuntimeReal(_BaseOculusRuntime):
"""Class for using the real Oculus runtime for desktop tests."""

OCULUS_BASE_ENVIRONMENT_VARIABLE = 'OculusBase'

def __init__(self, *args, **kwargs):
super(OculusRuntimeReal, self).__init__(*args, **kwargs)
self._runtime_handle = None

def _SetupInternal(self):
# We need to launch the Oculus client before running any tests to ensure
# that the runtime is ready when we try to enter VR.
self._runtime_handle = subprocess.Popen([self._GetOculusClientPath()])

def _WillRunStoryInternal(self):
if not self._runtime_handle:
raise RuntimeError(
'Somehow called real Oculus pre-story without calling setup')
if self._runtime_handle.poll() != None:
logging.warning(
'Oculus client closed prematurely with code %d, restarting',
self._runtime_handle.returncode)
self._runtime_handle = subprocess.Popen([self._GetOculusClientPath()])

def _TearDownInternal(self):
if not self._runtime_handle:
raise RuntimeError(
'Somehow called real Oculus tear down without calling setup')
if self._runtime_handle.poll() is None:
self._runtime_handle.terminate()

def _GetOculusClientPath(self):
# The install location of the Oculus runtime is set in the OculusBase
# environment variable at install time.
if self.OCULUS_BASE_ENVIRONMENT_VARIABLE not in os.environ:
raise RuntimeError('Failed to find the Oculus install location. Are you '
'sure it\'s installed?')
return os.path.join(os.environ[self.OCULUS_BASE_ENVIRONMENT_VARIABLE],
'Support', 'oculus-client', 'OculusClient.exe')


class OculusRuntimeMock(base_runtime.DesktopRuntimeBase):
"""Class for using a mock Oculus runtime for desktop tests."""
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from contrib.vr_benchmarks.desktop_runtimes import base_runtime


# pylint: disable=abstract-method
class _OpenVRRuntimeBase(base_runtime.DesktopRuntimeBase):
"""Base class for all OpenVR runtimes."""

def GetFeatureName(self):
return 'OpenVR'


class OpenVRRuntimeReal(_OpenVRRuntimeBase):
"""Class for using the real OpenVR runtime for desktop tests."""


class OpenVRRuntimeMock(_OpenVRRuntimeBase):
"""Class for using the mock OpenVR runtime for desktop tests."""
23 changes: 23 additions & 0 deletions tools/perf/contrib/vr_benchmarks/desktop_runtimes/wmr_runtimes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

from contrib.vr_benchmarks.desktop_runtimes import base_runtime


# pylint: disable=abstract-method
class _WMRRuntimeBase(base_runtime.DesktopRuntimeBase):
"""Base class for all WMR runtimes."""

def GetFeatureName(self):
return 'WindowsMixedReality'


class WMRRuntimeReal(_WMRRuntimeBase):
"""Class for using the real Windows Mixed Reality runtime for desktop tests.
"""


class WMRRuntimeMock(_WMRRuntimeBase):
"""Class for using the mock Windows Mixed Reality runtime for desktop tests.
"""
Loading

0 comments on commit 3b8ce26

Please sign in to comment.