···11+# Spaces in Monado design {#design-spaces}
22+33+<!--
44+Copyright 2022-2023, Collabora, Ltd. and the Monado contributors
55+SPDX-License-Identifier: BSL-1.0
66+-->
77+88+## Goals
99+1010+* Hold a super set of the semantic spaces that OpenXR requires, local, stage,
1111+ unbounded, etc...
1212+* Allow devices to be attached to other devices.
1313+* Generating events when a space is moved, dealing with the requirement that
1414+ the move only happens after a certain time in the future.
1515+* Make the internal graph be simple and non-cyclic.
1616+ * No bi-directional links.
1717+ * Always have a root object.
1818+1919+## Overall design
2020+2121+The `xrt_space` object is fairly straight forward, it's a space. Some have
2222+semantic meaning like local, stage, unbounded. The `xrt_space_overseer` object
2323+is where most of the interesting things happens. By having a separate object
2424+where functionality is implemented we can handle things like: different sessions
2525+with different spaces, have a object that space events comes from. It also makes
2626+it easier for the IPC layer to implement it.
2727+2828+## Issues & questions
2929+3030+* Where do space events come from?
3131+ * **UNRESOLVED:** Probably will come from the space overseer.
3232+* Do we map all spaces one to one, like the each `XrSpace` with an offset gets
3333+ backed with a `xrt_space`. There is going to be a limit on spaces from the
3434+ point of view of the IPC layer, do we create some of them locally?
3535+ * **RESOLVED:** While you can create a offset `xrt_space`, the offsets from
3636+ from the `XrSpace`s are not expressed as an `xrt_space` this is to reduce
3737+ the number of spaces created.
3838+* For the IPC gap do we mirror the entire space graph between the app side and
3939+ the service side. Or is it enough to only expose the spaces/nodes a app needs
4040+ and keep all of the links on the service side only.
4141+ * **RESOLVED:** The graph is kept opaque from the application (and all other
4242+ parts of Monado, an space overseer has greater freedom in how to configure
4343+ the space graph).