mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 04:36:07 +00:00
xrt: Refactor oxr_sdl2_hack to u_debug_gui
And OXR_DEBUG_GUI to XRT_DEBUG_GUI Co-authored-by: Jakob Bornecrantz <jakob@collabora.com>
This commit is contained in:
parent
e338d57945
commit
7485afbeaa
|
@ -269,16 +269,17 @@ option_with_deps(XRT_FEATURE_SLAM "Enable SLAM tracking support" DEPENDS XRT_HAV
|
||||||
option_with_deps(XRT_FEATURE_STEAMVR_PLUGIN "Build SteamVR plugin" DEPENDS "NOT ANDROID")
|
option_with_deps(XRT_FEATURE_STEAMVR_PLUGIN "Build SteamVR plugin" DEPENDS "NOT ANDROID")
|
||||||
option_with_deps(XRT_FEATURE_TRACING "Enable debug tracing on supported platforms" DEFAULT OFF DEPENDS "XRT_HAVE_PERCETTO OR XRT_HAVE_TRACY")
|
option_with_deps(XRT_FEATURE_TRACING "Enable debug tracing on supported platforms" DEFAULT OFF DEPENDS "XRT_HAVE_PERCETTO OR XRT_HAVE_TRACY")
|
||||||
option_with_deps(XRT_FEATURE_WINDOW_PEEK "Enable a window that displays the content of the HMD on screen" DEPENDS XRT_HAVE_SDL2)
|
option_with_deps(XRT_FEATURE_WINDOW_PEEK "Enable a window that displays the content of the HMD on screen" DEPENDS XRT_HAVE_SDL2)
|
||||||
|
option_with_deps(XRT_FEATURE_DEBUG_GUI "Enable debug window to be used" DEPENDS XRT_HAVE_SDL2)
|
||||||
option(XRT_FEATURE_SSE2 "Build using SSE2 instructions, if building for 32-bit x86" ON)
|
option(XRT_FEATURE_SSE2 "Build using SSE2 instructions, if building for 32-bit x86" ON)
|
||||||
|
|
||||||
if (XRT_FEATURE_SERVICE)
|
if (XRT_FEATURE_SERVICE)
|
||||||
# Disable the client debug gui by default for out-of-proc -
|
# Disable the client debug gui by default for out-of-proc -
|
||||||
# too many clients have problems with depending on SDL/GStreamer/etc and we rarely use it in this configuration
|
# too many clients have problems with depending on SDL/GStreamer/etc and we rarely use it in this configuration
|
||||||
option(XRT_FEATURE_CLIENT_DEBUG_GUI "Allow clients to have their own instances of the debug gui" OFF)
|
option_with_deps(XRT_FEATURE_CLIENT_DEBUG_GUI "Allow clients to have their own instances of the debug gui" DEFAULT OFF DEPENDS XRT_FEATURE_DEBUG_GUI)
|
||||||
else()
|
else()
|
||||||
# Enable the client debug gui by default for in-proc -
|
# Enable the client debug gui by default for in-proc -
|
||||||
# In in-proc, the client debug gui is the same as the server debug gui, and we use it a lot in this configuration
|
# In in-proc, the client debug gui is the same as the server debug gui, and we use it a lot in this configuration
|
||||||
option(XRT_FEATURE_CLIENT_DEBUG_GUI "Allow clients to have their own instances of the debug gui" ON)
|
option_with_deps(XRT_FEATURE_CLIENT_DEBUG_GUI "Allow clients to have their own instances of the debug gui" DEFAULT ON DEPENDS XRT_FEATURE_DEBUG_GUI)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# systemd detailed config
|
# systemd detailed config
|
||||||
|
@ -526,6 +527,7 @@ message(STATUS "# MODULE_MONADO_CLI ${XRT_MODULE_MONADO_CLI}")
|
||||||
message(STATUS "#")
|
message(STATUS "#")
|
||||||
message(STATUS "# FEATURE_CLIENT_DEBUG_GUI: ${XRT_FEATURE_CLIENT_DEBUG_GUI}")
|
message(STATUS "# FEATURE_CLIENT_DEBUG_GUI: ${XRT_FEATURE_CLIENT_DEBUG_GUI}")
|
||||||
message(STATUS "# FEATURE_COLOR_LOG: ${XRT_FEATURE_COLOR_LOG}")
|
message(STATUS "# FEATURE_COLOR_LOG: ${XRT_FEATURE_COLOR_LOG}")
|
||||||
|
message(STATUS "# FEATURE_DEBUG_GUI: ${XRT_FEATURE_DEBUG_GUI}")
|
||||||
message(STATUS "# FEATURE_MERCURY_HANDTRACKING: ${XRT_MODULE_MERCURY_HANDTRACKING}")
|
message(STATUS "# FEATURE_MERCURY_HANDTRACKING: ${XRT_MODULE_MERCURY_HANDTRACKING}")
|
||||||
message(STATUS "# FEATURE_OPENXR: ${XRT_FEATURE_OPENXR}")
|
message(STATUS "# FEATURE_OPENXR: ${XRT_FEATURE_OPENXR}")
|
||||||
message(STATUS "# FEATURE_OPENXR_LAYER_CUBE: ${XRT_FEATURE_OPENXR_LAYER_CUBE}")
|
message(STATUS "# FEATURE_OPENXR_LAYER_CUBE: ${XRT_FEATURE_OPENXR_LAYER_CUBE}")
|
||||||
|
|
|
@ -141,6 +141,37 @@ endif()
|
||||||
# Internal dependency and doesn't bring in any DSO.
|
# Internal dependency and doesn't bring in any DSO.
|
||||||
target_include_directories(aux_util PRIVATE ${EIGEN3_INCLUDE_DIR})
|
target_include_directories(aux_util PRIVATE ${EIGEN3_INCLUDE_DIR})
|
||||||
|
|
||||||
|
####
|
||||||
|
# Debug UI library
|
||||||
|
#
|
||||||
|
|
||||||
|
add_library(aux_util_debug_gui STATIC u_debug_gui.c u_debug_gui.h) # Always built, for stubs.
|
||||||
|
target_link_libraries(
|
||||||
|
aux_util_debug_gui
|
||||||
|
INTERFACE xrt-interfaces
|
||||||
|
PRIVATE aux-includes
|
||||||
|
)
|
||||||
|
|
||||||
|
if(XRT_FEATURE_DEBUG_GUI)
|
||||||
|
target_link_libraries(aux_util_debug_gui PRIVATE aux_util)
|
||||||
|
|
||||||
|
if(XRT_HAVE_OPENGL)
|
||||||
|
target_link_libraries(aux_util_debug_gui PUBLIC aux_ogl)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(XRT_HAVE_SDL2)
|
||||||
|
target_link_libraries(
|
||||||
|
aux_util_debug_gui PRIVATE st_gui xrt-external-imgui-sdl2 ${SDL2_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(XRT_BUILD_DRIVER_QWERTY)
|
||||||
|
target_link_libraries(
|
||||||
|
aux_util_debug_gui PRIVATE drv_qwerty drv_qwerty_includes
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
####
|
####
|
||||||
# Sink library
|
# Sink library
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,44 +1,51 @@
|
||||||
// Copyright 2019, Collabora, Ltd.
|
// Copyright 2019-2023, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
/*!
|
/*!
|
||||||
* @file
|
* @file
|
||||||
* @brief Hacky SDL integration
|
* @brief SDL2 Debug UI implementation
|
||||||
* @author Jakob Bornecrantz <jakob@collabora.com>
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||||
|
* @author Moses Turner <moses@collabora.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "util/u_file.h"
|
#include "xrt/xrt_config_build.h"
|
||||||
#include "xrt/xrt_compiler.h"
|
|
||||||
#include "xrt/xrt_instance.h"
|
|
||||||
#include "xrt/xrt_config_have.h"
|
|
||||||
#include "xrt/xrt_config_drivers.h"
|
|
||||||
|
|
||||||
#include "util/u_var.h"
|
#ifndef XRT_FEATURE_DEBUG_GUI
|
||||||
#include "util/u_misc.h"
|
|
||||||
#include "util/u_debug.h"
|
|
||||||
|
|
||||||
#include "os/os_threading.h"
|
#include "util/u_debug_gui.h"
|
||||||
|
|
||||||
|
|
||||||
struct xrt_instance;
|
|
||||||
|
|
||||||
#ifndef XRT_HAVE_SDL2
|
|
||||||
|
|
||||||
int
|
int
|
||||||
oxr_sdl2_hack_create(void **out_hack)
|
u_debug_gui_create(struct u_debug_gui **out_debug_ui)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
oxr_sdl2_hack_start(void *hack, struct xrt_instance *xinst, struct xrt_system_devices *xsysd)
|
u_debug_gui_start(struct u_debug_gui *debug_ui, struct xrt_instance *xinst, struct xrt_system_devices *xsysd)
|
||||||
{}
|
{
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
oxr_sdl2_hack_stop(void **hack)
|
u_debug_gui_stop(struct u_debug_gui **debug_ui)
|
||||||
{}
|
{
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* XRT_FEATURE_DEBUG_GUI */
|
||||||
|
|
||||||
#else
|
|
||||||
#include "xrt/xrt_system.h"
|
#include "xrt/xrt_system.h"
|
||||||
|
#include "xrt/xrt_instance.h"
|
||||||
|
#include "xrt/xrt_config_have.h"
|
||||||
|
#include "xrt/xrt_config_drivers.h"
|
||||||
|
|
||||||
|
#include "os/os_threading.h"
|
||||||
|
|
||||||
|
#include "util/u_var.h"
|
||||||
|
#include "util/u_misc.h"
|
||||||
|
#include "util/u_file.h"
|
||||||
|
#include "util/u_debug.h"
|
||||||
|
#include "util/u_debug_gui.h"
|
||||||
|
|
||||||
#include "ogl/ogl_api.h"
|
#include "ogl/ogl_api.h"
|
||||||
|
|
||||||
#include "gui/gui_common.h"
|
#include "gui/gui_common.h"
|
||||||
|
@ -50,7 +57,7 @@ oxr_sdl2_hack_stop(void **hack)
|
||||||
|
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
|
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(gui, "OXR_DEBUG_GUI", false)
|
DEBUG_GET_ONCE_BOOL_OPTION(gui, "XRT_DEBUG_GUI", false)
|
||||||
#ifdef XRT_BUILD_DRIVER_QWERTY
|
#ifdef XRT_BUILD_DRIVER_QWERTY
|
||||||
DEBUG_GET_ONCE_BOOL_OPTION(qwerty_enable, "QWERTY_ENABLE", false)
|
DEBUG_GET_ONCE_BOOL_OPTION(qwerty_enable, "QWERTY_ENABLE", false)
|
||||||
#endif
|
#endif
|
||||||
|
@ -60,7 +67,7 @@ DEBUG_GET_ONCE_BOOL_OPTION(qwerty_enable, "QWERTY_ENABLE", false)
|
||||||
* Common struct holding state for the GUI interface.
|
* Common struct holding state for the GUI interface.
|
||||||
* @extends gui_program
|
* @extends gui_program
|
||||||
*/
|
*/
|
||||||
struct sdl2_program
|
struct u_debug_gui
|
||||||
{
|
{
|
||||||
struct gui_program base;
|
struct gui_program base;
|
||||||
|
|
||||||
|
@ -81,7 +88,7 @@ struct gui_imgui
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sdl2_window_init(struct sdl2_program *p)
|
sdl2_window_init(struct u_debug_gui *p)
|
||||||
{
|
{
|
||||||
const char *title = "Monado! ✨⚡🔥";
|
const char *title = "Monado! ✨⚡🔥";
|
||||||
int x = SDL_WINDOWPOS_UNDEFINED;
|
int x = SDL_WINDOWPOS_UNDEFINED;
|
||||||
|
@ -137,7 +144,7 @@ sdl2_window_init(struct sdl2_program *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sdl2_loop(struct sdl2_program *p)
|
sdl2_loop(struct u_debug_gui *p)
|
||||||
{
|
{
|
||||||
// Need to call this before any other Imgui call.
|
// Need to call this before any other Imgui call.
|
||||||
igCreateContext(NULL);
|
igCreateContext(NULL);
|
||||||
|
@ -251,7 +258,7 @@ sdl2_loop(struct sdl2_program *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sdl2_close(struct sdl2_program *p)
|
sdl2_close(struct u_debug_gui *p)
|
||||||
{
|
{
|
||||||
// All scenes should be destroyed by now.
|
// All scenes should be destroyed by now.
|
||||||
gui_scene_manager_destroy(&p->base);
|
gui_scene_manager_destroy(&p->base);
|
||||||
|
@ -276,21 +283,20 @@ sdl2_close(struct sdl2_program *p)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
oxr_sdl2_hack_run_thread(void *ptr)
|
u_debug_gui_run_thread(void *ptr)
|
||||||
{
|
{
|
||||||
struct sdl2_program *p = (struct sdl2_program *)ptr;
|
struct u_debug_gui *debug_gui = (struct u_debug_gui *)ptr;
|
||||||
|
sdl2_window_init(debug_gui);
|
||||||
|
|
||||||
sdl2_window_init(p);
|
sdl2_loop(debug_gui);
|
||||||
|
|
||||||
sdl2_loop(p);
|
sdl2_close(debug_gui);
|
||||||
|
|
||||||
sdl2_close(p);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
oxr_sdl2_hack_create(void **out_hack)
|
u_debug_gui_create(struct u_debug_gui **out_debug_gui)
|
||||||
{
|
{
|
||||||
// Enabled?
|
// Enabled?
|
||||||
if (!debug_get_bool_option_gui()) {
|
if (!debug_get_bool_option_gui()) {
|
||||||
|
@ -300,53 +306,52 @@ oxr_sdl2_hack_create(void **out_hack)
|
||||||
// Need to do this as early as possible.
|
// Need to do this as early as possible.
|
||||||
u_var_force_on();
|
u_var_force_on();
|
||||||
|
|
||||||
struct sdl2_program *p = U_TYPED_CALLOC(struct sdl2_program);
|
struct u_debug_gui *p = U_TYPED_CALLOC(struct u_debug_gui);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
os_thread_helper_init(&p->oth);
|
os_thread_helper_init(&p->oth);
|
||||||
|
|
||||||
*out_hack = p;
|
*out_debug_gui = p;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
oxr_sdl2_hack_start(void *hack, struct xrt_instance *xinst, struct xrt_system_devices *xsysd)
|
u_debug_gui_start(struct u_debug_gui *debug_gui, struct xrt_instance *xinst, struct xrt_system_devices *xsysd)
|
||||||
{
|
{
|
||||||
struct sdl2_program *p = (struct sdl2_program *)hack;
|
if (debug_gui == NULL) {
|
||||||
if (p == NULL) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Share the system devices.
|
// Share the system devices.
|
||||||
p->base.xsysd = xsysd;
|
debug_gui->base.xsysd = xsysd;
|
||||||
|
|
||||||
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
|
if (SDL_Init(SDL_INIT_EVERYTHING) < 0) {
|
||||||
U_LOG_E("Failed to init SDL2!");
|
U_LOG_E("Failed to init SDL2!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p->sdl_initialized = true;
|
debug_gui->sdl_initialized = true;
|
||||||
|
|
||||||
(void)os_thread_helper_start(&p->oth, oxr_sdl2_hack_run_thread, p);
|
(void)os_thread_helper_start(&debug_gui->oth, u_debug_gui_run_thread, (void *)debug_gui);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
oxr_sdl2_hack_stop(void **hack_ptr)
|
u_debug_gui_stop(struct u_debug_gui **debug_gui)
|
||||||
{
|
{
|
||||||
struct sdl2_program *p = *(struct sdl2_program **)hack_ptr;
|
struct u_debug_gui *p = *(struct u_debug_gui **)debug_gui;
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// HACK!
|
|
||||||
p->base.stopped = true;
|
p->base.stopped = true;
|
||||||
|
|
||||||
// Destroy the thread object.
|
// Destroy the thread object.
|
||||||
os_thread_helper_destroy(&p->oth);
|
os_thread_helper_destroy(&p->oth);
|
||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
*hack_ptr = NULL;
|
*debug_gui = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif /* XRT_FEATURE_DEBUG_GUI */
|
36
src/xrt/auxiliary/util/u_debug_gui.h
Normal file
36
src/xrt/auxiliary/util/u_debug_gui.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
// Copyright 2019-2023, Collabora, Ltd.
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
/*!
|
||||||
|
* @file
|
||||||
|
* @brief SDL2 Debug UI implementation
|
||||||
|
* @author Jakob Bornecrantz <jakob@collabora.com>
|
||||||
|
* @author Moses Turner <moses@collabora.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "xrt/xrt_compiler.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct xrt_instance;
|
||||||
|
struct xrt_system_devices;
|
||||||
|
|
||||||
|
struct u_debug_gui;
|
||||||
|
|
||||||
|
int
|
||||||
|
u_debug_gui_create(struct u_debug_gui **out_debug_gui);
|
||||||
|
|
||||||
|
void
|
||||||
|
u_debug_gui_start(struct u_debug_gui *debug_gui, struct xrt_instance *xinst, struct xrt_system_devices *xsysd);
|
||||||
|
|
||||||
|
void
|
||||||
|
u_debug_gui_stop(struct u_debug_gui **debug_gui);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -21,6 +21,7 @@
|
||||||
/* keep sorted */
|
/* keep sorted */
|
||||||
|
|
||||||
#cmakedefine XRT_FEATURE_COLOR_LOG
|
#cmakedefine XRT_FEATURE_COLOR_LOG
|
||||||
|
#cmakedefine XRT_FEATURE_DEBUG_GUI
|
||||||
#cmakedefine XRT_FEATURE_OPENXR
|
#cmakedefine XRT_FEATURE_OPENXR
|
||||||
#cmakedefine XRT_FEATURE_OPENXR_DEBUG_UTILS
|
#cmakedefine XRT_FEATURE_OPENXR_DEBUG_UTILS
|
||||||
#cmakedefine XRT_FEATURE_OPENXR_LAYER_CUBE
|
#cmakedefine XRT_FEATURE_OPENXR_LAYER_CUBE
|
||||||
|
|
|
@ -92,7 +92,7 @@ target_include_directories(
|
||||||
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
target_link_libraries(ipc_server PRIVATE aux_util aux_util_process ipc_shared)
|
target_link_libraries(ipc_server PRIVATE aux_util aux_util_process aux_util_debug_gui ipc_shared)
|
||||||
|
|
||||||
if(XRT_HAVE_SYSTEMD)
|
if(XRT_HAVE_SYSTEMD)
|
||||||
target_include_directories(ipc_server PRIVATE ${SYSTEMD_INCLUDE_DIRS})
|
target_include_directories(ipc_server PRIVATE ${SYSTEMD_INCLUDE_DIRS})
|
||||||
|
|
|
@ -295,9 +295,7 @@ struct ipc_server
|
||||||
//! Handle for the current process, e.g. pidfile on linux
|
//! Handle for the current process, e.g. pidfile on linux
|
||||||
struct u_process *process;
|
struct u_process *process;
|
||||||
|
|
||||||
/* ---- HACK ---- */
|
struct u_debug_gui *debug_gui;
|
||||||
void *hack;
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
|
|
||||||
//! System devices.
|
//! System devices.
|
||||||
struct xrt_system_devices *xsysd;
|
struct xrt_system_devices *xsysd;
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "util/u_trace_marker.h"
|
#include "util/u_trace_marker.h"
|
||||||
#include "util/u_verify.h"
|
#include "util/u_verify.h"
|
||||||
#include "util/u_process.h"
|
#include "util/u_process.h"
|
||||||
|
#include "util/u_debug_gui.h"
|
||||||
|
|
||||||
#include "util/u_git_tag.h"
|
#include "util/u_git_tag.h"
|
||||||
|
|
||||||
|
@ -40,18 +41,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
extern int
|
|
||||||
oxr_sdl2_hack_create(void **out_hack);
|
|
||||||
|
|
||||||
extern void
|
|
||||||
oxr_sdl2_hack_start(void *hack, struct xrt_instance *xinst, struct xrt_system_devices *xsysd);
|
|
||||||
|
|
||||||
extern void
|
|
||||||
oxr_sdl2_hack_stop(void **hack_ptr);
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Defines and helpers.
|
* Defines and helpers.
|
||||||
|
@ -789,29 +778,23 @@ ipc_server_main(int argc, char **argv)
|
||||||
|
|
||||||
U_LOG_I("Monado Service %s starting up...", u_git_tag);
|
U_LOG_I("Monado Service %s starting up...", u_git_tag);
|
||||||
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
// need to create early before any vars are added
|
// need to create early before any vars are added
|
||||||
oxr_sdl2_hack_create(&s->hack);
|
u_debug_gui_create(&s->debug_gui);
|
||||||
/* ---- HACK ---- */
|
|
||||||
|
|
||||||
int ret = init_all(s);
|
int ret = init_all(s);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
free(s->hack);
|
free(s->debug_gui);
|
||||||
free(s);
|
free(s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_server_state(s);
|
init_server_state(s);
|
||||||
|
|
||||||
/* ---- HACK ---- */
|
u_debug_gui_start(s->debug_gui, s->xinst, s->xsysd);
|
||||||
oxr_sdl2_hack_start(s->hack, s->xinst, s->xsysd);
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
|
|
||||||
ret = main_loop(s);
|
ret = main_loop(s);
|
||||||
|
|
||||||
/* ---- HACK ---- */
|
u_debug_gui_stop(&s->debug_gui);
|
||||||
oxr_sdl2_hack_stop(&s->hack);
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
|
|
||||||
teardown_all(s);
|
teardown_all(s);
|
||||||
free(s);
|
free(s);
|
||||||
|
|
|
@ -19,6 +19,10 @@
|
||||||
#include "util/u_git_tag.h"
|
#include "util/u_git_tag.h"
|
||||||
#include "util/u_builders.h"
|
#include "util/u_builders.h"
|
||||||
|
|
||||||
|
#ifdef XRT_FEATURE_CLIENT_DEBUG_GUI
|
||||||
|
#include "util/u_debug_gui.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef XRT_OS_ANDROID
|
#ifdef XRT_OS_ANDROID
|
||||||
#include "android/android_globals.h"
|
#include "android/android_globals.h"
|
||||||
#include "android/android_looper.h"
|
#include "android/android_looper.h"
|
||||||
|
@ -49,19 +53,6 @@ DEBUG_GET_ONCE_FLOAT_OPTION(tracking_origin_offset_x, "OXR_TRACKING_ORIGIN_OFFSE
|
||||||
DEBUG_GET_ONCE_FLOAT_OPTION(tracking_origin_offset_y, "OXR_TRACKING_ORIGIN_OFFSET_Y", 0.0f)
|
DEBUG_GET_ONCE_FLOAT_OPTION(tracking_origin_offset_y, "OXR_TRACKING_ORIGIN_OFFSET_Y", 0.0f)
|
||||||
DEBUG_GET_ONCE_FLOAT_OPTION(tracking_origin_offset_z, "OXR_TRACKING_ORIGIN_OFFSET_Z", 0.0f)
|
DEBUG_GET_ONCE_FLOAT_OPTION(tracking_origin_offset_z, "OXR_TRACKING_ORIGIN_OFFSET_Z", 0.0f)
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_CLIENT_DEBUG_GUI
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
extern int
|
|
||||||
oxr_sdl2_hack_create(void **out_hack);
|
|
||||||
|
|
||||||
extern void
|
|
||||||
oxr_sdl2_hack_start(void *hack, struct xrt_instance *xinst, struct xrt_system_devices *xsysd);
|
|
||||||
|
|
||||||
extern void
|
|
||||||
oxr_sdl2_hack_stop(void **hack_ptr);
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static XrResult
|
static XrResult
|
||||||
oxr_instance_destroy(struct oxr_logger *log, struct oxr_handle_base *hb)
|
oxr_instance_destroy(struct oxr_logger *log, struct oxr_handle_base *hb)
|
||||||
{
|
{
|
||||||
|
@ -82,9 +73,7 @@ oxr_instance_destroy(struct oxr_logger *log, struct oxr_handle_base *hb)
|
||||||
xrt_system_devices_destroy(&inst->system.xsysd);
|
xrt_system_devices_destroy(&inst->system.xsysd);
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_CLIENT_DEBUG_GUI
|
#ifdef XRT_FEATURE_CLIENT_DEBUG_GUI
|
||||||
/* ---- HACK ---- */
|
u_debug_gui_stop(&inst->debug_ui);
|
||||||
oxr_sdl2_hack_stop(&inst->hack);
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
xrt_instance_destroy(&inst->xinst);
|
xrt_instance_destroy(&inst->xinst);
|
||||||
|
@ -204,9 +193,7 @@ oxr_instance_create(struct oxr_logger *log,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_CLIENT_DEBUG_GUI
|
#ifdef XRT_FEATURE_CLIENT_DEBUG_GUI
|
||||||
/* ---- HACK ---- */
|
u_debug_gui_create(&inst->debug_ui);
|
||||||
oxr_sdl2_hack_create(&inst->hack);
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = oxr_path_init(log, inst);
|
ret = oxr_path_init(log, inst);
|
||||||
|
@ -343,9 +330,7 @@ oxr_instance_create(struct oxr_logger *log,
|
||||||
u_var_add_root((void *)inst, "XrInstance", true);
|
u_var_add_root((void *)inst, "XrInstance", true);
|
||||||
|
|
||||||
#ifdef XRT_FEATURE_CLIENT_DEBUG_GUI
|
#ifdef XRT_FEATURE_CLIENT_DEBUG_GUI
|
||||||
/* ---- HACK ---- */
|
u_debug_gui_start(inst->debug_ui, inst->xinst, sys->xsysd);
|
||||||
oxr_sdl2_hack_start(inst->hack, inst->xinst, sys->xsysd);
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
oxr_log(log,
|
oxr_log(log,
|
||||||
|
|
|
@ -1360,9 +1360,7 @@ struct oxr_instance
|
||||||
//! Common structure for things referred to by OpenXR handles.
|
//! Common structure for things referred to by OpenXR handles.
|
||||||
struct oxr_handle_base handle;
|
struct oxr_handle_base handle;
|
||||||
|
|
||||||
/* ---- HACK ---- */
|
struct u_debug_gui *debug_ui;
|
||||||
void *hack;
|
|
||||||
/* ---- HACK ---- */
|
|
||||||
|
|
||||||
struct xrt_instance *xinst;
|
struct xrt_instance *xinst;
|
||||||
|
|
||||||
|
|
|
@ -130,21 +130,7 @@ elseif(NOT ANDROID)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
###
|
# Optional debug ui
|
||||||
# Inelegant but effective SDL2-based debug GUI
|
|
||||||
add_library(oxr_sdl2 STATIC oxr_sdl2_hack.c)
|
|
||||||
target_link_libraries(oxr_sdl2 PRIVATE aux_util)
|
|
||||||
if(XRT_HAVE_OPENGL)
|
|
||||||
target_link_libraries(oxr_sdl2 PUBLIC aux_ogl)
|
|
||||||
endif()
|
|
||||||
if(XRT_HAVE_SDL2)
|
|
||||||
target_link_libraries(oxr_sdl2 PRIVATE st_gui xrt-external-imgui-sdl2 ${SDL2_LIBRARIES})
|
|
||||||
|
|
||||||
if(XRT_BUILD_DRIVER_QWERTY)
|
|
||||||
target_link_libraries(oxr_sdl2 PRIVATE drv_qwerty drv_qwerty_includes)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(XRT_FEATURE_CLIENT_DEBUG_GUI)
|
if(XRT_FEATURE_CLIENT_DEBUG_GUI)
|
||||||
target_link_libraries(${RUNTIME_TARGET} PRIVATE oxr_sdl2)
|
target_link_libraries(${RUNTIME_TARGET} PRIVATE aux_util_debug_gui)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -13,19 +13,19 @@ struct xrt_system_devices;
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
oxr_sdl2_hack_create(void **out_hack)
|
u_debug_gui_create(void **out_hack)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
oxr_sdl2_hack_start(void *hack, struct xrt_instance *xinst, struct xrt_system_devices *xsysd)
|
u_debug_gui_start(void *hack, struct xrt_instance *xinst, struct xrt_system_devices *xsysd)
|
||||||
{
|
{
|
||||||
// Noop
|
// Noop
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
oxr_sdl2_hack_stop(void **hack)
|
u_debug_gui_stop(void **hack)
|
||||||
{
|
{
|
||||||
// Noop
|
// Noop
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,11 +8,11 @@ target_link_libraries(
|
||||||
monado-service
|
monado-service
|
||||||
PRIVATE
|
PRIVATE
|
||||||
aux_util
|
aux_util
|
||||||
|
aux_util_debug_gui
|
||||||
st_prober
|
st_prober
|
||||||
ipc_server
|
ipc_server
|
||||||
target_lists
|
target_lists
|
||||||
target_instance
|
target_instance
|
||||||
oxr_sdl2
|
|
||||||
)
|
)
|
||||||
|
|
||||||
install(TARGETS monado-service RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
install(TARGETS monado-service RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
|
Loading…
Reference in a new issue