monado/src/xrt/targets/common/target_instance.c

56 lines
1.2 KiB
C
Raw Normal View History

// Copyright 2020, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
* @brief Shared default implementation of the instance with compositor.
* @author Jakob Bornecrantz <jakob@collabora.com>
*/
#include "target_instance_parts.h"
#include "xrt/xrt_gfx_native.h"
static int
t_instance_create_native_compositor(struct xrt_instance *xinst,
struct xrt_device *xdev,
struct xrt_compositor_native **out_xcn)
{
2021-01-14 14:13:48 +00:00
struct xrt_compositor_native *xcn = xrt_gfx_provider_create_native(xdev);
if (xcn == NULL) {
return -1;
}
*out_xcn = xcn;
return 0;
}
/*
*
* Exported function(s).
*
*/
int
2021-01-14 14:13:48 +00:00
xrt_instance_create(struct xrt_instance_info *i_info, struct xrt_instance **out_xinst)
{
struct xrt_prober *xp = NULL;
int ret = xrt_prober_create_with_lists(&xp, &target_lists);
if (ret < 0) {
return ret;
}
struct t_instance *tinst = U_TYPED_CALLOC(struct t_instance);
tinst->base.select = t_instance_select;
2021-01-14 14:13:48 +00:00
tinst->base.create_native_compositor = t_instance_create_native_compositor;
tinst->base.get_prober = t_instance_get_prober;
tinst->base.destroy = t_instance_destroy;
tinst->xp = xp;
*out_xinst = &tinst->base;
return 0;
}