mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
t/common: Integrate null compositor
This commit is contained in:
parent
c976c54008
commit
7e45fc7dd9
|
@ -237,7 +237,7 @@ option(XRT_FEATURE_COLOR_LOG "Enable logging in color on supported platforms" ON
|
|||
option_with_deps(XRT_FEATURE_COMPOSITOR_MAIN "Build main compositor host functionality" DEPENDS XRT_HAVE_VULKAN "XRT_HAVE_WAYLAND OR XRT_HAVE_XCB OR ANDROID OR WIN32")
|
||||
option_with_deps(XRT_FEATURE_COMPOSITOR_NULL "Build testing null compositor" DEPENDS XRT_HAVE_VULKAN)
|
||||
option_with_deps(XRT_FEATURE_IPC "Enable the build of the IPC layer" DEPENDS "NOT WIN32")
|
||||
option_with_deps(XRT_FEATURE_OPENXR "Build OpenXR runtime target" DEPENDS XRT_FEATURE_COMPOSITOR_MAIN)
|
||||
option_with_deps(XRT_FEATURE_OPENXR "Build OpenXR runtime target" DEPENDS "XRT_FEATURE_COMPOSITOR_MAIN OR XRT_FEATURE_COMPOSITOR_NULL")
|
||||
option_with_deps(XRT_FEATURE_RENDERDOC "Enable RenderDoc API" DEPENDS "RT_LIBRARY OR WIN32")
|
||||
option_with_deps(XRT_FEATURE_SERVICE "Enable separate service module for OpenXR runtime" DEPENDS XRT_FEATURE_IPC XRT_FEATURE_OPENXR)
|
||||
option_with_deps(XRT_FEATURE_SERVICE_SYSTEMD "Enable systemd socket activation of the service" DEPENDS XRT_HAVE_SYSTEMD XRT_FEATURE_SERVICE)
|
||||
|
|
|
@ -123,7 +123,7 @@ endif()
|
|||
####
|
||||
# Instance
|
||||
#
|
||||
if(XRT_FEATURE_COMPOSITOR_MAIN)
|
||||
if(XRT_FEATURE_COMPOSITOR_MAIN OR XRT_FEATURE_COMPOSITOR_NULL)
|
||||
add_library(target_instance STATIC target_instance.c)
|
||||
target_link_libraries(
|
||||
target_instance
|
||||
|
@ -132,10 +132,17 @@ if(XRT_FEATURE_COMPOSITOR_MAIN)
|
|||
aux_util
|
||||
st_prober
|
||||
target_lists
|
||||
comp_main
|
||||
drv_includes
|
||||
)
|
||||
target_include_directories(target_instance PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(XRT_FEATURE_COMPOSITOR_MAIN)
|
||||
target_link_libraries(target_instance PRIVATE comp_main)
|
||||
endif()
|
||||
|
||||
if(XRT_FEATURE_COMPOSITOR_NULL)
|
||||
target_link_libraries(target_instance PRIVATE comp_null)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
####
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2020, Collabora, Ltd.
|
||||
// Copyright 2020-2022, Collabora, Ltd.
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
/*!
|
||||
* @file
|
||||
|
@ -9,6 +9,7 @@
|
|||
#include "xrt/xrt_gfx_native.h"
|
||||
#include "xrt/xrt_system.h"
|
||||
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_trace_marker.h"
|
||||
#include "util/u_system_helpers.h"
|
||||
|
||||
|
@ -17,6 +18,19 @@
|
|||
#include <assert.h>
|
||||
|
||||
|
||||
#ifdef XRT_FEATURE_COMPOSITOR_MAIN
|
||||
#define USE_NULL_DEFAULT (false)
|
||||
#else
|
||||
#define USE_NULL_DEFAULT (true)
|
||||
#endif
|
||||
|
||||
DEBUG_GET_ONCE_BOOL_OPTION(use_null, "XRT_COMPOSITOR_NULL", USE_NULL_DEFAULT)
|
||||
|
||||
xrt_result_t
|
||||
null_compositor_create_system(struct xrt_device *xdev, struct xrt_system_compositor **out_xsysc);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* Internal functions.
|
||||
|
@ -49,7 +63,30 @@ t_instance_create_system(struct xrt_instance *xinst,
|
|||
|
||||
struct xrt_device *head = xsysd->roles.head;
|
||||
|
||||
xret = xrt_gfx_provider_create_system(head, &xsysc);
|
||||
bool use_null = debug_get_bool_option_use_null();
|
||||
|
||||
#ifdef XRT_FEATURE_COMPOSITOR_NULL
|
||||
if (use_null) {
|
||||
xret = null_compositor_create_system(head, &xsysc);
|
||||
}
|
||||
#else
|
||||
if (use_null) {
|
||||
U_LOG_E("The null compositor is not compiled in!");
|
||||
xret = XRT_ERROR_VULKAN;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XRT_FEATURE_COMPOSITOR_MAIN
|
||||
if (xret == XRT_SUCCESS && xsysc == NULL) {
|
||||
xret = xrt_gfx_provider_create_system(head, &xsysc);
|
||||
}
|
||||
#else
|
||||
if (!use_null) {
|
||||
U_LOG_E("Explicitly didn't request the null compositor, but the main compositor hasn't been built!");
|
||||
xret = XRT_ERROR_VULKAN;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (xret != XRT_SUCCESS) {
|
||||
xrt_system_devices_destroy(&xsysd);
|
||||
return xret;
|
||||
|
|
Loading…
Reference in a new issue