Monado OpenXR Runtime
Loading...
Searching...
No Matches
xrt_compositor.h
Go to the documentation of this file.
1// Copyright 2019-2024, Collabora, Ltd.
2// Copyright 2025, NVIDIA CORPORATION.
3// SPDX-License-Identifier: BSL-1.0
4/*!
5 * @file
6 * @brief Header declaring XRT graphics interfaces.
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
9 * @author Rylie Pavlik <rylie.pavlik@collabora.com>
10 * @author Christoph Haag <christoph.haag@collabora.com>
11 * @author Korcan Hussein <korcan.hussein@collabora.com>
12 * @ingroup xrt_iface
13 */
14
15#pragma once
16
17#include "xrt/xrt_limits.h"
18#include "xrt/xrt_defines.h"
19#include "xrt/xrt_handles.h"
20#include "xrt/xrt_config_os.h"
21#include "xrt/xrt_config_have.h"
22#include "xrt/xrt_windows.h"
23
24#if defined(XRT_HAVE_D3D11)
25#include <d3d11.h>
26#elif defined(XRT_DOXYGEN)
27struct ID3D11Texture2D;
28#endif
29
30#if defined(XRT_HAVE_D3D12)
31#include <d3d12.h>
32#elif defined(XRT_DOXYGEN)
33struct ID3D12Resource;
34#endif
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
40
41/*
42 *
43 * Pre-declare things, also they should not be in the xrt_iface group.
44 *
45 */
46
47struct xrt_device;
48struct xrt_image_native;
49struct xrt_compositor;
51
52typedef struct VkCommandBuffer_T *VkCommandBuffer;
53#ifdef XRT_64_BIT
54typedef struct VkImage_T *VkImage;
55typedef struct VkDeviceMemory_T *VkDeviceMemory;
56#else
57typedef uint64_t VkImage;
58typedef uint64_t VkDeviceMemory;
59#endif
60
61
62/*!
63 * @addtogroup xrt_iface
64 * @{
65 */
66
67
68/*
69 *
70 * Layers.
71 *
72 */
73
74/*!
75 * Layer type.
76 */
78{
79 XRT_LAYER_PROJECTION,
80 XRT_LAYER_PROJECTION_DEPTH,
81 XRT_LAYER_QUAD,
82 XRT_LAYER_CUBE,
83 XRT_LAYER_CYLINDER,
84 XRT_LAYER_EQUIRECT1,
85 XRT_LAYER_EQUIRECT2,
86 XRT_LAYER_PASSTHROUGH
87};
88
89/*!
90 * Bit field for holding information about how a layer should be composited.
91 */
93{
94 XRT_LAYER_COMPOSITION_CORRECT_CHROMATIC_ABERRATION_BIT = 1u << 0u,
95 XRT_LAYER_COMPOSITION_BLEND_TEXTURE_SOURCE_ALPHA_BIT = 1u << 1u,
96 XRT_LAYER_COMPOSITION_UNPREMULTIPLIED_ALPHA_BIT = 1u << 2u,
97 /*!
98 * The layer is locked to the device and the pose should only be
99 * adjusted for the IPD.
100 */
102
103 /*!
104 * If this flag is set the compositor should use the scale and bias
105 * from the @ref xrt_layer_data struct.
106 */
108
109 //! Normal super sampling, see XrCompositionLayerSettingsFlagsFB.
111
112 //! Quality super sampling, see XrCompositionLayerSettingsFlagsFB.
114
115 //! Normal sharpening, see XrCompositionLayerSettingsFlagsFB.
117
118 //! Quality sharpening, see XrCompositionLayerSettingsFlagsFB.
120
121 /*!
122 * This layer has advanced blending information, this bit
123 * supersedes the behavior of
124 * @ref XRT_LAYER_COMPOSITION_BLEND_TEXTURE_SOURCE_ALPHA_BIT,
125 * see @p XrCompositionLayerAlphaBlendFB.
126 */
128
129 /*!
130 * Depth testing is requested when composing this layer if this flag is set,
131 * see XrCompositionLayerDepthTestFB.
132 */
134
135 /*!
136 * This layer has inverted alpha,
137 * see @p XR_COMPOSITION_LAYER_INVERTED_ALPHA_BIT_EXT
138 */
140
141 /*!
142 * When "emulating" a quad view projection layer with two stereo
143 * projection layers this is used to tag the context (background) layer
144 * that the inset layer is blended with.
145 */
147
148 /*!
149 * When "emulating" a quad view projection layer with two stereo
150 * projection layers this is used to tag the inset layer so that the
151 * compositor can apply blending between the two. Essentially this tells
152 * the compositor to blend the edges of this layer with the context
153 * layer below it.
154 */
156};
157
158/*!
159 * XrCompareOpFB
160 */
162{
163 XRT_COMPARE_OP_NEVER_FB = 0,
164 XRT_COMPARE_OP_LESS_FB = 1,
165 XRT_COMPARE_OP_EQUAL_FB = 2,
166 XRT_COMPARE_OP_LESS_OR_EQUAL_FB = 3,
167 XRT_COMPARE_OP_GREATER_FB = 4,
168 XRT_COMPARE_OP_NOT_EQUAL_FB = 5,
169 XRT_COMPARE_OP_GREATER_OR_EQUAL_FB = 6,
170 XRT_COMPARE_OP_ALWAYS_FB = 7,
171 XRT_COMPARE_OP_MAX_ENUM_FB = 0x7FFFFFFF
172};
173
174/*!
175 * Which view is the layer visible to?
176 *
177 * Used for quad layers.
178 *
179 * @note Doesn't have the same values as the OpenXR counterpart!
180 */
182{
183 XRT_LAYER_EYE_VISIBILITY_NONE = 0x0,
184 XRT_LAYER_EYE_VISIBILITY_LEFT_BIT = 0x1,
185 XRT_LAYER_EYE_VISIBILITY_RIGHT_BIT = 0x2,
186 XRT_LAYER_EYE_VISIBILITY_BOTH = 0x3,
187};
188
189/*!
190 * Blend factors.
191 */
193{
194 XRT_BLEND_FACTOR_ZERO = 0,
195 XRT_BLEND_FACTOR_ONE = 1,
196 XRT_BLEND_FACTOR_SRC_ALPHA = 2,
197 XRT_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 3,
198 XRT_BLEND_FACTOR_DST_ALPHA = 4,
199 XRT_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 5,
200 XRT_BLEND_FACTOR_MAX_ENUM_FB = 0x7FFFFFFF,
201};
202
203
204/*!
205 * Chroma key parameters in HSV space.
206 * Alpha 0-1 interpolates between hsv_min and hsv_max
207 * with curve as a power curve defined by the curve exponent.
208 *
209 * Used for projection layers.
210 */
212{
213 //!< Minimum HSV bounds
215 //! Maximum HSV bounds
217 //! Power curve for alpha falloff (1.0 = linear)
218 float curve;
219 //! Despill strength (0.0 = none, 1.0 = full)
220 float despill;
221};
222
223/*!
224 * Advanced blend
225 * provides explicit control over source and destination blend factors,
226 * with separate controls for color and alpha
227 *
228 * See @ref XRT_LAYER_COMPOSITION_ADVANCED_BLENDING_BIT.
229 */
231{
232 enum xrt_blend_factor src_factor_color;
233 enum xrt_blend_factor dst_factor_color;
234 enum xrt_blend_factor src_factor_alpha;
235 enum xrt_blend_factor dst_factor_alpha;
236};
237
238/*!
239 * Specifies a sub-image in a layer.
240 */
242{
243 //! Image index in the (implicit) swapchain
244 uint32_t image_index;
245 //! Index in image array (for array textures)
246 uint32_t array_index;
247 //! The rectangle in the image to use
249 //! Normalized sub image coordinates and size.
251};
252
253/*!
254 * All of the pure data values associated with a single view in a projection
255 * layer.
256 *
257 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
258 * this struct.
259 */
261{
262 struct xrt_sub_image sub;
263
264 struct xrt_fov fov;
265 struct xrt_pose pose;
266};
267
268/*!
269 * All the pure data values associated with a projection layer.
270 *
271 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
272 * this struct.
273 */
275{
276 struct xrt_layer_projection_view_data v[XRT_MAX_VIEWS];
277
278 struct xrt_layer_chroma_key_data chroma_key;
279};
280
281/*!
282 * All the pure data values associated with a depth information attached
283 * to a layer.
284 *
285 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
286 * this struct.
287 */
289{
290 struct xrt_sub_image sub;
291
292 float min_depth;
293 float max_depth;
294 float near_z;
295 float far_z;
296};
297
299{
300 bool depth_mask;
301 enum xrt_compare_op_fb compare_op;
302};
303
304/*!
305 * All the pure data values associated with a projection layer with depth
306 * swapchain attached.
307 *
308 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
309 * this struct.
310 */
312{
313 struct xrt_layer_projection_view_data v[XRT_MAX_VIEWS];
314
315 struct xrt_layer_depth_data d[XRT_MAX_VIEWS];
316
317 struct xrt_layer_chroma_key_data chroma_key;
318};
319
320/*!
321 * All the pure data values associated with a quad layer.
322 *
323 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
324 * this struct.
325 */
327{
328 enum xrt_layer_eye_visibility visibility;
329
330 struct xrt_sub_image sub;
331
332 struct xrt_pose pose;
333 struct xrt_vec2 size;
334};
335
336/*!
337 * All the pure data values associated with a cube layer.
338 *
339 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
340 * this struct.
341 */
343{
344 enum xrt_layer_eye_visibility visibility;
345
346 struct xrt_sub_image sub;
347
348 struct xrt_pose pose;
349};
350
351/*!
352 * All the pure data values associated with a cylinder layer.
353 *
354 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
355 * this struct.
356 */
358{
359 enum xrt_layer_eye_visibility visibility;
360
361 struct xrt_sub_image sub;
362
363 struct xrt_pose pose;
364 float radius;
365 float central_angle;
366 float aspect_ratio;
367};
368
369/*!
370 * All the pure data values associated with a equirect1 layer.
371 *
372 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
373 * this struct.
374 */
376{
377 enum xrt_layer_eye_visibility visibility;
378
379 struct xrt_sub_image sub;
380
381 struct xrt_pose pose;
382 float radius;
383 struct xrt_vec2 scale;
384 struct xrt_vec2 bias;
385};
386
387/*!
388 * All the pure data values associated with a equirect2 layer.
389 *
390 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
391 * this struct.
392 */
394{
395 enum xrt_layer_eye_visibility visibility;
396
397 struct xrt_sub_image sub;
398
399 struct xrt_pose pose;
400 float radius;
401 float central_horizontal_angle;
402 float upper_vertical_angle;
403 float lower_vertical_angle;
404};
405
406/*!
407 * @interface xrt_passthrough
408 */
410{
411 bool paused;
412};
413
414/*!
415 * @interface xrt_passthrough_layer
416 */
418{
419 bool paused;
420};
421
422/*!
423 * All the pure data values associated with a passthrough layer.
424 *
425 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
426 * this struct.
427 */
429{
430 struct xrt_passthrough xrt_pt;
431 struct xrt_passthrough_layer xrt_pl;
432};
433
434/*!
435 * All the pure data values associated with a composition layer.
436 *
437 * The @ref xrt_swapchain references and @ref xrt_device are provided outside of
438 * this struct.
439 */
441{
442 /*!
443 * Tag for compositor layer type.
444 */
446
447 /*!
448 * Often @ref XRT_INPUT_GENERIC_HEAD_POSE
449 */
451
452 /*!
453 * "Display no-earlier-than" timestamp for this layer.
454 *
455 * The layer may be displayed after this point, but must never be
456 * displayed before.
457 *
458 * alignas for 32 bit client support,
459 */
460 XRT_ALIGNAS(8) int64_t timestamp;
461
462 /*!
463 * Composition flags
464 */
466
467 /*!
468 * Depth test data
469 */
471
472 /*!
473 * Whether the main compositor should flip the direction of y when
474 * rendering.
475 *
476 * This is actually an input only to the "main" compositor
477 * comp_compositor. It is overwritten by the various client
478 * implementations of the @ref xrt_compositor interface depending on the
479 * conventions of the associated graphics API. Other @ref
480 * xrt_compositor_native implementations that are not the main
481 * compositor just pass this field along unchanged to the "real"
482 * compositor.
483 */
484 bool flip_y;
485
486 /*!
487 * Modulate the color sourced from the images.
488 */
490
491 /*!
492 * Modulate the color sourced from the images.
493 */
495
496 /*!
497 * Advanced blend factors
498 */
500
501 /*!
502 * Union of data values for the various layer types.
503 *
504 * The initialized member of this union should match the value of
505 * xrt_layer_data::type. It also should be clear because of the layer
506 * function called between xrt_compositor::layer_begin and
507 * xrt_compositor::layer_commit where this data was passed.
508 */
509 union {
510 struct xrt_layer_projection_data proj;
512 struct xrt_layer_quad_data quad;
513 struct xrt_layer_cube_data cube;
514 struct xrt_layer_cylinder_data cylinder;
515 struct xrt_layer_equirect1_data equirect1;
516 struct xrt_layer_equirect2_data equirect2;
517 struct xrt_layer_passthrough_data passthrough;
518 };
519 uint32_t view_count;
520};
521
522/*!
523 * Per frame data for the layer submission calls, used in
524 * @ref xrt_compositor::layer_begin.
525 */
527{
528 //! alignas for 32 bit client support, see @ref ipc-design
529 XRT_ALIGNAS(8) int64_t frame_id;
530 int64_t display_time_ns;
531 enum xrt_blend_mode env_blend_mode;
532};
533
534
535/*
536 *
537 * Swapchain.
538 *
539 */
540
541/*!
542 * @interface xrt_swapchain
543 *
544 * Common swapchain interface/base.
545 *
546 * Swapchains are owned by the @ref xrt_compositor that they where created from,
547 * it's the state trackers job to ensure all swapchains are destroyed before
548 * destroying the @ref xrt_compositor.
549 */
551{
552 /*!
553 * Reference helper.
554 */
555 struct xrt_reference reference;
556
557 /*!
558 * Number of images.
559 *
560 * The images themselves are on the subclasses.
561 */
562 uint32_t image_count;
563
564 /*!
565 * @ref dec_image_use must have been called as often as @ref inc_image_use.
566 */
567 void (*destroy)(struct xrt_swapchain *xsc);
568
569 /*!
570 * Obtain the index of the next image to use, without blocking on being
571 * able to write to it.
572 *
573 * See xrAcquireSwapchainImage.
574 *
575 * Caller must make sure that no image is acquired before calling
576 * @ref xrt_swapchain_acquire_image.
577 *
578 * @param xsc Self pointer
579 * @param[out] out_index Image index to use next
580 *
581 * Call @ref xrt_swapchain_wait_image before writing to the image index output from this function.
582 */
583 xrt_result_t (*acquire_image)(struct xrt_swapchain *xsc, uint32_t *out_index);
584
585 /*!
586 * @brief Increments the use counter of a swapchain image.
587 */
588 xrt_result_t (*inc_image_use)(struct xrt_swapchain *xsc, uint32_t index);
589
590 /*!
591 * @brief Decrements the use counter of a swapchain image.
592 *
593 * @ref wait_image will return once the image use counter is 0.
594 */
595 xrt_result_t (*dec_image_use)(struct xrt_swapchain *xsc, uint32_t index);
596
597 /*!
598 * Wait until image @p index is available for exclusive use, or until @p timeout_ns expires.
599 *
600 * See xrWaitSwapchainImage, which is the basis for this API.
601 * The state tracker needs to track image index, which should have come from @ref xrt_swapchain_acquire_image
602
603 * @param xsc Self pointer
604 * @param timeout_ns Timeout in nanoseconds,
605 * @param index Image index to wait for.
606 */
607 xrt_result_t (*wait_image)(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index);
608
609 /*!
610 * Do any barrier transitions to and from the application.
611 *
612 * @param xsc Self pointer
613 * @param direction Direction of the barrier transition.
614 * @param index Image index to barrier transition.
615 */
616 xrt_result_t (*barrier_image)(struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index);
617
618 /*!
619 * See xrReleaseSwapchainImage, state tracker needs to track index.
620 */
621 xrt_result_t (*release_image)(struct xrt_swapchain *xsc, uint32_t index);
622};
623
624/*!
625 * Update the reference counts on swapchain(s).
626 *
627 * @param[in,out] dst Pointer to a object reference: if the object reference is
628 * non-null will decrement its counter. The reference that
629 * @p dst points to will be set to @p src.
630 * @param[in] src New object for @p dst to refer to (may be null).
631 * If non-null, will have its refcount increased.
632 * @ingroup xrt_iface
633 * @relates xrt_swapchain
634 */
635XRT_NONNULL_FIRST static inline void
637{
638 struct xrt_swapchain *old_dst = *dst;
639
640 if (old_dst == src) {
641 return;
642 }
643
644 if (src) {
645 xrt_reference_inc(&src->reference);
646 }
647
648 *dst = src;
649
650 if (old_dst) {
651 if (xrt_reference_dec_and_is_zero(&old_dst->reference)) {
652 old_dst->destroy(old_dst);
653 }
654 }
655}
656
657/*!
658 * @copydoc xrt_swapchain::acquire_image
659 *
660 * Helper for calling through the function pointer.
661 *
662 * @public @memberof xrt_swapchain
663 */
664XRT_NONNULL_ALL static inline xrt_result_t
665xrt_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_index)
666{
667 return xsc->acquire_image(xsc, out_index);
668}
669
670/*!
671 * @copydoc xrt_swapchain::inc_image_use
672 *
673 * Helper for calling through the function pointer.
674 *
675 * @public @memberof xrt_swapchain
676 */
677XRT_NONNULL_ALL static inline xrt_result_t
678xrt_swapchain_inc_image_use(struct xrt_swapchain *xsc, uint32_t index)
679{
680 return xsc->inc_image_use(xsc, index);
681}
682
683/*!
684 * @copydoc xrt_swapchain::dec_image_use
685 *
686 * Helper for calling through the function pointer.
687 *
688 * @public @memberof xrt_swapchain
689 */
690XRT_NONNULL_ALL static inline xrt_result_t
691xrt_swapchain_dec_image_use(struct xrt_swapchain *xsc, uint32_t index)
692{
693 return xsc->dec_image_use(xsc, index);
694}
695
696/*!
697 * @copydoc xrt_swapchain::wait_image
698 *
699 * Helper for calling through the function pointer.
700 *
701 * @public @memberof xrt_swapchain
702 */
703XRT_NONNULL_ALL static inline xrt_result_t
704xrt_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
705{
706 return xsc->wait_image(xsc, timeout_ns, index);
707}
708
709/*!
710 * @copydoc xrt_swapchain::barrier_image
711 *
712 * Helper for calling through the function pointer.
713 *
714 * @public @memberof xrt_swapchain
715 */
716XRT_NONNULL_ALL static inline xrt_result_t
717xrt_swapchain_barrier_image(struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index)
718{
719 return xsc->barrier_image(xsc, direction, index);
720}
721
722/*!
723 * @copydoc xrt_swapchain::release_image
724 *
725 * Helper for calling through the function pointer.
726 *
727 * @public @memberof xrt_swapchain
728 */
729XRT_NONNULL_ALL static inline xrt_result_t
730xrt_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
731{
732 return xsc->release_image(xsc, index);
733}
734
735
736/*
737 *
738 * Fence.
739 *
740 */
741
742/*!
743 * Compositor fence used for synchronization.
744 */
746{
747 /*!
748 * Waits on the fence with the given timeout.
749 */
750 xrt_result_t (*wait)(struct xrt_compositor_fence *xcf, uint64_t timeout);
751
752 /*!
753 * Destroys the fence.
754 */
755 void (*destroy)(struct xrt_compositor_fence *xcf);
756};
757
758/*!
759 * @copydoc xrt_compositor_fence::wait
760 *
761 * Helper for calling through the function pointer.
762 *
763 * @public @memberof xrt_compositor_fence
764 */
765XRT_NONNULL_ALL static inline xrt_result_t
767{
768 return xcf->wait(xcf, timeout);
769}
770
771/*!
772 * @copydoc xrt_compositor_fence::destroy
773 *
774 * Helper for calling through the function pointer: does a null check and sets
775 * xcf_ptr to null if freed.
776 *
777 * @public @memberof xrt_compositor_fence
778 */
779static inline void
781{
782 struct xrt_compositor_fence *xcf = *xcf_ptr;
783 if (xcf == NULL) {
784 return;
785 }
786
787 xcf->destroy(xcf);
788 *xcf_ptr = NULL;
789}
790
791
792/*
793 *
794 * Compositor semaphore.
795 *
796 */
797
798/*!
799 * Compositor semaphore used for synchronization, needs to be as capable as a
800 * Vulkan pipeline semaphore.
801 */
803{
804 /*!
805 * Reference helper.
806 */
807 struct xrt_reference reference;
808
809 /*!
810 * Does a CPU side wait on the semaphore to reach the given value.
811 */
812 xrt_result_t (*wait)(struct xrt_compositor_semaphore *xcsem, uint64_t value, uint64_t timeout_ns);
813
814 /*!
815 * Destroys the semaphore.
816 */
817 void (*destroy)(struct xrt_compositor_semaphore *xcsem);
818};
819
820/*!
821 * Update the reference counts on compositor semaphore(s).
822 *
823 * @param[in,out] dst Pointer to a object reference: if the object reference is
824 * non-null will decrement its counter. The reference that
825 * @p dst points to will be set to @p src.
826 * @param[in] src New object for @p dst to refer to (may be null).
827 * If non-null, will have its refcount increased.
828 * @ingroup xrt_iface
829 * @relates xrt_compositor_semaphore
830 */
831XRT_NONNULL_FIRST static inline void
833{
834 struct xrt_compositor_semaphore *old_dst = *dst;
835
836 if (old_dst == src) {
837 return;
838 }
839
840 if (src) {
841 xrt_reference_inc(&src->reference);
842 }
843
844 *dst = src;
845
846 if (old_dst) {
847 if (xrt_reference_dec_and_is_zero(&old_dst->reference)) {
848 old_dst->destroy(old_dst);
849 }
850 }
851}
852
853/*!
854 * @copydoc xrt_compositor_semaphore::wait
855 *
856 * Helper for calling through the function pointer.
857 *
858 * @public @memberof xrt_compositor_semaphore
859 */
860XRT_NONNULL_ALL static inline xrt_result_t
861xrt_compositor_semaphore_wait(struct xrt_compositor_semaphore *xcsem, uint64_t value, uint64_t timeout)
862{
863 return xcsem->wait(xcsem, value, timeout);
864}
865
866
867/*
868 *
869 * Compositor.
870 *
871 */
872
874{
875 XRT_COMPOSITOR_FRAME_POINT_WOKE, //!< The client woke up after waiting.
876};
877
878/*!
879 * Swapchain creation info.
880 */
882{
883 enum xrt_swapchain_create_flags create;
884 enum xrt_swapchain_usage_bits bits;
885 uint32_t format;
886 uint32_t sample_count;
887 uint32_t width;
888 uint32_t height;
889 uint32_t face_count;
890 uint32_t array_size;
891 uint32_t mip_count;
892
893 /*
894 * List of formats that could be used when creating views of the swapchain images.
895 * See XR_KHR_vulkan_swapchain_format_list and VK_KHR_image_format_list
896 */
897 uint32_t format_count;
899};
900
901/*!
902 * Passthrough creation info.
903 */
908
909/*!
910 * Passthrough layer creation info.
911 */
917
918/*!
919 * Struct used to negotiate properties of a swapchain that is created outside
920 * of the compositor. Often used by a client compositor or IPC layer to allocate
921 * the swapchain images and then pass them into the native compositor.
922 */
924{
925 //! How many images the compositor want in the swapchain.
926 uint32_t image_count;
927
928 //! New creation bits.
930};
931
932/*!
933 * Session information, mostly overlay extension data.
934 */
936{
937 bool is_overlay;
938 //! alignas for 32 bit client support, see @ref ipc-design
939 XRT_ALIGNAS(8) uint64_t flags;
940 uint32_t z_order;
941};
942
943/*!
944 * Capabilities and information about the compositor and device together.
945 *
946 * For client compositors the formats of the native compositor are translated.
947 */
949{
950 //! Number of formats, never changes.
951 uint32_t format_count;
952
953 /*!
954 * Supported formats, never changes.
955 * alignas for 32 bit client support, see @ref ipc-design
956 */
958
959 //! Max texture size that GPU supports (size of a single dimension), zero means any size.
960 uint32_t max_texture_size;
961};
962
963/*!
964 * Begin Session information not known until clients have created an xrt-instance such as which
965 * extensions are enabled, view type, etc.
966 */
968{
969 enum xrt_view_type view_type;
970 bool ext_hand_tracking_enabled;
971 bool ext_hand_tracking_data_source_enabled;
972 bool ext_eye_gaze_interaction_enabled;
973 bool ext_future_enabled;
974 bool ext_hand_interaction_enabled;
975 bool htc_facial_tracking_enabled;
976 bool fb_body_tracking_enabled;
977 bool fb_face_tracking2_enabled;
978 bool meta_body_tracking_full_body_enabled;
979 bool meta_body_tracking_calibration_enabled;
980 bool meta_body_tracking_fidelity_enabled;
981 bool android_face_tracking_enabled;
982};
983
984/*!
985 * Hints the XR runtime what type of task the thread is doing.
986 */
988{
989 XRT_THREAD_HINT_APPLICATION_MAIN = 1,
990 XRT_THREAD_HINT_APPLICATION_WORKER = 2,
991 XRT_THREAD_HINT_RENDERER_MAIN = 3,
992 XRT_THREAD_HINT_RENDERER_WORKER = 4,
993};
994
995/*!
996 * @interface xrt_compositor
997 *
998 * Common compositor client interface/base.
999 *
1000 * A compositor is very much analogous to an `XrSession` but without any of the
1001 * input functionality, and does have the same lifetime as an `XrSession`.
1002 */
1004{
1005 /*!
1006 * Capabilities and recommended values information.
1007 */
1009
1010 /*!
1011 * For a given @ref xrt_swapchain_create_info struct returns a filled
1012 * out @ref xrt_swapchain_create_properties.
1013 */
1014 xrt_result_t (*get_swapchain_create_properties)(struct xrt_compositor *xc,
1015 const struct xrt_swapchain_create_info *info,
1016 struct xrt_swapchain_create_properties *xsccp);
1017
1018 /*!
1019 * @name Function pointers for swapchain and sync creation and import
1020 * @{
1021 */
1022 /*!
1023 * Create a swapchain with a set of images.
1024 *
1025 * The pointer pointed to by @p out_xsc has to either be NULL or a valid
1026 * @ref xrt_swapchain pointer. If there is a valid @ref xrt_swapchain
1027 * pointed by the pointed pointer it will have it reference decremented.
1028 */
1029 xrt_result_t (*create_swapchain)(struct xrt_compositor *xc,
1030 const struct xrt_swapchain_create_info *info,
1031 struct xrt_swapchain **out_xsc);
1032
1033 /*!
1034 * Create a swapchain from a set of native images.
1035 *
1036 * The pointer pointed to by @p out_xsc has to either be NULL or a valid
1037 * @ref xrt_swapchain pointer. If there is a valid @ref xrt_swapchain
1038 * pointed by the pointed pointer it will have it reference decremented.
1039 */
1040 xrt_result_t (*import_swapchain)(struct xrt_compositor *xc,
1041 const struct xrt_swapchain_create_info *info,
1042 struct xrt_image_native *native_images,
1043 uint32_t image_count,
1044 struct xrt_swapchain **out_xsc);
1045
1046 /*!
1047 * Create a compositor fence from a native sync handle.
1048 */
1049 xrt_result_t (*import_fence)(struct xrt_compositor *xc,
1051 struct xrt_compositor_fence **out_xcf);
1052
1053 /*!
1054 * Create a compositor semaphore, also returns a native handle of the
1055 * semaphore which is owned by the @ref xrt_compositor_semaphore struct.
1056 * The return values are always both valid, or on an error condition
1057 * encountered and error is returned, both not valid (untouched).
1058 *
1059 * @param[in] xc Compositor self pointer.
1060 * @param[out] out_handle Native handle owned by the samephore.
1061 * @param[out] out_handle Return of the created semahpore.
1062 */
1063 xrt_result_t (*create_semaphore)(struct xrt_compositor *xc,
1064 xrt_graphics_sync_handle_t *out_handle,
1065 struct xrt_compositor_semaphore **out_xcsem);
1066 /*! @} */
1067
1068 /*!
1069 * Create a passthrough.
1070 */
1071 xrt_result_t (*create_passthrough)(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info);
1072
1073
1074 /*!
1075 * Create a passthrough layer.
1076 */
1077 xrt_result_t (*create_passthrough_layer)(struct xrt_compositor *xc,
1078 const struct xrt_passthrough_layer_create_info *info);
1079 /*!
1080 * Destroy a passthrough.
1081 */
1082 xrt_result_t (*destroy_passthrough)(struct xrt_compositor *xc);
1083
1084 /*!
1085 * @name Function pointers for session functions
1086 * @{
1087 */
1088 /*!
1089 * See xrBeginSession.
1090 */
1091 xrt_result_t (*begin_session)(struct xrt_compositor *xc, const struct xrt_begin_session_info *info);
1092
1093 /*!
1094 * See xrEndSession, unlike the OpenXR one the state tracker is
1095 * responsible to call discard frame before calling this function. See
1096 * discard_frame.
1097 */
1098 xrt_result_t (*end_session)(struct xrt_compositor *xc);
1099
1100 /*! @} */
1101
1102 /*!
1103 * @name Function pointers for frame functions
1104 * @{
1105 */
1106
1107 /*!
1108 * This function and @ref mark_frame function calls are a alternative to
1109 * @ref wait_frame.
1110 *
1111 * The only requirement on the compositor for the @p frame_id
1112 * is that it is a positive number and larger then the last returned
1113 * frame_id.
1114 *
1115 * After a call to predict_frame, the state tracker is not allowed to
1116 * call this function until after a call to @ref mark_frame (with point
1117 * @ref XRT_COMPOSITOR_FRAME_POINT_WOKE), followed by either
1118 * @ref begin_frame or @ref discard_frame.
1119 *
1120 * @param[in] xc The compositor
1121 * @param[out] out_frame_id Frame id
1122 * @param[out] out_wake_time_ns When we want the client to be awoken to begin rendering.
1123 * @param[out] out_predicted_gpu_time_ns When we expect the client to finish the GPU work. If not
1124 * computed/available, set to 0.
1125 * @param[out] out_predicted_display_time_ns When the pixels turns into photons.
1126 * @param[out] out_predicted_display_period_ns The period for the frames.
1127 */
1128 xrt_result_t (*predict_frame)(struct xrt_compositor *xc,
1129 int64_t *out_frame_id,
1130 int64_t *out_wake_time_ns,
1131 int64_t *out_predicted_gpu_time_ns,
1132 int64_t *out_predicted_display_time_ns,
1133 int64_t *out_predicted_display_period_ns);
1134
1135 /*!
1136 * This function and @ref predict_frame function calls are a alternative to
1137 * @ref wait_frame.
1138 *
1139 * If point is @ref XRT_COMPOSITOR_FRAME_POINT_WOKE it is to mark that the
1140 * client woke up from waiting on a frame.
1141 *
1142 * @param[in] xc The compositor
1143 * @param[in] frame_id Frame id
1144 * @param[in] point What type of frame point to mark.
1145 * @param[in] when_ns When this point happened.
1146 */
1147 xrt_result_t (*mark_frame)(struct xrt_compositor *xc,
1148 int64_t frame_id,
1149 enum xrt_compositor_frame_point point,
1150 int64_t when_ns);
1151
1152 /*!
1153 * See xrWaitFrame.
1154 *
1155 * This function has the same semantics as calling @ref predict_frame,
1156 * sleeping, and then calling @ref mark_frame with a point of
1157 * @ref XRT_COMPOSITOR_FRAME_POINT_WOKE.
1158 *
1159 * The only requirement on the compositor for the @p frame_id
1160 * is that it is a positive number and larger then the last returned
1161 * @p frame_id.
1162 *
1163 * After a call to wait_frame, the state tracker is not allowed to call
1164 * this function until after a call to either @ref begin_frame or
1165 * @ref discard_frame.
1166 *
1167 * If the caller can do its own blocking, use the pair of functions
1168 * xrt_compositor::predict_frame and xrt_compositor::mark_frame instead
1169 * of this single blocking function.
1170 */
1171 xrt_result_t (*wait_frame)(struct xrt_compositor *xc,
1172 int64_t *out_frame_id,
1173 int64_t *out_predicted_display_time,
1174 int64_t *out_predicted_display_period);
1175
1176 /*!
1177 * See xrBeginFrame.
1178 *
1179 * Must have made a call to either @ref predict_frame or @ref wait_frame
1180 * before calling this function. After this function is called you must
1181 * call layer_commit.
1182 *
1183 * @param[in] xc The compositor
1184 * @param[in] frame_id Frame id
1185 */
1186 xrt_result_t (*begin_frame)(struct xrt_compositor *xc, int64_t frame_id);
1187
1188 /*!
1189 * @brief Explicitly discard a frame.
1190 *
1191 * This isn't in the OpenXR API but is explicit in the XRT interfaces.
1192 *
1193 * Two calls to xrBeginFrame without intervening xrEndFrame will cause
1194 * the state tracker to call:
1195 *
1196 * ```c
1197 * // first xrBeginFrame
1198 * xrt_comp_begin_frame(xc, frame_id);
1199 * // second xrBeginFrame
1200 * xrt_comp_discard_frame(xc, frame_id);
1201 * xrt_comp_begin_frame(xc, frame_id);
1202 * ```
1203 */
1204 xrt_result_t (*discard_frame)(struct xrt_compositor *xc, int64_t frame_id);
1205
1206 /*! @} */
1207
1208
1209 /*!
1210 * @name Function pointers for layer submission
1211 * @{
1212 */
1213 /*!
1214 * @brief Begins layer submission.
1215 *
1216 * This and the other `layer_*` calls are equivalent to xrEndFrame,
1217 * except split over multiple calls. It's only after
1218 * xrt_compositor::layer_commit that layers will be displayed.
1219 * From the point of view of the swapchain, the image is used as
1220 * soon as it's given in a call.
1221 */
1222 xrt_result_t (*layer_begin)(struct xrt_compositor *xc, const struct xrt_layer_frame_data *data);
1223
1224 /*!
1225 * @brief Adds a projection layer for submissions.
1226 *
1227 * Note that e.g. the same swapchain object may be passed as both
1228 * @p l_xsc and @p r_xsc - the parameters in @p data identify
1229 * the subrect and array texture index to use for each of the views.
1230 *
1231 * @param xc Self pointer
1232 * @param xdev The device the layer is relative to.
1233 * @param xsc Array of swapchain objects containing eye RGB data.
1234 * @param data All of the pure data bits (not pointers/handles),
1235 * including what parts of the supplied swapchain
1236 * objects to use for each view.
1237 */
1238 xrt_result_t (*layer_projection)(struct xrt_compositor *xc,
1239 struct xrt_device *xdev,
1240 struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
1241 const struct xrt_layer_data *data);
1242
1243 /*!
1244 * @brief Adds a projection layer for submission, has depth information.
1245 *
1246 * Note that e.g. the same swapchain object may be passed as both
1247 * @p l_xsc and @p r_xsc - the parameters in @p data identify
1248 * the subrect and array texture index to use for each of the views.
1249 * This flexibility is required by the OpenXR API and is passed through
1250 * to the compositor to preserve the maximum information
1251 *
1252 * @param xc Self pointer
1253 * @param xdev The device the layer is relative to.
1254 * @param xsc Array of swapchain objects containing eye RGB data.
1255 * @param d_xsc Array of swapchain objects containing eye depth data.
1256 * @param data All of the pure data bits (not pointers/handles),
1257 * including what parts of the supplied swapchain
1258 * objects to use for each view.
1259 */
1260 xrt_result_t (*layer_projection_depth)(struct xrt_compositor *xc,
1261 struct xrt_device *xdev,
1262 struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
1263 struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
1264 const struct xrt_layer_data *data);
1265
1266 /*!
1267 * Adds a quad layer for submission, the center of the quad is specified
1268 * by the pose and extends outwards from it.
1269 *
1270 * @param xc Self pointer
1271 * @param xdev The device the layer is relative to.
1272 * @param xsc Swapchain.
1273 * @param data All of the pure data bits (not pointers/handles),
1274 * including what part of the supplied swapchain
1275 * object to use.
1276 */
1277 xrt_result_t (*layer_quad)(struct xrt_compositor *xc,
1278 struct xrt_device *xdev,
1279 struct xrt_swapchain *xsc,
1280 const struct xrt_layer_data *data);
1281
1282 /*!
1283 * Adds a cube layer for submission.
1284 *
1285 * @param xc Self pointer
1286 * @param xdev The device the layer is relative to.
1287 * @param xsc Swapchain.
1288 * @param data All of the pure data bits (not pointers/handles),
1289 * including what part of the supplied swapchain
1290 * object to use.
1291 */
1292 xrt_result_t (*layer_cube)(struct xrt_compositor *xc,
1293 struct xrt_device *xdev,
1294 struct xrt_swapchain *xsc,
1295 const struct xrt_layer_data *data);
1296
1297 /*!
1298 * Adds a cylinder layer for submission.
1299 *
1300 * @param xc Self pointer
1301 * @param xdev The device the layer is relative to.
1302 * @param xsc Swapchain.
1303 * @param data All of the pure data bits (not pointers/handles),
1304 * including what part of the supplied swapchain
1305 * object to use.
1306 */
1307 xrt_result_t (*layer_cylinder)(struct xrt_compositor *xc,
1308 struct xrt_device *xdev,
1309 struct xrt_swapchain *xsc,
1310 const struct xrt_layer_data *data);
1311
1312 /*!
1313 * Adds a equirect1 layer for submission.
1314 *
1315 * @param xc Self pointer
1316 * @param xdev The device the layer is relative to.
1317 * @param xsc Swapchain.
1318 * @param data All of the pure data bits (not pointers/handles),
1319 * including what part of the supplied swapchain
1320 * object to use.
1321 */
1322 xrt_result_t (*layer_equirect1)(struct xrt_compositor *xc,
1323 struct xrt_device *xdev,
1324 struct xrt_swapchain *xsc,
1325 const struct xrt_layer_data *data);
1326
1327
1328 /*!
1329 * Adds a equirect2 layer for submission.
1330 *
1331 * @param xc Self pointer
1332 * @param xdev The device the layer is relative to.
1333 * @param xsc Swapchain.
1334 * @param data All of the pure data bits (not pointers/handles),
1335 * including what part of the supplied swapchain
1336 * object to use.
1337 */
1338 xrt_result_t (*layer_equirect2)(struct xrt_compositor *xc,
1339 struct xrt_device *xdev,
1340 struct xrt_swapchain *xsc,
1341 const struct xrt_layer_data *data);
1342
1343 /*!
1344 * Adds a passthrough layer for submission.
1345 *
1346 * @param xc Self pointer
1347 * @param xdev The device the layer is relative to.
1348 * @param data All of the pure data bits (not pointers/handles),
1349 * including what part of the supplied swapchain
1350 * object to use.
1351 */
1352 xrt_result_t (*layer_passthrough)(struct xrt_compositor *xc,
1353 struct xrt_device *xdev,
1354 const struct xrt_layer_data *data);
1355
1356 /*!
1357 * @brief Commits all of the submitted layers.
1358 *
1359 * Only after this call will the compositor actually use the layers.
1360 */
1361 xrt_result_t (*layer_commit)(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle);
1362
1363 /*!
1364 * @brief Commits all of the submitted layers, with a semaphore.
1365 *
1366 * Only after this call will the compositor actually use the layers.
1367 * @param xc Self pointer
1368 * @param xcsem Semaphore that will be signalled when the app GPU
1369 * work has completed.
1370 * @param value Semaphore value upone completion of GPU work.
1371 */
1372 xrt_result_t (*layer_commit_with_semaphore)(struct xrt_compositor *xc,
1373 struct xrt_compositor_semaphore *xcsem,
1374 uint64_t value);
1375
1376 /*! @} */
1377
1378
1379 /*!
1380 * @name Function pointers for XR_FB_display_refresh_rate.
1381 * @{
1382 */
1383
1384 /*!
1385 * Get the current display refresh rate.
1386 *
1387 * @param xc Self pointer
1388 * @param out_display_refresh_rate_hz Current display refresh rate in Hertz.
1389 */
1390 xrt_result_t (*get_display_refresh_rate)(struct xrt_compositor *xc, float *out_display_refresh_rate_hz);
1391
1392 /*!
1393 * Request system to change the display refresh rate to the requested value.
1394 *
1395 * @param xc Self pointer
1396 * @param display_refresh_rate_hz Requested display refresh rate in Hertz.
1397 */
1398 xrt_result_t (*request_display_refresh_rate)(struct xrt_compositor *xc, float display_refresh_rate_hz);
1399
1400 /*! @} */
1401
1402
1403 /*!
1404 * @brief Set CPU/GPU performance level.
1405 */
1406 xrt_result_t (*set_performance_level)(struct xrt_compositor *xc,
1407 enum xrt_perf_domain domain,
1408 enum xrt_perf_set_level level);
1409
1410 /*!
1411 * @brief Get the extents of the reference space's bounds rectangle.
1412 */
1413 xrt_result_t (*get_reference_bounds_rect)(struct xrt_compositor *xc,
1414 enum xrt_reference_space_type reference_space_type,
1415 struct xrt_vec2 *bounds);
1416
1417 /*!
1418 * Teardown the compositor.
1419 *
1420 * The state tracker must have made sure that no frames or sessions are
1421 * currently pending.
1422 *
1423 * @see xrt_compositor::discard_frame or xrt_compositor::end_frame for a pending frame
1424 * @see xrt_compositor::end_session for an open session.
1425 */
1426 void (*destroy)(struct xrt_compositor *xc);
1427
1428 /*!
1429 * @name Function pointers for extensions
1430 * @{
1431 */
1432
1433 /*!
1434 * @brief Set thread attributes according to thread type
1435 */
1436 xrt_result_t (*set_thread_hint)(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id);
1437
1438 /*! @} */
1439};
1440
1441/*!
1442 * @copydoc xrt_compositor::get_swapchain_create_properties
1443 *
1444 * Helper for calling through the function pointer.
1445 *
1446 * @public @memberof xrt_compositor
1447 */
1448XRT_NONNULL_ALL static inline xrt_result_t
1450 const struct xrt_swapchain_create_info *info,
1451 struct xrt_swapchain_create_properties *xsccp)
1452{
1453 return xc->get_swapchain_create_properties(xc, info, xsccp);
1454}
1455
1456/*!
1457 * @name Swapchain and sync creation and import methods
1458 * @{
1459 */
1460
1461/*!
1462 * @copydoc xrt_compositor::create_swapchain
1463 *
1464 * Helper for calling through the function pointer.
1465 *
1466 * @public @memberof xrt_compositor
1467 */
1468XRT_NONNULL_ALL static inline xrt_result_t
1470 const struct xrt_swapchain_create_info *info,
1471 struct xrt_swapchain **out_xsc)
1472{
1473 return xc->create_swapchain(xc, info, out_xsc);
1474}
1475
1476/*!
1477 * @copydoc xrt_compositor::import_swapchain
1478 *
1479 * Helper for calling through the function pointer.
1480 *
1481 * @public @memberof xrt_compositor
1482 */
1483XRT_NONNULL_ALL static inline xrt_result_t
1485 const struct xrt_swapchain_create_info *info,
1486 struct xrt_image_native *native_images,
1487 uint32_t image_count,
1488 struct xrt_swapchain **out_xsc)
1489{
1490 return xc->import_swapchain(xc, info, native_images, image_count, out_xsc);
1491}
1492
1493/*!
1494 * @copydoc xrt_compositor::import_fence
1495 *
1496 * Helper for calling through the function pointer.
1497 *
1498 * @public @memberof xrt_compositor
1499 */
1500XRT_NONNULL_ALL static inline xrt_result_t
1503 struct xrt_compositor_fence **out_xcf)
1504{
1505 return xc->import_fence(xc, handle, out_xcf);
1506}
1507
1508/*!
1509 * @copydoc xrt_compositor::create_semaphore
1510 *
1511 * Helper for calling through the function pointer.
1512 *
1513 * @public @memberof xrt_compositor
1514 */
1515XRT_NONNULL_ALL static inline xrt_result_t
1517 xrt_graphics_sync_handle_t *out_handle,
1518 struct xrt_compositor_semaphore **out_xcsem)
1519{
1520 return xc->create_semaphore(xc, out_handle, out_xcsem);
1521}
1522
1523/*! @} */
1524
1525/*!
1526 * @copydoc xrt_compositor::create_passthrough
1527 *
1528 * Helper for calling through the function pointer.
1529 *
1530 * @public @memberof xrt_compositor
1531 */
1532XRT_NONNULL_ALL static inline xrt_result_t
1534{
1535 return xc->create_passthrough(xc, info);
1536}
1537
1538/*!
1539 * @copydoc xrt_compositor::create_passthrough_layer
1540 *
1541 * Helper for calling through the function pointer.
1542 *
1543 * @public @memberof xrt_compositor
1544 */
1545XRT_NONNULL_ALL static inline xrt_result_t
1547{
1548 return xc->create_passthrough_layer(xc, info);
1549}
1550
1551/*!
1552 * @copydoc xrt_compositor::destroy_passthrough
1553 *
1554 * Helper for calling through the function pointer.
1555 *
1556 * @public @memberof xrt_compositor
1557 */
1558XRT_NONNULL_ALL static inline xrt_result_t
1560{
1561 return xc->destroy_passthrough(xc);
1562}
1563
1564/*!
1565 * @name Session methods
1566 * @{
1567 */
1568
1569/*!
1570 * @copydoc xrt_compositor::begin_session
1571 *
1572 * Helper for calling through the function pointer.
1573 *
1574 * @public @memberof xrt_compositor
1575 */
1576XRT_NONNULL_ALL static inline xrt_result_t
1578{
1579 return xc->begin_session(xc, info);
1580}
1581
1582/*!
1583 * @copydoc xrt_compositor::end_session
1584 *
1585 * Helper for calling through the function pointer.
1586 *
1587 * @public @memberof xrt_compositor
1588 */
1589XRT_NONNULL_ALL static inline xrt_result_t
1591{
1592 return xc->end_session(xc);
1593}
1594
1595/*! @} */
1596
1597
1598/*!
1599 * @name Frame-related methods
1600 * @brief Related to the OpenXR `xr*Frame` functions
1601 * @{
1602 */
1603
1604/*!
1605 * @copydoc xrt_compositor::predict_frame
1606 *
1607 * Helper for calling through the function pointer.
1608 *
1609 * @public @memberof xrt_compositor
1610 */
1611XRT_NONNULL_ALL static inline xrt_result_t
1613 int64_t *out_frame_id,
1614 int64_t *out_wake_time_ns,
1615 int64_t *out_predicted_gpu_time_ns,
1616 int64_t *out_predicted_display_time_ns,
1617 int64_t *out_predicted_display_period_ns)
1618{
1619 return xc->predict_frame( //
1620 xc, //
1621 out_frame_id, //
1622 out_wake_time_ns, //
1623 out_predicted_gpu_time_ns, //
1624 out_predicted_display_time_ns, //
1625 out_predicted_display_period_ns); //
1626}
1627
1628/*!
1629 * @copydoc xrt_compositor::mark_frame
1630 *
1631 * Helper for calling through the function pointer.
1632 *
1633 * @public @memberof xrt_compositor
1634 */
1635XRT_NONNULL_ALL static inline xrt_result_t
1636xrt_comp_mark_frame(struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns)
1637{
1638 return xc->mark_frame(xc, frame_id, point, when_ns);
1639}
1640
1641/*!
1642 * @copydoc xrt_compositor::wait_frame
1643 *
1644 * Helper for calling through the function pointer.
1645 *
1646 * @public @memberof xrt_compositor
1647 */
1648XRT_NONNULL_ALL static inline xrt_result_t
1650 int64_t *out_frame_id,
1651 int64_t *out_predicted_display_time,
1652 int64_t *out_predicted_display_period)
1653{
1654 return xc->wait_frame(xc, out_frame_id, out_predicted_display_time, out_predicted_display_period);
1655}
1656
1657/*!
1658 * @copydoc xrt_compositor::begin_frame
1659 *
1660 * Helper for calling through the function pointer.
1661 *
1662 * @public @memberof xrt_compositor
1663 */
1664XRT_NONNULL_ALL static inline xrt_result_t
1665xrt_comp_begin_frame(struct xrt_compositor *xc, int64_t frame_id)
1666{
1667 return xc->begin_frame(xc, frame_id);
1668}
1669
1670/*!
1671 * @copydoc xrt_compositor::discard_frame
1672 *
1673 * Helper for calling through the function pointer.
1674 *
1675 * @public @memberof xrt_compositor
1676 */
1677XRT_NONNULL_ALL static inline xrt_result_t
1678xrt_comp_discard_frame(struct xrt_compositor *xc, int64_t frame_id)
1679{
1680 return xc->discard_frame(xc, frame_id);
1681}
1682
1683/*! @} */
1684
1685
1686/*!
1687 * @name Layer submission methods
1688 * @brief Equivalent to `xrEndFrame`, but split across multiple calls.
1689 * @{
1690 */
1691
1692/*!
1693 * @copydoc xrt_compositor::layer_begin
1694 *
1695 * Helper for calling through the function pointer.
1696 *
1697 * @public @memberof xrt_compositor
1698 */
1699XRT_NONNULL_ALL static inline xrt_result_t
1701{
1702 return xc->layer_begin(xc, data);
1703}
1704
1705/*!
1706 * @copydoc xrt_compositor::layer_projection
1707 *
1708 * Helper for calling through the function pointer.
1709 *
1710 * @public @memberof xrt_compositor
1711 */
1712XRT_NONNULL_ALL static inline xrt_result_t
1714 struct xrt_device *xdev,
1715 struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
1716 const struct xrt_layer_data *data)
1717{
1718 return xc->layer_projection(xc, xdev, xsc, data);
1719}
1720
1721/*!
1722 * @copydoc xrt_compositor::layer_projection_depth
1723 *
1724 * Helper for calling through the function pointer.
1725 *
1726 * @public @memberof xrt_compositor
1727 */
1728XRT_NONNULL_ALL static inline xrt_result_t
1730 struct xrt_device *xdev,
1731 struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
1732 struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
1733 const struct xrt_layer_data *data)
1734{
1735 return xc->layer_projection_depth(xc, xdev, xsc, d_xsc, data);
1736}
1737
1738/*!
1739 * @copydoc xrt_compositor::layer_quad
1740 *
1741 * Helper for calling through the function pointer.
1742 *
1743 * @public @memberof xrt_compositor
1744 */
1745XRT_NONNULL_ALL static inline xrt_result_t
1747 struct xrt_device *xdev,
1748 struct xrt_swapchain *xsc,
1749 const struct xrt_layer_data *data)
1750{
1751 return xc->layer_quad(xc, xdev, xsc, data);
1752}
1753
1754/*!
1755 * @copydoc xrt_compositor::layer_cube
1756 *
1757 * Helper for calling through the function pointer.
1758 *
1759 * @public @memberof xrt_compositor
1760 */
1761XRT_NONNULL_ALL static inline xrt_result_t
1763 struct xrt_device *xdev,
1764 struct xrt_swapchain *xsc,
1765 const struct xrt_layer_data *data)
1766{
1767 return xc->layer_cube(xc, xdev, xsc, data);
1768}
1769
1770/*!
1771 * @copydoc xrt_compositor::layer_cylinder
1772 *
1773 * Helper for calling through the function pointer.
1774 *
1775 * @public @memberof xrt_compositor
1776 */
1777XRT_NONNULL_ALL static inline xrt_result_t
1779 struct xrt_device *xdev,
1780 struct xrt_swapchain *xsc,
1781 const struct xrt_layer_data *data)
1782{
1783 return xc->layer_cylinder(xc, xdev, xsc, data);
1784}
1785
1786
1787/*!
1788 * @copydoc xrt_compositor::layer_equirect1
1789 *
1790 * Helper for calling through the function pointer.
1791 *
1792 * @public @memberof xrt_compositor
1793 */
1794XRT_NONNULL_ALL static inline xrt_result_t
1796 struct xrt_device *xdev,
1797 struct xrt_swapchain *xsc,
1798 const struct xrt_layer_data *data)
1799{
1800 return xc->layer_equirect1(xc, xdev, xsc, data);
1801}
1802
1803/*!
1804 * @copydoc xrt_compositor::layer_equirect2
1805 *
1806 * Helper for calling through the function pointer.
1807 *
1808 * @public @memberof xrt_compositor
1809 */
1810XRT_NONNULL_ALL static inline xrt_result_t
1812 struct xrt_device *xdev,
1813 struct xrt_swapchain *xsc,
1814 const struct xrt_layer_data *data)
1815{
1816 return xc->layer_equirect2(xc, xdev, xsc, data);
1817}
1818
1819/*!
1820 * @copydoc xrt_compositor::layer_passthrough
1821 *
1822 * Helper for calling through the function pointer.
1823 *
1824 * @public @memberof xrt_compositor
1825 */
1826XRT_NONNULL_ALL static inline xrt_result_t
1827xrt_comp_layer_passthrough(struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data)
1828{
1829 return xc->layer_passthrough(xc, xdev, data);
1830}
1831
1832/*!
1833 * @copydoc xrt_compositor::layer_commit
1834 *
1835 * Helper for calling through the function pointer.
1836 *
1837 * @public @memberof xrt_compositor
1838 */
1839XRT_NONNULL_FIRST
1840static inline xrt_result_t
1842{
1843 return xc->layer_commit(xc, sync_handle);
1844}
1845
1846/*!
1847 * @copydoc xrt_compositor::layer_commit_with_semaphore
1848 *
1849 * Helper for calling through the function pointer.
1850 *
1851 * @public @memberof xrt_compositor
1852 */
1853XRT_NONNULL_ALL static inline xrt_result_t
1855{
1856 return xc->layer_commit_with_semaphore(xc, xcsem, value);
1857}
1858
1859/*! @} */
1860
1861/*!
1862 * @copydoc xrt_compositor::get_display_refresh_rate
1863 *
1864 * Helper for calling through the function pointer.
1865 *
1866 * @public @memberof xrt_compositor
1867 */
1868XRT_NONNULL_ALL static inline xrt_result_t
1869xrt_comp_get_display_refresh_rate(struct xrt_compositor *xc, float *out_display_refresh_rate_hz)
1870{
1871 return xc->get_display_refresh_rate(xc, out_display_refresh_rate_hz);
1872}
1873
1874/*!
1875 * @copydoc xrt_compositor::request_display_refresh_rate
1876 *
1877 * Helper for calling through the function pointer.
1878 *
1879 * @public @memberof xrt_compositor
1880 */
1881XRT_NONNULL_ALL static inline xrt_result_t
1882xrt_comp_request_display_refresh_rate(struct xrt_compositor *xc, float display_refresh_rate_hz)
1883{
1884 return xc->request_display_refresh_rate(xc, display_refresh_rate_hz);
1885}
1886
1887
1888/*!
1889 * @copydoc xrt_compositor::set_performance_level
1890 *
1891 * Helper for calling through the function pointer.
1892 *
1893 * @public @memberof xrt_compositor
1894 */
1895XRT_NONNULL_ALL static inline xrt_result_t
1897{
1898 return xc->set_performance_level(xc, domain, level);
1899}
1900
1901/*!
1902 * @copydoc xrt_compositor::get_reference_bounds_rect
1903 *
1904 * Helper for calling through the function pointer.
1905 *
1906 * @public @memberof xrt_compositor
1907 */
1908XRT_NONNULL_ALL static inline xrt_result_t
1910 enum xrt_reference_space_type reference_space_type,
1911 struct xrt_vec2 *bounds)
1912{
1913 if (xc->get_reference_bounds_rect == NULL) {
1915 }
1916
1917 return xc->get_reference_bounds_rect(xc, reference_space_type, bounds);
1918}
1919
1920/*!
1921 * @copydoc xrt_compositor::destroy
1922 *
1923 * Helper for calling through the function pointer: does a null check and sets
1924 * xc_ptr to null if freed.
1925 *
1926 * @public @memberof xrt_compositor
1927 */
1928XRT_NONNULL_ALL static inline void
1930{
1931 struct xrt_compositor *xc = *xc_ptr;
1932 if (xc == NULL) {
1933 return;
1934 }
1935
1936 xc->destroy(xc);
1937 *xc_ptr = NULL;
1938}
1939
1940/*!
1941 * @name Function pointers for extensions
1942 * @{
1943 */
1944
1945/*!
1946 * @brief Set thread attributes according to thread type
1947 */
1948XRT_NONNULL_ALL static inline xrt_result_t
1949xrt_comp_set_thread_hint(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id)
1950{
1951 return xc->set_thread_hint(xc, hint, thread_id);
1952}
1953
1954/*! @} */
1955
1956/*
1957 *
1958 * OpenGL interface.
1959 *
1960 */
1961
1962/*!
1963 * Base class for an OpenGL (ES) client swapchain.
1964 *
1965 * @ingroup xrt_iface comp_client
1966 * @extends xrt_swapchain
1967 */
1969{
1970 //! @public Base
1971 struct xrt_swapchain base;
1972
1973 // GLuint
1974 unsigned int images[XRT_MAX_SWAPCHAIN_IMAGES];
1975};
1976
1977/*!
1978 * Down-cast helper.
1979 *
1980 * @private @memberof xrt_swapchain_gl
1981 *
1982 * @todo unused - remove?
1983 */
1984static inline struct xrt_swapchain_gl *
1986{
1987 return (struct xrt_swapchain_gl *)xsc;
1988}
1989
1990
1991/*
1992 *
1993 * Vulkan interface.
1994 *
1995 */
1996
1997/*!
1998 * Base class for a Vulkan client swapchain.
1999 *
2000 * @ingroup xrt_iface comp_client
2001 * @extends xrt_swapchain
2002 */
2004{
2005 //! @public Base
2006 struct xrt_swapchain base;
2007
2008 //! Images to be used by the caller.
2010};
2011
2012/*!
2013 * Down-cast helper.
2014 *
2015 * @private @memberof xrt_swapchain_vk
2016 *
2017 * @todo unused - remove?
2018 */
2019static inline struct xrt_swapchain_vk *
2021{
2022 return (struct xrt_swapchain_vk *)xsc;
2023}
2024
2025#if defined(XRT_HAVE_D3D11) || defined(XRT_DOXYGEN)
2026
2027/*
2028 *
2029 * D3D11 interface.
2030 *
2031 */
2032
2033/*!
2034 * Base class for a D3D11 client swapchain.
2035 *
2036 * @ingroup xrt_iface comp_client
2037 * @extends xrt_swapchain
2038 */
2040{
2041 //! @public Base
2042 struct xrt_swapchain base;
2043
2044 //! Images to be used by the caller.
2045 ID3D11Texture2D *images[XRT_MAX_SWAPCHAIN_IMAGES];
2046};
2047
2048/*!
2049 * Graphics usage requirements for D3D APIs.
2050 *
2051 * @ingroup xrt_iface
2052 */
2054{
2055 LUID adapter_luid;
2056 D3D_FEATURE_LEVEL min_feature_level;
2057};
2058
2059#endif // XRT_OS_WINDOWS
2060
2061
2062#if defined(XRT_HAVE_D3D12) || defined(XRT_DOXYGEN)
2063/*
2064 *
2065 * D3D12 interface.
2066 *
2067 */
2068
2069/*!
2070 * Base class for a D3D12 client swapchain.
2071 *
2072 * @ingroup xrt_iface comp_client
2073 * @extends xrt_swapchain
2074 */
2076{
2077 //! @public Base
2078 struct xrt_swapchain base;
2079
2080 //! Images to be used by the caller.
2081 ID3D12Resource *images[XRT_MAX_SWAPCHAIN_IMAGES];
2082};
2083
2084#endif
2085
2086/*
2087 *
2088 * Native interface.
2089 *
2090 * These types are supported by underlying native buffers, which are DMABUF file
2091 * descriptors on Linux.
2092 *
2093 */
2094
2095/*!
2096 * A single image of a swapchain based on native buffer handles.
2097 *
2098 * @ingroup xrt_iface comp
2099 * @see xrt_swapchain_native, xrt_graphics_buffer_handle_t
2100 */
2102{
2103 /*!
2104 * Native buffer handle.
2105 */
2107
2108 /*!
2109 * @brief Buffer size in memory.
2110 *
2111 * Optional, set to 0 if unknown at allocation time.
2112 * If not zero, used for a max memory requirements check when importing
2113 * into Vulkan.
2114 */
2115 uint64_t size;
2116
2117 /*!
2118 * Is the image created with a dedicated allocation or not.
2119 */
2121
2122 /*!
2123 * Is the native buffer handle a DXGI handle?
2124 *
2125 * - If true, it is some kind of weird global handle, not reference counted, but
2126 * widely compatible with various images. Ostensibly deprecated, but works the best
2127 * on Windows.
2128 * - If false, it's either not Windows, or a reference counted "NT Handle"
2129 * which has awkward limitations, such as "usually no depth images allowed".
2130 */
2132};
2133
2134/*!
2135 * @interface xrt_swapchain_native
2136 * Base class for a swapchain that exposes a native buffer handle to be imported
2137 * into a client API.
2138 *
2139 * @ingroup xrt_iface comp
2140 * @extends xrt_swapchain
2141 */
2143{
2144 //! @public Base
2145 struct xrt_swapchain base;
2146
2147 /*!
2148 * Unique id for the swapchain, only unique for the current process, is
2149 * not synchronized between service and any apps via the IPC layer.
2150 */
2152
2154};
2155
2156/*!
2157 * @copydoc xrt_swapchain_reference
2158 *
2159 * @relates xrt_swapchain_native
2160 */
2161static inline void
2163{
2164 xrt_swapchain_reference((struct xrt_swapchain **)dst, (struct xrt_swapchain *)src);
2165}
2166
2167/*!
2168 * @interface xrt_compositor_native
2169 *
2170 * Main compositor server interface.
2171 *
2172 * @ingroup xrt_iface comp
2173 * @extends xrt_compositor
2174 */
2176{
2177 //! @public Base
2178 struct xrt_compositor base;
2179};
2180
2181/*!
2182 * @brief Create a native swapchain with a set of images.
2183 *
2184 * A specialized version of @ref xrt_comp_create_swapchain, for use only on @ref
2185 * xrt_compositor_native.
2186 *
2187 * Helper for calling through the base's function pointer then performing the
2188 * known-safe downcast.
2189 *
2190 * The pointer pointed to by @p out_xsc has to either be NULL or a valid
2191 * @ref xrt_swapchain pointer. If there is a valid @ref xrt_swapchain
2192 * pointed by the pointed pointer it will have it reference decremented.
2193 *
2194 * @public @memberof xrt_compositor_native
2195 */
2196XRT_NONNULL_ALL static inline xrt_result_t
2198 const struct xrt_swapchain_create_info *info,
2199 struct xrt_swapchain_native **out_xscn)
2200{
2201 struct xrt_swapchain *xsc = NULL; // Has to be NULL.
2202
2203 xrt_result_t ret = xrt_comp_create_swapchain(&xcn->base, info, &xsc);
2204 if (ret == XRT_SUCCESS) {
2205 // Need to unref any swapchain already there first.
2206 xrt_swapchain_native_reference(out_xscn, NULL);
2207
2208 // Already referenced.
2209 *out_xscn = (struct xrt_swapchain_native *)xsc;
2210 }
2211
2212 return ret;
2213}
2214
2215/*!
2216 * @copydoc xrt_compositor::destroy
2217 *
2218 * Helper for calling through the function pointer: does a null check and sets
2219 * xcn_ptr to null if freed.
2220 *
2221 * @public @memberof xrt_compositor_native
2222 */
2223XRT_NONNULL_ALL static inline void
2225{
2226 struct xrt_compositor_native *xcn = *xcn_ptr;
2227 if (xcn == NULL) {
2228 return;
2229 }
2230
2231 xcn->base.destroy(&xcn->base);
2232 *xcn_ptr = NULL;
2233}
2234
2235/*!
2236 * Holds information about the view configuration properties for a view in a system compositor.
2237 */
2239{
2240 struct
2241 {
2242 uint32_t width_pixels;
2243 uint32_t height_pixels;
2244 uint32_t sample_count;
2245 } recommended; //!< Recommended for this view.
2246
2247 struct
2248 {
2249 uint32_t width_pixels;
2250 uint32_t height_pixels;
2251 uint32_t sample_count;
2252 } max; //!< Maximums for this view.
2253};
2254
2256{
2257 //! Which view type this is for, mono, stereo, quad_with_inset, etc...
2259
2260 //! Must match the view_type, in the future view_types might have variable views.
2261 uint32_t view_count;
2262
2263 //! The per view information.
2264 struct xrt_view_config_properties views[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_VIEW_COUNT];
2265};
2266
2267
2268/*
2269 *
2270 * System composition: how to composite on a system, either directly or by combining layers from multiple apps
2271 *
2272 */
2273
2274/*!
2275 * Capabilities and information about the system compositor (and its wrapped native compositor, if any),
2276 * and device together.
2277 */
2279{
2280 uint32_t view_type_count;
2281 enum xrt_view_type view_types[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_COUNT];
2282
2283 //! Maximum number of composition layers supported, never changes.
2284 uint32_t max_layers;
2285
2286 /*!
2287 * Blend modes supported by the system (the combination of the
2288 * compositor and the HMD capabilities), never changes.
2289 *
2290 * In preference order. Based on the modes reported by the device,
2291 * but the compositor has a chance to modify this.
2292 */
2293 enum xrt_blend_mode supported_blend_modes[XRT_BLEND_MODE_MAX_ENUM];
2294
2295 //! Number of meaningful elements in xrt_system_compositor_info::supported_blend_modes
2297
2298 uint32_t refresh_rate_count;
2299 float refresh_rates_hz[XRT_MAX_SUPPORTED_REFRESH_RATES];
2300
2301 //! The vk device as used by the compositor, never changes.
2303
2304 //! The vk device suggested for Vulkan clients, never changes.
2306
2307 //! The (Windows) LUID for the GPU device suggested for D3D clients, never changes.
2309
2310 //! Whether @ref client_d3d_deviceLUID is valid
2312
2313 //! Whether submitting projection layers of a differing FOV from the target FOV is supported.
2315
2316 /*!
2317 * The compositor supports emulating quad views with insets even if the
2318 * device is only a stereo device. The views are split into two stereo
2319 * projections layers by the state trackers and tagged with the correct
2320 * layer type tags.
2321 *
2322 * This only needs to be set if the compositor hasn't exposed a
2323 * view_configs with the XRT_VIEW_TYPE_QUAD type, as that will also
2324 * cause the state tracker to submit split quad views with stereo
2325 * devices.
2326 */
2328};
2329
2330/*!
2331 * Details about the currently running session of an xrt_compositor.
2332 *
2333 * @related xrt_multi_compositor_control
2334 */
2336{
2337 //! Whether or not this session has been begun.
2339 //! The active view type of the session
2341};
2342
2344
2345/*!
2346 * @interface xrt_multi_compositor_control
2347 * Special functions to control multi session/clients.
2348 * Effectively an optional aspect of @ref xrt_system_compositor
2349 * exposed by implementations that can combine layers from multiple sessions/clients.
2350 */
2352{
2353 /*!
2354 * Sets the state of the compositor, generating any events to the client
2355 * if the state is actually changed. Input focus is enforced/handled by
2356 * a different component but is still signaled by the compositor.
2357 */
2359 struct xrt_compositor *xc,
2360 bool visible,
2361 bool focused,
2362 int64_t timestamp_ns);
2363
2364 /*!
2365 * Set the rendering Z order for rendering, visible has higher priority
2366 * then z_order but is still saved until visible again. This a signed
2367 * 64 bit integer compared to a unsigned 32 bit integer in OpenXR, so
2368 * that non-overlay clients can be handled like overlay ones.
2369 */
2370 xrt_result_t (*set_z_order)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t z_order);
2371
2372 /*!
2373 * Set the chroma key parameters for the base app's projection layers.
2374 * This is used to punch holes through opaque projection layers and adjust their blend mode.
2375 * Uses HSV min/max range for flexible color targeting.
2376 *
2377 * @param hsv_min Minimum HSV bounds
2378 * @param hsv_max Maximum HSV bounds
2379 * @param curve Power curve for alpha falloff
2380 * @param despill Despill strength
2381 */
2382 xrt_result_t (*set_base_chroma_key_params)(struct xrt_system_compositor *xsc,
2383 struct xrt_colour_hsv_f32 hsv_min,
2384 struct xrt_colour_hsv_f32 hsv_max,
2385 float curve,
2386 float despill);
2387
2388 /*!
2389 * Tell this client/session if the main application is visible or not.
2390 */
2391 xrt_result_t (*set_main_app_visibility)(struct xrt_system_compositor *xsc,
2392 struct xrt_compositor *xc,
2393 bool visible);
2394
2395 /*!
2396 * Notify this client/session if the compositor is going to lose the ability of rendering.
2397 *
2398 * @param loss_time_ns System monotonic timestamps, such as returned by os_monotonic_get_ns().
2399 */
2400 xrt_result_t (*notify_loss_pending)(struct xrt_system_compositor *xsc,
2401 struct xrt_compositor *xc,
2402 int64_t loss_time_ns);
2403
2404 /*!
2405 * Notify this client/session if the compositor lost the ability of rendering.
2406 */
2407 xrt_result_t (*notify_lost)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc);
2408
2409 /*!
2410 * Notify this client/session if the display refresh rate has been changed.
2411 */
2412 xrt_result_t (*notify_display_refresh_changed)(struct xrt_system_compositor *xsc,
2413 struct xrt_compositor *xc,
2414 float from_display_refresh_rate_hz,
2415 float to_display_refresh_rate_hz);
2416
2417 /*!
2418 * This function returns the state of the currently running session.
2419 */
2420 xrt_result_t (*session_get_running_state)(struct xrt_system_compositor *xsc,
2421 struct xrt_compositor *xc,
2422 struct xrt_compositor_session_running_state *out_running_state);
2423};
2424
2425/*!
2426 * The system compositor handles composition for a system.
2427 * It is not itself a "compositor" (as in xrt_compositor), but it can create/own compositors.
2428 * - In a multi-app capable system, the system compositor may own an internal compositor, and
2429 * xrt_system_compositor::create_native_compositor will
2430 * create a compositor that submits layers to a merging mechanism.
2431 * - In a non-multi-app capable system, xrt_system_compositor::create_native_compositor
2432 * creates normal, native compositors, that do not wrap or feed into any other compositor.
2433 *
2434 * This is a long lived object: it has the same life time as an XrSystemID.
2435 */
2437{
2438 /*!
2439 * An optional aspect/additional interface, providing multi-app control.
2440 * Populated if this system compositor supports multi client controls.
2441 */
2443
2444 //! Info regarding the system.
2446
2447 /*!
2448 * Create a new native compositor.
2449 *
2450 * This signals that you want to start XR, and as such implicitly brings
2451 * up a new session. Does not "call" `xrBeginSession`.
2452 *
2453 * Some system compositors might only support one `xrt_compositor`
2454 * active at a time, will return `XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED`
2455 * if this is the case.
2456 *
2457 * In a multi-session capable system compositor, this may return a "proxy"
2458 * for feeding a single client's layers to a compositor or a layer merging mechanism,
2459 * rather than a raw native compositor (not wrapping or forwarding) directly.
2460 */
2461 xrt_result_t (*create_native_compositor)(struct xrt_system_compositor *xsc,
2462 const struct xrt_session_info *xsi,
2463 struct xrt_session_event_sink *xses,
2464 struct xrt_compositor_native **out_xcn);
2465
2466 /*!
2467 * Gets the view configuration for the specified view type.
2468 */
2469 xrt_result_t (*get_view_config)(struct xrt_system_compositor *xsc,
2470 enum xrt_view_type view_type,
2471 struct xrt_view_config *out_view_config);
2472
2473 /*!
2474 * Teardown the system compositor.
2475 *
2476 * The state tracker must make sure that no compositors are alive.
2477 */
2478 void (*destroy)(struct xrt_system_compositor *xsc);
2479};
2480
2481/*!
2482 * @copydoc xrt_multi_compositor_control::set_state
2483 *
2484 * Helper for calling through the function pointer.
2485 *
2486 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2487 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2488 *
2489 * @public @memberof xrt_system_compositor
2490 */
2491XRT_NONNULL_ALL static inline xrt_result_t
2493 struct xrt_system_compositor *xsc, struct xrt_compositor *xc, bool visible, bool focused, int64_t timestamp_ns)
2494{
2495 if (xsc->xmcc == NULL) {
2497 }
2498
2499 return xsc->xmcc->set_state(xsc, xc, visible, focused, timestamp_ns);
2500}
2501
2502/*!
2503 * @copydoc xrt_multi_compositor_control::set_z_order
2504 *
2505 * Helper for calling through the function pointer.
2506 *
2507 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2508 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2509 *
2510 * @public @memberof xrt_system_compositor
2511 */
2512XRT_NONNULL_ALL static inline xrt_result_t
2513xrt_syscomp_set_z_order(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t z_order)
2514{
2515 if (xsc->xmcc == NULL) {
2517 }
2518
2519 return xsc->xmcc->set_z_order(xsc, xc, z_order);
2520}
2521
2522
2523/*!
2524 * @copydoc xrt_multi_compositor_control::set_main_app_visibility
2525 *
2526 * Helper for calling through the function pointer.
2527 *
2528 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2529 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2530 *
2531 * @public @memberof xrt_system_compositor
2532 */
2533XRT_NONNULL_ALL static inline xrt_result_t
2535{
2536 if (xsc->xmcc == NULL) {
2538 }
2539
2540 return xsc->xmcc->set_main_app_visibility(xsc, xc, visible);
2541}
2542
2543/*!
2544 * @copydoc xrt_multi_compositor_control::notify_loss_pending
2545 *
2546 * Helper for calling through the function pointer.
2547 *
2548 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2549 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2550 *
2551 * @public @memberof xrt_system_compositor
2552 */
2553XRT_NONNULL_ALL static inline xrt_result_t
2554xrt_syscomp_notify_loss_pending(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t loss_time_ns)
2555{
2556 if (xsc->xmcc == NULL) {
2558 }
2559
2560 return xsc->xmcc->notify_loss_pending(xsc, xc, loss_time_ns);
2561}
2562
2563/*!
2564 * @copydoc xrt_multi_compositor_control::notify_lost
2565 *
2566 * Helper for calling through the function pointer.
2567 *
2568 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2569 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2570 *
2571 * @public @memberof xrt_system_compositor
2572 */
2573XRT_NONNULL_ALL static inline xrt_result_t
2575{
2576 if (xsc->xmcc == NULL) {
2578 }
2579
2580 return xsc->xmcc->notify_lost(xsc, xc);
2581}
2582
2583/*!
2584 * @copydoc xrt_multi_compositor_control::notify_display_refresh_changed
2585 *
2586 * Helper for calling through the function pointer.
2587 *
2588 * If the system compositor @p xsc does not implement @ref xrt_multi_composition_control,
2589 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2590 *
2591 * @public @memberof xrt_system_compositor
2592 */
2593XRT_NONNULL_ALL static inline xrt_result_t
2595 struct xrt_compositor *xc,
2596 float from_display_refresh_rate_hz,
2597 float to_display_refresh_rate_hz)
2598{
2599 if (xsc->xmcc == NULL) {
2601 }
2602
2603 return xsc->xmcc->notify_display_refresh_changed(xsc, xc, from_display_refresh_rate_hz,
2604 to_display_refresh_rate_hz);
2605}
2606
2607/*!
2608 * @copydoc xrt_multi_compositor_control::session_get_running_state
2609 *
2610 * Helper for calling through the function pointer.
2611 *
2612 * If the system compositor @p xsc does not implement @ref xrt_multi_composition_control,
2613 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2614 *
2615 * @public @memberof xrt_system_compositor
2616 */
2617XRT_NONNULL_ALL static inline xrt_result_t
2619 struct xrt_compositor *xc,
2620 struct xrt_compositor_session_running_state *out_running_state)
2621{
2622 if (xsc->xmcc == NULL) {
2624 }
2625
2626 return xsc->xmcc->session_get_running_state(xsc, xc, out_running_state);
2627}
2628
2629/*!
2630 * @copydoc xrt_system_compositor::create_native_compositor
2631 *
2632 * Helper for calling through the function pointer.
2633 *
2634 * @public @memberof xrt_system_compositor
2635 */
2636XRT_NONNULL_ALL static inline xrt_result_t
2638 const struct xrt_session_info *xsi,
2639 struct xrt_session_event_sink *xses,
2640 struct xrt_compositor_native **out_xcn)
2641{
2642 return xsc->create_native_compositor(xsc, xsi, xses, out_xcn);
2643}
2644
2645/*!
2646 * @copydoc xrt_system_compositor::get_view_config
2647 *
2648 * Helper for calling through the function pointer.
2649 *
2650 * @public @memberof xrt_system_compositor
2651 */
2652XRT_NONNULL_ALL static inline xrt_result_t
2654 enum xrt_view_type view_type,
2655 struct xrt_view_config *out_view_config)
2656{
2657 return xsc->get_view_config(xsc, view_type, out_view_config);
2658}
2659
2660/*!
2661 * @copydoc xrt_system_compositor::destroy
2662 *
2663 * Helper for calling through the function pointer: does a null check and sets
2664 * xcn_ptr to null if freed.
2665 *
2666 * @public @memberof xrt_system_compositor
2667 */
2668XRT_NONNULL_ALL static inline void
2670{
2671 struct xrt_system_compositor *xsc = *xsc_ptr;
2672 if (xsc == NULL) {
2673 return;
2674 }
2675
2676 xsc->destroy(xsc);
2677 *xsc_ptr = NULL;
2678}
2679
2680
2681/*
2682 *
2683 * Image allocator.
2684 *
2685 */
2686
2687/*!
2688 * Allocator for system native images, in general you do not need to free the
2689 * images as they will be consumed by importing them to the graphics API.
2690 *
2691 * @see xrt_image_native
2692 */
2694{
2695 /*!
2696 * Allocate a set of images suitable to be used to back a swapchain
2697 * with the given create info properties (@p xsci).
2698 */
2699 xrt_result_t (*images_allocate)(struct xrt_image_native_allocator *xina,
2700 const struct xrt_swapchain_create_info *xsci,
2701 size_t image_count,
2702 struct xrt_image_native *out_images);
2703
2704 /*!
2705 * Free the given images.
2706 */
2707 xrt_result_t (*images_free)(struct xrt_image_native_allocator *xina,
2708 size_t image_count,
2709 struct xrt_image_native *images);
2710
2711 /*!
2712 * Destroy the image allocator.
2713 */
2714 void (*destroy)(struct xrt_image_native_allocator *xina);
2715};
2716
2717/*!
2718 * @copydoc xrt_image_native_allocator::xrt_images_allocate
2719 *
2720 * Helper for calling through the function pointer.
2721 *
2722 * @public @memberof xrt_image_native_allocate
2723 */
2724XRT_NONNULL_ALL static inline xrt_result_t
2725xrt_images_allocate(struct xrt_image_native_allocator *xina,
2726 const struct xrt_swapchain_create_info *xsci,
2727 size_t image_count,
2728 struct xrt_image_native *out_images)
2729{
2730 return xina->images_allocate(xina, xsci, image_count, out_images);
2731}
2732
2733/*!
2734 * @copydoc xrt_image_native_allocator::images_free
2735 *
2736 * Helper for calling through the function pointer.
2737 *
2738 * @public @memberof xrt_image_native_allocate
2739 */
2740XRT_NONNULL_ALL static inline xrt_result_t
2741xrt_images_free(struct xrt_image_native_allocator *xina, size_t image_count, struct xrt_image_native *images)
2742{
2743 return xina->images_free(xina, image_count, images);
2744}
2745
2746/*!
2747 * @copydoc xrt_image_native_allocator::destroy
2748 *
2749 * Helper for calling through the function pointer: does a null check and sets
2750 * xina_ptr to null if freed.
2751 *
2752 * @public @memberof xrt_image_native_allocator
2753 */
2754XRT_NONNULL_ALL static inline void
2756{
2757 struct xrt_image_native_allocator *xina = *xina_ptr;
2758 if (xina == NULL) {
2759 return;
2760 }
2761
2762 xina->destroy(xina);
2763 *xina_ptr = NULL;
2764}
2765
2766
2767/*!
2768 * @}
2769 */
2770
2771
2772#ifdef __cplusplus
2773}
2774#endif
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_commit_with_semaphore(struct xrt_compositor *xc, struct xrt_compositor_semaphore *xcsem, uint64_t value)
Commits all of the submitted layers, with a semaphore.
Definition xrt_compositor.h:1854
static XRT_NONNULL_ALL xrt_result_t xrt_syscomp_notify_display_refresh_changed(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, float from_display_refresh_rate_hz, float to_display_refresh_rate_hz)
Notify this client/session if the display refresh rate has been changed.
Definition xrt_compositor.h:2594
xrt_compare_op_fb
XrCompareOpFB.
Definition xrt_compositor.h:162
static XRT_NONNULL_ALL xrt_result_t xrt_comp_begin_frame(struct xrt_compositor *xc, int64_t frame_id)
See xrBeginFrame.
Definition xrt_compositor.h:1665
static XRT_NONNULL_ALL xrt_result_t xrt_comp_wait_frame(struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_predicted_display_time, int64_t *out_predicted_display_period)
See xrWaitFrame.
Definition xrt_compositor.h:1649
static XRT_NONNULL_ALL void xrt_comp_destroy(struct xrt_compositor **xc_ptr)
Teardown the compositor.
Definition xrt_compositor.h:1929
static XRT_NONNULL_ALL xrt_result_t xrt_comp_get_swapchain_create_properties(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp)
For a given xrt_swapchain_create_info struct returns a filled out xrt_swapchain_create_properties.
Definition xrt_compositor.h:1449
static XRT_NONNULL_FIRST void xrt_compositor_semaphore_reference(struct xrt_compositor_semaphore **dst, struct xrt_compositor_semaphore *src)
Update the reference counts on compositor semaphore(s).
Definition xrt_compositor.h:832
static XRT_NONNULL_ALL xrt_result_t xrt_syscomp_set_main_app_visibility(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, bool visible)
Tell this client/session if the main application is visible or not.
Definition xrt_compositor.h:2534
static XRT_NONNULL_ALL xrt_result_t xrt_comp_get_display_refresh_rate(struct xrt_compositor *xc, float *out_display_refresh_rate_hz)
Get the current display refresh rate.
Definition xrt_compositor.h:1869
xrt_blend_mode
Blend mode that the device supports, exact mirror of XrEnvironmentBlendMode.
Definition xrt_defines.h:112
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_begin(struct xrt_compositor *xc, const struct xrt_layer_frame_data *data)
Begins layer submission.
Definition xrt_compositor.h:1700
static XRT_NONNULL_ALL xrt_result_t xrt_syscomp_set_state(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, bool visible, bool focused, int64_t timestamp_ns)
Sets the state of the compositor, generating any events to the client if the state is actually change...
Definition xrt_compositor.h:2492
static XRT_NONNULL_ALL xrt_result_t xrt_syscomp_notify_loss_pending(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t loss_time_ns)
Notify this client/session if the compositor is going to lose the ability of rendering.
Definition xrt_compositor.h:2554
static XRT_NONNULL_ALL xrt_result_t xrt_comp_set_performance_level(struct xrt_compositor *xc, enum xrt_perf_domain domain, enum xrt_perf_set_level level)
Set CPU/GPU performance level.
Definition xrt_compositor.h:1896
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_passthrough(struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data)
Adds a passthrough layer for submission.
Definition xrt_compositor.h:1827
static XRT_NONNULL_ALL void xrt_syscomp_destroy(struct xrt_system_compositor **xsc_ptr)
Teardown the system compositor.
Definition xrt_compositor.h:2669
static XRT_NONNULL_FIRST xrt_result_t xrt_comp_layer_commit(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
Commits all of the submitted layers.
Definition xrt_compositor.h:1841
static XRT_NONNULL_ALL xrt_result_t xrt_swapchain_inc_image_use(struct xrt_swapchain *xsc, uint32_t index)
Increments the use counter of a swapchain image.
Definition xrt_compositor.h:678
static XRT_NONNULL_ALL xrt_result_t xrt_compositor_fence_wait(struct xrt_compositor_fence *xcf, uint64_t timeout)
Waits on the fence with the given timeout.
Definition xrt_compositor.h:766
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_cube(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a cube layer for submission.
Definition xrt_compositor.h:1762
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_cylinder(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a cylinder layer for submission.
Definition xrt_compositor.h:1778
static XRT_NONNULL_ALL xrt_result_t xrt_comp_request_display_refresh_rate(struct xrt_compositor *xc, float display_refresh_rate_hz)
Request system to change the display refresh rate to the requested value.
Definition xrt_compositor.h:1882
static XRT_NONNULL_ALL xrt_result_t xrt_comp_discard_frame(struct xrt_compositor *xc, int64_t frame_id)
Explicitly discard a frame.
Definition xrt_compositor.h:1678
static XRT_NONNULL_ALL xrt_result_t xrt_comp_native_create_swapchain(struct xrt_compositor_native *xcn, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_native **out_xscn)
Create a native swapchain with a set of images.
Definition xrt_compositor.h:2197
#define XRT_MAX_SWAPCHAIN_IMAGES
Max swapchain images, artificial limit.
Definition xrt_limits.h:53
static XRT_NONNULL_ALL xrt_result_t xrt_comp_begin_session(struct xrt_compositor *xc, const struct xrt_begin_session_info *info)
See xrBeginSession.
Definition xrt_compositor.h:1577
static XRT_NONNULL_ALL xrt_result_t xrt_comp_import_swapchain(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, uint32_t image_count, struct xrt_swapchain **out_xsc)
Create a swapchain from a set of native images.
Definition xrt_compositor.h:1484
static XRT_NONNULL_ALL xrt_result_t xrt_comp_mark_frame(struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns)
This function and predict_frame function calls are a alternative to wait_frame.
Definition xrt_compositor.h:1636
static XRT_NONNULL_ALL xrt_result_t xrt_syscomp_set_z_order(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t z_order)
Set the rendering Z order for rendering, visible has higher priority then z_order but is still saved ...
Definition xrt_compositor.h:2513
static XRT_NONNULL_ALL xrt_result_t xrt_comp_create_swapchain(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc)
Create a swapchain with a set of images.
Definition xrt_compositor.h:1469
static XRT_NONNULL_ALL xrt_result_t xrt_syscomp_create_native_compositor(struct xrt_system_compositor *xsc, const struct xrt_session_info *xsi, struct xrt_session_event_sink *xses, struct xrt_compositor_native **out_xcn)
Create a new native compositor.
Definition xrt_compositor.h:2637
xrt_input_name
Every internal input source known to monado with a baked in type.
Definition xrt_defines.h:1018
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_projection_depth(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data)
Adds a projection layer for submission, has depth information.
Definition xrt_compositor.h:1729
#define XRT_MAX_SWAPCHAIN_CREATE_INFO_FORMAT_LIST_COUNT
Max formats in the swapchain creation info formats list, artificial limit.
Definition xrt_limits.h:73
static XRT_NONNULL_ALL xrt_result_t xrt_swapchain_acquire_image(struct xrt_swapchain *xsc, uint32_t *out_index)
Obtain the index of the next image to use, without blocking on being able to write to it.
Definition xrt_compositor.h:665
static XRT_NONNULL_ALL xrt_result_t xrt_compositor_semaphore_wait(struct xrt_compositor_semaphore *xcsem, uint64_t value, uint64_t timeout)
Does a CPU side wait on the semaphore to reach the given value.
Definition xrt_compositor.h:861
static XRT_NONNULL_ALL xrt_result_t xrt_swapchain_barrier_image(struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index)
Do any barrier transitions to and from the application.
Definition xrt_compositor.h:717
static XRT_NONNULL_ALL xrt_result_t xrt_comp_predict_frame(struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_wake_time_ns, int64_t *out_predicted_gpu_time_ns, int64_t *out_predicted_display_time_ns, int64_t *out_predicted_display_period_ns)
This function and mark_frame function calls are a alternative to wait_frame.
Definition xrt_compositor.h:1612
static XRT_NONNULL_ALL xrt_result_t xrt_swapchain_release_image(struct xrt_swapchain *xsc, uint32_t index)
See xrReleaseSwapchainImage, state tracker needs to track index.
Definition xrt_compositor.h:730
enum xrt_result xrt_result_t
Result type used across Monado.
static XRT_NONNULL_ALL xrt_result_t xrt_comp_end_session(struct xrt_compositor *xc)
See xrEndSession, unlike the OpenXR one the state tracker is responsible to call discard frame before...
Definition xrt_compositor.h:1590
xrt_compositor_frame_point
Definition xrt_compositor.h:874
static void xrt_swapchain_native_reference(struct xrt_swapchain_native **dst, struct xrt_swapchain_native *src)
Update the reference counts on swapchain(s).
Definition xrt_compositor.h:2162
static XRT_NONNULL_ALL xrt_result_t xrt_comp_create_passthrough(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
Create a passthrough.
Definition xrt_compositor.h:1533
static XRT_NONNULL_ALL xrt_result_t xrt_comp_import_fence(struct xrt_compositor *xc, xrt_graphics_sync_handle_t handle, struct xrt_compositor_fence **out_xcf)
Create a compositor fence from a native sync handle.
Definition xrt_compositor.h:1501
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_equirect1(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a equirect1 layer for submission.
Definition xrt_compositor.h:1795
xrt_layer_composition_flags
Bit field for holding information about how a layer should be composited.
Definition xrt_compositor.h:93
xrt_thread_hint
Hints the XR runtime what type of task the thread is doing.
Definition xrt_compositor.h:988
static XRT_NONNULL_ALL xrt_result_t xrt_swapchain_dec_image_use(struct xrt_swapchain *xsc, uint32_t index)
Decrements the use counter of a swapchain image.
Definition xrt_compositor.h:691
static void xrt_compositor_fence_destroy(struct xrt_compositor_fence **xcf_ptr)
Destroys the fence.
Definition xrt_compositor.h:780
xrt_reference_space_type
Type of a OpenXR mapped reference space, maps to the semantic spaces on the xrt_space_overseer struct...
Definition xrt_defines.h:655
static XRT_NONNULL_ALL xrt_result_t xrt_syscomp_get_view_config(struct xrt_system_compositor *xsc, enum xrt_view_type view_type, struct xrt_view_config *out_view_config)
Gets the view configuration for the specified view type.
Definition xrt_compositor.h:2653
xrt_layer_eye_visibility
Which view is the layer visible to?
Definition xrt_compositor.h:182
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_projection(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data)
Adds a projection layer for submissions.
Definition xrt_compositor.h:1713
static XRT_NONNULL_ALL xrt_result_t xrt_comp_set_thread_hint(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id)
Set thread attributes according to thread type.
Definition xrt_compositor.h:1949
static XRT_NONNULL_ALL xrt_result_t xrt_swapchain_wait_image(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
Wait until image index is available for exclusive use, or until timeout_ns expires.
Definition xrt_compositor.h:704
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_equirect2(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a equirect2 layer for submission.
Definition xrt_compositor.h:1811
static XRT_NONNULL_ALL void xrt_images_destroy(struct xrt_image_native_allocator **xina_ptr)
Destroy the image allocator.
Definition xrt_compositor.h:2755
static XRT_NONNULL_FIRST void xrt_swapchain_reference(struct xrt_swapchain **dst, struct xrt_swapchain *src)
Update the reference counts on swapchain(s).
Definition xrt_compositor.h:636
static XRT_NONNULL_ALL xrt_result_t xrt_comp_create_passthrough_layer(struct xrt_compositor *xc, const struct xrt_passthrough_layer_create_info *info)
Create a passthrough layer.
Definition xrt_compositor.h:1546
static XRT_NONNULL_ALL xrt_result_t xrt_syscomp_session_get_running_state(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, struct xrt_compositor_session_running_state *out_running_state)
This function returns the state of the currently running session.
Definition xrt_compositor.h:2618
xrt_blend_factor
Blend factors.
Definition xrt_compositor.h:193
#define XRT_MAX_SUPPORTED_REFRESH_RATES
Max number of supported display refresh rates, artificial limit.
Definition xrt_limits.h:78
#define XRT_MAX_SWAPCHAIN_FORMATS
Max formats supported by a compositor, artificial limit.
Definition xrt_limits.h:58
static XRT_NONNULL_ALL xrt_result_t xrt_comp_layer_quad(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a quad layer for submission, the center of the quad is specified by the pose and extends outward...
Definition xrt_compositor.h:1746
static XRT_NONNULL_ALL void xrt_comp_native_destroy(struct xrt_compositor_native **xcn_ptr)
Teardown the compositor.
Definition xrt_compositor.h:2224
static XRT_NONNULL_ALL xrt_result_t xrt_comp_get_reference_bounds_rect(struct xrt_compositor *xc, enum xrt_reference_space_type reference_space_type, struct xrt_vec2 *bounds)
Get the extents of the reference space's bounds rectangle.
Definition xrt_compositor.h:1909
static XRT_NONNULL_ALL xrt_result_t xrt_comp_create_semaphore(struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem)
Create a compositor semaphore, also returns a native handle of the semaphore which is owned by the xr...
Definition xrt_compositor.h:1516
static XRT_NONNULL_ALL xrt_result_t xrt_comp_destroy_passthrough(struct xrt_compositor *xc)
Destroy a passthrough.
Definition xrt_compositor.h:1559
xrt_layer_type
Layer type.
Definition xrt_compositor.h:78
static XRT_NONNULL_ALL xrt_result_t xrt_syscomp_notify_lost(struct xrt_system_compositor *xsc, struct xrt_compositor *xc)
Notify this client/session if the compositor lost the ability of rendering.
Definition xrt_compositor.h:2574
@ XRT_COMPOSITOR_FRAME_POINT_WOKE
The client woke up after waiting.
Definition xrt_compositor.h:875
@ XRT_COMPOSITION_LAYER_PROCESSING_QUALITY_SUPER_SAMPLING_BIT_FB
Quality super sampling, see XrCompositionLayerSettingsFlagsFB.
Definition xrt_compositor.h:113
@ XRT_LAYER_SPLIT_QUAD_VIEW_CONTEXT
When "emulating" a quad view projection layer with two stereo projection layers this is used to tag t...
Definition xrt_compositor.h:146
@ XRT_LAYER_COMPOSITION_ADVANCED_BLENDING_BIT
This layer has advanced blending information, this bit supersedes the behavior of XRT_LAYER_COMPOSITI...
Definition xrt_compositor.h:127
@ XRT_LAYER_SPLIT_QUAD_VIEW_INSET
When "emulating" a quad view projection layer with two stereo projection layers this is used to tag t...
Definition xrt_compositor.h:155
@ XRT_COMPOSITION_LAYER_PROCESSING_NORMAL_SUPER_SAMPLING_BIT_FB
Normal super sampling, see XrCompositionLayerSettingsFlagsFB.
Definition xrt_compositor.h:110
@ XRT_LAYER_COMPOSITION_DEPTH_TEST
Depth testing is requested when composing this layer if this flag is set, see XrCompositionLayerDepth...
Definition xrt_compositor.h:133
@ XRT_LAYER_COMPOSITION_VIEW_SPACE_BIT
The layer is locked to the device and the pose should only be adjusted for the IPD.
Definition xrt_compositor.h:101
@ XRT_COMPOSITION_LAYER_PROCESSING_QUALITY_SHARPENING_BIT_FB
Quality sharpening, see XrCompositionLayerSettingsFlagsFB.
Definition xrt_compositor.h:119
@ XRT_COMPOSITION_LAYER_PROCESSING_NORMAL_SHARPENING_BIT_FB
Normal sharpening, see XrCompositionLayerSettingsFlagsFB.
Definition xrt_compositor.h:116
@ XRT_LAYER_COMPOSITION_INVERTED_ALPHA_BIT
This layer has inverted alpha, see XR_COMPOSITION_LAYER_INVERTED_ALPHA_BIT_EXT.
Definition xrt_compositor.h:139
@ XRT_LAYER_COMPOSITION_COLOR_BIAS_SCALE
If this flag is set the compositor should use the scale and bias from the xrt_layer_data struct.
Definition xrt_compositor.h:107
@ XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED
Multiple not supported on this layer level (IPC, compositor).
Definition xrt_results.h:108
@ XRT_SUCCESS
The operation succeeded.
Definition xrt_results.h:27
@ XRT_ERROR_NOT_IMPLEMENTED
The interface function called is not implemented by its interface.
Definition xrt_results.h:192
Definition m_space.cpp:87
Begin Session information not known until clients have created an xrt-instance such as which extensio...
Definition xrt_compositor.h:968
A 3 element HSV colour with floating point channels.
Definition xrt_defines.h:441
A 4 element colour with floating point channels.
Definition xrt_defines.h:453
Compositor fence used for synchronization.
Definition xrt_compositor.h:746
xrt_result_t(* wait)(struct xrt_compositor_fence *xcf, uint64_t timeout)
Waits on the fence with the given timeout.
Definition xrt_compositor.h:750
void(* destroy)(struct xrt_compositor_fence *xcf)
Destroys the fence.
Definition xrt_compositor.h:755
Capabilities and information about the compositor and device together.
Definition xrt_compositor.h:949
XRT_ALIGNAS(8) int64_t formats[XRT_MAX_SWAPCHAIN_FORMATS]
Supported formats, never changes.
uint32_t format_count
Number of formats, never changes.
Definition xrt_compositor.h:951
Main compositor server interface.
Definition xrt_compositor.h:2176
struct xrt_compositor base
Base.
Definition xrt_compositor.h:2178
Compositor semaphore used for synchronization, needs to be as capable as a Vulkan pipeline semaphore.
Definition xrt_compositor.h:803
struct xrt_reference reference
Reference helper.
Definition xrt_compositor.h:807
void(* destroy)(struct xrt_compositor_semaphore *xcsem)
Destroys the semaphore.
Definition xrt_compositor.h:817
xrt_result_t(* wait)(struct xrt_compositor_semaphore *xcsem, uint64_t value, uint64_t timeout_ns)
Does a CPU side wait on the semaphore to reach the given value.
Definition xrt_compositor.h:812
Details about the currently running session of an xrt_compositor.
Definition xrt_compositor.h:2336
enum xrt_view_type active_view_type
The active view type of the session.
Definition xrt_compositor.h:2340
bool running
Whether or not this session has been begun.
Definition xrt_compositor.h:2338
Common compositor client interface/base.
Definition xrt_compositor.h:1004
xrt_result_t(* layer_projection_depth)(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data)
Adds a projection layer for submission, has depth information.
Definition xrt_compositor.h:1260
void(* destroy)(struct xrt_compositor *xc)
Teardown the compositor.
Definition xrt_compositor.h:1426
xrt_result_t(* layer_commit)(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle)
Commits all of the submitted layers.
Definition xrt_compositor.h:1361
xrt_result_t(* create_swapchain)(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain **out_xsc)
Create a swapchain with a set of images.
Definition xrt_compositor.h:1029
xrt_result_t(* get_swapchain_create_properties)(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_swapchain_create_properties *xsccp)
For a given xrt_swapchain_create_info struct returns a filled out xrt_swapchain_create_properties.
Definition xrt_compositor.h:1014
xrt_result_t(* set_thread_hint)(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id)
Set thread attributes according to thread type.
Definition xrt_compositor.h:1436
xrt_result_t(* layer_cylinder)(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a cylinder layer for submission.
Definition xrt_compositor.h:1307
xrt_result_t(* end_session)(struct xrt_compositor *xc)
See xrEndSession, unlike the OpenXR one the state tracker is responsible to call discard frame before...
Definition xrt_compositor.h:1098
xrt_result_t(* discard_frame)(struct xrt_compositor *xc, int64_t frame_id)
Explicitly discard a frame.
Definition xrt_compositor.h:1204
xrt_result_t(* destroy_passthrough)(struct xrt_compositor *xc)
Destroy a passthrough.
Definition xrt_compositor.h:1082
xrt_result_t(* get_display_refresh_rate)(struct xrt_compositor *xc, float *out_display_refresh_rate_hz)
Get the current display refresh rate.
Definition xrt_compositor.h:1390
xrt_result_t(* request_display_refresh_rate)(struct xrt_compositor *xc, float display_refresh_rate_hz)
Request system to change the display refresh rate to the requested value.
Definition xrt_compositor.h:1398
xrt_result_t(* begin_frame)(struct xrt_compositor *xc, int64_t frame_id)
See xrBeginFrame.
Definition xrt_compositor.h:1186
xrt_result_t(* layer_quad)(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a quad layer for submission, the center of the quad is specified by the pose and extends outward...
Definition xrt_compositor.h:1277
xrt_result_t(* predict_frame)(struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_wake_time_ns, int64_t *out_predicted_gpu_time_ns, int64_t *out_predicted_display_time_ns, int64_t *out_predicted_display_period_ns)
This function and mark_frame function calls are a alternative to wait_frame.
Definition xrt_compositor.h:1128
xrt_result_t(* layer_projection)(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc[XRT_MAX_VIEWS], const struct xrt_layer_data *data)
Adds a projection layer for submissions.
Definition xrt_compositor.h:1238
xrt_result_t(* mark_frame)(struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns)
This function and predict_frame function calls are a alternative to wait_frame.
Definition xrt_compositor.h:1147
xrt_result_t(* layer_equirect1)(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a equirect1 layer for submission.
Definition xrt_compositor.h:1322
xrt_result_t(* import_swapchain)(struct xrt_compositor *xc, const struct xrt_swapchain_create_info *info, struct xrt_image_native *native_images, uint32_t image_count, struct xrt_swapchain **out_xsc)
Create a swapchain from a set of native images.
Definition xrt_compositor.h:1040
xrt_result_t(* set_performance_level)(struct xrt_compositor *xc, enum xrt_perf_domain domain, enum xrt_perf_set_level level)
Set CPU/GPU performance level.
Definition xrt_compositor.h:1406
xrt_result_t(* wait_frame)(struct xrt_compositor *xc, int64_t *out_frame_id, int64_t *out_predicted_display_time, int64_t *out_predicted_display_period)
See xrWaitFrame.
Definition xrt_compositor.h:1171
xrt_result_t(* import_fence)(struct xrt_compositor *xc, xrt_graphics_sync_handle_t handle, struct xrt_compositor_fence **out_xcf)
Create a compositor fence from a native sync handle.
Definition xrt_compositor.h:1049
xrt_result_t(* layer_begin)(struct xrt_compositor *xc, const struct xrt_layer_frame_data *data)
Begins layer submission.
Definition xrt_compositor.h:1222
xrt_result_t(* get_reference_bounds_rect)(struct xrt_compositor *xc, enum xrt_reference_space_type reference_space_type, struct xrt_vec2 *bounds)
Get the extents of the reference space's bounds rectangle.
Definition xrt_compositor.h:1413
xrt_result_t(* begin_session)(struct xrt_compositor *xc, const struct xrt_begin_session_info *info)
See xrBeginSession.
Definition xrt_compositor.h:1091
xrt_result_t(* create_passthrough)(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
Create a passthrough.
Definition xrt_compositor.h:1071
xrt_result_t(* layer_equirect2)(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a equirect2 layer for submission.
Definition xrt_compositor.h:1338
xrt_result_t(* create_semaphore)(struct xrt_compositor *xc, xrt_graphics_sync_handle_t *out_handle, struct xrt_compositor_semaphore **out_xcsem)
Create a compositor semaphore, also returns a native handle of the semaphore which is owned by the xr...
Definition xrt_compositor.h:1063
xrt_result_t(* layer_passthrough)(struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data)
Adds a passthrough layer for submission.
Definition xrt_compositor.h:1352
xrt_result_t(* layer_cube)(struct xrt_compositor *xc, struct xrt_device *xdev, struct xrt_swapchain *xsc, const struct xrt_layer_data *data)
Adds a cube layer for submission.
Definition xrt_compositor.h:1292
xrt_result_t(* create_passthrough_layer)(struct xrt_compositor *xc, const struct xrt_passthrough_layer_create_info *info)
Create a passthrough layer.
Definition xrt_compositor.h:1077
xrt_result_t(* layer_commit_with_semaphore)(struct xrt_compositor *xc, struct xrt_compositor_semaphore *xcsem, uint64_t value)
Commits all of the submitted layers, with a semaphore.
Definition xrt_compositor.h:1372
Graphics usage requirements for D3D APIs.
Definition xrt_compositor.h:2054
A single HMD or input device.
Definition xrt_device.h:328
Describes a projection matrix fov.
Definition xrt_defines.h:542
Allocator for system native images, in general you do not need to free the images as they will be con...
Definition xrt_compositor.h:2694
void(* destroy)(struct xrt_image_native_allocator *xina)
Destroy the image allocator.
Definition xrt_compositor.h:2714
xrt_result_t(* images_allocate)(struct xrt_image_native_allocator *xina, const struct xrt_swapchain_create_info *xsci, size_t image_count, struct xrt_image_native *out_images)
Allocate a set of images suitable to be used to back a swapchain with the given create info propertie...
Definition xrt_compositor.h:2699
xrt_result_t(* images_free)(struct xrt_image_native_allocator *xina, size_t image_count, struct xrt_image_native *images)
Free the given images.
Definition xrt_compositor.h:2707
A single image of a swapchain based on native buffer handles.
Definition xrt_compositor.h:2102
bool use_dedicated_allocation
Is the image created with a dedicated allocation or not.
Definition xrt_compositor.h:2120
xrt_graphics_buffer_handle_t handle
Native buffer handle.
Definition xrt_compositor.h:2106
uint64_t size
Buffer size in memory.
Definition xrt_compositor.h:2115
bool is_dxgi_handle
Is the native buffer handle a DXGI handle?
Definition xrt_compositor.h:2131
Advanced blend provides explicit control over source and destination blend factors,...
Definition xrt_compositor.h:231
Chroma key parameters in HSV space.
Definition xrt_compositor.h:212
struct xrt_colour_hsv_f32 hsv_max
Maximum HSV bounds.
Definition xrt_compositor.h:216
float despill
Despill strength (0.0 = none, 1.0 = full)
Definition xrt_compositor.h:220
float curve
Power curve for alpha falloff (1.0 = linear)
Definition xrt_compositor.h:218
struct xrt_colour_hsv_f32 hsv_min
< Minimum HSV bounds
Definition xrt_compositor.h:214
All the pure data values associated with a cube layer.
Definition xrt_compositor.h:343
All the pure data values associated with a cylinder layer.
Definition xrt_compositor.h:358
All the pure data values associated with a composition layer.
Definition xrt_compositor.h:441
struct xrt_colour_rgba_f32 color_scale
Modulate the color sourced from the images.
Definition xrt_compositor.h:489
struct xrt_colour_rgba_f32 color_bias
Modulate the color sourced from the images.
Definition xrt_compositor.h:494
enum xrt_input_name name
Often XRT_INPUT_GENERIC_HEAD_POSE.
Definition xrt_compositor.h:450
enum xrt_layer_type type
Tag for compositor layer type.
Definition xrt_compositor.h:445
struct xrt_layer_depth_test_data depth_test
Depth test data.
Definition xrt_compositor.h:470
bool flip_y
Whether the main compositor should flip the direction of y when rendering.
Definition xrt_compositor.h:484
struct xrt_layer_advanced_blend_data advanced_blend
Advanced blend factors.
Definition xrt_compositor.h:499
XRT_ALIGNAS(8) int64_t timestamp
"Display no-earlier-than" timestamp for this layer.
All the pure data values associated with a depth information attached to a layer.
Definition xrt_compositor.h:289
Definition xrt_compositor.h:299
All the pure data values associated with a equirect1 layer.
Definition xrt_compositor.h:376
All the pure data values associated with a equirect2 layer.
Definition xrt_compositor.h:394
Per frame data for the layer submission calls, used in xrt_compositor::layer_begin.
Definition xrt_compositor.h:527
XRT_ALIGNAS(8) int64_t frame_id
alignas for 32 bit client support, see IPC Design and Implementation
All the pure data values associated with a passthrough layer.
Definition xrt_compositor.h:429
All the pure data values associated with a projection layer.
Definition xrt_compositor.h:275
All the pure data values associated with a projection layer with depth swapchain attached.
Definition xrt_compositor.h:312
All of the pure data values associated with a single view in a projection layer.
Definition xrt_compositor.h:261
All the pure data values associated with a quad layer.
Definition xrt_compositor.h:327
A limited unique id, it is only unique for the process it is in, so must not be used or synchronized ...
Definition xrt_defines.h:82
To transport LUIDs between different APIs.
Definition xrt_defines.h:63
Special functions to control multi session/clients.
Definition xrt_compositor.h:2352
xrt_result_t(* set_main_app_visibility)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, bool visible)
Tell this client/session if the main application is visible or not.
Definition xrt_compositor.h:2391
xrt_result_t(* notify_display_refresh_changed)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, float from_display_refresh_rate_hz, float to_display_refresh_rate_hz)
Notify this client/session if the display refresh rate has been changed.
Definition xrt_compositor.h:2412
xrt_result_t(* set_z_order)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t z_order)
Set the rendering Z order for rendering, visible has higher priority then z_order but is still saved ...
Definition xrt_compositor.h:2370
xrt_result_t(* set_state)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, bool visible, bool focused, int64_t timestamp_ns)
Sets the state of the compositor, generating any events to the client if the state is actually change...
Definition xrt_compositor.h:2358
xrt_result_t(* notify_loss_pending)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t loss_time_ns)
Notify this client/session if the compositor is going to lose the ability of rendering.
Definition xrt_compositor.h:2400
xrt_result_t(* notify_lost)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc)
Notify this client/session if the compositor lost the ability of rendering.
Definition xrt_compositor.h:2407
xrt_result_t(* session_get_running_state)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, struct xrt_compositor_session_running_state *out_running_state)
This function returns the state of the currently running session.
Definition xrt_compositor.h:2420
Normalized image rectangle, coordinates and size in 0 .
Definition xrt_defines.h:510
Passthrough creation info.
Definition xrt_compositor.h:905
Passthrough layer creation info.
Definition xrt_compositor.h:913
Definition xrt_compositor.h:418
Definition xrt_compositor.h:410
A pose composed of a position and orientation.
Definition xrt_defines.h:522
Image rectangle.
Definition xrt_defines.h:487
A base class for reference counted objects.
Definition xrt_defines.h:99
Used internally from producers of events to push events into session, some sinks might multiplex even...
Definition xrt_session.h:224
Session information, mostly overlay extension data.
Definition xrt_compositor.h:936
XRT_ALIGNAS(8) uint64_t flags
alignas for 32 bit client support, see IPC Design and Implementation
Specifies a sub-image in a layer.
Definition xrt_compositor.h:242
struct xrt_normalized_rect norm_rect
Normalized sub image coordinates and size.
Definition xrt_compositor.h:250
struct xrt_rect rect
The rectangle in the image to use.
Definition xrt_compositor.h:248
uint32_t image_index
Image index in the (implicit) swapchain.
Definition xrt_compositor.h:244
uint32_t array_index
Index in image array (for array textures)
Definition xrt_compositor.h:246
Swapchain creation info.
Definition xrt_compositor.h:882
Struct used to negotiate properties of a swapchain that is created outside of the compositor.
Definition xrt_compositor.h:924
enum xrt_swapchain_usage_bits extra_bits
New creation bits.
Definition xrt_compositor.h:929
uint32_t image_count
How many images the compositor want in the swapchain.
Definition xrt_compositor.h:926
Base class for a D3D11 client swapchain.
Definition xrt_compositor.h:2040
Base class for a D3D12 client swapchain.
Definition xrt_compositor.h:2076
Base class for an OpenGL (ES) client swapchain.
Definition xrt_compositor.h:1969
Base class for a swapchain that exposes a native buffer handle to be imported into a client API.
Definition xrt_compositor.h:2143
xrt_limited_unique_id_t limited_unique_id
Unique id for the swapchain, only unique for the current process, is not synchronized between service...
Definition xrt_compositor.h:2151
Base class for a Vulkan client swapchain.
Definition xrt_compositor.h:2004
Common swapchain interface/base.
Definition xrt_compositor.h:551
xrt_result_t(* wait_image)(struct xrt_swapchain *xsc, int64_t timeout_ns, uint32_t index)
Wait until image index is available for exclusive use, or until timeout_ns expires.
Definition xrt_compositor.h:607
xrt_result_t(* barrier_image)(struct xrt_swapchain *xsc, enum xrt_barrier_direction direction, uint32_t index)
Do any barrier transitions to and from the application.
Definition xrt_compositor.h:616
xrt_result_t(* dec_image_use)(struct xrt_swapchain *xsc, uint32_t index)
Decrements the use counter of a swapchain image.
Definition xrt_compositor.h:595
xrt_result_t(* release_image)(struct xrt_swapchain *xsc, uint32_t index)
See xrReleaseSwapchainImage, state tracker needs to track index.
Definition xrt_compositor.h:621
xrt_result_t(* acquire_image)(struct xrt_swapchain *xsc, uint32_t *out_index)
Obtain the index of the next image to use, without blocking on being able to write to it.
Definition xrt_compositor.h:583
struct xrt_reference reference
Reference helper.
Definition xrt_compositor.h:555
xrt_result_t(* inc_image_use)(struct xrt_swapchain *xsc, uint32_t index)
Increments the use counter of a swapchain image.
Definition xrt_compositor.h:588
void(* destroy)(struct xrt_swapchain *xsc)
dec_image_use must have been called as often as inc_image_use.
Definition xrt_compositor.h:567
uint32_t image_count
Number of images.
Definition xrt_compositor.h:562
Capabilities and information about the system compositor (and its wrapped native compositor,...
Definition xrt_compositor.h:2279
uint8_t supported_blend_mode_count
Number of meaningful elements in xrt_system_compositor_info::supported_blend_modes.
Definition xrt_compositor.h:2296
bool supports_emulated_quad_views_with_inset
The compositor supports emulating quad views with insets even if the device is only a stereo device.
Definition xrt_compositor.h:2327
bool client_d3d_deviceLUID_valid
Whether client_d3d_deviceLUID is valid.
Definition xrt_compositor.h:2311
xrt_uuid_t client_vk_deviceUUID
The vk device suggested for Vulkan clients, never changes.
Definition xrt_compositor.h:2305
xrt_luid_t client_d3d_deviceLUID
The (Windows) LUID for the GPU device suggested for D3D clients, never changes.
Definition xrt_compositor.h:2308
bool supports_fov_mutable
Whether submitting projection layers of a differing FOV from the target FOV is supported.
Definition xrt_compositor.h:2314
xrt_uuid_t compositor_vk_deviceUUID
The vk device as used by the compositor, never changes.
Definition xrt_compositor.h:2302
uint32_t max_layers
Maximum number of composition layers supported, never changes.
Definition xrt_compositor.h:2284
The system compositor handles composition for a system.
Definition xrt_compositor.h:2437
void(* destroy)(struct xrt_system_compositor *xsc)
Teardown the system compositor.
Definition xrt_compositor.h:2478
struct xrt_multi_compositor_control * xmcc
An optional aspect/additional interface, providing multi-app control.
Definition xrt_compositor.h:2442
xrt_result_t(* create_native_compositor)(struct xrt_system_compositor *xsc, const struct xrt_session_info *xsi, struct xrt_session_event_sink *xses, struct xrt_compositor_native **out_xcn)
Create a new native compositor.
Definition xrt_compositor.h:2461
xrt_result_t(* get_view_config)(struct xrt_system_compositor *xsc, enum xrt_view_type view_type, struct xrt_view_config *out_view_config)
Gets the view configuration for the specified view type.
Definition xrt_compositor.h:2469
To transport UUIDs between different APIs.
Definition xrt_defines.h:39
A 2 element vector with single floats.
Definition xrt_defines.h:279
Holds information about the view configuration properties for a view in a system compositor.
Definition xrt_compositor.h:2239
Definition xrt_compositor.h:2256
enum xrt_view_type view_type
Which view type this is for, mono, stereo, quad_with_inset, etc...
Definition xrt_compositor.h:2258
uint32_t view_count
Must match the view_type, in the future view_types might have variable views.
Definition xrt_compositor.h:2261
static void set_state(struct u_autoexpgain *aeg, enum u_aeg_action action)
Defines the AEG state machine transitions.
Definition u_autoexpgain.c:168
Auto detect OS and certain features.
Common defines and enums for XRT.
xrt_swapchain_usage_bits
Usage of the swapchain images.
Definition xrt_defines.h:792
xrt_passthrough_purpose_flags
Specify the kind of passthrough behavior the layer provides.
Definition xrt_defines.h:151
xrt_perf_domain
Domain type.
Definition xrt_defines.h:2524
xrt_view_type
View type to be rendered to by the compositor.
Definition xrt_defines.h:2510
xrt_swapchain_create_flags
Special flags for creating swapchain images.
Definition xrt_defines.h:766
xrt_passthrough_create_flags
Special flags for creating passthrough.
Definition xrt_defines.h:125
xrt_perf_set_level
Performance level.
Definition xrt_defines.h:2540
xrt_barrier_direction
The direction of a transition.
Definition xrt_defines.h:807
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:252
int xrt_graphics_sync_handle_t
The type underlying synchronization primitives (semaphores, etc) shared between compositor clients an...
Definition xrt_handles.h:354
Header for limits of the XRT interfaces.
A minimal way to include Windows.h.