Monado OpenXR Runtime
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
XRT interfaces

The main interface shared between the different components of Monado. More...

Collaboration diagram for XRT interfaces:

Files

file  xrt_compiler.h
 Header holding common defines.
 
file  xrt_compositor.h
 Header defining a XRT graphics provider.
 
file  xrt_config.h
 Includes all config headers, use separate headers instead.
 
file  xrt_config_os.h
 Auto detect OS and certain features.
 
file  xrt_defines.h
 Common defines and enums for XRT.
 
file  xrt_device.h
 Header defining a xrt HMD device.
 
file  xrt_documentation.h
 Header with just documentation.
 
file  xrt_frame.h
 Data frame header.
 
file  xrt_frameserver.h
 Frameserver interface for video drivers.
 
file  xrt_gfx_egl.h
 Header defining a XRT graphics provider.
 
file  xrt_gfx_fd.h
 Header defining a XRT graphics provider.
 
file  xrt_gfx_gl.h
 Header for misc OpenGL code, not a complete graphics provider.
 
file  xrt_gfx_gles.h
 Header for misc OpenGL ES code, not a complete graphics provider.
 
file  xrt_gfx_vk.h
 Header defining a XRT graphics provider.
 
file  xrt_gfx_xlib.h
 Header defining a XRT graphics provider.
 
file  xrt_openxr_includes.h
 Include all of the openxr headers in one place.
 
file  xrt_prober.h
 Common interface to probe for devices.
 
file  xrt_tracking.h
 Header defining the tracking system integration in Monado.
 
file  xrt_vulkan_includes.h
 Include all of the Vulkan headers in one place.
 

Data Structures

struct  xrt_swapchain
 Common swapchain base. More...
 
struct  xrt_compositor
 Common compositor base. More...
 
struct  xrt_swapchain_gl
 
struct  xrt_compositor_gl
 
struct  xrt_swapchain_vk
 Base class for a Vulkan client swapchain. More...
 
struct  xrt_compositor_vk
 Base class for a Vulkan client compositor. More...
 
struct  xrt_image_fd
 A single image of a fd based swapchain. More...
 
struct  xrt_swapchain_fd
 A swapchain that exposes fd to be imported into a client API. More...
 
struct  xrt_compositor_fd
 Main compositor. More...
 
struct  xrt_reference
 A base class for reference counted objects. More...
 
struct  xrt_quat
 A quaternion with single floats. More...
 
struct  xrt_vec1
 A 1 element vector with single floats. More...
 
struct  xrt_vec2
 A 2 element vector with single floats. More...
 
struct  xrt_vec3
 A 3 element vector with single floats. More...
 
struct  xrt_vec3_i32
 A 3 element vector with 32 bit integers. More...
 
struct  xrt_vec2_i32
 A 2 element vector with 32 bit integers. More...
 
struct  xrt_colour_rgb_u8
 A 3 element colour with 8 bits per channel. More...
 
struct  xrt_colour_rgba_u8
 A 4 element colour with 8 bits per channel. More...
 
struct  xrt_colour_rgb_f32
 A 3 element colour with floating point channels. More...
 
struct  xrt_colour_rgba_f32
 A 4 element colour with floating point channels. More...
 
struct  xrt_size
 Image size. More...
 
struct  xrt_pose
 A pose composed of a position and orientation. More...
 
struct  xrt_fov
 Describes a projection matrix fov. More...
 
struct  xrt_matrix_2x2
 A tightly packed 2x2 matrix of floats. More...
 
struct  xrt_matrix_3x3
 A tightly packed 3x3 matrix of floats. More...
 
struct  xrt_matrix_4x4
 A tightly packed 4x4 matrix of floats. More...
 
struct  xrt_api_requirements
 A range of API versions supported. More...
 
struct  xrt_space_relation
 A relation with two spaces, includes velocity and acceleration. More...
 
union  xrt_input_value
 A union of all input types. More...
 
union  xrt_output_value
 A union of all output types. More...
 
struct  xrt_view
 A per-lens view information. More...
 
struct  xrt_hmd_parts
 All of the device components that deals with interfacing to a users head. More...
 
struct  xrt_input
 A single named input, that sits on a xrt_device. More...
 
struct  xrt_device
 A single HMD or input device. More...
 
struct  xrt_frame
 Basic frame data structure - holds a pointer to buffer. More...
 
struct  xrt_frame_sink
 A object that is sent frames. More...
 
struct  xrt_frame_node
 A interface object used for destroying a frame graph. More...
 
