c/main: Add own interface for creating the main compositor

This commit is contained in:
Jakob Bornecrantz 2022-11-13 23:12:38 +00:00 committed by Ryan Pavlik
parent a26daf3fb5
commit 8d6b794878
4 changed files with 42 additions and 3 deletions

View file

@ -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)

View file

@ -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);

View file

@ -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 <jakob@collabora.com>
* @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

View file

@ -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 <assert.h>
@ -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) {