The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

xrt: Replicate oxr view configs in xrt_system_compositor_info

Co-authored-by: Jakob Bornecrantz <tbornecrantz@nvidia.com>
Co-authored-by: Rafal Karp <rkarp@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2612>

+296 -123
+22 -9
src/xrt/compositor/main/comp_compositor.c
··· 1031 1031 1032 1032 COMP_DEBUG(c, "Doing init %p", (void *)c); 1033 1033 1034 - if (xdev->hmd->view_count == 0) { 1035 - U_LOG_E("Bug detected: HMD \"%s\" does not set xdev->hmd.view_count. Value must be > 0!", xdev->str); 1034 + uint32_t view_count = xdev->hmd->view_count; 1035 + enum xrt_view_type view_type = 0; // Invalid 1036 + 1037 + switch (view_count) { 1038 + case 0: 1039 + U_LOG_E("Bug detected: HMD \"%s\" xdev->hmd.view_count must be > 0!", xdev->str); 1036 1040 assert(xdev->hmd->view_count > 0); 1041 + break; 1042 + case 1: view_type = XRT_VIEW_TYPE_MONO; break; 1043 + case 2: view_type = XRT_VIEW_TYPE_STEREO; break; 1044 + default: 1045 + U_LOG_E("Bug detected: HMD \"%s\" xdev->hmd.view_count must be 1 or 2, not %u!", xdev->str, view_count); 1046 + assert(view_count == 1 && view_count == 2); 1047 + break; 1037 1048 } 1038 1049 1039 1050 // Do this as early as possible. ··· 1131 1142 sys_info->supports_fov_mutable = true; 1132 1143 1133 1144 // clang-format off 1134 - uint32_t view_count = xdev->hmd->view_count; 1135 1145 for (uint32_t i = 0; i < view_count; ++i) { 1136 1146 uint32_t w = (uint32_t)(xdev->hmd->views[i].display.w_pixels * scale); 1137 1147 uint32_t h = (uint32_t)(xdev->hmd->views[i].display.h_pixels * scale); 1138 1148 uint32_t w_2 = xdev->hmd->views[i].display.w_pixels * 2; 1139 1149 uint32_t h_2 = xdev->hmd->views[i].display.h_pixels * 2; 1140 1150 1141 - sys_info->views[i].recommended.width_pixels = w; 1142 - sys_info->views[i].recommended.height_pixels = h; 1143 - sys_info->views[i].recommended.sample_count = 1; 1144 - sys_info->views[i].max.width_pixels = w_2; 1145 - sys_info->views[i].max.height_pixels = h_2; 1146 - sys_info->views[i].max.sample_count = 1; 1151 + sys_info->view_configs[0].views[i].recommended.width_pixels = w; 1152 + sys_info->view_configs[0].views[i].recommended.height_pixels = h; 1153 + sys_info->view_configs[0].views[i].recommended.sample_count = 1; 1154 + sys_info->view_configs[0].views[i].max.width_pixels = w_2; 1155 + sys_info->view_configs[0].views[i].max.height_pixels = h_2; 1156 + sys_info->view_configs[0].views[i].max.sample_count = 1; 1147 1157 } 1148 1158 // clang-format on 1159 + sys_info->view_configs[0].view_type = view_type; 1160 + sys_info->view_configs[0].view_count = view_count; 1161 + sys_info->view_config_count = 1; // Only one view config for now. 1149 1162 1150 1163 // If we can add e.g. video pass-through capabilities, we may need to change (augment) this list. 1151 1164 // Just copying it directly right now.
+21 -7
src/xrt/compositor/null/null_compositor.c
··· 271 271 // Required by OpenXR spec. 272 272 sys_info->max_layers = XRT_MAX_LAYERS; 273 273 274 + uint32_t view_count = xdev->hmd->view_count; 275 + enum xrt_view_type view_type = 0; // Invalid 276 + 277 + switch (view_count) { 278 + case 0: U_LOG_E("Bug detected: HMD \"%s\" xdev->hmd.view_count must be > 0!", xdev->str); return false; 279 + case 1: view_type = XRT_VIEW_TYPE_MONO; break; 280 + case 2: view_type = XRT_VIEW_TYPE_STEREO; break; 281 + default: 282 + U_LOG_E("Bug detected: HMD \"%s\" xdev->hmd.view_count must be 1 or 2, not %u!", xdev->str, view_count); 283 + return false; 284 + } 285 + 274 286 // UUIDs and LUID already set in vk init. 275 287 (void)sys_info->compositor_vk_deviceUUID; 276 288 (void)sys_info->client_vk_deviceUUID; 277 289 (void)sys_info->client_d3d_deviceLUID; 278 290 (void)sys_info->client_d3d_deviceLUID_valid; 279 - uint32_t view_count = xdev->hmd->view_count; 280 291 // clang-format off 281 292 for (uint32_t i = 0; i < view_count; ++i) { 282 - sys_info->views[i].recommended.width_pixels = RECOMMENDED_VIEW_WIDTH; 283 - sys_info->views[i].recommended.height_pixels = RECOMMENDED_VIEW_HEIGHT; 284 - sys_info->views[i].recommended.sample_count = 1; 285 - sys_info->views[i].max.width_pixels = MAX_VIEW_WIDTH; 286 - sys_info->views[i].max.height_pixels = MAX_VIEW_HEIGHT; 287 - sys_info->views[i].max.sample_count = 1; 293 + sys_info->view_configs[0].views[i].recommended.width_pixels = RECOMMENDED_VIEW_WIDTH; 294 + sys_info->view_configs[0].views[i].recommended.height_pixels = RECOMMENDED_VIEW_HEIGHT; 295 + sys_info->view_configs[0].views[i].recommended.sample_count = 1; 296 + sys_info->view_configs[0].views[i].max.width_pixels = MAX_VIEW_WIDTH; 297 + sys_info->view_configs[0].views[i].max.height_pixels = MAX_VIEW_HEIGHT; 298 + sys_info->view_configs[0].views[i].max.sample_count = 1; 288 299 } 289 300 // clang-format on 301 + sys_info->view_configs[0].view_type = view_type; 302 + sys_info->view_configs[0].view_count = view_count; 303 + sys_info->view_config_count = 1; // Only one view config type supported. 290 304 291 305 // Copy the list directly. 292 306 assert(xdev->hmd->blend_mode_count <= XRT_MAX_DEVICE_BLEND_MODES);
+35 -16
src/xrt/include/xrt/xrt_compositor.h
··· 1 1 // Copyright 2019-2024, Collabora, Ltd. 2 + // Copyright 2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 2282 2283 *xcn_ptr = NULL; 2283 2284 } 2284 2285 2286 + /*! 2287 + * Holds information about the view configuration properties for a view in a system compositor. 2288 + */ 2289 + struct xrt_view_config_properties 2290 + { 2291 + struct 2292 + { 2293 + uint32_t width_pixels; 2294 + uint32_t height_pixels; 2295 + uint32_t sample_count; 2296 + } recommended; //!< Recommended for this view. 2297 + 2298 + struct 2299 + { 2300 + uint32_t width_pixels; 2301 + uint32_t height_pixels; 2302 + uint32_t sample_count; 2303 + } max; //!< Maximums for this view. 2304 + }; 2305 + 2306 + struct xrt_view_config 2307 + { 2308 + //! Which view type this is for, mono, stereo, quad_with_inset, etc... 2309 + enum xrt_view_type view_type; 2310 + 2311 + //! Must match the view_type, in the future view_types might have variable views. 2312 + uint32_t view_count; 2313 + 2314 + //! The per view information. 2315 + struct xrt_view_config_properties views[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_VIEW_COUNT]; 2316 + }; 2317 + 2285 2318 2286 2319 /* 2287 2320 * ··· 2295 2328 */ 2296 2329 struct xrt_system_compositor_info 2297 2330 { 2298 - struct 2299 - { 2300 - struct 2301 - { 2302 - uint32_t width_pixels; 2303 - uint32_t height_pixels; 2304 - uint32_t sample_count; 2305 - } recommended; //!< Recommended for this view. 2306 - 2307 - struct 2308 - { 2309 - uint32_t width_pixels; 2310 - uint32_t height_pixels; 2311 - uint32_t sample_count; 2312 - } max; //!< Maximums for this view. 2313 - } views[XRT_MAX_VIEWS]; //!< View configuration information. 2331 + uint32_t view_config_count; 2332 + struct xrt_view_config view_configs[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_COUNT]; 2314 2333 2315 2334 //! Maximum number of composition layers supported, never changes. 2316 2335 uint32_t max_layers;
+11
src/xrt/include/xrt/xrt_limits.h
··· 1 1 // Copyright 2019-2022, Collabora, Ltd. 2 + // Copyright 2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 20 21 * Max number of views supported by a compositor, artificial limit. 21 22 */ 22 23 #define XRT_MAX_VIEWS 2 24 + 25 + /* 26 + * System needs to support at least 4 views for stereo with foveated inset. 27 + */ 28 + #define XRT_MAX_COMPOSITOR_VIEW_CONFIGS_VIEW_COUNT (XRT_MAX_VIEWS > 4 ? XRT_MAX_VIEWS : 4) 29 + 30 + /* 31 + * Max number of view configurations a system compositor can support simultaneously. 32 + */ 33 + #define XRT_MAX_COMPOSITOR_VIEW_CONFIGS_COUNT 2 23 34 24 35 /*! 25 36 * Maximum number of handles sent in one call.
+3 -1
src/xrt/state_trackers/oxr/oxr_api_swapchain.c
··· 165 165 } 166 166 167 167 // TODO Find the max of the views[0].max.sample_count limits. 168 - uint32_t max_sample_count = xsysc_info->views[0].max.sample_count; 168 + assert(xsysc_info->view_config_count > 0); 169 + assert(xsysc_info->view_configs[0].view_count > 0); 170 + uint32_t max_sample_count = xsysc_info->view_configs[0].views[0].max.sample_count; 169 171 170 172 if (createInfo->sampleCount > max_sample_count) { 171 173 return oxr_error(&log, XR_ERROR_VALIDATION_FAILURE,
+1
src/xrt/state_trackers/oxr/oxr_api_verify.h
··· 23 23 struct oxr_action_set; 24 24 struct oxr_extension_status; 25 25 struct oxr_instance; 26 + struct oxr_system; 26 27 struct oxr_logger; 27 28 struct oxr_subaction_paths; 28 29
+22
src/xrt/state_trackers/oxr/oxr_conversions.h
··· 16 16 #include "xrt/xrt_vulkan_includes.h" 17 17 #include "xrt/xrt_openxr_includes.h" 18 18 19 + #include "oxr_defines.h" 20 + 19 21 20 22 /* 21 23 * ··· 344 346 .position = xrt_vec3_to_xr(&q->position), 345 347 }; 346 348 } 349 + 350 + 351 + /* 352 + * 353 + * View things 354 + * 355 + */ 356 + 357 + static inline XrViewConfigurationType 358 + xrt_view_type_to_xr(enum xrt_view_type view_type) 359 + { 360 + switch (view_type) { 361 + case XRT_VIEW_TYPE_MONO: return XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO; 362 + case XRT_VIEW_TYPE_STEREO: return XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO; 363 + } 364 + 365 + // Used as default, to get warnings. 366 + assert(false && "Invalid view type"); 367 + return XR_VIEW_CONFIGURATION_TYPE_MAX_ENUM; 368 + }
+18 -4
src/xrt/state_trackers/oxr/oxr_objects.h
··· 1482 1482 }; 1483 1483 1484 1484 /*! 1485 + * Holds the properties that a system supports for a view configuration type. 1486 + * 1487 + * @relates oxr_system 1488 + */ 1489 + struct oxr_view_config_properties 1490 + { 1491 + XrViewConfigurationType view_config_type; 1492 + 1493 + uint32_t view_count; 1494 + XrViewConfigurationView views[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_VIEW_COUNT]; 1495 + 1496 + uint32_t blend_mode_count; 1497 + XrEnvironmentBlendMode blend_modes[3]; 1498 + }; 1499 + 1500 + /*! 1485 1501 * Single or multiple devices grouped together to form a system that sessions 1486 1502 * can be created from. Might need to open devices to get all 1487 1503 * properties from it, but shouldn't. ··· 1513 1529 //! Have the client application called the gfx api requirements func? 1514 1530 bool gotten_requirements; 1515 1531 1516 - XrViewConfigurationType view_config_type; 1517 - XrViewConfigurationView views[2]; 1518 - uint32_t blend_mode_count; 1519 - XrEnvironmentBlendMode blend_modes[3]; 1532 + uint32_t view_config_count; 1533 + struct oxr_view_config_properties view_configs[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_COUNT]; 1520 1534 1521 1535 XrReferenceSpaceType reference_spaces[5]; 1522 1536 uint32_t reference_space_count;
+9 -2
src/xrt/state_trackers/oxr/oxr_session.c
··· 558 558 break; 559 559 case XRT_SESSION_EVENT_VISIBILITY_MASK_CHANGE: 560 560 #ifdef OXR_HAVE_KHR_visibility_mask 561 - oxr_event_push_XrEventDataVisibilityMaskChangedKHR(log, sess, sess->sys->view_config_type, 562 - xse.mask_change.view_index); 561 + // Assume mask changed for all view configuration types. 562 + for (uint32_t i = 0; i < sess->sys->view_config_count; i++) { 563 + struct oxr_view_config_properties *props = &sess->sys->view_configs[i]; 564 + oxr_event_push_XrEventDataVisibilityMaskChangedKHR( // 565 + log, // 566 + sess, // 567 + props->view_config_type, // 568 + xse.mask_change.view_index); // 569 + } 563 570 break; 564 571 #endif // OXR_HAVE_KHR_visibility_mask 565 572 case XRT_SESSION_EVENT_USER_PRESENCE_CHANGE:
+134 -70
src/xrt/state_trackers/oxr/oxr_system.c
··· 18 18 #include "util/u_debug.h" 19 19 #include "util/u_verify.h" 20 20 21 + #include "oxr_api_verify.h" 22 + #include "oxr_chain.h" 23 + #include "oxr_conversions.h" 21 24 #include "oxr_objects.h" 22 25 #include "oxr_logger.h" 23 26 #include "oxr_two_call.h" 24 - #include "oxr_chain.h" 25 - #include "oxr_api_verify.h" 26 - #include "oxr_conversions.h" 27 27 28 28 29 29 /* ··· 36 36 37 37 38 38 39 + static struct oxr_view_config_properties * 40 + get_view_config_properties(struct oxr_system *sys, XrViewConfigurationType view_config_type) 41 + { 42 + for (uint32_t i = 0; i < sys->view_config_count; i++) { 43 + if (sys->view_configs[i].view_config_type == view_config_type) { 44 + return &sys->view_configs[i]; 45 + } 46 + } 47 + 48 + return NULL; 49 + } 50 + 51 + static void 52 + fill_in_view_config_properties_blend_modes(struct oxr_view_config_properties *props, 53 + const struct xrt_system_compositor_info *info) 54 + { 55 + // Headless path. 56 + if (info == NULL) { 57 + props->blend_modes[0] = XR_ENVIRONMENT_BLEND_MODE_OPAQUE; 58 + props->blend_mode_count = 1; 59 + return; 60 + } 61 + 62 + assert(info->supported_blend_mode_count <= ARRAY_SIZE(props->blend_modes)); 63 + assert(info->supported_blend_mode_count != 0); 64 + 65 + for (uint8_t i = 0; i < info->supported_blend_mode_count; i++) { 66 + assert(u_verify_blend_mode_valid(info->supported_blend_modes[i])); 67 + props->blend_modes[i] = (XrEnvironmentBlendMode)info->supported_blend_modes[i]; 68 + } 69 + props->blend_mode_count = (uint32_t)info->supported_blend_mode_count; 70 + } 71 + 72 + static void 73 + fill_in_view_config_properties_view_config_type(struct oxr_view_config_properties *props, enum xrt_view_type view_type) 74 + { 75 + props->view_config_type = xrt_view_type_to_xr(view_type); 76 + U_LOG_D("props->view_config_type = %d", props->view_config_type); 77 + } 78 + 79 + static void 80 + fill_in_view_config_properties_views(struct oxr_logger *log, 81 + XrViewConfigurationView *xr_views, 82 + const struct xrt_view_config *view_config) 83 + { 84 + assert(view_config->view_count <= XRT_MAX_COMPOSITOR_VIEW_CONFIGS_VIEW_COUNT); 85 + 86 + double scale = debug_get_num_option_scale_percentage() / 100.0; 87 + if (scale > 2.0) { 88 + scale = 2.0; 89 + oxr_log(log, "Clamped scale to 200%%\n"); 90 + } 91 + 92 + #define imin(a, b) (a < b ? a : b) 93 + for (uint32_t i = 0; i < view_config->view_count; ++i) { 94 + uint32_t w = (uint32_t)(view_config->views[i].recommended.width_pixels * scale); 95 + uint32_t h = (uint32_t)(view_config->views[i].recommended.height_pixels * scale); 96 + uint32_t w_2 = view_config->views[i].max.width_pixels; 97 + uint32_t h_2 = view_config->views[i].max.height_pixels; 98 + 99 + w = imin(w, w_2); 100 + h = imin(h, h_2); 101 + 102 + xr_views[i].type = XR_TYPE_VIEW_CONFIGURATION_VIEW; 103 + xr_views[i].recommendedImageRectWidth = w; 104 + xr_views[i].maxImageRectWidth = w_2; 105 + xr_views[i].recommendedImageRectHeight = h; 106 + xr_views[i].maxImageRectHeight = h_2; 107 + xr_views[i].recommendedSwapchainSampleCount = view_config->views[i].recommended.sample_count; 108 + xr_views[i].maxSwapchainSampleCount = view_config->views[i].max.sample_count; 109 + } 110 + #undef imin 111 + } 112 + 113 + static void 114 + fill_in_view_config_properties(struct oxr_logger *log, 115 + struct oxr_view_config_properties *props, 116 + const struct xrt_system_compositor_info *info, 117 + const struct xrt_view_config *view_config) 118 + { 119 + fill_in_view_config_properties_blend_modes(props, info); 120 + fill_in_view_config_properties_view_config_type(props, view_config->view_type); 121 + fill_in_view_config_properties_views(log, props->views, view_config); 122 + props->view_count = view_config->view_count; 123 + } 124 + 39 125 static bool 40 126 oxr_system_matches(struct oxr_logger *log, struct oxr_system *sys, XrFormFactor form_factor) 41 127 { ··· 68 154 * Two-call helpers. 69 155 * 70 156 */ 157 + 158 + static void 159 + view_configuration_type_fill_in(XrViewConfigurationType *target, struct oxr_view_config_properties *source) 160 + { 161 + *target = source->view_config_type; 162 + } 71 163 72 164 static void 73 165 view_configuration_view_fill_in(XrViewConfigurationView *target_view, XrViewConfigurationView *source_view) ··· 159 251 160 252 sys->inst = inst; 161 253 sys->systemId = systemId; 162 - if (view_count == 1) { 163 - sys->view_config_type = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO; 164 - } else if (view_count == 2) { 165 - sys->view_config_type = XR_VIEW_CONFIGURATION_TYPE_PRIMARY_STEREO; 166 - } else { 167 - assert(false && "view_count must be 1 or 2"); 168 - } 169 - U_LOG_D("sys->view_config_type = %d", sys->view_config_type); 170 254 sys->dynamic_roles_cache = (struct xrt_system_roles)XRT_SYSTEM_ROLES_INIT; 171 255 172 256 #ifdef XR_USE_GRAPHICS_API_VULKAN ··· 179 263 sys->suggested_d3d_luid_valid = false; 180 264 #endif 181 265 182 - // Headless. 183 - if (sys->xsysc == NULL) { 184 - sys->blend_modes[0] = XR_ENVIRONMENT_BLEND_MODE_OPAQUE; 185 - sys->blend_mode_count = 1; 186 - return XR_SUCCESS; 187 - } 188 - 189 - double scale = debug_get_num_option_scale_percentage() / 100.0; 190 - if (scale > 2.0) { 191 - scale = 2.0; 192 - oxr_log(log, "Clamped scale to 200%%\n"); 193 - } 194 - 195 - struct xrt_system_compositor_info *info = &sys->xsysc->info; 196 - 197 - #define imin(a, b) (a < b ? a : b) 198 - for (uint32_t i = 0; i < view_count; ++i) { 199 - uint32_t w = (uint32_t)(info->views[i].recommended.width_pixels * scale); 200 - uint32_t h = (uint32_t)(info->views[i].recommended.height_pixels * scale); 201 - uint32_t w_2 = info->views[i].max.width_pixels; 202 - uint32_t h_2 = info->views[i].max.height_pixels; 266 + if (sys->xsysc != NULL) { 267 + const struct xrt_system_compositor_info *info = &sys->xsysc->info; 203 268 204 - w = imin(w, w_2); 205 - h = imin(h, h_2); 269 + for (uint32_t i = 0; i < info->view_config_count; i++) { 270 + const struct xrt_view_config *view_config = &info->view_configs[i]; 206 271 207 - sys->views[i].recommendedImageRectWidth = w; 208 - sys->views[i].maxImageRectWidth = w_2; 209 - sys->views[i].recommendedImageRectHeight = h; 210 - sys->views[i].maxImageRectHeight = h_2; 211 - sys->views[i].recommendedSwapchainSampleCount = info->views[i].recommended.sample_count; 212 - sys->views[i].maxSwapchainSampleCount = info->views[i].max.sample_count; 213 - } 214 - 215 - #undef imin 216 - 217 - 218 - /* 219 - * Blend mode support. 220 - */ 272 + assert(sys->view_config_count < XRT_MAX_COMPOSITOR_VIEW_CONFIGS_COUNT); 273 + fill_in_view_config_properties( // 274 + log, // 275 + &sys->view_configs[sys->view_config_count], // 276 + info, // 277 + view_config); // 278 + sys->view_config_count++; 279 + } 280 + } else { 281 + // Headless path, view configs contain no views but still need blend modes and view types. 282 + assert(view_count == 1 || view_count == 2); 221 283 222 - assert(info->supported_blend_mode_count <= ARRAY_SIZE(sys->blend_modes)); 223 - assert(info->supported_blend_mode_count != 0); 284 + enum xrt_view_type view_type = view_count == 1 ? XRT_VIEW_TYPE_MONO : XRT_VIEW_TYPE_STEREO; 224 285 225 - for (uint8_t i = 0; i < info->supported_blend_mode_count; i++) { 226 - assert(u_verify_blend_mode_valid(info->supported_blend_modes[i])); 227 - sys->blend_modes[i] = (XrEnvironmentBlendMode)info->supported_blend_modes[i]; 286 + // First headless config: regular mono or stereo 287 + fill_in_view_config_properties_blend_modes(&sys->view_configs[0], NULL); 288 + fill_in_view_config_properties_view_config_type(&sys->view_configs[0], view_type); 289 + sys->view_config_count++; 228 290 } 229 - sys->blend_mode_count = (uint32_t)info->supported_blend_mode_count; 230 291 231 292 232 293 /* ··· 627 688 uint32_t *viewConfigurationTypeCountOutput, 628 689 XrViewConfigurationType *viewConfigurationTypes) 629 690 { 630 - OXR_TWO_CALL_HELPER(log, viewConfigurationTypeCapacityInput, viewConfigurationTypeCountOutput, 631 - viewConfigurationTypes, 1, &sys->view_config_type, XR_SUCCESS); 691 + OXR_TWO_CALL_FILL_IN_HELPER(log, viewConfigurationTypeCapacityInput, viewConfigurationTypeCountOutput, 692 + viewConfigurationTypes, sys->view_config_count, view_configuration_type_fill_in, 693 + sys->view_configs, XR_SUCCESS); 632 694 } 633 695 634 696 XrResult ··· 639 701 uint32_t *environmentBlendModeCountOutput, 640 702 XrEnvironmentBlendMode *environmentBlendModes) 641 703 { 642 - //! @todo Take into account viewConfigurationType 704 + struct oxr_view_config_properties *props = get_view_config_properties(sys, viewConfigurationType); 705 + if (props == NULL) { 706 + return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "Didn't find view configs"); 707 + } 708 + 643 709 OXR_TWO_CALL_HELPER(log, environmentBlendModeCapacityInput, environmentBlendModeCountOutput, 644 - environmentBlendModes, sys->blend_mode_count, sys->blend_modes, XR_SUCCESS); 710 + environmentBlendModes, props->blend_mode_count, props->blend_modes, XR_SUCCESS); 645 711 } 646 712 647 713 XrResult ··· 650 716 XrViewConfigurationType viewConfigurationType, 651 717 XrViewConfigurationProperties *configurationProperties) 652 718 { 653 - if (viewConfigurationType != sys->view_config_type) { 654 - return oxr_error(log, XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED, "Invalid view configuration type"); 719 + struct oxr_view_config_properties *props = get_view_config_properties(sys, viewConfigurationType); 720 + if (props == NULL) { 721 + return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "Didn't find view configs"); 655 722 } 656 723 657 - configurationProperties->viewConfigurationType = sys->view_config_type; 724 + configurationProperties->viewConfigurationType = props->view_config_type; 658 725 configurationProperties->fovMutable = sys->xsysc->info.supports_fov_mutable; 659 726 660 727 return XR_SUCCESS; ··· 668 735 uint32_t *viewCountOutput, 669 736 XrViewConfigurationView *views) 670 737 { 671 - if (viewConfigurationType != sys->view_config_type) { 672 - return oxr_error(log, XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED, "Invalid view configuration type"); 738 + struct oxr_view_config_properties *props = get_view_config_properties(sys, viewConfigurationType); 739 + if (props == NULL) { 740 + return oxr_error(log, XR_ERROR_RUNTIME_FAILURE, "Didn't find view configs"); 673 741 } 674 - if (sys->view_config_type == XR_VIEW_CONFIGURATION_TYPE_PRIMARY_MONO) { 675 - OXR_TWO_CALL_FILL_IN_HELPER(log, viewCapacityInput, viewCountOutput, views, 1, 676 - view_configuration_view_fill_in, sys->views, XR_SUCCESS); 677 - } else { 678 - OXR_TWO_CALL_FILL_IN_HELPER(log, viewCapacityInput, viewCountOutput, views, 2, 679 - view_configuration_view_fill_in, sys->views, XR_SUCCESS); 680 - } 742 + 743 + OXR_TWO_CALL_FILL_IN_HELPER(log, viewCapacityInput, viewCountOutput, views, props->view_count, 744 + view_configuration_view_fill_in, props->views, XR_SUCCESS); 681 745 }
+5 -2
src/xrt/state_trackers/oxr/oxr_verify.c
··· 464 464 XrViewConfigurationType view_conf, 465 465 const char *view_conf_name) 466 466 { 467 - if (sys->view_config_type == view_conf) { 468 - return XR_SUCCESS; 467 + for (uint32_t i = 0; i < sys->view_config_count; i++) { 468 + struct oxr_view_config_properties *props = &sys->view_configs[i]; 469 + if (props->view_config_type == view_conf) { 470 + return XR_SUCCESS; 471 + } 469 472 } 470 473 471 474 return oxr_error(log, XR_ERROR_VIEW_CONFIGURATION_TYPE_UNSUPPORTED,
+15 -12
src/xrt/targets/sdl_test/sdl_compositor.c
··· 277 277 } 278 278 279 279 // clang-format off 280 - sys_info->views[0].recommended.width_pixels = w; 281 - sys_info->views[0].recommended.height_pixels = h; 282 - sys_info->views[0].recommended.sample_count = 1; 283 - sys_info->views[0].max.width_pixels = max; 284 - sys_info->views[0].max.height_pixels = max; 285 - sys_info->views[0].max.sample_count = 1; 280 + sys_info->view_configs[0].view_type = XRT_VIEW_TYPE_STEREO; 281 + sys_info->view_configs[0].view_count = 2; 282 + 283 + sys_info->view_configs[0].views[0].recommended.width_pixels = w; 284 + sys_info->view_configs[0].views[0].recommended.height_pixels = h; 285 + sys_info->view_configs[0].views[0].recommended.sample_count = 1; 286 + sys_info->view_configs[0].views[0].max.width_pixels = max; 287 + sys_info->view_configs[0].views[0].max.height_pixels = max; 288 + sys_info->view_configs[0].views[0].max.sample_count = 1; 286 289 287 - sys_info->views[1].recommended.width_pixels = min; // Second view is minimum 288 - sys_info->views[1].recommended.height_pixels = min; // Second view is minimum 289 - sys_info->views[1].recommended.sample_count = 1; 290 - sys_info->views[1].max.width_pixels = max; 291 - sys_info->views[1].max.height_pixels = max; 292 - sys_info->views[1].max.sample_count = 1; 290 + sys_info->view_configs[0].views[1].recommended.width_pixels = min; // Second view is minimum 291 + sys_info->view_configs[0].views[1].recommended.height_pixels = min; // Second view is minimum 292 + sys_info->view_configs[0].views[1].recommended.sample_count = 1; 293 + sys_info->view_configs[0].views[1].max.width_pixels = max; 294 + sys_info->view_configs[0].views[1].max.height_pixels = max; 295 + sys_info->view_configs[0].views[1].max.sample_count = 1; 293 296 // clang-format on 294 297 295 298 // Copy the list directly.