mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-29 18:08:29 +00:00
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>
This commit is contained in:
parent
28ec3246eb
commit
bc6a42441c
|
@ -242,3 +242,12 @@ target_link_libraries(
|
|||
drv_includes
|
||||
)
|
||||
target_include_directories(target_instance_no_comp PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
####
|
||||
# Platform
|
||||
|
||||
if(ANDROID)
|
||||
target_link_libraries(target_instance PRIVATE aux_android)
|
||||
|
||||
target_link_libraries(target_instance_no_comp PRIVATE aux_android)
|
||||
endif()
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
// Copyright 2020-2023, Collabora, Ltd.
|
||||
// Copyright 2020-2024, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Shared default implementation of the instance with compositor.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @author Rylie Pavlik <rylie.pavlik@collabora.com>
|
||||
*/
|
||||
|
||||
#include "xrt/xrt_space.h"
|
||||
#include "xrt/xrt_system.h"
|
||||
#include "xrt/xrt_config_build.h"
|
||||
#include "xrt/xrt_config_os.h"
|
||||
|
||||
|
||||
#include "os/os_time.h"
|
||||
|
||||
|
@ -25,6 +28,9 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef XRT_OS_ANDROID
|
||||
#include "android/android_instance_base.h"
|
||||
#endif
|
||||
|
||||
#ifdef XRT_MODULE_COMPOSITOR_MAIN
|
||||
#define USE_NULL_DEFAULT (false)
|
||||
|
@ -169,6 +175,17 @@ xrt_instance_create(struct xrt_instance_info *ii, struct xrt_instance **out_xins
|
|||
|
||||
tinst->base.startup_timestamp = os_monotonic_get_ns();
|
||||
|
||||
#ifdef XRT_OS_ANDROID
|
||||
if (ii != NULL) {
|
||||
ret = android_instance_base_init(&tinst->android, &tinst->base, ii);
|
||||
if (ret < 0) {
|
||||
xrt_prober_destroy(&xp);
|
||||
free(tinst);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
#endif // XRT_OS_ANDROID
|
||||
|
||||
*out_xinst = &tinst->base;
|
||||
|
||||
return XRT_SUCCESS;
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
// Copyright 2020-2023, Collabora, Ltd.
|
||||
// Copyright 2020-2024, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Shared default implementation of the instance, but with no compositor
|
||||
* usage
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @author Rylie Pavlik <rylie.pavlik@collabora.com>
|
||||
*/
|
||||
|
||||
#include "xrt/xrt_system.h"
|
||||
#include "xrt/xrt_config_os.h"
|
||||
|
||||
#include "util/u_system.h"
|
||||
#include "util/u_trace_marker.h"
|
||||
|
@ -17,6 +19,9 @@
|
|||
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef XRT_OS_ANDROID
|
||||
#include "android/android_instance_base.h"
|
||||
#endif
|
||||
|
||||
static xrt_result_t
|
||||
t_instance_create_system(struct xrt_instance *xinst,
|
||||
|
@ -89,6 +94,15 @@ xrt_instance_create(struct xrt_instance_info *ii, struct xrt_instance **out_xins
|
|||
tinst->base.destroy = t_instance_destroy;
|
||||
tinst->xp = xp;
|
||||
|
||||
#ifdef XRT_OS_ANDROID
|
||||
ret = android_instance_base_init(&tinst->android, &tinst->base, ii);
|
||||
if (ret < 0) {
|
||||
xrt_prober_destroy(&xp);
|
||||
free(tinst);
|
||||
return ret;
|
||||
}
|
||||
#endif // XRT_OS_ANDROID
|
||||
|
||||
*out_xinst = &tinst->base;
|
||||
|
||||
return XRT_SUCCESS;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
// Copyright 2020, Collabora, Ltd.
|
||||
// Copyright 2020-2024, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
* @brief Shared default implementation of the instance: pieces that are used
|
||||
* whether or not there's a compositor.
|
||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||
* @author Rylie Pavlik <rylie.pavlik@collabora.com>
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
|
@ -12,10 +13,17 @@
|
|||
|
||||
#include "xrt/xrt_prober.h"
|
||||
#include "xrt/xrt_instance.h"
|
||||
#include "xrt/xrt_config_os.h"
|
||||
#ifdef XRT_OS_ANDROID
|
||||
#include "xrt/xrt_android.h"
|
||||
#endif // XRT_OS_ANDROID
|
||||
|
||||
#include "util/u_misc.h"
|
||||
#include "util/u_trace_marker.h"
|
||||
|
||||
#ifdef XRT_OS_ANDROID
|
||||
#include "android/android_instance_base.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
*
|
||||
|
@ -34,6 +42,9 @@ struct t_instance
|
|||
{
|
||||
struct xrt_instance base;
|
||||
struct xrt_prober *xp;
|
||||
#ifdef XRT_OS_ANDROID
|
||||
struct android_instance_base android;
|
||||
#endif
|
||||
};
|
||||
|
||||
static inline struct t_instance *
|
||||
|
@ -73,5 +84,10 @@ t_instance_destroy(struct xrt_instance *xinst)
|
|||
struct t_instance *tinst = t_instance(xinst);
|
||||
|
||||
xrt_prober_destroy(&tinst->xp);
|
||||
|
||||
#ifdef XRT_OS_ANDROID
|
||||
android_instance_base_cleanup(&tinst->android, xinst);
|
||||
#endif // XRT_OS_ANDROID
|
||||
|
||||
free(tinst);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue