From 34d82ea08233473c627516a9347f9816620a5ba5 Mon Sep 17 00:00:00 2001 From: Simon Zeni Date: Tue, 11 Jun 2024 11:41:31 -0400 Subject: [PATCH] xrt: introduce XRT_ERROR_NOT_IMPLEMENTED Merge XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED and XRT_ERROR_COMPOSITOR_FUNCTION_NOT_IMPLEMENTED into a single generic result value. Part-of: --- doc/changes/xrt/mr.2244.md | 1 + src/xrt/auxiliary/util/u_device.c | 2 +- src/xrt/auxiliary/util/u_pretty_print.c | 3 +-- src/xrt/include/xrt/xrt_compositor.h | 4 +--- src/xrt/include/xrt/xrt_device.h | 7 +++---- src/xrt/include/xrt/xrt_results.h | 11 ++--------- src/xrt/state_trackers/oxr/oxr_session.c | 2 +- 7 files changed, 10 insertions(+), 20 deletions(-) create mode 100644 doc/changes/xrt/mr.2244.md diff --git a/doc/changes/xrt/mr.2244.md b/doc/changes/xrt/mr.2244.md new file mode 100644 index 000000000..ff91f1f9a --- /dev/null +++ b/doc/changes/xrt/mr.2244.md @@ -0,0 +1 @@ +introduce XRT_ERROR_NOT_IMPLEMENTED, remove XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED and XRT_ERROR_COMPOSITOR_FUNCTION_NOT_IMPLEMENTED diff --git a/src/xrt/auxiliary/util/u_device.c b/src/xrt/auxiliary/util/u_device.c index af5d899e2..6d38edba6 100644 --- a/src/xrt/auxiliary/util/u_device.c +++ b/src/xrt/auxiliary/util/u_device.c @@ -530,7 +530,7 @@ u_device_ni_get_visibility_mask(struct xrt_device *xdev, struct xrt_visibility_mask **out_mask) { E(get_visibility_mask); - return XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED; + return XRT_ERROR_NOT_IMPLEMENTED; } bool diff --git a/src/xrt/auxiliary/util/u_pretty_print.c b/src/xrt/auxiliary/util/u_pretty_print.c index 2181f10d8..a2a712b1c 100644 --- a/src/xrt/auxiliary/util/u_pretty_print.c +++ b/src/xrt/auxiliary/util/u_pretty_print.c @@ -168,8 +168,7 @@ u_pp_xrt_result(struct u_pp_delegate dg, xrt_result_t xret) case XRT_ERROR_RECENTERING_NOT_SUPPORTED: DG("XRT_ERROR_RECENTERING_NOT_SUPPORTED"); return; case XRT_ERROR_COMPOSITOR_NOT_SUPPORTED: DG("XRT_ERROR_COMPOSITOR_NOT_SUPPORTED"); return; case XRT_ERROR_IPC_COMPOSITOR_NOT_CREATED: DG("XRT_ERROR_IPC_COMPOSITOR_NOT_CREATED"); return; - case XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED: DG("XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED"); return; - case XRT_ERROR_COMPOSITOR_FUNCTION_NOT_IMPLEMENTED: DG("XRT_ERROR_COMPOSITOR_FUNCTION_NOT_IMPLEMENTED"); return; + case XRT_ERROR_NOT_IMPLEMENTED: DG("XRT_ERROR_NOT_IMPLEMENTED"); return; } // clang-format on diff --git a/src/xrt/include/xrt/xrt_compositor.h b/src/xrt/include/xrt/xrt_compositor.h index 7b282d4c9..f7505eeeb 100644 --- a/src/xrt/include/xrt/xrt_compositor.h +++ b/src/xrt/include/xrt/xrt_compositor.h @@ -1889,9 +1889,7 @@ xrt_comp_get_reference_bounds_rect(struct xrt_compositor *xc, struct xrt_vec2 *bounds) { if (xc->get_reference_bounds_rect == NULL) { - bounds->x = 0.f; - bounds->y = 0.f; - return XRT_ERROR_COMPOSITOR_FUNCTION_NOT_IMPLEMENTED; + return XRT_ERROR_NOT_IMPLEMENTED; } return xc->get_reference_bounds_rect(xc, reference_space_type, bounds); diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h index 4b2ac0cfb..5174c3bbb 100644 --- a/src/xrt/include/xrt/xrt_device.h +++ b/src/xrt/include/xrt/xrt_device.h @@ -584,7 +584,7 @@ xrt_device_get_body_skeleton(struct xrt_device *xdev, struct xrt_body_skeleton *out_value) { if (xdev->get_body_skeleton == NULL) { - return XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED; + return XRT_ERROR_NOT_IMPLEMENTED; } return xdev->get_body_skeleton(xdev, body_tracking_type, out_value); } @@ -603,7 +603,7 @@ xrt_device_get_body_joints(struct xrt_device *xdev, struct xrt_body_joint_set *out_value) { if (xdev->get_body_joints == NULL) { - return XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED; + return XRT_ERROR_NOT_IMPLEMENTED; } return xdev->get_body_joints(xdev, body_tracking_type, desired_timestamp_ns, out_value); } @@ -667,9 +667,8 @@ xrt_device_get_visibility_mask(struct xrt_device *xdev, uint32_t view_index, struct xrt_visibility_mask **out_mask) { - if (xdev->get_visibility_mask == NULL) { - return XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED; + return XRT_ERROR_NOT_IMPLEMENTED; } return xdev->get_visibility_mask(xdev, type, view_index, out_mask); } diff --git a/src/xrt/include/xrt/xrt_results.h b/src/xrt/include/xrt/xrt_results.h index 83b6bf88d..cc59edc7f 100644 --- a/src/xrt/include/xrt/xrt_results.h +++ b/src/xrt/include/xrt/xrt_results.h @@ -181,14 +181,7 @@ typedef enum xrt_result XRT_ERROR_IPC_COMPOSITOR_NOT_CREATED = -28, /*! - * The function called on the device was not implemented, it is not - * meant to query the availability of the function or feature, only a - * error condition on bad code. + * The interface function called is not implemented by its interface. */ - XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED = -29, - - /*! - * The function was not implemented in the compositor - */ - XRT_ERROR_COMPOSITOR_FUNCTION_NOT_IMPLEMENTED = -30, + XRT_ERROR_NOT_IMPLEMENTED = -29, } xrt_result_t; diff --git a/src/xrt/state_trackers/oxr/oxr_session.c b/src/xrt/state_trackers/oxr/oxr_session.c index 773391d5c..a95b5ee71 100644 --- a/src/xrt/state_trackers/oxr/oxr_session.c +++ b/src/xrt/state_trackers/oxr/oxr_session.c @@ -1419,7 +1419,7 @@ oxr_session_get_visibility_mask(struct oxr_logger *log, // If we didn't have any cached mask get it. if (mask == NULL) { xret = xrt_device_get_visibility_mask(xdev, type, viewIndex, &mask); - if (xret == XRT_ERROR_DEVICE_FUNCTION_NOT_IMPLEMENTED && xdev->hmd != NULL) { + if (xret == XRT_ERROR_NOT_IMPLEMENTED && xdev->hmd != NULL) { const struct xrt_fov fov = xdev->hmd->distortion.fov[viewIndex]; u_visibility_mask_get_default(type, &fov, &mask); xret = XRT_SUCCESS;