The open source OpenXR runtime
0
fork

Configure Feed

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

ipc: Add arguments to main function

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2400>

authored by

Jakob Bornecrantz and committed by
Simon Zeni
88588213 0f7c0399

+44 -13
+1
doc/changes/ipc/mr.2400.md
··· 1 + Add: Interface to the server to better control the debug gui.
+19 -1
src/xrt/ipc/server/ipc_server_interface.h
··· 1 1 // Copyright 2020-2023, Collabora, Ltd. 2 + // Copyright 2024-2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 12 13 #include "xrt/xrt_compiler.h" 13 14 #include "xrt/xrt_config_os.h" 14 15 16 + #ifndef XRT_OS_ANDROID 17 + #include "util/u_debug_gui.h" 18 + #endif 19 + 20 + 15 21 #ifdef __cplusplus 16 22 extern "C" { 17 23 #endif ··· 20 26 #ifndef XRT_OS_ANDROID 21 27 22 28 /*! 29 + * Information passed into the IPC server main function, used for customization 30 + * of the IPC server. 31 + * 32 + * @ingroup ipc_server 33 + */ 34 + struct ipc_server_main_info 35 + { 36 + //! Information passed onto the debug gui. 37 + struct u_debug_gui_create_info udgci; 38 + }; 39 + 40 + /*! 23 41 * Main entrypoint to the compositor process. 24 42 * 25 43 * @ingroup ipc_server 26 44 */ 27 45 int 28 - ipc_server_main(int argc, char **argv); 46 + ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi); 29 47 30 48 #endif 31 49
+2 -7
src/xrt/ipc/server/ipc_server_process.c
··· 1004 1004 1005 1005 #ifndef XRT_OS_ANDROID 1006 1006 int 1007 - ipc_server_main(int argc, char **argv) 1007 + ipc_server_main(int argc, char **argv, const struct ipc_server_main_info *ismi) 1008 1008 { 1009 1009 // Get log level first. 1010 1010 enum u_logging_level log_level = debug_get_log_option_ipc_log(); ··· 1019 1019 timeBeginPeriod(1); 1020 1020 #endif 1021 1021 1022 - struct u_debug_gui_info udgci = { 1023 - .window_title = "Monado! ✨⚡🔥", 1024 - .open = U_DEBUG_GUI_OPEN_AUTO, 1025 - }; 1026 - 1027 1022 /* 1028 1023 * Need to create early before any vars are added. Not created in 1029 1024 * init_all since that function is shared with Android and the debug 1030 1025 * GUI isn't supported on Android. 1031 1026 */ 1032 - u_debug_gui_create(&udgci, &s->debug_gui); 1027 + u_debug_gui_create(&ismi->udgci, &s->debug_gui); 1033 1028 1034 1029 1035 1030 int ret = init_all(s, log_level);
+12 -4
src/xrt/targets/sdl_test/sdl_main.c
··· 1 1 // Copyright 2019-2022, Collabora, Ltd. 2 + // Copyright 2024-2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 8 9 9 10 #include "util/u_trace_marker.h" 10 11 12 + #include "server/ipc_server_interface.h" 13 + 11 14 #include <SDL2/SDL.h> 12 15 #include <SDL2/SDL_main.h> 13 16 ··· 15 18 // Insert the on load constructor to init trace marker. 16 19 U_TRACE_TARGET_SETUP(U_TRACE_WHICH_SERVICE) 17 20 18 - int 19 - ipc_server_main(int argc, char *argv[]); 20 - 21 21 22 22 int 23 23 main(int argc, char *argv[]) 24 24 { 25 25 u_trace_marker_init(); 26 26 27 - return ipc_server_main(argc, argv); 27 + struct ipc_server_main_info ismi = { 28 + .udgci = 29 + { 30 + .window_title = "Monado SDL Test Debug GUI", 31 + .open = U_DEBUG_GUI_OPEN_AUTO, 32 + }, 33 + }; 34 + 35 + return ipc_server_main(argc, argv, &ismi); 28 36 }
+10 -1
src/xrt/targets/service/main.c
··· 1 1 // Copyright 2020, Collabora, Ltd. 2 + // Copyright 2024-2025, NVIDIA CORPORATION. 2 3 // SPDX-License-Identifier: BSL-1.0 3 4 /*! 4 5 * @file ··· 37 38 u_trace_marker_init(); 38 39 u_metrics_init(); 39 40 40 - int ret = ipc_server_main(argc, argv); 41 + struct ipc_server_main_info ismi = { 42 + .udgci = 43 + { 44 + .window_title = "Monado! ✨⚡🔥", 45 + .open = U_DEBUG_GUI_OPEN_AUTO, 46 + }, 47 + }; 48 + 49 + int ret = ipc_server_main(argc, argv, &ismi); 41 50 42 51 u_metrics_close(); 43 52