The open source OpenXR runtime

u/space_overseer: allow single local space

u_space_overseer by default creates a local/local_floor pair for each
application and can't recenter them.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2351>

authored by

Patrick Nicolas and committed by
Marge Bot
8aea7b86 ee2ddead

+26 -4
+5 -1
src/xrt/auxiliary/util/u_builders.c
··· 151 151 struct xrt_device **xdevs, 152 152 uint32_t xdev_count, 153 153 bool root_is_unbounded, 154 + bool per_app_local_spaces, 154 155 struct xrt_space_overseer **out_xso) 155 156 { 156 157 /* ··· 185 186 xdev_count, // xdev_count 186 187 head, // head 187 188 &T_stage_local, // local_offset 188 - root_is_unbounded); // root_is_unbounded 189 + root_is_unbounded, // root_is_unbounded 190 + per_app_local_spaces // per_app_local_spaces 191 + ); 189 192 190 193 *out_xso = (struct xrt_space_overseer *)uso; 191 194 } ··· 248 251 xsysd->xdevs, // xdevs 249 252 xsysd->xdev_count, // xdev_count 250 253 false, // root_is_unbounded 254 + true, // per_app_local_spaces 251 255 out_xso); // out_xso 252 256 253 257 return XRT_SUCCESS;
+1
src/xrt/auxiliary/util/u_builders.h
··· 174 174 struct xrt_device **xdevs, 175 175 uint32_t xdev_count, 176 176 bool root_is_unbounded, 177 + bool per_app_local_spaces, 177 178 struct xrt_space_overseer **out_xso); 178 179 179 180 /*!
+14 -1
src/xrt/auxiliary/util/u_space_overseer.c
··· 113 113 * spaces and that they share the same parent. 114 114 */ 115 115 bool can_do_local_spaces_recenter; 116 + 117 + /*! 118 + * Create independent local and local_floor per application 119 + */ 120 + bool per_app_local_spaces; 116 121 }; 117 122 118 123 ··· 832 837 struct xrt_space **out_local_floor_space) 833 838 { 834 839 assert(xso->semantic.root != NULL); 840 + struct u_space_overseer *uso = u_space_overseer(xso); 841 + if (!uso->per_app_local_spaces) { 842 + xrt_space_reference(out_local_space, xso->semantic.local); 843 + xrt_space_reference(out_local_floor_space, xso->semantic.local_floor); 844 + return XRT_SUCCESS; 845 + } 835 846 836 847 struct xrt_pose identity = XRT_POSE_IDENTITY; 837 848 struct xrt_space_relation xsr = XRT_SPACE_RELATION_ZERO; ··· 1103 1114 uint32_t xdev_count, 1104 1115 struct xrt_device *head, 1105 1116 const struct xrt_pose *local_offset, 1106 - bool root_is_unbounded) 1117 + bool root_is_unbounded, 1118 + bool per_app_local_spaces) 1107 1119 { 1108 1120 struct xrt_space *root = uso->base.semantic.root; // Convenience 1121 + uso->per_app_local_spaces = per_app_local_spaces; 1109 1122 1110 1123 for (uint32_t i = 0; i < xdev_count; i++) { 1111 1124 struct xrt_device *xdev = xdevs[i];
+2 -1
src/xrt/auxiliary/util/u_space_overseer.h
··· 49 49 uint32_t xdev_count, 50 50 struct xrt_device *head, 51 51 const struct xrt_pose *local_offset, 52 - bool root_is_unbounded); 52 + bool root_is_unbounded, 53 + bool per_app_local_spaces); 53 54 54 55 /*! 55 56 * Creates a space without any offset, this is just for optimisation over a
+3 -1
src/xrt/targets/common/target_builder_steamvr.c
··· 167 167 xsysd->xdev_count, // xdev_count 168 168 svrb->head, // head 169 169 &T_stage_local, // local_offset 170 - false); // root_is_unbounded 170 + false, // root_is_unbounded 171 + true // per_app_local_spaces 172 + ); 171 173 172 174 *out_xso = (struct xrt_space_overseer *)uso; 173 175
+1
src/xrt/targets/sdl_test/sdl_instance.c
··· 154 154 sp->xsysd_base.xdevs, // xdevs 155 155 sp->xsysd_base.xdev_count, // xdev_count 156 156 false, // root_is_unbounded 157 + true, // per_app_local_spaces 157 158 &sp->xso); // out_xso 158 159 } 159 160