struct  xrt_frame_context
 Object used to track all sinks and frame producers in a graph. More...
 
struct  xrt_fs_capture_parameters
 Controlling the camera capture parameters. More...
 
struct  xrt_fs
 Frameserver that generates frame, multiple subframes (like stereo and mipmaps) can be generate in one frame. More...
 
struct  xrt_prober_entry
 Entry for a single device. More...
 
struct  xrt_prober_entry_lists
 Main root of all of the probing device. More...
 
struct  xrt_prober_device
 A probed device, may or may not be opened. More...
 
struct  xrt_prober
 The main prober that probes and manages found but not opened HMD devices that are connected to the system. More...
 
struct  xrt_auto_prober
 A simple prober to probe for a HMD device connected to the system. More...
 

Macros

#define XRT_DEBUGBREAK()
 To trigger a trap/break in the debugger. More...
 
#define container_of(ptr, type, field)   (type *)((char *)ptr - offsetof(type, field))
 Get the holder from a pointer to a field. More...
 
#define XRT_MAX_SWAPCHAIN_IMAGES   8
 Max swapchain images, artificial limit. More...
 
#define XRT_MAX_SWAPCHAIN_FORMATS   8
 Max formats supported by a compositor, artificial limit. More...
 
#define XRT_INPUT_NAME(id, type)   ((id << 8) | XRT_INPUT_TYPE_##type)
 Create an enum value for xrt_input_name that packs an ID and input type. More...
 
#define XRT_GET_INPUT_TYPE(name)   (name & 0xff)
 Extract the xrt_input_type from an xrt_input_name. More...
 
#define XRT_MAX_DEVICES_PER_PROBE   16
 The maximum number of devices that a single "found" function called by the prober can create per-call. More...
 

Typedefs

typedef struct xrt_auto_prober *(* xrt_auto_prober_creator) ()
 Function for creating a auto prober. More...
 
typedef void(* xrt_prober_list_video_cb) (struct xrt_prober *xp, struct xrt_prober_device *pdev, const char *name, void *ptr)
 Callback for listing video devices. More...
 

Enumerations

enum  xrt_swapchain_create_flags { XRT_SWAPCHAIN_CREATE_STATIC_IMAGE = (1 << 0) }
 Special flags for creating swapchain images. More...
 
enum  xrt_swapchain_usage_bits {
  XRT_SWAPCHAIN_USAGE_COLOR = 0x00000001, XRT_SWAPCHAIN_USAGE_DEPTH_STENCIL = 0x00000002, XRT_SWAPCHAIN_USAGE_UNORDERED_ACCESS = 0x00000004, XRT_SWAPCHAIN_USAGE_TRANSFER_SRC = 0x00000008,
  XRT_SWAPCHAIN_USAGE_TRANSFER_DST = 0x00000010, XRT_SWAPCHAIN_USAGE_SAMPLED = 0x00000020, XRT_SWAPCHAIN_USAGE_MUTABLE_FORMAT = 0x00000040
}
 Usage of the swapchain images. More...
 
enum  xrt_view_type { XRT_VIEW_TYPE_MONO = 1, XRT_VIEW_TYPE_STEREO = 2 }
 View type to be rendered to by the compositor. More...
 
enum  xrt_blend_mode { XRT_BLEND_MODE_OPAQUE = 1 << 0, XRT_BLEND_MODE_ADDITIVE = 1 << 1, XRT_BLEND_MODE_ALPHA_BLEND = 1 << 2 }
 Which blend mode does the device support, used as both a bitfield and value. More...
 
enum  xrt_stereo_format { XRT_STEREO_FORMAT_NONE, XRT_STEREO_FORMAT_SBS, XRT_STEREO_FORMAT_INTERLEAVED, XRT_STEREO_FORMAT_OAU }
 What type of stereo format a frame has. More...
 
enum  xrt_space_relation_flags {
  XRT_SPACE_RELATION_ORIENTATION_VALID_BIT = 0x00000001, XRT_SPACE_RELATION_POSITION_VALID_BIT = 0x00000002, XRT_SPACE_RELATION_LINEAR_VELOCITY_VALID_BIT = 0x00000004, XRT_SPACE_RELATION_ANGULAR_VELOCITY_VALID_BIT = 0x00000008,
  XRT_SPACE_RELATION_LINEAR_ACCELERATION_VALID_BIT = 0x00000010, XRT_SPACE_RELATION_ANGULAR_ACCELERATION_VALID_BIT = 0x00000020, XRT_SPACE_RELATION_ORIENTATION_TRACKED_BIT = 0x00000040, XRT_SPACE_RELATION_POSITION_TRACKED_BIT = 0x00000080,
  XRT_SPACE_RELATION_BITMASK_ALL, XRT_SPACE_RELATION_BITMASK_NONE = 0
}
 Flags of which components of a xrt_space_relation is valid. More...
 
