2020-04-11 00:28:35 +00:00
|
|
|
// Copyright 2020, Collabora, Ltd.
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
|
|
|
* @brief Common client side code.
|
|
|
|
* @author Pete Black <pblack@collabora.com>
|
|
|
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
|
|
|
* @ingroup ipc_client
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "xrt/xrt_compiler.h"
|
2020-11-09 21:24:39 +00:00
|
|
|
#include "xrt/xrt_config_os.h"
|
2020-10-29 13:40:43 +00:00
|
|
|
#include "shared/ipc_protocol.h"
|
|
|
|
#include "shared/ipc_utils.h"
|
2020-04-11 00:28:35 +00:00
|
|
|
|
2020-05-01 14:11:26 +00:00
|
|
|
#include "util/u_threading.h"
|
2020-11-12 14:01:34 +00:00
|
|
|
#include "util/u_logging.h"
|
2020-05-01 14:11:26 +00:00
|
|
|
|
2020-04-11 00:28:35 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Logging
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-11-12 14:01:34 +00:00
|
|
|
#define IPC_TRACE(d, ...) U_LOG_IFL_T(d->ll, __VA_ARGS__)
|
|
|
|
#define IPC_DEBUG(d, ...) U_LOG_IFL_D(d->ll, __VA_ARGS__)
|
|
|
|
#define IPC_INFO(d, ...) U_LOG_IFL_I(d->ll, __VA_ARGS__)
|
|
|
|
#define IPC_WARN(d, ...) U_LOG_IFL_W(d->ll, __VA_ARGS__)
|
|
|
|
#define IPC_ERROR(d, ...) U_LOG_IFL_E(d->ll, __VA_ARGS__)
|
2020-04-11 00:28:35 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Structs
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-07-14 22:13:07 +00:00
|
|
|
struct xrt_compositor_native;
|
2020-04-11 00:28:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* Connection.
|
|
|
|
*/
|
2020-07-07 17:24:52 +00:00
|
|
|
struct ipc_connection
|
2020-04-11 00:28:35 +00:00
|
|
|
{
|
2020-07-07 22:56:40 +00:00
|
|
|
struct ipc_message_channel imc;
|
2020-04-11 00:28:35 +00:00
|
|
|
|
|
|
|
struct ipc_shared_memory *ism;
|
2020-07-16 16:22:40 +00:00
|
|
|
xrt_shmem_handle_t ism_handle;
|
2020-04-11 00:28:35 +00:00
|
|
|
|
2020-05-01 14:11:26 +00:00
|
|
|
struct os_mutex mutex;
|
2020-11-09 21:24:39 +00:00
|
|
|
|
|
|
|
#ifdef XRT_OS_ANDROID
|
|
|
|
struct ipc_client_android *ica;
|
|
|
|
#endif // XRT_OS_ANDROID
|
2020-05-01 14:11:26 +00:00
|
|
|
|
2020-11-12 14:01:34 +00:00
|
|
|
enum u_logging_level ll;
|
2020-07-07 17:24:52 +00:00
|
|
|
};
|
2020-04-11 00:28:35 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Internal functions.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2020-08-19 20:38:23 +00:00
|
|
|
/*!
|
2021-01-12 19:25:16 +00:00
|
|
|
* Create an IPC client system compositor.
|
2020-08-19 20:38:23 +00:00
|
|
|
*
|
|
|
|
* @param ipc_c IPC connection
|
|
|
|
* @param xina Optional native image allocator for client-side allocation. Takes
|
|
|
|
* ownership if one is supplied.
|
|
|
|
* @param xdev Taken in but not used currently @todo remove this param?
|
2021-02-01 17:34:08 +00:00
|
|
|
* @param[out] out_xcs Pointer to receive the created xrt_system_compositor.
|
2020-08-19 20:38:23 +00:00
|
|
|
*/
|
2020-04-11 00:28:35 +00:00
|
|
|
int
|
2021-01-12 19:25:16 +00:00
|
|
|
ipc_client_create_system_compositor(struct ipc_connection *ipc_c,
|
|
|
|
struct xrt_image_native_allocator *xina,
|
|
|
|
struct xrt_device *xdev,
|
|
|
|
struct xrt_system_compositor **out_xcs);
|
2020-04-11 00:28:35 +00:00
|
|
|
|
|
|
|
struct xrt_device *
|
2021-01-14 14:13:48 +00:00
|
|
|
ipc_client_hmd_create(struct ipc_connection *ipc_c, struct xrt_tracking_origin *xtrack, uint32_t device_id);
|
2020-04-11 00:28:35 +00:00
|
|
|
|
|
|
|
struct xrt_device *
|
2021-01-14 14:13:48 +00:00
|
|
|
ipc_client_device_create(struct ipc_connection *ipc_c, struct xrt_tracking_origin *xtrack, uint32_t device_id);
|