diff --git a/src/xrt/include/xrt/xrt_compiler.h b/src/xrt/include/xrt/xrt_compiler.h index 0778929b4..a7adaa03c 100644 --- a/src/xrt/include/xrt/xrt_compiler.h +++ b/src/xrt/include/xrt/xrt_compiler.h @@ -1,4 +1,5 @@ // Copyright 2019, Collabora, Ltd. +// Copyright 2025-2026, NVIDIA CORPORATION. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -86,6 +87,32 @@ #endif +/* + * To indicate that all pointer parameters must not be null. + * + * Note: MSVC does not have a function-level equivalent. To get similar checking + * on MSVC, individual parameters would need SAL annotations like _In_, _Out_, etc. + */ +#if defined(__GNUC__) +#define XRT_NONNULL_ALL __attribute__((nonnull)) +#else +#define XRT_NONNULL_ALL +#endif + + +/* + * To indicate that the first parameter must not be null. + * + * Note: MSVC does not have a function-level equivalent. To get similar checking + * on MSVC, individual parameters would need SAL annotations like _In_, _Out_, etc. + */ +#if defined(__GNUC__) +#define XRT_NONNULL_FIRST __attribute__((nonnull(1))) +#else +#define XRT_NONNULL_FIRST +#endif + + /* * To make sure return values are checked. */ diff --git a/src/xrt/include/xrt/xrt_compositor.h b/src/xrt/include/xrt/xrt_compositor.h index 1ae33e286..c05232bac 100644 --- a/src/xrt/include/xrt/xrt_compositor.h +++ b/src/xrt/include/xrt/xrt_compositor.h @@ -621,7 +621,7 @@ struct xrt_swapchain * @ingroup xrt_iface * @relates xrt_swapchain */ -static inline void +XRT_NONNULL_FIRST static inline void xrt_swapchain_reference(struct xrt_swapchain **dst, struct xrt_swapchain *src) { struct xrt_swapchain *old_dst = *dst; @@ -650,7 +650,7 @@ xrt_swapchain_reference(struct xrt_swapchain **dst, struct xrt_swapchain *src) * * @public @memberof xrt_swapchain */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_index) { return xsc->acquire_image(xsc, out_index); @@ -663,7 +663,7 @@ xrt_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_index) * * @public @memberof xrt_swapchain */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_swapchain_inc_image_use(struct xrt_swapchain *xsc, uint32_t index) { return xsc->inc_image_use(xsc, index); @@ -676,7 +676,7 @@ xrt_swapchain_inc_image_use(struct xrt_swapchain *xsc, uint32_t index) * * @public @memberof xrt_swapchain */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_swapchain_dec_image_use(struct xrt_swapchain *xsc, uint32_t index) { return xsc->dec_image_use(xsc, index); @@ -689,7 +689,7 @@ xrt_swapchain_dec_image_use(struct xrt_swapchain *xsc, uint32_t index) * * @public @memberof xrt_swapchain */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index) { return xsc->wait_image(xsc, timeout_ns, index); @@ -702,7 +702,7 @@ xrt_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t * * @public @memberof xrt_swapchain */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_swapchain_barrier_image(struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index) { return xsc->barrier_image(xsc, direction, index); @@ -715,7 +715,7 @@ xrt_swapchain_barrier_image(struct xrt_swapchain *xsc, enum xrt_barrier_directio * * @public @memberof xrt_swapchain */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index) { return xsc->release_image(xsc, index); @@ -751,7 +751,7 @@ struct xrt_compositor_fence * * @public @memberof xrt_compositor_fence */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_compositor_fence_wait(struct xrt_compositor_fence *xcf, uint64_t timeout) { return xcf->wait(xcf, timeout); @@ -817,7 +817,7 @@ struct xrt_compositor_semaphore * @ingroup xrt_iface * @relates xrt_compositor_semaphore */ -static inline void +XRT_NONNULL_FIRST static inline void xrt_compositor_semaphore_reference(struct xrt_compositor_semaphore **dst, struct xrt_compositor_semaphore *src) { struct xrt_compositor_semaphore *old_dst = *dst; @@ -846,7 +846,7 @@ xrt_compositor_semaphore_reference(struct xrt_compositor_semaphore **dst, struct * * @public @memberof xrt_compositor_semaphore */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_compositor_semaphore_wait(struct xrt_compositor_semaphore *xcsem, uint64_t value, uint64_t timeout) { return xcsem->wait(xcsem, value, timeout); @@ -1433,7 +1433,7 @@ struct xrt_compositor * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_get_swapchain_create_properties(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp) @@ -1453,7 +1453,7 @@ xrt_comp_get_swapchain_create_properties(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_create_swapchain(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc) @@ -1468,7 +1468,7 @@ xrt_comp_create_swapchain(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_import_swapchain(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, @@ -1485,7 +1485,7 @@ xrt_comp_import_swapchain(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_import_fence(struct xrt_compositor *xc, xrt_graphics_sync_handle_t handle, struct xrt_compositor_fence **out_xcf) @@ -1500,7 +1500,7 @@ xrt_comp_import_fence(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_create_semaphore(struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem) @@ -1517,7 +1517,7 @@ xrt_comp_create_semaphore(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_create_passthrough(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info) { return xc->create_passthrough(xc, info); @@ -1530,7 +1530,7 @@ xrt_comp_create_passthrough(struct xrt_compositor *xc, const struct xrt_passthro * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_create_passthrough_layer(struct xrt_compositor *xc, const struct xrt_passthrough_layer_create_info *info) { return xc->create_passthrough_layer(xc, info); @@ -1543,7 +1543,7 @@ xrt_comp_create_passthrough_layer(struct xrt_compositor *xc, const struct xrt_pa * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_destroy_passthrough(struct xrt_compositor *xc) { return xc->destroy_passthrough(xc); @@ -1561,7 +1561,7 @@ xrt_comp_destroy_passthrough(struct xrt_compositor *xc) * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_begin_session(struct xrt_compositor *xc, const struct xrt_begin_session_info *info) { return xc->begin_session(xc, info); @@ -1574,7 +1574,7 @@ xrt_comp_begin_session(struct xrt_compositor *xc, const struct xrt_begin_session * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_end_session(struct xrt_compositor *xc) { return xc->end_session(xc); @@ -1596,7 +1596,7 @@ xrt_comp_end_session(struct xrt_compositor *xc) * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_predict_frame(struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_wake_time_ns, @@ -1620,7 +1620,7 @@ xrt_comp_predict_frame(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_mark_frame(struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns) { return xc->mark_frame(xc, frame_id, point, when_ns); @@ -1633,7 +1633,7 @@ xrt_comp_mark_frame(struct xrt_compositor *xc, int64_t frame_id, enum xrt_compos * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_wait_frame(struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_predicted_display_time, @@ -1649,7 +1649,7 @@ xrt_comp_wait_frame(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_begin_frame(struct xrt_compositor *xc, int64_t frame_id) { return xc->begin_frame(xc, frame_id); @@ -1662,7 +1662,7 @@ xrt_comp_begin_frame(struct xrt_compositor *xc, int64_t frame_id) * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_discard_frame(struct xrt_compositor *xc, int64_t frame_id) { return xc->discard_frame(xc, frame_id); @@ -1684,7 +1684,7 @@ xrt_comp_discard_frame(struct xrt_compositor *xc, int64_t frame_id) * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_begin(struct xrt_compositor *xc, const struct xrt_layer_frame_data *data) { return xc->layer_begin(xc, data); @@ -1697,7 +1697,7 @@ xrt_comp_layer_begin(struct xrt_compositor *xc, const struct xrt_layer_frame_dat * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_projection(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], @@ -1713,7 +1713,7 @@ xrt_comp_layer_projection(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_projection_depth(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], @@ -1730,7 +1730,7 @@ xrt_comp_layer_projection_depth(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_quad(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, @@ -1746,7 +1746,7 @@ xrt_comp_layer_quad(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_cube(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, @@ -1762,7 +1762,7 @@ xrt_comp_layer_cube(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_cylinder(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, @@ -1779,7 +1779,7 @@ xrt_comp_layer_cylinder(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_equirect1(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, @@ -1795,7 +1795,7 @@ xrt_comp_layer_equirect1(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_equirect2(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, @@ -1811,7 +1811,7 @@ xrt_comp_layer_equirect2(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_passthrough(struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data) { return xc->layer_passthrough(xc, xdev, data); @@ -1824,6 +1824,7 @@ xrt_comp_layer_passthrough(struct xrt_compositor *xc, struct xrt_device *xdev, c * * @public @memberof xrt_compositor */ +XRT_NONNULL_FIRST static inline xrt_result_t xrt_comp_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle) { @@ -1837,7 +1838,7 @@ xrt_comp_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_layer_commit_with_semaphore(struct xrt_compositor *xc, struct xrt_compositor_semaphore *xcsem, uint64_t value) { return xc->layer_commit_with_semaphore(xc, xcsem, value); @@ -1852,7 +1853,7 @@ xrt_comp_layer_commit_with_semaphore(struct xrt_compositor *xc, struct xrt_compo * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_get_display_refresh_rate(struct xrt_compositor *xc, float *out_display_refresh_rate_hz) { return xc->get_display_refresh_rate(xc, out_display_refresh_rate_hz); @@ -1865,7 +1866,7 @@ xrt_comp_get_display_refresh_rate(struct xrt_compositor *xc, float *out_display_ * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_request_display_refresh_rate(struct xrt_compositor *xc, float display_refresh_rate_hz) { return xc->request_display_refresh_rate(xc, display_refresh_rate_hz); @@ -1879,7 +1880,7 @@ xrt_comp_request_display_refresh_rate(struct xrt_compositor *xc, float display_r * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_set_performance_level(struct xrt_compositor *xc, enum xrt_perf_domain domain, enum xrt_perf_set_level level) { return xc->set_performance_level(xc, domain, level); @@ -1892,7 +1893,7 @@ xrt_comp_set_performance_level(struct xrt_compositor *xc, enum xrt_perf_domain d * * @public @memberof xrt_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_get_reference_bounds_rect(struct xrt_compositor *xc, enum xrt_reference_space_type reference_space_type, struct xrt_vec2 *bounds) @@ -1912,7 +1913,7 @@ xrt_comp_get_reference_bounds_rect(struct xrt_compositor *xc, * * @public @memberof xrt_compositor */ -static inline void +XRT_NONNULL_ALL static inline void xrt_comp_destroy(struct xrt_compositor **xc_ptr) { struct xrt_compositor *xc = *xc_ptr; @@ -1932,7 +1933,7 @@ xrt_comp_destroy(struct xrt_compositor **xc_ptr) /*! * @brief Set thread attributes according to thread type */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_set_thread_hint(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id) { return xc->set_thread_hint(xc, hint, thread_id); @@ -2252,7 +2253,7 @@ struct xrt_compositor_native * * @public @memberof xrt_compositor_native */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_comp_native_create_swapchain(struct xrt_compositor_native *xcn, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_native **out_xscn) @@ -2279,7 +2280,7 @@ xrt_comp_native_create_swapchain(struct xrt_compositor_native *xcn, * * @public @memberof xrt_compositor_native */ -static inline void +XRT_NONNULL_ALL static inline void xrt_comp_native_destroy(struct xrt_compositor_native **xcn_ptr) { struct xrt_compositor_native *xcn = *xcn_ptr; @@ -2491,7 +2492,7 @@ struct xrt_system_compositor * * @public @memberof xrt_system_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_syscomp_set_state( struct xrt_system_compositor *xsc, struct xrt_compositor *xc, bool visible, bool focused, int64_t timestamp_ns) { @@ -2512,7 +2513,7 @@ xrt_syscomp_set_state( * * @public @memberof xrt_system_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_syscomp_set_z_order(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t z_order) { if (xsc->xmcc == NULL) { @@ -2533,7 +2534,7 @@ xrt_syscomp_set_z_order(struct xrt_system_compositor *xsc, struct xrt_compositor * * @public @memberof xrt_system_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_syscomp_set_main_app_visibility(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, bool visible) { if (xsc->xmcc == NULL) { @@ -2553,7 +2554,7 @@ xrt_syscomp_set_main_app_visibility(struct xrt_system_compositor *xsc, struct xr * * @public @memberof xrt_system_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_syscomp_notify_loss_pending(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t loss_time_ns) { if (xsc->xmcc == NULL) { @@ -2573,7 +2574,7 @@ xrt_syscomp_notify_loss_pending(struct xrt_system_compositor *xsc, struct xrt_co * * @public @memberof xrt_system_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_syscomp_notify_lost(struct xrt_system_compositor *xsc, struct xrt_compositor *xc) { if (xsc->xmcc == NULL) { @@ -2593,7 +2594,7 @@ xrt_syscomp_notify_lost(struct xrt_system_compositor *xsc, struct xrt_compositor * * @public @memberof xrt_system_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_syscomp_notify_display_refresh_changed(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, float from_display_refresh_rate_hz, @@ -2614,7 +2615,7 @@ xrt_syscomp_notify_display_refresh_changed(struct xrt_system_compositor *xsc, * * @public @memberof xrt_system_compositor */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_syscomp_create_native_compositor(struct xrt_system_compositor *xsc, const struct xrt_session_info *xsi, struct xrt_session_event_sink *xses, @@ -2631,7 +2632,7 @@ xrt_syscomp_create_native_compositor(struct xrt_system_compositor *xsc, * * @public @memberof xrt_system_compositor */ -static inline void +XRT_NONNULL_ALL static inline void xrt_syscomp_destroy(struct xrt_system_compositor **xsc_ptr) { struct xrt_system_compositor *xsc = *xsc_ptr; @@ -2687,7 +2688,7 @@ struct xrt_image_native_allocator * * @public @memberof xrt_image_native_allocate */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_images_allocate(struct xrt_image_native_allocator *xina, const struct xrt_swapchain_create_info *xsci, size_t image_count, @@ -2703,7 +2704,7 @@ xrt_images_allocate(struct xrt_image_native_allocator *xina, * * @public @memberof xrt_image_native_allocate */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_images_free(struct xrt_image_native_allocator *xina, size_t image_count, struct xrt_image_native *images) { return xina->images_free(xina, image_count, images); @@ -2717,7 +2718,7 @@ xrt_images_free(struct xrt_image_native_allocator *xina, size_t image_count, str * * @public @memberof xrt_image_native_allocator */ -static inline void +XRT_NONNULL_ALL static inline void xrt_images_destroy(struct xrt_image_native_allocator **xina_ptr) { struct xrt_image_native_allocator *xina = *xina_ptr; diff --git a/src/xrt/include/xrt/xrt_device.h b/src/xrt/include/xrt/xrt_device.h index 5166228c8..87ccea7da 100644 --- a/src/xrt/include/xrt/xrt_device.h +++ b/src/xrt/include/xrt/xrt_device.h @@ -1,5 +1,5 @@ // Copyright 2019-2024, Collabora, Ltd. -// Copyright 2024-2025, NVIDIA CORPORATION. +// Copyright 2024-2026, NVIDIA CORPORATION. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -749,7 +749,7 @@ struct xrt_device * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_update_inputs(struct xrt_device *xdev) { return xdev->update_inputs(xdev); @@ -762,7 +762,7 @@ xrt_device_update_inputs(struct xrt_device *xdev) * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_tracked_pose(struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, @@ -778,7 +778,7 @@ xrt_device_get_tracked_pose(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_hand_tracking(struct xrt_device *xdev, enum xrt_input_name name, int64_t desired_timestamp_ns, @@ -795,7 +795,7 @@ xrt_device_get_hand_tracking(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_face_tracking(struct xrt_device *xdev, enum xrt_input_name facial_expression_type, int64_t at_timestamp_ns, @@ -811,7 +811,7 @@ xrt_device_get_face_tracking(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_face_calibration_state_android(struct xrt_device *xdev, bool *out_face_is_calibrated) { return xdev->get_face_calibration_state_android(xdev, out_face_is_calibrated); @@ -824,7 +824,7 @@ xrt_device_get_face_calibration_state_android(struct xrt_device *xdev, bool *out * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_body_skeleton(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, struct xrt_body_skeleton *out_value) @@ -839,7 +839,7 @@ xrt_device_get_body_skeleton(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_body_joints(struct xrt_device *xdev, enum xrt_input_name body_tracking_type, int64_t desired_timestamp_ns, @@ -855,7 +855,7 @@ xrt_device_get_body_joints(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_reset_body_tracking_calibration_meta(struct xrt_device *xdev) { if (xdev->reset_body_tracking_calibration_meta == NULL) { @@ -871,7 +871,7 @@ xrt_device_reset_body_tracking_calibration_meta(struct xrt_device *xdev) * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_set_body_tracking_calibration_override_meta(struct xrt_device *xdev, float new_body_height) { if (xdev->set_body_tracking_calibration_override_meta == NULL) { @@ -887,14 +887,14 @@ xrt_device_set_body_tracking_calibration_override_meta(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_set_output(struct xrt_device *xdev, enum xrt_output_name name, const struct xrt_output_value *value) { xdev->set_output(xdev, name, value); return XRT_SUCCESS; } -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_output_limits(struct xrt_device *xdev, struct xrt_output_limits *limits) { if (xdev->get_output_limits) { @@ -911,7 +911,7 @@ xrt_device_get_output_limits(struct xrt_device *xdev, struct xrt_output_limits * * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_presence(struct xrt_device *xdev, bool *presence) { if (xdev->get_presence) { @@ -926,7 +926,7 @@ xrt_device_get_presence(struct xrt_device *xdev, bool *presence) * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_begin_plane_detection_ext(struct xrt_device *xdev, const struct xrt_plane_detector_begin_info_ext *begin_info, uint64_t plane_detection_id, @@ -940,7 +940,7 @@ xrt_device_begin_plane_detection_ext(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_destroy_plane_detection_ext(struct xrt_device *xdev, uint64_t plane_detection_id) { return xdev->destroy_plane_detection_ext(xdev, plane_detection_id); @@ -951,7 +951,7 @@ xrt_device_destroy_plane_detection_ext(struct xrt_device *xdev, uint64_t plane_d * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_plane_detection_state_ext(struct xrt_device *xdev, uint64_t plane_detection_id, enum xrt_plane_detector_state_ext *out_state) @@ -964,7 +964,7 @@ xrt_device_get_plane_detection_state_ext(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_plane_detections_ext(struct xrt_device *xdev, uint64_t plane_detection_id, struct xrt_plane_detections_ext *out_detections) @@ -978,7 +978,7 @@ xrt_device_get_plane_detections_ext(struct xrt_device *xdev, * @copydoc xrt_device::get_view_poses * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_view_poses(struct xrt_device *xdev, const struct xrt_vec3 *default_eye_relation, int64_t at_timestamp_ns, @@ -1006,7 +1006,7 @@ xrt_device_get_view_poses(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_compute_distortion( struct xrt_device *xdev, uint32_t view, float u, float v, struct xrt_uv_triplet *out_result) { @@ -1020,7 +1020,7 @@ xrt_device_compute_distortion( * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_visibility_mask(struct xrt_device *xdev, enum xrt_visibility_mask_type type, uint32_t view_index, @@ -1036,7 +1036,7 @@ xrt_device_get_visibility_mask(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_ref_space_usage(struct xrt_device *xdev, enum xrt_reference_space_type type, enum xrt_input_name name, @@ -1052,7 +1052,7 @@ xrt_device_ref_space_usage(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline bool +XRT_NONNULL_ALL static inline bool xrt_device_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_factor form_factor) { return xdev->is_form_factor_available(xdev, form_factor); @@ -1065,7 +1065,7 @@ xrt_device_is_form_factor_available(struct xrt_device *xdev, enum xrt_form_facto * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_battery_status(struct xrt_device *xdev, bool *out_present, bool *out_charging, float *out_charge) { return xdev->get_battery_status(xdev, out_present, out_charging, out_charge); @@ -1077,7 +1077,7 @@ xrt_device_get_battery_status(struct xrt_device *xdev, bool *out_present, bool * * @copydoc xrt_device::get_brightness * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_brightness(struct xrt_device *xdev, float *out_brightness) { return xdev->get_brightness(xdev, out_brightness); @@ -1089,7 +1089,7 @@ xrt_device_get_brightness(struct xrt_device *xdev, float *out_brightness) * @copydoc xrt_device::set_brightness * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_set_brightness(struct xrt_device *xdev, float brightness, bool relative) { return xdev->set_brightness(xdev, brightness, relative); @@ -1102,7 +1102,7 @@ xrt_device_set_brightness(struct xrt_device *xdev, float brightness, bool relati * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_get_compositor_info(struct xrt_device *xdev, const struct xrt_device_compositor_mode *mode, struct xrt_device_compositor_info *out_info) @@ -1117,7 +1117,7 @@ xrt_device_get_compositor_info(struct xrt_device *xdev, * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_begin_feature(struct xrt_device *xdev, enum xrt_device_feature_type type) { return xdev->begin_feature(xdev, type); @@ -1130,7 +1130,7 @@ xrt_device_begin_feature(struct xrt_device *xdev, enum xrt_device_feature_type t * * @public @memberof xrt_device */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_device_end_feature(struct xrt_device *xdev, enum xrt_device_feature_type type) { return xdev->end_feature(xdev, type); @@ -1143,7 +1143,7 @@ xrt_device_end_feature(struct xrt_device *xdev, enum xrt_device_feature_type typ * * @public @memberof xrt_device */ -static inline void +XRT_NONNULL_ALL static inline void xrt_device_destroy(struct xrt_device **xdev_ptr) { struct xrt_device *xdev = *xdev_ptr; diff --git a/src/xrt/include/xrt/xrt_future.h b/src/xrt/include/xrt/xrt_future.h index ec6ae11ce..1e0618b17 100644 --- a/src/xrt/include/xrt/xrt_future.h +++ b/src/xrt/include/xrt/xrt_future.h @@ -1,4 +1,5 @@ // Copyright 2025, Collabora, Ltd. +// Copyright 2025-2026, NVIDIA CORPORATION. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -222,10 +223,10 @@ xrt_future_reference(struct xrt_future **dst, struct xrt_future *src) * * @public @memberof xrt_future */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_future_get_result(const struct xrt_future *xft, struct xrt_future_result *out_result) { - assert(xft && xft->get_result); + assert(xft->get_result); return xft->get_result(xft, out_result); } @@ -236,10 +237,10 @@ xrt_future_get_result(const struct xrt_future *xft, struct xrt_future_result *ou * * @public @memberof xrt_future */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_future_get_state(const struct xrt_future *xft, enum xrt_future_state *out_state) { - assert(xft && xft->get_state); + assert(xft->get_state); return xft->get_state(xft, out_state); } @@ -250,10 +251,10 @@ xrt_future_get_state(const struct xrt_future *xft, enum xrt_future_state *out_st * * @public @memberof xrt_future */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_future_cancel(struct xrt_future *xft) { - assert(xft && xft->cancel); + assert(xft->cancel); return xft->cancel(xft); } @@ -264,10 +265,10 @@ xrt_future_cancel(struct xrt_future *xft) * * @public @memberof xrt_future */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_future_wait(struct xrt_future *xft, int64_t timeout_ns) { - assert(xft && xft->wait); + assert(xft->wait); return xft->wait(xft, timeout_ns); } @@ -278,10 +279,10 @@ xrt_future_wait(struct xrt_future *xft, int64_t timeout_ns) * * @public @memberof xrt_future */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_future_is_cancel_requested(const struct xrt_future *xft, bool *out_request_cancel) { - assert(xft && xft->is_cancel_requested); + assert(xft->is_cancel_requested); return xft->is_cancel_requested(xft, out_request_cancel); } @@ -292,10 +293,10 @@ xrt_future_is_cancel_requested(const struct xrt_future *xft, bool *out_request_c * * @public @memberof xrt_future */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_future_complete(struct xrt_future *xft, const struct xrt_future_result *ft_result) { - assert(xft && xft->complete); + assert(xft->complete); return xft->complete(xft, ft_result); } diff --git a/src/xrt/include/xrt/xrt_instance.h b/src/xrt/include/xrt/xrt_instance.h index 9034bfd1e..b6593e06e 100644 --- a/src/xrt/include/xrt/xrt_instance.h +++ b/src/xrt/include/xrt/xrt_instance.h @@ -1,5 +1,5 @@ // Copyright 2020-2024, Collabora, Ltd. -// Copyright 2025, NVIDIA CORPORATION. +// Copyright 2025-2026, NVIDIA CORPORATION. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -214,7 +214,7 @@ struct xrt_instance * * @public @memberof xrt_instance */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_instance_is_system_available(struct xrt_instance *xinst, bool *out_available) { return xinst->is_system_available(xinst, out_available); @@ -244,7 +244,7 @@ xrt_instance_create_system(struct xrt_instance *xinst, * * @public @memberof xrt_instance */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_instance_get_prober(struct xrt_instance *xinst, struct xrt_prober **out_xp) { return xinst->get_prober(xinst, out_xp); @@ -260,7 +260,7 @@ xrt_instance_get_prober(struct xrt_instance *xinst, struct xrt_prober **out_xp) * * @public @memberof xrt_instance */ -static inline void +XRT_NONNULL_ALL static inline void xrt_instance_destroy(struct xrt_instance **xinst_ptr) { struct xrt_instance *xinst = *xinst_ptr; @@ -286,7 +286,7 @@ xrt_instance_destroy(struct xrt_instance **xinst_ptr) * Each target must implement this function. * * @param[in] ii A pointer to a info struct containing information about the - * application. + * application, optional can be null. * @param[out] out_xinst A pointer to an xrt_instance pointer. Will be * populated. * diff --git a/src/xrt/include/xrt/xrt_prober.h b/src/xrt/include/xrt/xrt_prober.h index a92a9fec1..3b79bf25f 100644 --- a/src/xrt/include/xrt/xrt_prober.h +++ b/src/xrt/include/xrt/xrt_prober.h @@ -1,4 +1,5 @@ // Copyright 2019-2023, Collabora, Ltd. +// Copyright 2025-2026, NVIDIA CORPORATION. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -325,7 +326,7 @@ struct xrt_prober * * @public @memberof xrt_prober */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_prober_probe(struct xrt_prober *xp) { return xp->probe(xp); @@ -338,7 +339,7 @@ xrt_prober_probe(struct xrt_prober *xp) * * @public @memberof xrt_prober */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_prober_lock_list(struct xrt_prober *xp, struct xrt_prober_device ***out_devices, size_t *out_device_count) { return xp->lock_list(xp, out_devices, out_device_count); @@ -351,7 +352,7 @@ xrt_prober_lock_list(struct xrt_prober *xp, struct xrt_prober_device ***out_devi * * @public @memberof xrt_prober */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_prober_unlock_list(struct xrt_prober *xp, struct xrt_prober_device ***devices) { return xp->unlock_list(xp, devices); @@ -364,7 +365,7 @@ xrt_prober_unlock_list(struct xrt_prober *xp, struct xrt_prober_device ***device * * @public @memberof xrt_prober */ -static inline int +XRT_NONNULL_ALL static inline int xrt_prober_dump(struct xrt_prober *xp, bool use_stdout) { return xp->dump(xp, use_stdout); @@ -377,7 +378,7 @@ xrt_prober_dump(struct xrt_prober *xp, bool use_stdout) * * @public @memberof xrt_prober */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_prober_create_system(struct xrt_prober *xp, struct xrt_session_event_sink *broadcast, struct xrt_system_devices **out_xsysd, @@ -393,7 +394,7 @@ xrt_prober_create_system(struct xrt_prober *xp, * * @public @memberof xrt_prober */ -static inline int +XRT_NONNULL_ALL static inline int xrt_prober_select(struct xrt_prober *xp, struct xrt_device **xdevs, size_t xdev_capacity) { return xp->select(xp, xdevs, xdev_capacity); @@ -406,7 +407,7 @@ xrt_prober_select(struct xrt_prober *xp, struct xrt_device **xdevs, size_t xdev_ * * @public @memberof xrt_prober */ -static inline int +XRT_NONNULL_ALL static inline int xrt_prober_open_hid_interface(struct xrt_prober *xp, struct xrt_prober_device *xpdev, int iface, @@ -422,7 +423,7 @@ xrt_prober_open_hid_interface(struct xrt_prober *xp, * * @public @memberof xrt_prober */ -static inline int +XRT_NONNULL_ALL static inline int xrt_prober_get_string_descriptor(struct xrt_prober *xp, struct xrt_prober_device *xpdev, enum xrt_prober_string which_string, @@ -439,7 +440,7 @@ xrt_prober_get_string_descriptor(struct xrt_prober *xp, * * @public @memberof xrt_prober */ -static inline bool +XRT_NONNULL_ALL static inline bool xrt_prober_can_open(struct xrt_prober *xp, struct xrt_prober_device *xpdev) { return xp->can_open(xp, xpdev); @@ -453,7 +454,7 @@ xrt_prober_can_open(struct xrt_prober *xp, struct xrt_prober_device *xpdev) * * @public @memberof xrt_prober */ -static inline int +XRT_NONNULL_FIRST static inline int xrt_prober_open_video_device(struct xrt_prober *xp, struct xrt_prober_device *xpdev, struct xrt_frame_context *xfctx, @@ -482,7 +483,7 @@ xrt_prober_list_video_devices(struct xrt_prober *xp, xrt_prober_list_video_func_ * * @public @memberof xrt_prober */ -static inline int +XRT_NONNULL_ALL static inline int xrt_prober_get_builders(struct xrt_prober *xp, size_t *out_builder_count, struct xrt_builder ***out_builders, @@ -501,7 +502,7 @@ xrt_prober_get_builders(struct xrt_prober *xp, * * @public @memberof xrt_prober */ -static inline void +XRT_NONNULL_ALL static inline void xrt_prober_destroy(struct xrt_prober **xp_ptr) { struct xrt_prober *xp = *xp_ptr; @@ -623,7 +624,7 @@ struct xrt_builder * * @public @memberof xrt_builder */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_builder_estimate_system(struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, @@ -639,7 +640,7 @@ xrt_builder_estimate_system(struct xrt_builder *xb, * * @public @memberof xrt_builder */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_builder_open_system(struct xrt_builder *xb, cJSON *config, struct xrt_prober *xp, @@ -658,7 +659,7 @@ xrt_builder_open_system(struct xrt_builder *xb, * * @public @memberof xrt_builder */ -static inline void +XRT_NONNULL_ALL static inline void xrt_builder_destroy(struct xrt_builder **xb_ptr) { struct xrt_builder *xb = *xb_ptr; @@ -841,7 +842,7 @@ struct xrt_prober_entry_lists * * @public @memberof xrt_prober */ -int +XRT_NONNULL_ALL int xrt_prober_create_with_lists(struct xrt_prober **out_xp, struct xrt_prober_entry_lists *list); diff --git a/src/xrt/include/xrt/xrt_session.h b/src/xrt/include/xrt/xrt_session.h index 96f7f8b11..daca64472 100644 --- a/src/xrt/include/xrt/xrt_session.h +++ b/src/xrt/include/xrt/xrt_session.h @@ -1,4 +1,5 @@ // Copyright 2020-2023, Collabora, Ltd. +// Copyright 2025-2026, NVIDIA CORPORATION. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -251,7 +252,7 @@ struct xrt_session_event_sink * * @public @memberof xrt_session_event_sink */ -XRT_CHECK_RESULT static inline xrt_result_t +XRT_CHECK_RESULT XRT_NONNULL_ALL static inline xrt_result_t xrt_session_event_sink_push(struct xrt_session_event_sink *xses, const union xrt_session_event *xse) { return xses->push_event(xses, xse); @@ -307,7 +308,7 @@ struct xrt_session * * @public @memberof xrt_session */ -XRT_CHECK_RESULT static inline xrt_result_t +XRT_CHECK_RESULT XRT_NONNULL_ALL static inline xrt_result_t xrt_session_poll_events(struct xrt_session *xs, union xrt_session_event *out_xse) { return xs->poll_events(xs, out_xse); @@ -336,7 +337,7 @@ xrt_session_request_exit(struct xrt_session *xs) * * @public @memberof xrt_session */ -static inline void +XRT_NONNULL_ALL static inline void xrt_session_destroy(struct xrt_session **xs_ptr) { struct xrt_session *xs = *xs_ptr; diff --git a/src/xrt/include/xrt/xrt_space.h b/src/xrt/include/xrt/xrt_space.h index d3d43d547..5852a4462 100644 --- a/src/xrt/include/xrt/xrt_space.h +++ b/src/xrt/include/xrt/xrt_space.h @@ -1,5 +1,5 @@ // Copyright 2019-2023, Collabora, Ltd. -// Copyright 2025, NVIDIA CORPORATION. +// Copyright 2025-2026, NVIDIA CORPORATION. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -372,7 +372,7 @@ struct xrt_space_overseer * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_create_offset_space(struct xrt_space_overseer *xso, struct xrt_space *parent, const struct xrt_pose *offset, @@ -388,7 +388,7 @@ xrt_space_overseer_create_offset_space(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_create_pose_space(struct xrt_space_overseer *xso, struct xrt_device *xdev, enum xrt_input_name name, @@ -404,7 +404,7 @@ xrt_space_overseer_create_pose_space(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_locate_space(struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, @@ -423,7 +423,7 @@ xrt_space_overseer_locate_space(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_locate_spaces(struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, @@ -444,7 +444,7 @@ xrt_space_overseer_locate_spaces(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_locate_device(struct xrt_space_overseer *xso, struct xrt_space *base_space, const struct xrt_pose *base_offset, @@ -462,7 +462,7 @@ xrt_space_overseer_locate_device(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_ref_space_inc(struct xrt_space_overseer *xso, enum xrt_reference_space_type type) { return xso->ref_space_inc(xso, type); @@ -475,7 +475,7 @@ xrt_space_overseer_ref_space_inc(struct xrt_space_overseer *xso, enum xrt_refere * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_ref_space_dec(struct xrt_space_overseer *xso, enum xrt_reference_space_type type) { return xso->ref_space_dec(xso, type); @@ -488,7 +488,7 @@ xrt_space_overseer_ref_space_dec(struct xrt_space_overseer *xso, enum xrt_refere * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_recenter_local_spaces(struct xrt_space_overseer *xso) { return xso->recenter_local_spaces(xso); @@ -501,7 +501,7 @@ xrt_space_overseer_recenter_local_spaces(struct xrt_space_overseer *xso) * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_get_tracking_origin_offset(struct xrt_space_overseer *xso, struct xrt_tracking_origin *xto, struct xrt_pose *out_offset) @@ -516,7 +516,7 @@ xrt_space_overseer_get_tracking_origin_offset(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_set_tracking_origin_offset(struct xrt_space_overseer *xso, struct xrt_tracking_origin *xto, const struct xrt_pose *offset) @@ -531,7 +531,7 @@ xrt_space_overseer_set_tracking_origin_offset(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_get_reference_space_offset(struct xrt_space_overseer *xso, enum xrt_reference_space_type type, struct xrt_pose *out_offset) @@ -546,7 +546,7 @@ xrt_space_overseer_get_reference_space_offset(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_set_reference_space_offset(struct xrt_space_overseer *xso, enum xrt_reference_space_type type, const struct xrt_pose *offset) @@ -561,7 +561,7 @@ xrt_space_overseer_set_reference_space_offset(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_create_local_space(struct xrt_space_overseer *xso, struct xrt_space **out_local_space, struct xrt_space **out_local_floor_space) @@ -576,7 +576,7 @@ xrt_space_overseer_create_local_space(struct xrt_space_overseer *xso, * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_add_device(struct xrt_space_overseer *xso, struct xrt_device *xdev) { return xso->add_device(xso, xdev); @@ -589,7 +589,7 @@ xrt_space_overseer_add_device(struct xrt_space_overseer *xso, struct xrt_device * * @public @memberof xrt_space_overseer */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_space_overseer_attach_device(struct xrt_space_overseer *xso, struct xrt_device *xdev, struct xrt_space *space) { return xso->attach_device(xso, xdev, space); diff --git a/src/xrt/include/xrt/xrt_system.h b/src/xrt/include/xrt/xrt_system.h index a282ab563..74ef200f2 100644 --- a/src/xrt/include/xrt/xrt_system.h +++ b/src/xrt/include/xrt/xrt_system.h @@ -113,7 +113,7 @@ xrt_system_create_session(struct xrt_system *xsys, * * @public @memberof xrt_system */ -static inline void +XRT_NONNULL_ALL static inline void xrt_system_destroy(struct xrt_system **xsys_ptr) { struct xrt_system *xsys = *xsys_ptr; @@ -362,7 +362,7 @@ struct xrt_system_devices * * @public @memberof xrt_system_devices */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_system_devices_get_roles(struct xrt_system_devices *xsysd, struct xrt_system_roles *out_roles) { return xsysd->get_roles(xsysd, out_roles); @@ -375,7 +375,7 @@ xrt_system_devices_get_roles(struct xrt_system_devices *xsysd, struct xrt_system * * @public @memberof xrt_system_devices */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_system_devices_feature_inc(struct xrt_system_devices *xsysd, enum xrt_device_feature_type type) { return xsysd->feature_inc(xsysd, type); @@ -388,7 +388,7 @@ xrt_system_devices_feature_inc(struct xrt_system_devices *xsysd, enum xrt_device * * @public @memberof xrt_system_devices */ -static inline xrt_result_t +XRT_NONNULL_ALL static inline xrt_result_t xrt_system_devices_feature_dec(struct xrt_system_devices *xsysd, enum xrt_device_feature_type type) { return xsysd->feature_dec(xsysd, type); @@ -404,7 +404,7 @@ xrt_system_devices_feature_dec(struct xrt_system_devices *xsysd, enum xrt_device * * @public @memberof xrt_system_devices */ -static inline void +XRT_NONNULL_ALL static inline void xrt_system_devices_destroy(struct xrt_system_devices **xsysd_ptr) { struct xrt_system_devices *xsysd = *xsysd_ptr; diff --git a/src/xrt/include/xrt/xrt_tracking.h b/src/xrt/include/xrt/xrt_tracking.h index 3217322f9..1403f1163 100644 --- a/src/xrt/include/xrt/xrt_tracking.h +++ b/src/xrt/include/xrt/xrt_tracking.h @@ -1,5 +1,5 @@ // Copyright 2019, Collabora, Ltd. -// Copyright 2025, NVIDIA CORPORATION. +// Copyright 2025-2026, NVIDIA CORPORATION. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -312,28 +312,28 @@ struct xrt_tracked_slam */ //! @public @memberof xrt_imu_sink -static inline void +XRT_NONNULL_ALL static inline void xrt_sink_push_imu(struct xrt_imu_sink *sink, struct xrt_imu_sample *sample) { sink->push_imu(sink, sample); } //! @public @memberof xrt_pose_sink -static inline void +XRT_NONNULL_ALL static inline void xrt_sink_push_pose(struct xrt_pose_sink *sink, struct xrt_pose_sample *sample) { sink->push_pose(sink, sample); } //! @public @memberof xrt_hand_masks_sink -static inline void +XRT_NONNULL_ALL static inline void xrt_sink_push_hand_masks(struct xrt_hand_masks_sink *sink, struct xrt_hand_masks_sample *hand_masks) { sink->push_hand_masks(sink, hand_masks); } //! @public @memberof xrt_tracked_psmv -static inline void +XRT_NONNULL_ALL static inline void xrt_tracked_psmv_get_tracked_pose(struct xrt_tracked_psmv *psmv, enum xrt_input_name name, timepoint_ns when_ns, @@ -343,14 +343,14 @@ xrt_tracked_psmv_get_tracked_pose(struct xrt_tracked_psmv *psmv, } //! @public @memberof xrt_tracked_psmv -static inline void +XRT_NONNULL_ALL static inline void xrt_tracked_psmv_push_imu(struct xrt_tracked_psmv *psmv, timepoint_ns timestamp_ns, struct xrt_tracking_sample *sample) { psmv->push_imu(psmv, timestamp_ns, sample); } //! @public @memberof xrt_tracked_psmv -static inline void +XRT_NONNULL_ALL static inline void xrt_tracked_psmv_destroy(struct xrt_tracked_psmv **xtmv_ptr) { struct xrt_tracked_psmv *xtmv = *xtmv_ptr; @@ -363,7 +363,7 @@ xrt_tracked_psmv_destroy(struct xrt_tracked_psmv **xtmv_ptr) } //! @public @memberof xrt_tracked_psmv -static inline void +XRT_NONNULL_ALL static inline void xrt_tracked_psvr_get_tracked_pose(struct xrt_tracked_psvr *psvr, timepoint_ns when_ns, struct xrt_space_relation *out_relation) @@ -372,14 +372,14 @@ xrt_tracked_psvr_get_tracked_pose(struct xrt_tracked_psvr *psvr, } //! @public @memberof xrt_tracked_psmv -static inline void +XRT_NONNULL_ALL static inline void xrt_tracked_psvr_push_imu(struct xrt_tracked_psvr *psvr, timepoint_ns timestamp_ns, struct xrt_tracking_sample *sample) { psvr->push_imu(psvr, timestamp_ns, sample); } //! @public @memberof xrt_tracked_psmv -static inline void +XRT_NONNULL_ALL static inline void xrt_tracked_psvr_destroy(struct xrt_tracked_psvr **xtvr_ptr) { struct xrt_tracked_psvr *xtvr = *xtvr_ptr; @@ -393,7 +393,7 @@ xrt_tracked_psvr_destroy(struct xrt_tracked_psvr **xtvr_ptr) //! @public @memberof xrt_tracked_slam -static inline void +XRT_NONNULL_ALL static inline void xrt_tracked_slam_get_tracked_pose(struct xrt_tracked_slam *slam, timepoint_ns when_ns, struct xrt_space_relation *out_relation) diff --git a/src/xrt/include/xrt/xrt_visibility_mask.h b/src/xrt/include/xrt/xrt_visibility_mask.h index f5b52bfc3..31b39a291 100644 --- a/src/xrt/include/xrt/xrt_visibility_mask.h +++ b/src/xrt/include/xrt/xrt_visibility_mask.h @@ -1,4 +1,5 @@ // Copyright 2023, Collabora, Ltd. +// Copyright 2025-2026, NVIDIA CORPORATION. // SPDX-License-Identifier: BSL-1.0 /*! * @file @@ -33,7 +34,7 @@ struct xrt_visibility_mask * * @ingroup xrt_iface */ -static inline uint32_t * +XRT_NONNULL_ALL static inline uint32_t * xrt_visibility_mask_get_indices(const struct xrt_visibility_mask *mask) { return (uint32_t *)&mask[1]; @@ -44,7 +45,7 @@ xrt_visibility_mask_get_indices(const struct xrt_visibility_mask *mask) * * @ingroup xrt_iface */ -static inline struct xrt_vec2 * +XRT_NONNULL_ALL static inline struct xrt_vec2 * xrt_visibility_mask_get_vertices(const struct xrt_visibility_mask *mask) { const uint32_t *indices = xrt_visibility_mask_get_indices(mask); @@ -56,7 +57,7 @@ xrt_visibility_mask_get_vertices(const struct xrt_visibility_mask *mask) * * @ingroup xrt_iface */ -static inline size_t +XRT_NONNULL_ALL static inline size_t xrt_visibility_mask_get_size(const struct xrt_visibility_mask *mask) { return sizeof(*mask) + //