Monado OpenXR Runtime
comp_semaphore.h
Go to the documentation of this file.
1// Copyright 2019-2023, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Independent semaphore implementation.
6 * @author Jakob Bornecrantz <jakob@collabora.com>
7 * @ingroup comp_util
8 */
9
10#pragma once
11
12#include "xrt/xrt_compositor.h"
13#include "vk/vk_helpers.h"
14
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20
21/*!
22 * A simple implementation of the xrt_compositor_semaphore interface.
23 *
24 * @ingroup comp_util
25 * @implements xrt_compositor_swapchain
26 * @see comp_compositor
27 */
29{
30 struct xrt_compositor_semaphore base;
31
32 struct vk_bundle *vk;
33
34 VkSemaphore semaphore;
35
36 /*!
37 * Shared handle, the layer above compositor, such as IPC & st/oxr,
38 * doesn't consume this handle, instead it has dup semantics. So we
39 * need to keep track of the handle and free it once done. This is
40 * because the platform may be required by the platform.
41 */
43};
44
45
46/*
47 *
48 * Helper functions.
49 *
50 */
51
52/*!
53 * Convenience function to convert a xrt_compositor_semaphore to a comp_semaphore.
54 *
55 * @ingroup comp_util
56 * @private @memberof comp_semaphore
57 */
58static inline struct comp_semaphore *
60{
61 return (struct comp_semaphore *)xcsem;
62}
63
64
65/*
66 *
67 * 'Exported' functions.
68 *
69 */
70
71/*!
72 * Creates a @ref comp_semaphore, used to implement compositor functionality.
73 *
74 * @ingroup comp_util
75 */
79 struct xrt_compositor_semaphore **out_xcsem);
80
81
82#ifdef __cplusplus
83}
84#endif
xrt_result_t comp_semaphore_create(struct vk_bundle *vk, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem)
Creates a comp_semaphore, used to implement compositor functionality.
Definition: comp_semaphore.c:82
enum xrt_result xrt_result_t
Result type used across Monado.
A simple implementation of the xrt_compositor_semaphore interface.
Definition: comp_semaphore.h:29
xrt_graphics_sync_handle_t handle
Shared handle, the layer above compositor, such as IPC & st/oxr, doesn't consume this handle,...
Definition: comp_semaphore.h:42
A bundle of Vulkan functions and objects, used by both Compositor and Compositor client code.
Definition: vk_helpers.h:49
Compositor semaphore used for synchronization, needs to be as capable as a Vulkan pipeline semaphore.
Definition: xrt_compositor.h:788
Common Vulkan code header.
Header declaring XRT graphics interfaces.
int xrt_graphics_sync_handle_t
The type underlying synchronization primitives (semaphores, etc) shared between compositor clients an...
Definition: xrt_handles.h:348