The open source OpenXR runtime
at mr/scanout-values 99 lines 2.3 kB view raw
1// Copyright 2020-2023, Collabora, Ltd. 2// Copyright 2024-2025, NVIDIA CORPORATION. 3// SPDX-License-Identifier: BSL-1.0 4/*! 5 * @file 6 * @brief Interface for IPC server code. 7 * @author Pete Black <pblack@collabora.com> 8 * @author Jakob Bornecrantz <jakob@collabora.com> 9 * @author Rylie Pavlik <rylie.pavlik@collabora.com> 10 * @ingroup ipc_server 11 */ 12 13#pragma once 14 15#include "xrt/xrt_config_os.h" 16#include "xrt/xrt_results.h" 17 18#include "util/u_debug_gui.h" 19 20 21#ifdef __cplusplus 22extern "C" { 23#endif 24 25 26struct xrt_instance; 27struct ipc_server; 28 29/*! 30 * Information passed into the IPC server main function, used for customization 31 * of the IPC server. 32 * 33 * @ingroup ipc_server 34 */ 35struct ipc_server_main_info 36{ 37 //! Information passed onto the debug gui. 38 struct u_debug_gui_create_info udgci; 39}; 40 41/*! 42 * 43 * @ingroup ipc_server 44 */ 45struct ipc_server_callbacks 46{ 47 /*! 48 * The IPC server failed to init. 49 * 50 * @param[in] xret The error code generated during init. 51 * @param[in] data User data given passed into the main function. 52 */ 53 void (*init_failed)(xrt_result_t xret, void *data); 54 55 /*! 56 * The service has completed init and is entering its mainloop. 57 * 58 * @param[in] s The IPC server. 59 * @param[in] xinst Instance that was created by the IPC server. 60 * @param[in] data User data given passed into the main function. 61 */ 62 void (*mainloop_entering)(struct ipc_server *s, struct xrt_instance *xinst, void *data); 63 64 /*! 65 * The service is leaving the mainloop, after this callback returns the 66 * IPC server will destroy all resources created. 67 * 68 * @param[in] s The IPC server. 69 * @param[in] xinst Instance that was created by the IPC server. 70 * @param[in] data User data given passed into the main function. 71 */ 72 void (*mainloop_leaving)(struct ipc_server *s, struct xrt_instance *xinst, void *data); 73}; 74 75/*! 76 * Common main function for starting the IPC service. 77 * 78 * @ingroup ipc_server 79 */ 80int 81ipc_server_main_common(const struct ipc_server_main_info *ismi, const struct ipc_server_callbacks *iscb, void *data); 82 83 84#ifndef XRT_OS_ANDROID 85 86/*! 87 * Main entrypoint to the compositor process. 88 * 89 * @ingroup ipc_server 90 */ 91int 92ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi); 93 94#endif 95 96 97#ifdef __cplusplus 98} 99#endif