forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
Showing
13 changed files
with
420 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
39 changes: 39 additions & 0 deletions
39
tools/perf/contrib/vr_benchmarks/desktop_runtimes/base_runtime.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__) |
64 changes: 64 additions & 0 deletions
64
tools/perf/contrib/vr_benchmarks/desktop_runtimes/oculus_runtimes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.""" |
21 changes: 21 additions & 0 deletions
21
tools/perf/contrib/vr_benchmarks/desktop_runtimes/openvr_runtimes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
23
tools/perf/contrib/vr_benchmarks/desktop_runtimes/wmr_runtimes.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
""" |
Oops, something went wrong.