The open source OpenXR runtime
0
fork

Configure Feed

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

ipc: Use the new helper to set device functions

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

authored by

Jakob Bornecrantz and committed by
Marge Bot
95598839 9618af59

+15 -17
+1 -4
src/xrt/ipc/client/ipc_client_device.c
··· 86 86 ipc_client_device_t *icd = U_DEVICE_ALLOCATE(ipc_client_device_t, flags, 0, 0); 87 87 88 88 // Fills in almost everything a regular device needs. 89 - ipc_client_xdev_init(icd, ipc_c, xtrack, device_id); 90 - 91 - // Need to set the destroy function. 92 - icd->base.destroy = ipc_client_device_destroy; 89 + ipc_client_xdev_init(icd, ipc_c, xtrack, device_id, ipc_client_device_destroy); 93 90 94 91 // Setup variable tracker. 95 92 u_var_add_root(icd, icd->base.str, true);
+1 -2
src/xrt/ipc/client/ipc_client_hmd.c
··· 321 321 ipc_client_hmd_t *ich = U_DEVICE_ALLOCATE(ipc_client_hmd_t, flags, 0, 0); 322 322 323 323 // Fills in almost everything a regular device needs. 324 - ipc_client_xdev_init(ich, ipc_c, xtrack, device_id); 324 + ipc_client_xdev_init(ich, ipc_c, xtrack, device_id, ipc_client_hmd_destroy); 325 325 326 326 // Fill in needed HMD functions, and destroy. 327 327 ich->base.get_view_poses = ipc_client_hmd_get_view_poses; 328 328 ich->base.compute_distortion = ipc_client_hmd_compute_distortion; 329 329 ich->base.is_form_factor_available = ipc_client_hmd_is_form_factor_available; 330 330 ich->base.get_visibility_mask = ipc_client_hmd_get_visibility_mask; 331 - ich->base.destroy = ipc_client_hmd_destroy; 332 331 ich->base.get_brightness = ipc_client_hmd_get_brightness; 333 332 ich->base.set_brightness = ipc_client_hmd_set_brightness; 334 333
+8 -10
src/xrt/ipc/client/ipc_client_xdev.c
··· 20 20 #include "util/u_misc.h" 21 21 #include "util/u_debug.h" 22 22 #include "util/u_device.h" 23 - #include "util/u_device_ni.h" 24 23 25 24 #include "client/ipc_client.h" 26 25 #include "client/ipc_client_connection.h" ··· 392 391 ipc_client_xdev_init(struct ipc_client_xdev *icx, 393 392 struct ipc_connection *ipc_c, 394 393 struct xrt_tracking_origin *xtrack, 395 - uint32_t device_id) 394 + uint32_t device_id, 395 + u_device_destroy_function_t destroy_fn) 396 396 { 397 397 // Helpers. 398 398 struct ipc_shared_memory *ism = ipc_c->ism; ··· 401 401 // Important fields. 402 402 icx->ipc_c = ipc_c; 403 403 icx->device_id = device_id; 404 + 405 + /* 406 + * Fill in not implemented or noop versions first, 407 + * destroy gets filled in by either device or HMD. 408 + */ 409 + u_device_populate_function_pointers(&icx->base, ipc_client_xdev_get_tracked_pose, destroy_fn); 404 410 405 411 // Shared implemented functions. 406 412 icx->base.update_inputs = ipc_client_xdev_update_inputs; 407 - icx->base.get_tracked_pose = ipc_client_xdev_get_tracked_pose; 408 413 icx->base.get_hand_tracking = ipc_client_xdev_get_hand_tracking; 409 414 icx->base.get_face_tracking = ipc_client_xdev_get_face_tracking; 410 415 icx->base.get_body_skeleton = ipc_client_xdev_get_body_skeleton; ··· 421 426 icx->base.destroy_plane_detection_ext = ipc_client_xdev_destroy_plane_detection_ext; 422 427 icx->base.get_plane_detection_state_ext = ipc_client_xdev_get_plane_detection_state_ext; 423 428 icx->base.get_plane_detections_ext = ipc_client_xdev_get_plane_detections_ext; 424 - 425 - // Not implemented functions, some get overridden. 426 - icx->base.get_view_poses = u_device_ni_get_view_poses; 427 - icx->base.compute_distortion = u_device_ni_compute_distortion; 428 - icx->base.get_visibility_mask = u_device_ni_get_visibility_mask; 429 - icx->base.is_form_factor_available = u_device_ni_is_form_factor_available; 430 - icx->base.get_battery_status = u_device_ni_get_battery_status; 431 429 432 430 // Copying the information from the isdev. 433 431 icx->base.device_type = isdev->device_type;
+5 -1
src/xrt/ipc/client/ipc_client_xdev.h
··· 13 13 14 14 #pragma once 15 15 16 + #include "util/u_device.h" 17 + 18 + 16 19 #ifdef __cplusplus 17 20 extern "C" { 18 21 #endif ··· 58 61 ipc_client_xdev_init(struct ipc_client_xdev *icx, 59 62 struct ipc_connection *ipc_c, 60 63 struct xrt_tracking_origin *xtrack, 61 - uint32_t device_id); 64 + uint32_t device_id, 65 + u_device_destroy_function_t destroy_fn); 62 66 63 67 /*! 64 68 * Frees any memory that was allocated as part of init and resets some pointers.