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:

Static 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
 Instance information structure, including both platform and application info. More...
 
int64_t startup_timestamp
 CLOCK_MONOTONIC timestamp of the instance startup. More...
 
struct xrt_instance_android * android_instance
 An "aspect" of the xrt_instance interface, used only on Android. More...
 
Interface Methods

All implementations of the xrt_instance interface 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

◆ android_instance

struct xrt_instance_android* xrt_instance::android_instance

An "aspect" of the xrt_instance interface, used only on Android.

See also
xrt_instance_android

Referenced by android_instance_base::android_instance_base_cleanup().

◆ 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().

◆ instance_info

struct xrt_instance_info xrt_instance::instance_info

Instance information structure, including both platform and application info.

◆ startup_timestamp

int64_t xrt_instance::startup_timestamp

CLOCK_MONOTONIC timestamp of the instance startup.


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