The open source OpenXR runtime

st/oxr: Tidy oxr_system.c file

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

+53 -35
+53 -35
src/xrt/state_trackers/oxr/oxr_system.c
··· 26 26 #include "oxr_conversions.h" 27 27 28 28 29 + /* 30 + * 31 + * General helpers 32 + * 33 + */ 34 + 29 35 DEBUG_GET_ONCE_NUM_OPTION(scale_percentage, "OXR_VIEWPORT_SCALE_PERCENTAGE", 100) 30 36 31 37 ··· 36 42 return xr_form_factor_to_xrt(form_factor) == sys->xsys->properties.form_factor; 37 43 } 38 44 45 + static bool 46 + oxr_system_get_body_tracking_support(struct oxr_logger *log, 47 + struct oxr_instance *inst, 48 + const enum xrt_input_name body_tracking_name) 49 + { 50 + struct oxr_system *sys = &inst->system; 51 + const struct xrt_device *body = GET_XDEV_BY_ROLE(sys, body); 52 + if (body == NULL || !body->supported.body_tracking || body->inputs == NULL) { 53 + return false; 54 + } 55 + 56 + for (size_t input_idx = 0; input_idx < body->input_count; ++input_idx) { 57 + const struct xrt_input *input = &body->inputs[input_idx]; 58 + if (input->name == body_tracking_name) { 59 + return true; 60 + } 61 + } 62 + return false; 63 + } 64 + 65 + 66 + /* 67 + * 68 + * Two-call helpers. 69 + * 70 + */ 71 + 72 + static void 73 + view_configuration_view_fill_in(XrViewConfigurationView *target_view, XrViewConfigurationView *source_view) 74 + { 75 + // clang-format off 76 + target_view->recommendedImageRectWidth = source_view->recommendedImageRectWidth; 77 + target_view->maxImageRectWidth = source_view->maxImageRectWidth; 78 + target_view->recommendedImageRectHeight = source_view->recommendedImageRectHeight; 79 + target_view->maxImageRectHeight = source_view->maxImageRectHeight; 80 + target_view->recommendedSwapchainSampleCount = source_view->recommendedSwapchainSampleCount; 81 + target_view->maxSwapchainSampleCount = source_view->maxSwapchainSampleCount; 82 + // clang-format on 83 + } 84 + 85 + 86 + /* 87 + * 88 + * 'Exported' functions. 89 + * 90 + */ 91 + 39 92 XrResult 40 93 oxr_system_select(struct oxr_logger *log, 41 94 struct oxr_system **systems, ··· 97 150 98 151 return XR_SUCCESS; 99 152 } 100 - 101 - 102 153 103 154 XrResult 104 155 oxr_system_fill_in( ··· 352 403 return; 353 404 } 354 405 355 - static bool 356 - oxr_system_get_body_tracking_support(struct oxr_logger *log, 357 - struct oxr_instance *inst, 358 - const enum xrt_input_name body_tracking_name) 359 - { 360 - struct oxr_system *sys = &inst->system; 361 - const struct xrt_device *body = GET_XDEV_BY_ROLE(sys, body); 362 - if (body == NULL || !body->supported.body_tracking || body->inputs == NULL) { 363 - return false; 364 - } 365 - 366 - for (size_t input_idx = 0; input_idx < body->input_count; ++input_idx) { 367 - const struct xrt_input *input = &body->inputs[input_idx]; 368 - if (input->name == body_tracking_name) { 369 - return true; 370 - } 371 - } 372 - return false; 373 - } 374 - 375 406 bool 376 407 oxr_system_get_body_tracking_fb_support(struct oxr_logger *log, struct oxr_instance *inst) 377 408 { ··· 627 658 configurationProperties->fovMutable = sys->xsysc->info.supports_fov_mutable; 628 659 629 660 return XR_SUCCESS; 630 - } 631 - 632 - static void 633 - view_configuration_view_fill_in(XrViewConfigurationView *target_view, XrViewConfigurationView *source_view) 634 - { 635 - // clang-format off 636 - target_view->recommendedImageRectWidth = source_view->recommendedImageRectWidth; 637 - target_view->maxImageRectWidth = source_view->maxImageRectWidth; 638 - target_view->recommendedImageRectHeight = source_view->recommendedImageRectHeight; 639 - target_view->maxImageRectHeight = source_view->maxImageRectHeight; 640 - target_view->recommendedSwapchainSampleCount = source_view->recommendedSwapchainSampleCount; 641 - target_view->maxSwapchainSampleCount = source_view->maxSwapchainSampleCount; 642 - // clang-format on 643 661 } 644 662 645 663 XrResult