Monado OpenXR Runtime
Loading...
Searching...
No Matches
Base implementations

The base module provide the default implementations of some of the XRT interfaces objects, such as the xrt_system and xrt_session. More...

Collaboration diagram for Base implementations:

Directories

directory base
 The base module implementation files.
 

Files

file  b_documentation.h
 Documentation for the base module.
 
file  b_space_overseer.c
 A implementation of the xrt_space_overseer interface.
 
file  b_space_overseer.h
 A implementation of the xrt_space_overseer interface.
 
file  b_system_devices.c
 Default implementation helpers for xrt_system_devices.
 
file  b_system_devices.h
 Default implementation helpers for xrt_system_devices.
 

Data Structures

struct  b_system_devices
 Helper struct to manage devices by implementing the xrt_system_devices. More...
 
struct  b_system_devices_static
 Helper struct to manage devices by implementing the xrt_system_devices, this has only static device roles. More...
 

Functions

struct b_space_overseerb_space_overseer_create (struct xrt_session_event_sink *broadcast)
 Create a default implementation of a space overseer.
 
void b_space_overseer_legacy_setup (struct b_space_overseer *uso, struct xrt_device **xdevs, uint32_t xdev_count, struct xrt_device *head, const struct xrt_pose *local_offset, bool root_is_unbounded, bool per_app_local_spaces)
 Sets up the space overseer and all semantic spaces in a way that works with the old xrt_tracking_origin information.
 
void b_space_overseer_create_null_space (struct b_space_overseer *uso, struct xrt_space *parent, struct xrt_space **out_space)
 Creates a space without any offset, this is just for optimisation over a regular offset space.
 
void b_space_overseer_link_space_to_device (struct b_space_overseer *uso, struct xrt_space *xs, struct xrt_device *xdev)
 The space overseer internally keeps track the space that xrt_device is in, and then uses that mapping when creating pose spaces.
 
static struct b_system_devicesb_system_devices (struct xrt_system_devices *xsysd)
 Small inline helper to cast from xrt_system_devices.
 
struct b_system_devicesb_system_devices_allocate (void)
 Allocates a empty b_system_devices to be filled in by the caller, only the destroy function is filled in.
 
void b_system_devices_close (struct xrt_system_devices *xsysd)
 Destroys all devices and clears out the frame context, doesn't free the struct itself, useful for code embedding the system devices struct into other objects where it's not the first member or C++ classes.
 
static struct b_system_devices_staticb_system_devices_static (struct xrt_system_devices *xsysd)
 Small inline helper to cast from xrt_system_devices.
 
struct b_system_devices_staticb_system_devices_static_allocate (void)
 Allocates a empty b_system_devices to be filled in by the caller, only the destroy function is filled in.
 
void b_system_devices_static_finalize (struct b_system_devices_static *bsysds, struct xrt_device *left, struct xrt_device *right, struct xrt_device *gamepad)
 Finalizes the static struct with the given input devices, the system devices will always return these devices for the left and right role.
 

Detailed Description

The base module provide the default implementations of some of the XRT interfaces objects, such as the xrt_system and xrt_session.

Some of the objects are even extendable by external users of the the Monado codebase. These lives here instead of in other places such as the auxiliary or state tracker modules.

Function Documentation

◆ b_space_overseer_create()

◆ b_space_overseer_create_null_space()

void b_space_overseer_create_null_space ( struct b_space_overseer uso,
struct xrt_space parent,
struct xrt_space **  out_space 
)

#include <base/b_space_overseer.h>

Creates a space without any offset, this is just for optimisation over a regular offset space.

References create_space().

Referenced by b_space_overseer_legacy_setup().

◆ b_space_overseer_legacy_setup()

void b_space_overseer_legacy_setup ( struct b_space_overseer uso,
struct xrt_device **  xdevs,
uint32_t  xdev_count,
struct xrt_device head,
const struct xrt_pose local_offset,
bool  root_is_unbounded,
bool  per_app_local_spaces 
)

◆ b_space_overseer_link_space_to_device()

void b_space_overseer_link_space_to_device ( struct b_space_overseer uso,
struct xrt_space xs,
struct xrt_device xdev 
)

#include <base/b_space_overseer.h>

The space overseer internally keeps track the space that xrt_device is in, and then uses that mapping when creating pose spaces.

This function allows builders to create a much more bespoke setup. This function adds a reference to the space.

References b_space_overseer::lock, xrt_device::str, U_LOG_W, b_space_overseer::xdev_map, and xrt_space::xrt_space_reference().

Referenced by add_device_helper(), and remote_builder_setup_space_overseer().

◆ b_system_devices()

static struct b_system_devices * b_system_devices ( struct xrt_system_devices xsysd)
inlinestatic

#include <base/b_system_devices.h>

Small inline helper to cast from xrt_system_devices.

◆ b_system_devices_allocate()

struct b_system_devices * b_system_devices_allocate ( void  )

#include <base/b_system_devices.h>

Allocates a empty b_system_devices to be filled in by the caller, only the destroy function is filled in.

References xrt_system_devices::destroy, and U_TYPED_CALLOC.

◆ b_system_devices_close()

void b_system_devices_close ( struct xrt_system_devices xsysd)

#include <base/b_system_devices.h>

Destroys all devices and clears out the frame context, doesn't free the struct itself, useful for code embedding the system devices struct into other objects where it's not the first member or C++ classes.

References ARRAY_SIZE, xrt_system_devices::static_xdevs, and b_system_devices::xfctx.

◆ b_system_devices_static()

static struct b_system_devices_static * b_system_devices_static ( struct xrt_system_devices xsysd)
inlinestatic

#include <base/b_system_devices.h>

Small inline helper to cast from xrt_system_devices.

◆ b_system_devices_static_allocate()

struct b_system_devices_static * b_system_devices_static_allocate ( void  )

#include <base/b_system_devices.h>

Allocates a empty b_system_devices to be filled in by the caller, only the destroy function is filled in.

References xrt_system_devices::destroy, xrt_system_devices::feature_dec, xrt_system_devices::feature_inc, xrt_system_devices::get_roles, and U_TYPED_CALLOC.

Referenced by t_builder_roles_helper_open_system().

◆ b_system_devices_static_finalize()

void b_system_devices_static_finalize ( struct b_system_devices_static bsysds,
struct xrt_device left,
struct xrt_device right,
struct xrt_device gamepad 
)

#include <base/b_system_devices.h>

Finalizes the static struct with the given input devices, the system devices will always return these devices for the left and right role.

This function must be called before xrt_system_devices_get_roles is called.

References b_system_devices_static::cached, xrt_system_roles::gamepad, xrt_system_roles::left, xrt_system_devices::left, xrt_system_roles::right, xrt_system_devices::right, U_LOG_D, and xrt_system_roles::XRT_SYSTEM_ROLES_INIT.

Referenced by t_builder_roles_helper_open_system().