The open source OpenXR runtime
1// Copyright 2019, Collabora, Ltd.
2// Copyright 2024-2025, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Compositor window header.
7 * @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
8 * @author Jakob Bornecrantz <jakob@collabora.com>
9 * @ingroup comp_main
10 */
11
12#pragma once
13
14#include "main/comp_target_swapchain.h"
15#include "main/comp_compositor.h"
16
17#include "xrt/xrt_config_os.h"
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23
24/*
25 *
26 * Functions.
27 *
28 */
29
30/*!
31 * Debug info target factor, always available.
32 *
33 * @ingroup comp_main
34 */
35extern const struct comp_target_factory comp_target_factory_debug_image;
36
37#ifdef VK_USE_PLATFORM_XCB_KHR
38
39/*!
40 * Create a xcb window.
41 *
42 * @ingroup comp_main
43 * @public @memberof comp_window_xcb
44 */
45struct comp_target *
46comp_window_xcb_create(struct comp_compositor *c);
47
48extern const struct comp_target_factory comp_target_factory_xcb;
49
50#endif // VK_USE_PLATFORM_XCB_KHR
51
52#ifdef VK_USE_PLATFORM_WAYLAND_KHR
53
54/*!
55 * Create a wayland window.
56 *
57 * @ingroup comp_main
58 * @public @memberof comp_window_wayland
59 */
60struct comp_target *
61comp_window_wayland_create(struct comp_compositor *c);
62
63extern const struct comp_target_factory comp_target_factory_wayland;
64
65/*!
66 * Create a direct surface to a HMD using Wayland.
67 *
68 * @ingroup comp
69 */
70struct comp_target *
71comp_window_direct_wayland_create(struct comp_compositor *c);
72
73extern const struct comp_target_factory comp_target_factory_direct_wayland;
74
75#endif // VK_USE_PLATFORM_WAYLAND_KHR
76
77#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
78/*!
79 * Create a direct surface to an HMD over RandR.
80 *
81 * @ingroup comp_main
82 * @public @memberof comp_window_direct_randr
83 */
84struct comp_target *
85comp_window_direct_randr_create(struct comp_compositor *c);
86
87extern const struct comp_target_factory comp_target_factory_direct_randr;
88
89/*!
90 * Create a direct surface to an HMD on NVIDIA.
91 *
92 * @ingroup comp_main
93 * @public @memberof comp_window_direct_nvidia
94 */
95struct comp_target *
96comp_window_direct_nvidia_create(struct comp_compositor *c);
97
98extern const struct comp_target_factory comp_target_factory_direct_nvidia;
99#endif // VK_USE_PLATFORM_XLIB_XRANDR_EXT
100
101#if 1
102/*!
103 * Create a direct surface to an HMD on VkDisplay.
104 *
105 * @ingroup comp_main
106 * @public @memberof comp_window_direct_vk_display
107 */
108struct comp_target *
109comp_window_vk_display_create(struct comp_compositor *c);
110
111extern const struct comp_target_factory comp_target_factory_vk_display;
112#endif // 1
113
114#ifdef XRT_OS_ANDROID
115/*!
116 * Create a surface to an HMD on Android.
117 *
118 * @ingroup comp_main
119 * @public @memberof comp_window_android
120 */
121struct comp_target *
122comp_window_android_create(struct comp_compositor *c);
123
124extern const struct comp_target_factory comp_target_factory_android;
125#endif // XRT_OS_ANDROID
126
127#ifdef XRT_OS_WINDOWS
128
129/*!
130 * Create a rendering window on Windows.
131 *
132 * @ingroup comp_main
133 * @public @memberof comp_window_mswin
134 */
135struct comp_target *
136comp_window_mswin_create(struct comp_compositor *c);
137
138extern const struct comp_target_factory comp_target_factory_mswin;
139#endif // XRT_OS_WINDOWS
140
141#ifdef __cplusplus
142}
143#endif