Monado OpenXR Runtime
xrt_instance Interface Reference

This interface acts as a root object for Monado. More...

#include <xrt/xrt_instance.h>

Inheritance diagram for xrt_instance:
Collaboration diagram for xrt_instance:

Public Member Functions

static xrt_result_t xrt_instance_create_system (struct xrt_instance *xinst, struct xrt_system **out_xsys, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso, struct xrt_system_compositor **out_xsysc)
 Creates all of the system resources like the devices and system compositor. More...
 
static xrt_result_t xrt_instance_get_prober (struct xrt_instance *xinst, struct xrt_prober **out_xp)
 Get the instance xrt_prober, if any. More...
 
static void xrt_instance_destroy (struct xrt_instance **xinst_ptr)
 Destroy an xrt_instance - helper function. More...
 

Data Fields

struct xrt_instance_info instance_info
 
uint64_t startup_timestamp
 
Interface Methods

All implementations of the xrt_instance implementation must populate all these function pointers with their implementation methods.

To use this interface, see the helper functions.

xrt_result_t(* create_system )(struct xrt_instance *xinst, struct xrt_system **out_xsys, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso, struct xrt_system_compositor **out_xsysc)
 Creates all of the system resources like the devices and system compositor. More...
 
xrt_result_t(* get_prober )(struct xrt_instance *xinst, struct xrt_prober **out_xp)
 Get the instance xrt_prober, if any. More...
 
void(* destroy )(struct xrt_instance *xinst)
 Destroy the instance and its owned objects, including the prober (if any). More...
 

Related Functions

(Note that these are not member functions.)

Factory

Implemented in each target.

xrt_result_t xrt_instance_create (struct xrt_instance_info *ii, struct xrt_instance **out_xinst)
 Create an implementation of the xrt_instance interface. More...
 

Detailed Description

This interface acts as a root object for Monado.

It typically either wraps an xrt_prober or forms a connection to an out-of-process XR service.

This is as close to a singleton object as there is in Monado: you should not create more than one xrt_instance implementation per process.

Each "target" will provide its own (private) implementation of this interface, which is exposed by implementing xrt_instance_create().

Additional information can be found in Understanding and Writing Targets: Connecting the Pieces.

See also
ipc_instance_create

Field Documentation

◆ create_system

xrt_result_t(* xrt_instance::create_system) (struct xrt_instance *xinst, struct xrt_system **out_xsys, struct xrt_system_devices **out_xsysd, struct xrt_space_overseer **out_xso, struct xrt_system_compositor **out_xsysc)

Creates all of the system resources like the devices and system compositor.

The system compositor is optional.

Should only be called once.

Note
Code consuming this interface should use xrt_instance_create_system()
Parameters
xinstPointer to self
[out]out_xsysReturn of system, required.
[out]out_xsysdReturn of devices, required.
[out]out_xsyscReturn of system compositor, optional.
See also
xrt_prober::probe, xrt_prober::select, xrt_gfx_provider_create_native

Referenced by sdl_instance_init(), and xrt_instance_create_system().

◆ destroy

void(* xrt_instance::destroy) (struct xrt_instance *xinst)

Destroy the instance and its owned objects, including the prober (if any).

Code consuming this interface should use xrt_instance_destroy().

Parameters
xinstPointer to self

Referenced by xrt_instance_destroy().

◆ get_prober

xrt_result_t(* xrt_instance::get_prober) (struct xrt_instance *xinst, struct xrt_prober **out_xp)

Get the instance xrt_prober, if any.

If the instance is not using an xrt_prober, it may return null.

The instance retains ownership of the prober and is responsible for destroying it.

Can be called multiple times. (The prober is usually created at instance construction time.)

Note
Code consuming this interface should use xrt_instance_get_prober().
Parameters
xinstPointer to self
[out]out_xpPointer to xrt_prober pointer, will be populated or set to NULL.
Returns
XRT_SUCCESS on success, other error code on error.

Referenced by xrt_instance_get_prober().


The documentation for this interface was generated from the following file: