ipc: 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>
This commit is contained in:
Rylie Pavlik 2021-04-09 16:31:52 -05:00
parent bc6a42441c
commit 13e023955c
2 changed files with 29 additions and 2 deletions

View file

@ -85,6 +85,11 @@ if(WIN32)
endif()
target_link_libraries(ipc_client PRIVATE aux_util ipc_shared)
if(ANDROID)
# Need android_instance_base on the client side too.
target_link_libraries(ipc_client PRIVATE aux_android)
endif()
###
# Server

View file

@ -54,8 +54,9 @@
#endif
#ifdef XRT_OS_ANDROID
#include "android/android_globals.h"
#include "xrt/xrt_android.h"
#include "android/ipc_client_android.h"
#include "android/android_instance_base.h"
#endif // XRT_OS_ANDROID
DEBUG_GET_ONCE_LOG_OPTION(ipc_log, "IPC_LOG", U_LOGGING_WARN)
@ -82,6 +83,10 @@ struct ipc_client_instance
struct xrt_device *xdevs[XRT_SYSTEM_MAX_DEVICES];
size_t xdev_count;
#ifdef XRT_OS_ANDROID
struct android_instance_base android;
#endif
};
static inline struct ipc_client_instance *
@ -232,6 +237,11 @@ ipc_client_instance_destroy(struct xrt_instance *xinst)
}
ii->xtrack_count = 0;
#ifdef XRT_OS_ANDROID
android_instance_base_cleanup(&(ii->android), xinst);
ipc_client_android_destroy(&(ii->ipc_c.ica));
#endif // XRT_OS_ANDROID
#ifdef XRT_OS_WINDOWS
timeEndPeriod(1);
#endif
@ -265,11 +275,23 @@ ipc_instance_create(const struct xrt_instance_info *i_info, struct xrt_instance
timeBeginPeriod(1);
#endif
xrt_result_t xret = ipc_client_connection_init(&ii->ipc_c, debug_get_log_option_ipc_log(), i_info);
xrt_result_t xret;
#ifdef XRT_OS_ANDROID
xret = android_instance_base_init(&ii->android, &ii->base, i_info);
if (xret != XRT_SUCCESS) {
free(ii);
return xret;
}
#endif
xret = ipc_client_connection_init(&ii->ipc_c, debug_get_log_option_ipc_log(), i_info);
if (xret != XRT_SUCCESS) {
#ifdef XRT_OS_ANDROID
android_instance_base_cleanup(&(ii->android), &(ii->base));
#endif
free(ii);
return xret;
}
uint32_t count = 0;
struct xrt_tracking_origin *xtrack = NULL;