The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

t/north_star: Add slam device after HMD device.

The HMD display device apparently needs to be the first one in
the xdevs list. Comments in xrt_prober.h seem to confirm this.

Order hmd and slam device acccordingly in the north_star target
builder.

Otherwise XR client calls to xrEndFrame(), at least with projection
layers, will cause monado-service to crash, as it chooses the
"slam device" xdev as "HMD", instead of the actual hmd device,
and therefore dereferences a xdev->hmd which is NULL inside
_update_projection_layer() and thereby segfaults.

gdb backtrace after SIGSEGV:

_update_projection_layer (xc=0x7ffe60000bf0, ics=0x5555560a5208, layer=0x7fff0a5ed620, i=0) at /home/dragon/projects/monado/src/xrt/ipc/server/ipc_server_handler.c:749
749 uint32_t view_count = xdev->hmd->view_count;
(gdb) bt
0 _update_projection_layer (xc=0x7ffe60000bf0, ics=0x5555560a5208, layer=0x7fff0a5ed620, i=0) at /home/dragon/projects/monado/src/xrt/ipc/server/ipc_server_handler.c:749
1 0x00005555555abd30 in _update_layers (ics=0x5555560a5208, xc=0x7ffe60000bf0, slot=0x7fff0a5ed600) at /home/dragon/projects/monado/src/xrt/ipc/server/ipc_server_handler.c:973
2 0x00005555555ac060 in ipc_handle_compositor_layer_sync (ics=0x5555560a5208, slot_id=0, out_free_slot_id=0x7fff0a5ef134, handles=0x7fff0a5ef170, handle_count=0)
at /home/dragon/projects/monado/src/xrt/ipc/server/ipc_server_handler.c:1058
3 0x00005555555a7167 in ipc_dispatch (ics=0x5555560a5208, ipc_command=0x7fff0a5ef840) at /home/dragon/projects/monado/build/src/xrt/ipc/ipc_server_generated.c:518
4 0x00005555555a56cc in client_loop (ics=0x5555560a5208) at /home/dragon/projects/monado/src/xrt/ipc/server/ipc_server_per_client_thread.c:191
5 0x00005555555a593d in ipc_server_client_thread (_ics=0x5555560a5208) at /home/dragon/projects/monado/src/xrt/ipc/server/ipc_server_per_client_thread.c:332

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2228>

authored by

Mario Kleiner and committed by
Marge Bot
e7cbcefa b681a01f

+4 -1
+4 -1
src/xrt/targets/common/target_builder_north_star.c
··· 543 543 struct xrt_device *head_wrap = NULL; 544 544 545 545 if (slam_device != NULL) { 546 - xsysd->xdevs[xsysd->xdev_count++] = slam_device; 547 546 head_wrap = multi_create_tracking_override(XRT_TRACKING_OVERRIDE_DIRECT, ns_hmd, slam_device, 548 547 XRT_INPUT_GENERIC_TRACKER_POSE, &head_offset); 549 548 } else { ··· 555 554 struct xrt_device *left = NULL, *right = NULL; 556 555 struct xrt_device *left_ht = NULL, *right_ht = NULL; 557 556 xsysd->xdevs[xsysd->xdev_count++] = head_wrap; 557 + 558 + // Add slam device after HMD: 559 + if (slam_device != NULL) 560 + xsysd->xdevs[xsysd->xdev_count++] = slam_device; 558 561 559 562 if (hand_device != NULL) { 560 563 // note: hand_parented_to_head_tracker is always false when slam_device is NULL