2019-03-18 05:50:31 +00:00
|
|
|
# Monado - XR Runtime (XRT)
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-10-30 22:05:10 +00:00
|
|
|
<!--
|
2021-11-03 19:25:33 +00:00
|
|
|
Copyright 2018-2021, Collabora, Ltd.
|
|
|
|
|
2020-10-30 22:05:10 +00:00
|
|
|
SPDX-License-Identifier: CC-BY-4.0
|
|
|
|
|
|
|
|
This must stay in sync with the last section!
|
|
|
|
-->
|
|
|
|
|
2020-12-04 22:19:10 +00:00
|
|
|
> * Main homepage and documentation: <https://monado.freedesktop.org/>
|
2019-08-23 14:21:40 +00:00
|
|
|
> * Promotional homepage: <https://monado.dev>
|
|
|
|
> * Maintained at <https://gitlab.freedesktop.org/monado/monado>
|
|
|
|
> * Latest API documentation: <https://monado.pages.freedesktop.org/monado>
|
2020-12-04 22:24:45 +00:00
|
|
|
> * Continuously-updated changelog of the default branch:
|
2022-08-22 22:14:14 +00:00
|
|
|
> <https://monado.pages.freedesktop.org/monado/_c_h_a_n_g_e_l_o_g.html>
|
2019-08-23 14:21:40 +00:00
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
Monado is an open source XR runtime delivering immersive experiences such as VR
|
2019-10-28 13:35:33 +00:00
|
|
|
and AR on mobile, PC/desktop, and any other device
|
2019-03-18 05:52:32 +00:00
|
|
|
(because gosh darn people
|
|
|
|
come up with a lot of weird hardware).
|
|
|
|
Monado aims to be a complete and conforming implementation
|
|
|
|
of the OpenXR API made by Khronos.
|
2022-05-17 20:30:05 +00:00
|
|
|
The project is primarily developed on GNU/Linux, but also runs on Android and Windows.
|
2019-03-18 05:52:32 +00:00
|
|
|
"Monado" has no specific meaning and is just a name.
|
|
|
|
|
|
|
|
## Monado source tree
|
|
|
|
|
|
|
|
* `src/xrt/include` - headers that define the internal interfaces of Monado.
|
|
|
|
* `src/xrt/compositor` - code for doing distortion and driving the display hardware of a device.
|
2019-06-18 18:05:37 +00:00
|
|
|
* `src/xrt/auxiliary` - utilities and other larger components.
|
2019-03-18 05:52:32 +00:00
|
|
|
* `src/xrt/drivers` - hardware drivers.
|
|
|
|
* `src/xrt/state_trackers/oxr` - OpenXR API implementation.
|
|
|
|
* `src/xrt/targets` - glue code and build logic to produce final binaries.
|
|
|
|
* `src/external` - a small collection of external code and headers.
|
|
|
|
|
|
|
|
## Getting Started
|
|
|
|
|
|
|
|
Dependencies include:
|
|
|
|
|
2022-05-23 15:35:44 +00:00
|
|
|
* [CMake][] 3.13 or newer (Note Ubuntu 18.04 only has 3.10)
|
2022-01-21 16:58:44 +00:00
|
|
|
* Python 3.6 or newer
|
2020-12-06 23:57:01 +00:00
|
|
|
* Vulkan headers and loader - Fedora package `vulkan-loader-devel`
|
2019-08-23 14:21:40 +00:00
|
|
|
* OpenGL headers
|
2023-07-31 21:44:21 +00:00
|
|
|
* Eigen3 - Debian/Ubuntu package `libeigen3-dev`
|
2020-12-06 23:57:01 +00:00
|
|
|
* glslangValidator - Debian/Ubuntu package `glslang-tools`, Fedora package `glslang`.
|
2019-08-23 14:21:40 +00:00
|
|
|
* libusb
|
2023-07-31 21:44:21 +00:00
|
|
|
* libudev - Debian/Ubuntu package `libudev-dev`, Fedora package `systemd-devel`
|
2019-09-26 15:02:16 +00:00
|
|
|
* Video 4 Linux - Debian/Ubuntu package `libv4l-dev`.
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
Optional (but recommended) dependencies:
|
|
|
|
|
|
|
|
* libxcb and xcb-xrandr development packages
|
2019-03-21 12:04:54 +00:00
|
|
|
* [OpenHMD][] 0.3.0 or newer (found using pkg-config)
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2019-08-23 14:21:40 +00:00
|
|
|
Truly optional dependencies, useful for some drivers, app support, etc.:
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2024-01-14 17:58:27 +00:00
|
|
|
* Doxygen - Debian/Ubuntu package `doxygen` and `graphviz`
|
2019-03-18 05:52:32 +00:00
|
|
|
* Wayland development packages
|
2019-08-23 14:21:40 +00:00
|
|
|
* Xlib development packages
|
2024-01-14 17:58:27 +00:00
|
|
|
* libhidapi - Debian/Ubuntu package `libhidapi-dev`
|
2019-08-23 14:21:40 +00:00
|
|
|
* OpenCV
|
2024-01-14 17:58:27 +00:00
|
|
|
* libuvc - Debian/Ubuntu package `libuvc-dev`
|
2019-08-23 14:21:40 +00:00
|
|
|
* libjpeg
|
2024-01-14 17:58:27 +00:00
|
|
|
* libbluetooth - Debian/Ubuntu package `libbluetooth-dev`
|
|
|
|
* libsdl - Debian/Ubuntu package `libsdl2-dev`
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-10-08 22:08:40 +00:00
|
|
|
Experimental Windows support requires the Vulkan SDK and also needs or works
|
|
|
|
best with the following vcpkg packages installed:
|
|
|
|
|
|
|
|
* pthreads eigen3 libusb hidapi zlib doxygen
|
|
|
|
|
2021-06-08 16:58:30 +00:00
|
|
|
If you have a recent [vcpkg](https://vcpkg.io) installed and use the appropriate
|
|
|
|
CMake toolchain file, the vcpkg manifest in the Monado repository will instruct
|
2023-08-02 17:35:57 +00:00
|
|
|
vcpkg to locally install the dependencies automatically. The Vulkan SDK
|
|
|
|
installer should set the `VULKAN_SDK` Windows environment variable to point
|
|
|
|
at the installation location (for example, `C:/VulkanSDK/1.3.250.1`), though
|
|
|
|
make sure you open a new terminal (or open the CMake GUI) *after* doing that
|
|
|
|
install to make sure it is available.
|
2021-06-08 16:58:30 +00:00
|
|
|
|
2023-03-23 23:21:58 +00:00
|
|
|
Monado has been tested on these distributions, but is expected to work on almost
|
|
|
|
any modern distribution.
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2024-05-05 07:29:00 +00:00
|
|
|
* Ubuntu 24.04, 22.04, 20.04, (18.04 may not be fully supported)
|
2023-03-23 23:21:58 +00:00
|
|
|
* Debian 11 `bookworm`, 10 `buster`
|
2019-08-23 14:21:40 +00:00
|
|
|
* Up-to-date package lists can be found in our CI config file,
|
|
|
|
`.gitlab-ci.yml`
|
2020-07-16 13:59:30 +00:00
|
|
|
* Archlinux
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
These distributions include recent-enough versions of all the
|
|
|
|
software to use direct mode,
|
|
|
|
without using any external, third-party, or backported
|
|
|
|
package sources.
|
|
|
|
|
2019-03-27 13:06:08 +00:00
|
|
|
See also [Status of DRM Leases][drm-lease]
|
2019-03-18 05:52:32 +00:00
|
|
|
for more details on specific packages, versions, and commits.
|
|
|
|
|
2020-07-16 13:59:30 +00:00
|
|
|
Due to the lack of a OpenGL extension: GL_EXT_memory_object_fd on Intel's
|
|
|
|
OpenGL driver, only the AMD
|
2019-03-21 12:04:54 +00:00
|
|
|
radeonsi driver and the proprietary NVIDIA driver will work for OpenGL OpenXR
|
|
|
|
clients. This is due to a requirement of the Compositor. Support status of the
|
|
|
|
extension can be found on the [mesamatrix website][mesamatrix-ext].
|
|
|
|
|
2020-07-16 13:59:30 +00:00
|
|
|
### CMake
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
Build process is similar to other CMake builds,
|
|
|
|
so something like the following will build it.
|
|
|
|
|
|
|
|
Go into the source directory, create a build directory,
|
|
|
|
and change into it.
|
|
|
|
|
2019-03-27 13:07:18 +00:00
|
|
|
```bash
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
```
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
Then, invoke [CMake to generate a project][cmake-generate].
|
|
|
|
Feel free to change the build type or generator ("Ninja" is fast and parallel) as you see fit.
|
|
|
|
|
2019-03-27 13:07:18 +00:00
|
|
|
```bash
|
|
|
|
cmake .. -DCMAKE_BUILD_TYPE=Debug -G "Unix Makefiles"
|
|
|
|
```
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
If you plan to install the runtime,
|
|
|
|
append something like `-DCMAKE_INSTALL_PREFIX=~/.local`
|
|
|
|
to specify the root of the install directory.
|
|
|
|
(The default install prefix is `/usr/local`.)
|
|
|
|
|
|
|
|
To build, [the generic CMake build commands][cmake-build] below will work on all systems,
|
|
|
|
though you can manually invoke your build tool (`make`, `ninja`, etc.) if you prefer.
|
|
|
|
The first command builds the runtime and docs,
|
|
|
|
and the second, which is optional, installs the runtime under `${CMAKE_INSTALL_PREFIX}`.
|
|
|
|
|
2019-03-27 13:07:18 +00:00
|
|
|
```bash
|
|
|
|
cmake --build .
|
|
|
|
cmake --build . --target install
|
|
|
|
```
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
Alternately, if using Make, the following will build the runtime and docs, then install.
|
|
|
|
Replace `make` with `ninja` if you used the Ninja generator.
|
|
|
|
|
2019-03-27 13:07:18 +00:00
|
|
|
```bash
|
|
|
|
make
|
|
|
|
make install
|
|
|
|
```
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2019-03-18 05:39:34 +00:00
|
|
|
Documentation can be browsed by opening `doc/html/index.html` in the build directory in a web browser.
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
## Getting started using OpenXR with Monado
|
|
|
|
|
2019-03-27 13:06:08 +00:00
|
|
|
This implements the [OpenXR][] API,
|
2019-03-18 05:52:32 +00:00
|
|
|
so to do anything with it, you'll need an application
|
|
|
|
that uses OpenXR, along with the OpenXR loader.
|
|
|
|
The OpenXR loader is a glue library that connects OpenXR applications to OpenXR runtimes such as Monado
|
2020-07-16 13:59:30 +00:00
|
|
|
It determines which runtime to use by looking for the config file `active_runtime.json` (either a symlink to
|
|
|
|
or a copy of a runtime manifest) in the usual XDG config paths
|
2019-03-18 05:52:32 +00:00
|
|
|
and processes environment variables such as `XR_RUNTIME_JSON=/usr/share/openxr/0/openxr_monado.json`.
|
|
|
|
It can also insert OpenXR API Layers without the application or the runtime having to do it.
|
|
|
|
|
2020-07-16 13:59:30 +00:00
|
|
|
You can use the `hello_xr` sample provided with the OpenXR SDK.
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
The OpenXR loader can be pointed to a runtime json file in a nonstandard location with the environment variable `XR_RUNTIME_JSON`. Example:
|
|
|
|
|
2019-03-27 13:07:18 +00:00
|
|
|
```bash
|
|
|
|
XR_RUNTIME_JSON=~/monado/build/openxr_monado-dev.json ./openxr-example
|
|
|
|
```
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-07-16 13:59:30 +00:00
|
|
|
For ease of development Monado creates a runtime manifest file in its build directory using an absolute path to the
|
|
|
|
Monado runtime in the build directory called `openxr_monado-dev.json`. Pointing `XR_RUNTIME_JSON` to this
|
|
|
|
file allows using Monado after building, without installing.
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
Note that the loader can always find and load the runtime
|
|
|
|
if the path to the runtime library given in the json manifest is an absolute path,
|
|
|
|
but if a relative path like `libopenxr_monado.so.0` is given,
|
|
|
|
then `LD_LIBRARY_PATH` must include the directory that contains `libopenxr_monado.so.0`.
|
2020-07-16 13:59:30 +00:00
|
|
|
The absolute path in `openxr_monado-dev.json` takes care of this for you.
|
|
|
|
|
|
|
|
Distribution packages for monado may provide the "active runtime" file `/etc/xdg/openxr/1/active_runtime.json`.
|
|
|
|
In this case the loader will automatically use Monado when starting an OpenXR application. This global configuration
|
|
|
|
can be overridden on a per user basis by creating `~/.config/openxr/1/active_runtime.json`.
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
## Direct mode
|
|
|
|
|
2020-07-16 13:59:30 +00:00
|
|
|
On AMD and Intel GPUs our direct mode code requires a connected HMD to have
|
|
|
|
the `non-desktop` xrandr property set to 1.
|
2019-03-18 05:52:32 +00:00
|
|
|
Only the most common HMDs have the needed quirks added to the linux kernel.
|
|
|
|
|
|
|
|
If you know that your HMD lacks the quirk you can run this command **before** or
|
|
|
|
after connecting the HMD and it will have it. Where `HDMI-A-0` is the xrandr
|
|
|
|
output name where you plug the HMD in.
|
|
|
|
|
|
|
|
```bash
|
|
|
|
xrandr --output HDMI-A-0 --prop --set non-desktop 1
|
|
|
|
```
|
|
|
|
|
|
|
|
You can verify that it stuck with the command.
|
|
|
|
|
|
|
|
```bash
|
2019-04-13 22:57:53 +00:00
|
|
|
xrandr --prop
|
2019-03-18 05:52:32 +00:00
|
|
|
```
|
|
|
|
|
2020-06-03 07:53:40 +00:00
|
|
|
## Running Vulkan Validation
|
|
|
|
|
|
|
|
To run Monado with Vulkan validation the loader's layer functionality can be used.
|
|
|
|
```
|
|
|
|
VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ./build/src/xrt/targets/service/monado-service
|
|
|
|
```
|
|
|
|
The same can be done when launching a Vulkan client.
|
|
|
|
|
|
|
|
If you want a backtrace to be produced at validation errors, create a `vk_layer_settings.txt`
|
|
|
|
file with the following content:
|
|
|
|
```
|
|
|
|
khronos_validation.debug_action = VK_DBG_LAYER_ACTION_LOG_MSG,VK_DBG_LAYER_ACTION_BREAK
|
|
|
|
khronos_validation.report_flags = error,warn
|
|
|
|
khronos_validation.log_filename = stdout
|
|
|
|
```
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
## Coding style and formatting
|
|
|
|
|
|
|
|
[clang-format][] is used,
|
|
|
|
and a `.clang-format` config file is present in the repo
|
|
|
|
to allow your editor to use them.
|
|
|
|
|
|
|
|
To manually apply clang-format to every non-external source file in the tree,
|
|
|
|
run this command in the source dir with a `sh`-compatible shell
|
|
|
|
(Git for Windows git-bash should be OK):
|
|
|
|
|
2019-03-27 13:07:18 +00:00
|
|
|
```bash
|
|
|
|
scripts/format-project.sh
|
|
|
|
```
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
You can optionally put something like `CLANG_FORMAT=clang-format-7` before that command
|
|
|
|
if your clang-format binary isn't named `clang-format`.
|
2021-02-11 15:45:58 +00:00
|
|
|
**Note that you'll typically prefer** to use something like `git clang-format`
|
2022-05-17 20:30:05 +00:00
|
|
|
to re-format only your changes, in case version differences in tools result in overall format changes.
|
|
|
|
The CI "style" job currently runs on Debian Bullseye, so it has clang-format-11.
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2020-02-24 08:44:57 +00:00
|
|
|
[OpenHMD]: http://openhmd.net
|
2019-04-01 15:10:02 +00:00
|
|
|
[drm-lease]: https://haagch.frickel.club/#!drmlease%2Emd
|
2019-03-27 13:06:08 +00:00
|
|
|
[OpenXR]: https://khronos.org/openxr
|
2019-03-18 05:52:32 +00:00
|
|
|
[clang-format]: https://releases.llvm.org/7.0.0/tools/clang/docs/ClangFormat.html
|
|
|
|
[cmake-build]: https://cmake.org/cmake/help/v3.12/manual/cmake.1.html#build-tool-mode
|
|
|
|
[cmake-generate]: https://cmake.org/cmake/help/v3.12/manual/cmake.1.html
|
|
|
|
[CMake]: https://cmake.org
|
2019-03-21 12:04:54 +00:00
|
|
|
[mesamatrix-ext]: https://mesamatrix.net/#Version_ExtensionsthatarenotpartofanyOpenGLorOpenGLESversion
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
## Contributing, Code of Conduct
|
|
|
|
|
2020-12-04 22:19:10 +00:00
|
|
|
See `CONTRIBUTING.md` for details of contribution guidelines. GitLab Issues and
|
2023-04-03 08:22:50 +00:00
|
|
|
Merge Requests are the preferred way to discuss problems, suggest enhancements,
|
2020-12-04 22:30:25 +00:00
|
|
|
or submit changes for review. **In case of a security issue**, you should choose
|
|
|
|
the "confidential" option when using the GitLab issues page. For highest
|
2023-11-15 17:09:51 +00:00
|
|
|
security, you can send encrypted email (using GPG/OpenPGP) to Rylie Pavlik at
|
|
|
|
<rylie.pavlik@collabora.com> and using the associated key from
|
|
|
|
<https://keys.openpgp.org/vks/v1/by-fingerprint/45207B2B1E53E1F2755FF63CC5A2D593A61DBC9D>.
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
Please note that this project is released with a Contributor Code of Conduct.
|
|
|
|
By participating in this project you agree to abide by its terms.
|
|
|
|
|
|
|
|
We follow the standard freedesktop.org code of conduct,
|
|
|
|
available at <https://www.freedesktop.org/wiki/CodeOfConduct/>,
|
|
|
|
which is based on the [Contributor Covenant](https://www.contributor-covenant.org).
|
|
|
|
|
|
|
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
|
|
reported by contacting:
|
|
|
|
|
|
|
|
* First-line project contacts:
|
|
|
|
* Jakob Bornecrantz <jakob@collabora.com>
|
2023-11-15 17:09:51 +00:00
|
|
|
* Rylie Pavlik <rylie.pavlik@collabora.com>
|
2019-03-18 05:52:32 +00:00
|
|
|
* freedesktop.org contacts: see most recent list at <https://www.freedesktop.org/wiki/CodeOfConduct/>
|
|
|
|
|
2021-11-03 19:25:33 +00:00
|
|
|
Code of Conduct section excerpt adapted from the
|
|
|
|
[Contributor Covenant](https://www.contributor-covenant.org), version 1.4.1,
|
|
|
|
available at
|
|
|
|
<https://www.contributor-covenant.org/version/1/4/code-of-conduct.html>, and
|
|
|
|
from the freedesktop.org-specific version of that code, available at
|
|
|
|
<https://www.freedesktop.org/wiki/CodeOfConduct/>, used under CC-BY-4.0.
|