ipc: Implement xrt_device::compute_distortion

This commit is contained in:
Jakob Bornecrantz 2023-03-09 15:51:25 +00:00
parent d601f893da
commit bff220b6f8
3 changed files with 56 additions and 0 deletions

View file

@ -135,6 +135,29 @@ ipc_client_hmd_get_view_poses(struct xrt_device *xdev,
}
}
static bool
ipc_client_hmd_compute_distortion(
struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result)
{
ipc_client_hmd_t *ich = ipc_client_hmd(xdev);
bool ret;
xrt_result_t xret = ipc_call_device_compute_distortion( //
ich->ipc_c, //
ich->device_id, //
view, //
u, //
v, //
&ret, //
out_result); //
if (xret != XRT_SUCCESS) {
IPC_ERROR(ich->ipc_c, "Error calling compute distortion!");
return false;
}
return ret;
}
static bool
ipc_client_hmd_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor)
{
@ -165,6 +188,7 @@ ipc_client_hmd_create(struct ipc_connection *ipc_c, struct xrt_tracking_origin *
ich->base.update_inputs = ipc_client_hmd_update_inputs;
ich->base.get_tracked_pose = ipc_client_hmd_get_tracked_pose;
ich->base.get_view_poses = ipc_client_hmd_get_view_poses;
ich->base.compute_distortion = ipc_client_hmd_compute_distortion;
ich->base.destroy = ipc_client_hmd_destroy;
ich->base.is_form_factor_available = ipc_client_hmd_is_form_factor_available;

View file

@ -1140,6 +1140,25 @@ ipc_handle_device_get_view_poses_2(volatile struct ipc_client_state *ics,
return XRT_SUCCESS;
}
xrt_result_t
ipc_handle_device_compute_distortion(volatile struct ipc_client_state *ics,
uint32_t id,
uint32_t view,
float u,
float v,
bool *out_ret,
struct xrt_uv_triplet *out_triplet)
{
// To make the code a bit more readable.
uint32_t device_id = id;
struct xrt_device *xdev = get_xdev(ics, device_id);
bool ret = xrt_device_compute_distortion(xdev, view, u, v, out_triplet);
*out_ret = ret;
return XRT_SUCCESS;
}
xrt_result_t
ipc_handle_device_set_output(volatile struct ipc_client_state *ics,
uint32_t id,

View file

@ -246,6 +246,19 @@
]
},
"device_compute_distortion": {
"in": [
{"name": "id", "type": "uint32_t"},
{"name": "view", "type": "uint32_t"},
{"name": "u", "type": "float"},
{"name": "v", "type": "float"}
],
"out": [
{"name": "ret", "type": "bool"},
{"name": "triplet", "type": "struct xrt_uv_triplet"}
]
},
"device_set_output": {
"in": [
{"name": "id", "type": "uint32_t"},