mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
ipc: Use check helpers in other client code as well
This commit is contained in:
parent
bfaf615d4f
commit
83b77285bd
|
@ -77,10 +77,8 @@ ipc_client_device_update_inputs(struct xrt_device *xdev)
|
|||
{
|
||||
ipc_client_device_t *icd = ipc_client_device(xdev);
|
||||
|
||||
xrt_result_t r = ipc_call_device_update_input(icd->ipc_c, icd->device_id);
|
||||
if (r != XRT_SUCCESS) {
|
||||
IPC_ERROR(icd->ipc_c, "Error sending input update!");
|
||||
}
|
||||
xrt_result_t xret = ipc_call_device_update_input(icd->ipc_c, icd->device_id);
|
||||
IPC_CHK_ONLY_PRINT(icd->ipc_c, xret, "ipc_call_device_update_input");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -91,14 +89,16 @@ ipc_client_device_get_tracked_pose(struct xrt_device *xdev,
|
|||
{
|
||||
ipc_client_device_t *icd = ipc_client_device(xdev);
|
||||
|
||||
xrt_result_t r =
|
||||
ipc_call_device_get_tracked_pose(icd->ipc_c, icd->device_id, name, at_timestamp_ns, out_relation);
|
||||
if (r != XRT_SUCCESS) {
|
||||
IPC_ERROR(icd->ipc_c, "Error sending input update!");
|
||||
}
|
||||
xrt_result_t xret = ipc_call_device_get_tracked_pose( //
|
||||
icd->ipc_c, //
|
||||
icd->device_id, //
|
||||
name, //
|
||||
at_timestamp_ns, //
|
||||
out_relation); //
|
||||
IPC_CHK_ONLY_PRINT(icd->ipc_c, xret, "ipc_call_device_get_tracked_pose");
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
ipc_client_device_get_hand_tracking(struct xrt_device *xdev,
|
||||
enum xrt_input_name name,
|
||||
uint64_t at_timestamp_ns,
|
||||
|
@ -107,11 +107,14 @@ ipc_client_device_get_hand_tracking(struct xrt_device *xdev,
|
|||
{
|
||||
ipc_client_device_t *icd = ipc_client_device(xdev);
|
||||
|
||||
xrt_result_t r = ipc_call_device_get_hand_tracking(icd->ipc_c, icd->device_id, name, at_timestamp_ns, out_value,
|
||||
out_timestamp_ns);
|
||||
if (r != XRT_SUCCESS) {
|
||||
IPC_ERROR(icd->ipc_c, "Error sending input update!");
|
||||
}
|
||||
xrt_result_t xret = ipc_call_device_get_hand_tracking( //
|
||||
icd->ipc_c, //
|
||||
icd->device_id, //
|
||||
name, //
|
||||
at_timestamp_ns, //
|
||||
out_value, //
|
||||
out_timestamp_ns); //
|
||||
IPC_CHK_ONLY_PRINT(icd->ipc_c, xret, "ipc_call_device_get_hand_tracking");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -132,10 +135,8 @@ ipc_client_device_set_output(struct xrt_device *xdev, enum xrt_output_name name,
|
|||
{
|
||||
ipc_client_device_t *icd = ipc_client_device(xdev);
|
||||
|
||||
xrt_result_t r = ipc_call_device_set_output(icd->ipc_c, icd->device_id, name, value);
|
||||
if (r != XRT_SUCCESS) {
|
||||
IPC_ERROR(icd->ipc_c, "Error sending set output!");
|
||||
}
|
||||
xrt_result_t xret = ipc_call_device_set_output(icd->ipc_c, icd->device_id, name, value);
|
||||
IPC_CHK_ONLY_PRINT(icd->ipc_c, xret, "ipc_call_device_set_output");
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -69,7 +69,7 @@ call_get_view_poses_raw(ipc_client_hmd_t *ich,
|
|||
struct xrt_pose *out_poses)
|
||||
{
|
||||
struct ipc_connection *ipc_c = ich->ipc_c;
|
||||
xrt_result_t xret = XRT_SUCCESS;
|
||||
xrt_result_t xret;
|
||||
|
||||
ipc_client_connection_lock(ipc_c);
|
||||
|
||||
|
@ -80,9 +80,7 @@ call_get_view_poses_raw(ipc_client_hmd_t *ich,
|
|||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
view_count); //
|
||||
if (xret != XRT_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
IPC_CHK_WITH_GOTO(ich->ipc_c, xret, "ipc_send_device_get_view_poses_locked", out);
|
||||
|
||||
// This is the data we get back in the provided reply.
|
||||
uint32_t returned_view_count = 0;
|
||||
|
@ -93,9 +91,7 @@ call_get_view_poses_raw(ipc_client_hmd_t *ich,
|
|||
ipc_c, //
|
||||
&head_relation, //
|
||||
&returned_view_count); //
|
||||
if (xret != XRT_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
IPC_CHK_WITH_GOTO(ich->ipc_c, xret, "ipc_receive_device_get_view_poses_locked", out);
|
||||
|
||||
if (view_count != returned_view_count) {
|
||||
IPC_ERROR(ich->ipc_c, "Wrong view counts (sent: %u != got: %u)", view_count, returned_view_count);
|
||||
|
@ -104,15 +100,11 @@ call_get_view_poses_raw(ipc_client_hmd_t *ich,
|
|||
|
||||
// We can read directly to the output variables.
|
||||
xret = ipc_receive(&ipc_c->imc, out_fovs, sizeof(struct xrt_fov) * view_count);
|
||||
if (xret != XRT_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
IPC_CHK_WITH_GOTO(ich->ipc_c, xret, "ipc_receive(1)", out);
|
||||
|
||||
// We can read directly to the output variables.
|
||||
xret = ipc_receive(&ipc_c->imc, out_poses, sizeof(struct xrt_pose) * view_count);
|
||||
if (xret != XRT_SUCCESS) {
|
||||
goto out;
|
||||
}
|
||||
IPC_CHK_WITH_GOTO(ich->ipc_c, xret, "ipc_receive(2)", out);
|
||||
|
||||
/*
|
||||
* Finally set the head_relation that we got in the reply, mostly to
|
||||
|
@ -152,10 +144,8 @@ ipc_client_hmd_update_inputs(struct xrt_device *xdev)
|
|||
{
|
||||
ipc_client_hmd_t *ich = ipc_client_hmd(xdev);
|
||||
|
||||
xrt_result_t r = ipc_call_device_update_input(ich->ipc_c, ich->device_id);
|
||||
if (r != XRT_SUCCESS) {
|
||||
IPC_ERROR(ich->ipc_c, "Error calling input update!");
|
||||
}
|
||||
xrt_result_t xret = ipc_call_device_update_input(ich->ipc_c, ich->device_id);
|
||||
IPC_CHK_ONLY_PRINT(ich->ipc_c, xret, "ipc_call_device_update_input");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -165,12 +155,15 @@ ipc_client_hmd_get_tracked_pose(struct xrt_device *xdev,
|
|||
struct xrt_space_relation *out_relation)
|
||||
{
|
||||
ipc_client_hmd_t *ich = ipc_client_hmd(xdev);
|
||||
xrt_result_t xret;
|
||||
|
||||
xrt_result_t r =
|
||||
ipc_call_device_get_tracked_pose(ich->ipc_c, ich->device_id, name, at_timestamp_ns, out_relation);
|
||||
if (r != XRT_SUCCESS) {
|
||||
IPC_ERROR(ich->ipc_c, "Error calling tracked pose!");
|
||||
}
|
||||
xret = ipc_call_device_get_tracked_pose( //
|
||||
ich->ipc_c, //
|
||||
ich->device_id, //
|
||||
name, //
|
||||
at_timestamp_ns, //
|
||||
out_relation); //
|
||||
IPC_CHK_ONLY_PRINT(ich->ipc_c, xret, "ipc_call_device_get_tracked_pose");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -183,20 +176,19 @@ ipc_client_hmd_get_view_poses(struct xrt_device *xdev,
|
|||
struct xrt_pose *out_poses)
|
||||
{
|
||||
ipc_client_hmd_t *ich = ipc_client_hmd(xdev);
|
||||
xrt_result_t xret;
|
||||
|
||||
struct ipc_info_get_view_poses_2 info = {0};
|
||||
|
||||
if (view_count == 2) {
|
||||
// Fast path.
|
||||
xrt_result_t r = ipc_call_device_get_view_poses_2( //
|
||||
ich->ipc_c, //
|
||||
ich->device_id, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
&info); //
|
||||
if (r != XRT_SUCCESS) {
|
||||
IPC_ERROR(ich->ipc_c, "Error calling view poses!");
|
||||
}
|
||||
xret = ipc_call_device_get_view_poses_2( //
|
||||
ich->ipc_c, //
|
||||
ich->device_id, //
|
||||
default_eye_relation, //
|
||||
at_timestamp_ns, //
|
||||
&info); //
|
||||
IPC_CHK_ONLY_PRINT(ich->ipc_c, xret, "ipc_call_device_get_view_poses_2");
|
||||
|
||||
*out_head_relation = info.head_relation;
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
@ -227,20 +219,18 @@ 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);
|
||||
xrt_result_t xret;
|
||||
|
||||
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;
|
||||
}
|
||||
xret = ipc_call_device_compute_distortion( //
|
||||
ich->ipc_c, //
|
||||
ich->device_id, //
|
||||
view, //
|
||||
u, //
|
||||
v, //
|
||||
&ret, //
|
||||
out_result); //
|
||||
IPC_CHK_WITH_RET(ich->ipc_c, xret, "ipc_call_device_compute_distortion", false);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -249,11 +239,16 @@ static bool
|
|||
ipc_client_hmd_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor)
|
||||
{
|
||||
ipc_client_hmd_t *ich = ipc_client_hmd(xdev);
|
||||
xrt_result_t xret;
|
||||
|
||||
bool available = false;
|
||||
xrt_result_t r = ipc_call_device_is_form_factor_available(ich->ipc_c, ich->device_id, form_factor, &available);
|
||||
if (r != XRT_SUCCESS) {
|
||||
IPC_ERROR(ich->ipc_c, "Error calling is available!");
|
||||
}
|
||||
xret = ipc_call_device_is_form_factor_available( //
|
||||
ich->ipc_c, //
|
||||
ich->device_id, //
|
||||
form_factor, //
|
||||
&available); //
|
||||
IPC_CHK_ONLY_PRINT(ich->ipc_c, xret, "ipc_call_device_is_form_factor_available");
|
||||
|
||||
return available;
|
||||
}
|
||||
|
||||
|
|
|
@ -95,9 +95,7 @@ create_offset_space(struct xrt_space_overseer *xso,
|
|||
uint32_t id = 0;
|
||||
|
||||
xret = ipc_call_space_create_offset(icspo->ipc_c, parent_id, offset, &id);
|
||||
if (xret != XRT_SUCCESS) {
|
||||
return xret;
|
||||
}
|
||||
IPC_CHK_AND_RET(icspo->ipc_c, xret, "ipc_call_space_create_offset");
|
||||
|
||||
alloc_space_with_id(icspo, id, out_space);
|
||||
|
||||
|
@ -116,9 +114,7 @@ create_pose_space(struct xrt_space_overseer *xso,
|
|||
uint32_t id = 0;
|
||||
|
||||
xret = ipc_call_space_create_pose(icspo->ipc_c, xdev_id, name, &id);
|
||||
if (xret != XRT_SUCCESS) {
|
||||
return xret;
|
||||
}
|
||||
IPC_CHK_AND_RET(icspo->ipc_c, xret, "ipc_call_space_create_pose");
|
||||
|
||||
alloc_space_with_id(icspo, id, out_space);
|
||||
|
||||
|
@ -135,11 +131,12 @@ locate_space(struct xrt_space_overseer *xso,
|
|||
struct xrt_space_relation *out_relation)
|
||||
{
|
||||
struct ipc_client_space_overseer *icspo = ipc_client_space_overseer(xso);
|
||||
xrt_result_t xret;
|
||||
|
||||
struct ipc_client_space *icsp_base_space = ipc_client_space(base_space);
|
||||
struct ipc_client_space *icsp_space = ipc_client_space(space);
|
||||
|
||||
return ipc_call_space_locate_space( //
|
||||
xret = ipc_call_space_locate_space( //
|
||||
icspo->ipc_c, //
|
||||
icsp_base_space->id, //
|
||||
base_offset, //
|
||||
|
@ -147,6 +144,7 @@ locate_space(struct xrt_space_overseer *xso,
|
|||
icsp_space->id, //
|
||||
offset, //
|
||||
out_relation); //
|
||||
IPC_CHK_ALWAYS_RET(icspo->ipc_c, xret, "ipc_call_space_locate_space");
|
||||
}
|
||||
|
||||
static xrt_result_t
|
||||
|
@ -158,17 +156,19 @@ locate_device(struct xrt_space_overseer *xso,
|
|||
struct xrt_space_relation *out_relation)
|
||||
{
|
||||
struct ipc_client_space_overseer *icspo = ipc_client_space_overseer(xso);
|
||||
xrt_result_t xret;
|
||||
|
||||
struct ipc_client_space *icsp_base_space = ipc_client_space(base_space);
|
||||
uint32_t xdev_id = ipc_client_xdev(xdev)->device_id;
|
||||
|
||||
return ipc_call_space_locate_device( //
|
||||
xret = ipc_call_space_locate_device( //
|
||||
icspo->ipc_c, //
|
||||
icsp_base_space->id, //
|
||||
base_offset, //
|
||||
at_timestamp_ns, //
|
||||
xdev_id, //
|
||||
out_relation); //
|
||||
IPC_CHK_ALWAYS_RET(icspo->ipc_c, xret, "ipc_call_space_locate_device");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in a new issue