···28282929Dependencies include:
30303131-* [CMake][] 3.13 or newer (Note Ubuntu 18.04 only has 3.10)
3131+* [CMake][] 3.13 or newer (Note Ubuntu 18.04 only has 3.10) or meson >= 0.49
3232* Vulkan headers
3333* OpenGL headers
3434* Eigen3
···6060* Debian 10 `buster`
6161 * Up-to-date package lists can be found in our CI config file,
6262 `.gitlab-ci.yml`
6363+* Archlinux
63646465These distributions include recent-enough versions of all the
6566software to use direct mode,
···6970See also [Status of DRM Leases][drm-lease]
7071for more details on specific packages, versions, and commits.
71727272-Due to the lack of a OpenGL extension: GL_EXT_memory_object_fd, only the AMD
7373+Due to the lack of a OpenGL extension: GL_EXT_memory_object_fd on Intel's
7474+OpenGL driver, only the AMD
7375radeonsi driver and the proprietary NVIDIA driver will work for OpenGL OpenXR
7476clients. This is due to a requirement of the Compositor. Support status of the
7577extension can be found on the [mesamatrix website][mesamatrix-ext].
76787979+### CMake
8080+7781Build process is similar to other CMake builds,
7882so something like the following will build it.
7983···117121118122Documentation can be browsed by opening `doc/html/index.html` in the build directory in a web browser.
119123124124+### Meson
125125+126126+The build process is similar to other Meson builds.
127127+For a system wide installation requiring root privileges:
128128+129129+```bash
130130+meson --prefix=/usr build
131131+ninja -C build install
132132+```
133133+134134+For a local installation in ~/.local:
135135+136136+```bash
137137+meson --prefix=~/.local -Dinstall-active-runtime=false build
138138+ninja -C build install
139139+```
140140+141141+Note that the installation of the `active_runtime.json` file should be disabled for installations without
142142+root privileges because this file is always installed in meson's syconfdir (usually /etc).
143143+120144## Getting started using OpenXR with Monado
121145122146This implements the [OpenXR][] API,
123147so to do anything with it, you'll need an application
124148that uses OpenXR, along with the OpenXR loader.
125149The OpenXR loader is a glue library that connects OpenXR applications to OpenXR runtimes such as Monado
126126-It determines which runtime to use by reading config file default `/usr/local/share/openxr/0/active_runtime.json`
150150+It determines which runtime to use by looking for the config file `active_runtime.json` (either a symlink to
151151+or a copy of a runtime manifest) in the usual XDG config paths
127152and processes environment variables such as `XR_RUNTIME_JSON=/usr/share/openxr/0/openxr_monado.json`.
128153It can also insert OpenXR API Layers without the application or the runtime having to do it.
129154130130-You can use the `hello_xr` sample provided with the
131131-OpenXR loader and API layers.
155155+You can use the `hello_xr` sample provided with the OpenXR SDK.
132156133157The OpenXR loader can be pointed to a runtime json file in a nonstandard location with the environment variable `XR_RUNTIME_JSON`. Example:
134158···136160XR_RUNTIME_JSON=~/monado/build/openxr_monado-dev.json ./openxr-example
137161```
138162139139-For this reason this runtime creates two manifest files within the build directory:
140140-141141-* `openxr_monado.json` uses a relative path to the runtime, and is intended to be installed with `make install`.
142142-* `openxr_monado_dev.json` uses an absolute path to the runtime in its build directory,
143143- and is intended to be used for development without installing the runtime.
144144-145145-If Monado has been installed through a distribution package
146146-and provides the "active runtime" file /usr/local/share/openxr/0/active_runtime.json,
147147-then the loader will automatically use Monado when starting any OpenXR application.
148148-149149-If Monado has been compiled in a custom directory like ~/monado/build,
150150-the OpenXR loader can be pointed to the runtime when starting an OpenXR application
151151-by setting the environment variable XR_RUNTIME_JSON to the `openxr_monado_dev.json` manifest
152152-that was generated by the build: see above.
163163+For ease of development Monado creates a runtime manifest file in its build directory using an absolute path to the
164164+Monado runtime in the build directory called `openxr_monado-dev.json`. Pointing `XR_RUNTIME_JSON` to this
165165+file allows using Monado after building, without installing.
153166154167Note that the loader can always find and load the runtime
155168if the path to the runtime library given in the json manifest is an absolute path,
156169but if a relative path like `libopenxr_monado.so.0` is given,
157170then `LD_LIBRARY_PATH` must include the directory that contains `libopenxr_monado.so.0`.
158158-The absolute path in `openxr_monado_dev.json` takes care of this for you.
171171+The absolute path in `openxr_monado-dev.json` takes care of this for you.
172172+173173+Distribution packages for monado may provide the "active runtime" file `/etc/xdg/openxr/1/active_runtime.json`.
174174+In this case the loader will automatically use Monado when starting an OpenXR application. This global configuration
175175+can be overridden on a per user basis by creating `~/.config/openxr/1/active_runtime.json`.
159176160177## Direct mode
161178162162-Our direct mode code requires a connected HMD to have the `non-desktop` xrandr
163163-property set to 1.
179179+On AMD and Intel GPUs our direct mode code requires a connected HMD to have
180180+the `non-desktop` xrandr property set to 1.
164181Only the most common HMDs have the needed quirks added to the linux kernel.
165165-Just keep on reading for more info on how to work around that.
166182167183If you know that your HMD lacks the quirk you can run this command **before** or
168184after connecting the HMD and it will have it. Where `HDMI-A-0` is the xrandr
···192208khronos_validation.debug_action = VK_DBG_LAYER_ACTION_LOG_MSG,VK_DBG_LAYER_ACTION_BREAK
193209khronos_validation.report_flags = error,warn
194210khronos_validation.log_filename = stdout
195195-```
196196-197197-## Using libsurvive
198198-199199-To enable the libsurvive driver, libsurvive has to be installed as a library with a pkgconfig file
200200-(https://github.com/cntools/libsurvive/pull/187).
201201-202202-When starting any libsrvive or OpenXR application, libsurvive will run calibration and save
203203-configuration and calibration data in the current working directory.
204204-205205-Make sure the HMD can see both basestations and is not moved during calibration.
206206-207207-To remove libsurvive's calibration data (e.g. to force recalibration) delete the following
208208-files/directories:
209209-210210- rm -r *config.json calinfo
211211-212212-Though working and somewhat usable, support for the libsurvive driver is **experimental**.
213213-Therefore with both meson and cmake, the survive driver has to be explicitly enabled with
214214-215215-```
216216-#cmake
217217--DBUILD_WITH_LIBSURVIVE=On
218218-219219-#meson
220220--Ddrivers=auto,survive
221211```
222212223213## Coding style and formatting