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