enum  xrt_input_type {
  XRT_INPUT_TYPE_VEC1_ZERO_TO_ONE = 0x00, XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE = 0x01, XRT_INPUT_TYPE_VEC2_MINUS_ONE_TO_ONE = 0x02, XRT_INPUT_TYPE_VEC3_MINUS_ONE_TO_ONE = 0x03,
  XRT_INPUT_TYPE_BOOLEAN = 0x04, XRT_INPUT_TYPE_POSE = 0x05
}
 Base type of this inputs. More...
 
enum  xrt_input_name {
  XRT_INPUT_GENERIC_HEAD_POSE = XRT_INPUT_NAME(0x0000, POSE), XRT_INPUT_GENERIC_HEAD_DETECT = XRT_INPUT_NAME(0x0001, BOOLEAN), XRT_INPUT_PSMV_PS_CLICK = XRT_INPUT_NAME(0x0020, BOOLEAN), XRT_INPUT_PSMV_MOVE_CLICK = XRT_INPUT_NAME(0x0021, BOOLEAN),
  XRT_INPUT_PSMV_START_CLICK = XRT_INPUT_NAME(0x0022, BOOLEAN), XRT_INPUT_PSMV_SELECT_CLICK = XRT_INPUT_NAME(0x0023, BOOLEAN), XRT_INPUT_PSMV_SQUARE_CLICK = XRT_INPUT_NAME(0x0024, BOOLEAN), XRT_INPUT_PSMV_CROSS_CLICK = XRT_INPUT_NAME(0x0025, BOOLEAN),
  XRT_INPUT_PSMV_CIRCLE_CLICK = XRT_INPUT_NAME(0x0026, BOOLEAN), XRT_INPUT_PSMV_TRIANGLE_CLICK = XRT_INPUT_NAME(0x0027, BOOLEAN), XRT_INPUT_PSMV_TRIGGER_VALUE = XRT_INPUT_NAME(0x0028, VEC1_ZERO_TO_ONE), XRT_INPUT_PSMV_BODY_CENTER_POSE = XRT_INPUT_NAME(0x0029, POSE),
  XRT_INPUT_PSMV_BALL_CENTER_POSE = XRT_INPUT_NAME(0x002A, POSE), XRT_INPUT_PSMV_BALL_TIP_POSE = XRT_INPUT_NAME(0x002B, POSE), XRT_INPUT_HYDRA_1_CLICK = XRT_INPUT_NAME(0x0030, BOOLEAN), XRT_INPUT_HYDRA_2_CLICK = XRT_INPUT_NAME(0x0031, BOOLEAN),
  XRT_INPUT_HYDRA_3_CLICK = XRT_INPUT_NAME(0x0032, BOOLEAN), XRT_INPUT_HYDRA_4_CLICK = XRT_INPUT_NAME(0x0033, BOOLEAN), XRT_INPUT_HYDRA_MIDDLE_CLICK = XRT_INPUT_NAME(0x0034, BOOLEAN), XRT_INPUT_HYDRA_BUMPER_CLICK = XRT_INPUT_NAME(0x0035, BOOLEAN),
  XRT_INPUT_HYDRA_JOYSTICK_CLICK = XRT_INPUT_NAME(0x0036, BOOLEAN), XRT_INPUT_HYDRA_JOYSTICK_VALUE = XRT_INPUT_NAME(0x0037, VEC2_MINUS_ONE_TO_ONE), XRT_INPUT_HYDRA_TRIGGER_VALUE = XRT_INPUT_NAME(0x0038, VEC1_ZERO_TO_ONE), XRT_INPUT_HYDRA_POSE = XRT_INPUT_NAME(0x0039, POSE),
  XRT_INPUT_DAYDREAM_TOUCHPAD_CLICK = XRT_INPUT_NAME(0x0040, BOOLEAN), XRT_INPUT_DAYDREAM_BAR_CLICK = XRT_INPUT_NAME(0x0041, BOOLEAN), XRT_INPUT_DAYDREAM_CIRCLE_CLICK = XRT_INPUT_NAME(0x0042, BOOLEAN), XRT_INPUT_DAYDREAM_VOLUP_CLICK = XRT_INPUT_NAME(0x0043, BOOLEAN),
  XRT_INPUT_DAYDREAM_VOLDN_CLICK = XRT_INPUT_NAME(0x0044, BOOLEAN), XRT_INPUT_DAYDREAM_TOUCHPAD_VALUE_X = XRT_INPUT_NAME(0x0045, VEC1_ZERO_TO_ONE), XRT_INPUT_DAYDREAM_TOUCHPAD_VALUE_Y = XRT_INPUT_NAME(0x0046, VEC1_ZERO_TO_ONE), XRT_INPUT_DAYDREAM_POSE = XRT_INPUT_NAME(0x0047, POSE)
}
 Name of a input with a baked in type. More...
 
