Monado OpenXR Runtime
u_handles.h
Go to the documentation of this file.
1// Copyright 2020-2021, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Functions for dealing generically with various handle types defined
6 * in xrt_handles.h
7 *
8 * @author Rylie Pavlik <rylie.pavlik@collabora.com>
9 * @ingroup aux_util
10 *
11 */
12
13#pragma once
14
15#include <xrt/xrt_handles.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21/*!
22 * Increase the reference count on the buffer handle, returning the new
23 * reference.
24 *
25 *
26 * Depending on the underlying type, the value may be the same or different than what was passed in. It should be
27 * retained for use at release time, regardless. (For example, if the underlying native handle does not expose reference
28 * counting, it may be duplicated and the duplicate returned.)
29 *
30 * @public @memberof xrt_graphics_buffer_handle_t
31 */
33u_graphics_buffer_ref(xrt_graphics_buffer_handle_t handle);
34
35/*!
36 * Decrease the reference count/release the handle reference passed in.
37 *
38 * Be sure to only call this once per handle.
39 *
40 * Performs null-check and clears the value after unreferencing.
41 *
42 * @public @memberof xrt_graphics_buffer_handle_t
43 */
44void
45u_graphics_buffer_unref(xrt_graphics_buffer_handle_t *handle);
46
47/*!
48 * Increase the reference count on the sync handle, returning the new
49 * reference.
50 *
51 * Depending on the underlying type, the value may be the same or different than what was passed in. It should be
52 * retained for use at release time, regardless. (For example, if the underlying native handle does not expose reference
53 * counting, it may be duplicated and the duplicate returned.)
54 *
55 * @public @memberof xrt_graphics_sync_handle_t
56 */
58u_graphics_sync_ref(xrt_graphics_sync_handle_t handle);
59
60/*!
61 * Decrease the reference count/release the handle reference passed in.
62 *
63 * Be sure to only call this once per handle.
64 *
65 * Performs null-check and clears the value after unreferencing.
66 *
67 * @public @memberof xrt_graphics_sync_handle_t
68 */
69void
70u_graphics_sync_unref(xrt_graphics_sync_handle_t *handle);
71
72#ifdef __cplusplus
73} // extern "C"
74#endif
Native handle types.
int xrt_graphics_buffer_handle_t
The type underlying buffers shared between compositor clients and the main compositor.
Definition: xrt_handles.h:246
int xrt_graphics_sync_handle_t
The type underlying synchronization primitives (semaphores, etc) shared between compositor clients an...
Definition: xrt_handles.h:348