Monado OpenXR Runtime
target_instance_parts.h
Go to the documentation of this file.
1 // Copyright 2020, Collabora, Ltd.
2 // SPDX-License-Identifier: BSL-1.0
3 /*!
4  * @file
5  * @brief Shared default implementation of the instance: pieces that are used
6  * whether or not there's a compositor.
7  * @author Jakob Bornecrantz <jakob@collabora.com>
8  */
9 #pragma once
10 
11 #include "target_lists.h"
12 
13 #include "xrt/xrt_prober.h"
14 #include "xrt/xrt_instance.h"
15 
16 #include "util/u_misc.h"
17 #include "util/u_trace_marker.h"
18 
19 
20 /*
21  *
22  * Struct and helpers.
23  *
24  */
25 
26 /*!
27  * Main "real" instance implementation.
28  *
29  * Used in instances both with and without compositor usage.
30  *
31  * @implements xrt_instance
32  */
33 struct t_instance
34 {
35  struct xrt_instance base;
36  struct xrt_prober *xp;
37 };
38 
39 static inline struct t_instance *
40 t_instance(struct xrt_instance *xinst)
41 {
42  return (struct t_instance *)xinst;
43 }
44 
45 
46 /*
47  *
48  * Member functions.
49  *
50  */
51 
52 static xrt_result_t
53 t_instance_get_prober(struct xrt_instance *xinst, struct xrt_prober **out_xp)
54 {
55  XRT_TRACE_MARKER();
56 
57  struct t_instance *tinst = t_instance(xinst);
58 
59  if (tinst->xp == NULL) {
61  }
62 
63  *out_xp = tinst->xp;
64 
65  return XRT_SUCCESS;
66 }
67 
68 static void
69 t_instance_destroy(struct xrt_instance *xinst)
70 {
71  XRT_TRACE_MARKER();
72 
73  struct t_instance *tinst = t_instance(xinst);
74 
75  xrt_prober_destroy(&tinst->xp);
76  free(tinst);
77 }
enum xrt_result xrt_result_t
Result type used across Monado.
@ XRT_ERROR_PROBER_NOT_SUPPORTED
The prober list has not been locked before this call.
Definition: xrt_results.h:128
@ XRT_SUCCESS
The operation succeeded.
Definition: xrt_results.h:26
Main "real" instance implementation.
Definition: target_instance_parts.h:34
This interface acts as a root object for Monado.
Definition: xrt_instance.h:67
The main prober that probes and manages found but not opened HMD devices that are connected to the sy...
Definition: xrt_prober.h:132
static void xrt_prober_destroy(struct xrt_prober **xp_ptr)
Destroy the prober and set the pointer to null.
Definition: xrt_prober.h:505
Common things to pull into a target.
Very small misc utils.
Tracing support code, see Tracing support.
Header for xrt_instance object.
Common interface to probe for devices.