The open source OpenXR runtime
0
fork

Configure Feed

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

st/oxr: Return if XR_SESSION_NOT_FOCUSED is not focused in xrSyncActions

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

+27 -6
+1 -5
src/xrt/state_trackers/oxr/oxr_api_action.c
··· 156 156 os_mutex_unlock(&sess->sys->sync_actions_mutex); 157 157 } 158 158 159 - if (syncInfo->countActiveActionSets == 0) { 160 - // nothing to do 161 - return XR_SUCCESS; 162 - } 163 - 164 159 for (uint32_t i = 0; i < syncInfo->countActiveActionSets; i++) { 165 160 struct oxr_action_set *act_set = NULL; 161 + 166 162 OXR_VERIFY_ACTIONSET_NOT_NULL(&log, syncInfo->activeActionSets[i].actionSet, act_set); 167 163 168 164 XrResult res = oxr_verify_subaction_path_sync(&log, sess->sys->inst, act_set,
+26 -1
src/xrt/state_trackers/oxr/oxr_input.c
··· 1 1 // Copyright 2018-2024, Collabora, Ltd. 2 - // Copyright 2023, NVIDIA CORPORATION. 2 + // Copyright 2023-2025, NVIDIA CORPORATION. 3 3 // SPDX-License-Identifier: BSL-1.0 4 4 /*! 5 5 * @file ··· 1862 1862 struct oxr_action_set *act_set = NULL; 1863 1863 struct oxr_action_set_attachment *act_set_attached = NULL; 1864 1864 1865 + /* 1866 + * No side-effects allowed in this section as we are still 1867 + * validating and checking for errors at this point. 1868 + */ 1869 + 1865 1870 // Check that all action sets has been attached. 1866 1871 for (uint32_t i = 0; i < countActionSets; i++) { 1867 1872 oxr_session_get_action_set_attachment(sess, actionSets[i].actionSet, &act_set_attached, &act_set); ··· 1871 1876 "not been attached to this session", 1872 1877 i, act_set != NULL ? act_set->data->name : "NULL"); 1873 1878 } 1879 + } 1880 + 1881 + /* 1882 + * Can only call this function if the session state is focused. This is 1883 + * not an error and has to be checked after all validation, but before 1884 + * any side-effects happens. 1885 + */ 1886 + if (sess->state != XR_SESSION_STATE_FOCUSED) { 1887 + return XR_SESSION_NOT_FOCUSED; 1888 + } 1889 + 1890 + /* 1891 + * Side-effects allowed below, but not validation. 1892 + */ 1893 + 1894 + if (countActionSets == 0) { 1895 + // Nothing to do. 1896 + return XR_SUCCESS; 1874 1897 } 1875 1898 1876 1899 // Synchronize outputs to this time. ··· 1922 1945 OXR_FOR_EACH_SUBACTION_PATH(ACCUMULATE_REQUESTED) 1923 1946 #undef ACCUMULATE_REQUESTED 1924 1947 } 1948 + 1949 + //! @TODO This validation is not allowed here, must done above. 1925 1950 if (!any_action_with_subactionpath) { 1926 1951 return oxr_error(log, XR_ERROR_PATH_UNSUPPORTED, 1927 1952 "No action with specified subactionpath in actionset");