enum  xrt_output_type { XRT_OUTPUT_TYPE_VIBRATION = 0x00 }
 Base type of this output. More...
 
enum  xrt_output_name { XRT_OUTPUT_NAME_PSMV_RUMBLE_VIBRATION = XRT_OUTPUT_NAME(0x0020, VIBRATION) }
 Name of a output with a baked in type. More...
 

Functions

struct xrt_compositor_glxrt_gfx_provider_create_gl_egl (struct xrt_compositor_fd *xcfd, EGLDisplay display, EGLConfig config, EGLContext context, PFNEGLGETPROCADDRESSPROC getProcAddress)
 
struct xrt_compositor_fdxrt_gfx_provider_create_fd (struct xrt_device *xdev, bool flip_y)
 Creates the main fd compositor. More...
 
void xrt_gfx_gl_get_versions (struct xrt_api_requirements *ver)
 
void xrt_gfx_gles_get_versions (struct xrt_api_requirements *ver)
 
void xrt_gfx_vk_get_versions (struct xrt_api_requirements *ver)
 
struct xrt_compositor_vkxrt_gfx_vk_provider_create (struct xrt_compositor_fd *xcfd, VkInstance instance, PFN_vkGetInstanceProcAddr get_instance_proc_addr, VkPhysicalDevice physical_device, VkDevice device, uint32_t queue_family_index, uint32_t queue_index)
 
struct xrt_compositor_glxrt_gfx_provider_create_gl_xlib (struct xrt_compositor_fd *xcfd, Display *xDisplay, uint32_t visualid, GLXFBConfig glxFBConfig, GLXDrawable glxDrawable, GLXContext glxContext)
 
int xrt_prober_create (struct xrt_prober **out_xp)
 Call this function to create the xrt_prober. More...
 
int xrt_prober_create_with_lists (struct xrt_prober **out_xp, struct xrt_prober_entry_lists *list)
 Used by the target binary to create the prober with a list of drivers. More...
 

Variables

const char * xrt_gfx_vk_instance_extensions
 
const char * xrt_gfx_vk_device_extensions
 
enum  xrt_tracking_type { XRT_TRACKING_TYPE_NONE, XRT_TRACKING_TYPE_RGB }
 What kind of tracking system is this. More...
 

Detailed Description

The main interface shared between the different components of Monado.

Macro Definition Documentation

◆ container_of

#define container_of (   ptr,
  type,
  field 
)    (type *)((char *)ptr - offsetof(type, field))

#include <include/xrt/xrt_compiler.h>

Get the holder from a pointer to a field.

Referenced by gui_ogl_sink_update().

◆ XRT_DEBUGBREAK

#define XRT_DEBUGBREAK ( )

#include <include/xrt/xrt_compiler.h>

To trigger a trap/break in the debugger.

◆ XRT_GET_INPUT_TYPE

#define XRT_GET_INPUT_TYPE (   name)    (name & 0xff)

#include <include/xrt/xrt_defines.h>

Extract the xrt_input_type from an xrt_input_name.

Parameters
nameA xrt_input_name value
See also
xrt_input_name
xrt_input_type

◆ XRT_INPUT_NAME

