The open source OpenXR runtime
0
fork

Configure Feed

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

t/common: Create android_instance_base if required.

Co-authored-by: Jarvis Huang <quic_jarvhuan@quicinc.com>
Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/1655>

+59 -3
+9
src/xrt/targets/common/CMakeLists.txt
··· 242 242 drv_includes 243 243 ) 244 244 target_include_directories(target_instance_no_comp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) 245 + 246 + #### 247 + # Platform 248 + 249 + if(ANDROID) 250 + target_link_libraries(target_instance PRIVATE aux_android) 251 + 252 + target_link_libraries(target_instance_no_comp PRIVATE aux_android) 253 + endif()
+18 -1
src/xrt/targets/common/target_instance.c
··· 1 - // Copyright 2020-2023, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief Shared default implementation of the instance with compositor. 6 6 * @author Jakob Bornecrantz <jakob@collabora.com> 7 + * @author Rylie Pavlik <rylie.pavlik@collabora.com> 7 8 */ 8 9 9 10 #include "xrt/xrt_space.h" 10 11 #include "xrt/xrt_system.h" 11 12 #include "xrt/xrt_config_build.h" 13 + #include "xrt/xrt_config_os.h" 14 + 12 15 13 16 #include "os/os_time.h" 14 17 ··· 25 28 26 29 #include <assert.h> 27 30 31 + #ifdef XRT_OS_ANDROID 32 + #include "android/android_instance_base.h" 33 + #endif 28 34 29 35 #ifdef XRT_MODULE_COMPOSITOR_MAIN 30 36 #define USE_NULL_DEFAULT (false) ··· 168 174 tinst->xp = xp; 169 175 170 176 tinst->base.startup_timestamp = os_monotonic_get_ns(); 177 + 178 + #ifdef XRT_OS_ANDROID 179 + if (ii != NULL) { 180 + ret = android_instance_base_init(&tinst->android, &tinst->base, ii); 181 + if (ret < 0) { 182 + xrt_prober_destroy(&xp); 183 + free(tinst); 184 + return ret; 185 + } 186 + } 187 + #endif // XRT_OS_ANDROID 171 188 172 189 *out_xinst = &tinst->base; 173 190
+15 -1
src/xrt/targets/common/target_instance_no_comp.c
··· 1 - // Copyright 2020-2023, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief Shared default implementation of the instance, but with no compositor 6 6 * usage 7 7 * @author Jakob Bornecrantz <jakob@collabora.com> 8 + * @author Rylie Pavlik <rylie.pavlik@collabora.com> 8 9 */ 9 10 10 11 #include "xrt/xrt_system.h" 12 + #include "xrt/xrt_config_os.h" 11 13 12 14 #include "util/u_system.h" 13 15 #include "util/u_trace_marker.h" ··· 17 19 18 20 #include <assert.h> 19 21 22 + #ifdef XRT_OS_ANDROID 23 + #include "android/android_instance_base.h" 24 + #endif 20 25 21 26 static xrt_result_t 22 27 t_instance_create_system(struct xrt_instance *xinst, ··· 88 93 tinst->base.get_prober = t_instance_get_prober; 89 94 tinst->base.destroy = t_instance_destroy; 90 95 tinst->xp = xp; 96 + 97 + #ifdef XRT_OS_ANDROID 98 + ret = android_instance_base_init(&tinst->android, &tinst->base, ii); 99 + if (ret < 0) { 100 + xrt_prober_destroy(&xp); 101 + free(tinst); 102 + return ret; 103 + } 104 + #endif // XRT_OS_ANDROID 91 105 92 106 *out_xinst = &tinst->base; 93 107
+17 -1
src/xrt/targets/common/target_instance_parts.h
··· 1 - // Copyright 2020, Collabora, Ltd. 1 + // Copyright 2020-2024, Collabora, Ltd. 2 2 // SPDX-License-Identifier: BSL-1.0 3 3 /*! 4 4 * @file 5 5 * @brief Shared default implementation of the instance: pieces that are used 6 6 * whether or not there's a compositor. 7 7 * @author Jakob Bornecrantz <jakob@collabora.com> 8 + * @author Rylie Pavlik <rylie.pavlik@collabora.com> 8 9 */ 9 10 #pragma once 10 11 ··· 12 13 13 14 #include "xrt/xrt_prober.h" 14 15 #include "xrt/xrt_instance.h" 16 + #include "xrt/xrt_config_os.h" 17 + #ifdef XRT_OS_ANDROID 18 + #include "xrt/xrt_android.h" 19 + #endif // XRT_OS_ANDROID 15 20 16 21 #include "util/u_misc.h" 17 22 #include "util/u_trace_marker.h" 18 23 24 + #ifdef XRT_OS_ANDROID 25 + #include "android/android_instance_base.h" 26 + #endif 19 27 20 28 /* 21 29 * ··· 34 42 { 35 43 struct xrt_instance base; 36 44 struct xrt_prober *xp; 45 + #ifdef XRT_OS_ANDROID 46 + struct android_instance_base android; 47 + #endif 37 48 }; 38 49 39 50 static inline struct t_instance * ··· 73 84 struct t_instance *tinst = t_instance(xinst); 74 85 75 86 xrt_prober_destroy(&tinst->xp); 87 + 88 + #ifdef XRT_OS_ANDROID 89 + android_instance_base_cleanup(&tinst->android, xinst); 90 + #endif // XRT_OS_ANDROID 91 + 76 92 free(tinst); 77 93 }