From 8d6b7948783a7ae6633154bd4baa9c3906463866 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 13 Nov 2022 23:12:38 +0000 Subject: [PATCH] c/main: Add own interface for creating the main compositor --- src/xrt/compositor/CMakeLists.txt | 2 +- src/xrt/compositor/main/comp_compositor.c | 2 +- src/xrt/compositor/main/comp_main_interface.h | 35 +++++++++++++++++++ src/xrt/targets/common/target_instance.c | 6 +++- 4 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 src/xrt/compositor/main/comp_main_interface.h diff --git a/src/xrt/compositor/CMakeLists.txt b/src/xrt/compositor/CMakeLists.txt index e663ef8e6..ec0835b0e 100644 --- a/src/xrt/compositor/CMakeLists.txt +++ b/src/xrt/compositor/CMakeLists.txt @@ -197,7 +197,7 @@ if(XRT_FEATURE_COMPOSITOR_MAIN) comp_util comp_render ) - target_include_directories(comp_main PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + target_include_directories(comp_main PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) if(XRT_HAVE_XCB) target_sources(comp_main PRIVATE main/comp_window_xcb.c) diff --git a/src/xrt/compositor/main/comp_compositor.c b/src/xrt/compositor/main/comp_compositor.c index 77d393bbd..8b15c81b9 100644 --- a/src/xrt/compositor/main/comp_compositor.c +++ b/src/xrt/compositor/main/comp_compositor.c @@ -1157,7 +1157,7 @@ compositor_init_renderer(struct comp_compositor *c) } xrt_result_t -xrt_gfx_provider_create_system(struct xrt_device *xdev, struct xrt_system_compositor **out_xsysc) +comp_main_create_system_compositor(struct xrt_device *xdev, struct xrt_system_compositor **out_xsysc) { struct comp_compositor *c = U_TYPED_CALLOC(struct comp_compositor); diff --git a/src/xrt/compositor/main/comp_main_interface.h b/src/xrt/compositor/main/comp_main_interface.h new file mode 100644 index 000000000..e6d67fd7c --- /dev/null +++ b/src/xrt/compositor/main/comp_main_interface.h @@ -0,0 +1,35 @@ +// Copyright 2019-2022, Collabora, Ltd. +// SPDX-License-Identifier: BSL-1.0 +/*! + * @file + * @brief Header for the main compositor interface. + * @author Jakob Bornecrantz + * @ingroup comp_main + * + * Formerly a header for defining a XRT graphics provider. + */ + +#pragma once + +#include "xrt/xrt_device.h" +#include "xrt/xrt_compositor.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/*! + * Creates the main compositor, it doesn't return itself but instead wraps + * itself with a system compositor. The main compositor is a native compositor. + * + * @ingroup comp_main + * @relates xrt_system_compositor + */ +xrt_result_t +comp_main_create_system_compositor(struct xrt_device *xdev, struct xrt_system_compositor **out_xsysc); + + +#ifdef __cplusplus +} +#endif diff --git a/src/xrt/targets/common/target_instance.c b/src/xrt/targets/common/target_instance.c index 0646a0908..94c2d50f0 100644 --- a/src/xrt/targets/common/target_instance.c +++ b/src/xrt/targets/common/target_instance.c @@ -16,6 +16,10 @@ #include "util/u_trace_marker.h" #include "util/u_system_helpers.h" +#ifdef XRT_FEATURE_COMPOSITOR_MAIN +#include "main/comp_main_interface.h" +#endif + #include "target_instance_parts.h" #include @@ -81,7 +85,7 @@ t_instance_create_system(struct xrt_instance *xinst, #ifdef XRT_FEATURE_COMPOSITOR_MAIN if (xret == XRT_SUCCESS && xsysc == NULL) { - xret = xrt_gfx_provider_create_system(head, &xsysc); + xret = comp_main_create_system_compositor(head, &xsysc); } #else if (!use_null) {