#define XRT_INPUT_NAME (   id,
  type 
)    ((id << 8) | XRT_INPUT_TYPE_##type)

#include <include/xrt/xrt_defines.h>

Create an enum value for xrt_input_name that packs an ID and input type.

Parameters
idan integer
typeThe suffix of an xrt_input_type value name: XRT_INPUT_TYPE_ is prepended automatically.
See also
xrt_input_name

◆ XRT_MAX_DEVICES_PER_PROBE

#define XRT_MAX_DEVICES_PER_PROBE   16

#include <include/xrt/xrt_prober.h>

The maximum number of devices that a single "found" function called by the prober can create per-call.

◆ XRT_MAX_SWAPCHAIN_FORMATS

#define XRT_MAX_SWAPCHAIN_FORMATS   8

#include <include/xrt/xrt_compositor.h>

Max formats supported by a compositor, artificial limit.

◆ XRT_MAX_SWAPCHAIN_IMAGES

#define XRT_MAX_SWAPCHAIN_IMAGES   8

#include <include/xrt/xrt_compositor.h>

Max swapchain images, artificial limit.

Typedef Documentation

◆ xrt_auto_prober_creator

typedef struct xrt_auto_prober*(* xrt_auto_prober_creator) ()

#include <include/xrt/xrt_prober.h>

Function for creating a auto prober.

◆ xrt_prober_list_video_cb

typedef void(* xrt_prober_list_video_cb) (struct xrt_prober *xp, struct xrt_prober_device *pdev, const char *name, void *ptr)

#include <include/xrt/xrt_prober.h>

Callback for listing video devices.

Enumeration Type Documentation

◆ xrt_blend_mode

#include <include/xrt/xrt_defines.h>

Which blend mode does the device support, used as both a bitfield and value.

◆ xrt_input_name

#include <include/xrt/xrt_defines.h>

Name of a input with a baked in type.

See also
xrt_input_type
Enumerator
XRT_INPUT_DAYDREAM_TOUCHPAD_VALUE_X 
Todo:
This should be merged and be tagged as a touchpad, maybe.

◆ xrt_input_type

#include <include/xrt/xrt_defines.h>

Base type of this inputs.

Enumerator
XRT_INPUT_TYPE_VEC1_ZERO_TO_ONE 

Float input in [0, 1].

XRT_INPUT_TYPE_VEC1_MINUS_ONE_TO_ONE 

Float input in [-1, 1].

XRT_INPUT_TYPE_VEC2_MINUS_ONE_TO_ONE 

Vec2 input, components in [-1, 1].

XRT_INPUT_TYPE_VEC3_MINUS_ONE_TO_ONE 

Vec3 input, components in [-1, 1].

XRT_INPUT_TYPE_BOOLEAN 

Boolean (digital, binary) input.

XRT_INPUT_TYPE_POSE 

A tracked pose.

◆ xrt_output_name

#include <include/xrt/xrt_defines.h>

Name of a output with a baked in type.

See also
xrt_output_type

◆ xrt_output_type

#include <include/xrt/xrt_defines.h>

Base type of this output.

◆ xrt_space_relation_flags

#include <include/xrt/xrt_defines.h>

Flags of which components of a xrt_space_relation is valid.

See also
xrt_space_relation

◆ xrt_stereo_format

#include <include/xrt/xrt_defines.h>

What type of stereo format a frame has.

Enumerator
XRT_STEREO_FORMAT_SBS 

Side by side.

XRT_STEREO_FORMAT_INTERLEAVED 

Interleaved pixels.

XRT_STEREO_FORMAT_OAU 

Over & Under.

◆ xrt_swapchain_create_flags

#include <include/xrt/xrt_compositor.h>

Special flags for creating swapchain images.

◆ xrt_swapchain_usage_bits

#include <include/xrt/xrt_compositor.h>

Usage of the swapchain images.

◆ xrt_tracking_type

#include <include/xrt/xrt_tracking.h>

What kind of tracking system is this.

Todo:
Is none, Colour, IR, Magnetic the kind of type we need to know about?

◆ xrt_view_type

#include <include/xrt/xrt_compositor.h>

View type to be rendered to by the compositor.

Function Documentation

◆ xrt_gfx_provider_create_fd()

struct xrt_compositor_fd* xrt_gfx_provider_create_fd ( struct xrt_device xdev,
bool  flip_y 
)

#include <include/xrt/xrt_gfx_fd.h>

Creates the main fd compositor.

Todo:
set this to an estimate that's better than 6ms

References xrt_compositor::begin_session, comp_swapchain_create(), xrt_compositor::create_swapchain, and U_TYPED_CALLOC.

◆ xrt_prober_create()

int xrt_prober_create ( struct xrt_prober **  out_xp)

#include <include/xrt/xrt_prober.h>

Call this function to create the xrt_prober.

This function is setup in the the very small target wrapper.c for each binary.

References xrt_prober_create_with_lists().

Referenced by gui_prober_init().

◆ xrt_prober_create_with_lists()

int xrt_prober_create_with_lists ( struct xrt_prober **  out_xp,
struct xrt_prober_entry_lists list 
)

#include <include/xrt/xrt_prober.h>

Used by the target binary to create the prober with a list of drivers.

References U_TYPED_CALLOC.

Referenced by xrt_prober_create().