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 meta_body_tracking_fidelity_enabled;
994 bool android_face_tracking_enabled;
995};
996
997/*!
998 * Hints the XR runtime what type of task the thread is doing.
999 */
1001{
1002 XRT_THREAD_HINT_APPLICATION_MAIN = 1,
1003 XRT_THREAD_HINT_APPLICATION_WORKER = 2,
1004 XRT_THREAD_HINT_RENDERER_MAIN = 3,
1005 XRT_THREAD_HINT_RENDERER_WORKER = 4,
1006};
1007
1008/*!
1009 * @interface xrt_compositor
1010 *
1011 * Common compositor client interface/base.
1012 *
1013 * A compositor is very much analogous to an `XrSession` but without any of the
1014 * input functionality, and does have the same lifetime as an `XrSession`.
1015 */
1017{
1018 /*!
1019 * Capabilities and recommended values information.
1020 */
1022
1023 /*!
1024 * For a given @ref xrt_swapchain_create_info struct returns a filled
1025 * out @ref xrt_swapchain_create_properties.
1026 */
1027 xrt_result_t (*get_swapchain_create_properties)(struct xrt_compositor *xc,
1028 const struct xrt_swapchain_create_info *info,
1029 struct xrt_swapchain_create_properties *xsccp);
1030
1031 /*!
1032 * @name Function pointers for swapchain and sync creation and import
1033 * @{
1034 */
1035 /*!
1036 * Create a swapchain with a set of images.
1037 *
1038 * The pointer pointed to by @p out_xsc has to either be NULL or a valid
1039 * @ref xrt_swapchain pointer. If there is a valid @ref xrt_swapchain
1040 * pointed by the pointed pointer it will have it reference decremented.
1041 */
1042 xrt_result_t (*create_swapchain)(struct xrt_compositor *xc,
1043 const struct xrt_swapchain_create_info *info,
1044 struct xrt_swapchain **out_xsc);
1045
1046 /*!
1047 * Create a swapchain from a set of native images.
1048 *
1049 * The pointer pointed to by @p out_xsc has to either be NULL or a valid
1050 * @ref xrt_swapchain pointer. If there is a valid @ref xrt_swapchain
1051 * pointed by the pointed pointer it will have it reference decremented.
1052 */
1053 xrt_result_t (*import_swapchain)(struct xrt_compositor *xc,
1054 const struct xrt_swapchain_create_info *info,
1055 struct xrt_image_native *native_images,
1056 uint32_t image_count,
1057 struct xrt_swapchain **out_xsc);
1058
1059 /*!
1060 * Create a compositor fence from a native sync handle.
1061 */
1062 xrt_result_t (*import_fence)(struct xrt_compositor *xc,
1064 struct xrt_compositor_fence **out_xcf);
1065
1066 /*!
1067 * Create a compositor semaphore, also returns a native handle of the
1068 * semaphore which is owned by the @ref xrt_compositor_semaphore struct.
1069 * The return values are always both valid, or on an error condition
1070 * encountered and error is returned, both not valid (untouched).
1071 *
1072 * @param[in] xc Compositor self pointer.
1073 * @param[out] out_handle Native handle owned by the samephore.
1074 * @param[out] out_handle Return of the created semahpore.
1075 */
1076 xrt_result_t (*create_semaphore)(struct xrt_compositor *xc,
1077 xrt_graphics_sync_handle_t *out_handle,
1078 struct xrt_compositor_semaphore **out_xcsem);
1079 /*! @} */
1080
1081 /*!
1082 * Create a passthrough.
1083 */
1084 xrt_result_t (*create_passthrough)(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info);
1085
1086
1087 /*!
1088 * Create a passthrough layer.
1089 */
1090 xrt_result_t (*create_passthrough_layer)(struct xrt_compositor *xc,
1091 const struct xrt_passthrough_layer_create_info *info);
1092 /*!
1093 * Destroy a passthrough.
1094 */
1095 xrt_result_t (*destroy_passthrough)(struct xrt_compositor *xc);
1096
1097 /*!
1098 * @name Function pointers for session functions
1099 * @{
1100 */
1101 /*!
1102 * See xrBeginSession.
1103 */
1104 xrt_result_t (*begin_session)(struct xrt_compositor *xc, const struct xrt_begin_session_info *info);
1105
1106 /*!
1107 * See xrEndSession, unlike the OpenXR one the state tracker is
1108 * responsible to call discard frame before calling this function. See
1109 * discard_frame.
1110 */
1111 xrt_result_t (*end_session)(struct xrt_compositor *xc);
1112
1113 /*! @} */
1114
1115 /*!
1116 * @name Function pointers for frame functions
1117 * @{
1118 */
1119
1120 /*!
1121 * This function and @ref mark_frame function calls are a alternative to
1122 * @ref wait_frame.
1123 *
1124 * The only requirement on the compositor for the @p frame_id
1125 * is that it is a positive number and larger then the last returned
1126 * frame_id.
1127 *
1128 * After a call to predict_frame, the state tracker is not allowed to
1129 * call this function until after a call to @ref mark_frame (with point
1130 * @ref XRT_COMPOSITOR_FRAME_POINT_WOKE), followed by either
1131 * @ref begin_frame or @ref discard_frame.
1132 *
1133 * @param[in] xc The compositor
1134 * @param[out] out_frame_id Frame id
1135 * @param[out] out_wake_time_ns When we want the client to be awoken to begin rendering.
1136 * @param[out] out_predicted_gpu_time_ns When we expect the client to finish the GPU work. If not
1137 * computed/available, set to 0.
1138 * @param[out] out_predicted_display_time_ns When the pixels turns into photons.
1139 * @param[out] out_predicted_display_period_ns The period for the frames.
1140 */
1141 xrt_result_t (*predict_frame)(struct xrt_compositor *xc,
1142 int64_t *out_frame_id,
1143 int64_t *out_wake_time_ns,
1144 int64_t *out_predicted_gpu_time_ns,
1145 int64_t *out_predicted_display_time_ns,
1146 int64_t *out_predicted_display_period_ns);
1147
1148 /*!
1149 * This function and @ref predict_frame function calls are a alternative to
1150 * @ref wait_frame.
1151 *
1152 * If point is @ref XRT_COMPOSITOR_FRAME_POINT_WOKE it is to mark that the
1153 * client woke up from waiting on a frame.
1154 *
1155 * @param[in] xc The compositor
1156 * @param[in] frame_id Frame id
1157 * @param[in] point What type of frame point to mark.
1158 * @param[in] when_ns When this point happened.
1159 */
1160 xrt_result_t (*mark_frame)(struct xrt_compositor *xc,
1161 int64_t frame_id,
1162 enum xrt_compositor_frame_point point,
1163 int64_t when_ns);
1164
1165 /*!
1166 * See xrWaitFrame.
1167 *
1168 * This function has the same semantics as calling @ref predict_frame,
1169 * sleeping, and then calling @ref mark_frame with a point of
1170 * @ref XRT_COMPOSITOR_FRAME_POINT_WOKE.
1171 *
1172 * The only requirement on the compositor for the @p frame_id
1173 * is that it is a positive number and larger then the last returned
1174 * @p frame_id.
1175 *
1176 * After a call to wait_frame, the state tracker is not allowed to call
1177 * this function until after a call to either @ref begin_frame or
1178 * @ref discard_frame.
1179 *
1180 * If the caller can do its own blocking, use the pair of functions
1181 * xrt_compositor::predict_frame and xrt_compositor::mark_frame instead
1182 * of this single blocking function.
1183 */
1184 xrt_result_t (*wait_frame)(struct xrt_compositor *xc,
1185 int64_t *out_frame_id,
1186 int64_t *out_predicted_display_time,
1187 int64_t *out_predicted_display_period);
1188
1189 /*!
1190 * See xrBeginFrame.
1191 *
1192 * Must have made a call to either @ref predict_frame or @ref wait_frame
1193 * before calling this function. After this function is called you must
1194 * call layer_commit.
1195 *
1196 * @param[in] xc The compositor
1197 * @param[in] frame_id Frame id
1198 */
1199 xrt_result_t (*begin_frame)(struct xrt_compositor *xc, int64_t frame_id);
1200
1201 /*!
1202 * @brief Explicitly discard a frame.
1203 *
1204 * This isn't in the OpenXR API but is explicit in the XRT interfaces.
1205 *
1206 * Two calls to xrBeginFrame without intervening xrEndFrame will cause
1207 * the state tracker to call:
1208 *
1209 * ```c
1210 * // first xrBeginFrame
1211 * xrt_comp_begin_frame(xc, frame_id);
1212 * // second xrBeginFrame
1213 * xrt_comp_discard_frame(xc, frame_id);
1214 * xrt_comp_begin_frame(xc, frame_id);
1215 * ```
1216 */
1217 xrt_result_t (*discard_frame)(struct xrt_compositor *xc, int64_t frame_id);
1218
1219 /*! @} */
1220
1221
1222 /*!
1223 * @name Function pointers for layer submission
1224 * @{
1225 */
1226 /*!
1227 * @brief Begins layer submission.
1228 *
1229 * This and the other `layer_*` calls are equivalent to xrEndFrame,
1230 * except split over multiple calls. It's only after
1231 * xrt_compositor::layer_commit that layers will be displayed.
1232 * From the point of view of the swapchain, the image is used as
1233 * soon as it's given in a call.
1234 */
1235 xrt_result_t (*layer_begin)(struct xrt_compositor *xc, const struct xrt_layer_frame_data *data);
1236
1237 /*!
1238 * @brief Adds a projection layer for submissions.
1239 *
1240 * Note that e.g. the same swapchain object may be passed as both
1241 * @p l_xsc and @p r_xsc - the parameters in @p data identify
1242 * the subrect and array texture index to use for each of the views.
1243 *
1244 * @param xc Self pointer
1245 * @param xdev The device the layer is relative to.
1246 * @param xsc Array of swapchain objects containing eye RGB data.
1247 * @param data All of the pure data bits (not pointers/handles),
1248 * including what parts of the supplied swapchain
1249 * objects to use for each view.
1250 */
1251 xrt_result_t (*layer_projection)(struct xrt_compositor *xc,
1252 struct xrt_device *xdev,
1253 struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
1254 const struct xrt_layer_data *data);
1255
1256 /*!
1257 * @brief Adds a projection layer for submission, has depth information.
1258 *
1259 * Note that e.g. the same swapchain object may be passed as both
1260 * @p l_xsc and @p r_xsc - the parameters in @p data identify
1261 * the subrect and array texture index to use for each of the views.
1262 * This flexibility is required by the OpenXR API and is passed through
1263 * to the compositor to preserve the maximum information
1264 *
1265 * @param xc Self pointer
1266 * @param xdev The device the layer is relative to.
1267 * @param xsc Array of swapchain objects containing eye RGB data.
1268 * @param d_xsc Array of swapchain objects containing eye depth data.
1269 * @param data All of the pure data bits (not pointers/handles),
1270 * including what parts of the supplied swapchain
1271 * objects to use for each view.
1272 */
1273 xrt_result_t (*layer_projection_depth)(struct xrt_compositor *xc,
1274 struct xrt_device *xdev,
1275 struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
1276 struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
1277 const struct xrt_layer_data *data);
1278
1279 /*!
1280 * Adds a quad layer for submission, the center of the quad is specified
1281 * by the pose and extends outwards from it.
1282 *
1283 * @param xc Self pointer
1284 * @param xdev The device the layer is relative to.
1285 * @param xsc Swapchain.
1286 * @param data All of the pure data bits (not pointers/handles),
1287 * including what part of the supplied swapchain
1288 * object to use.
1289 */
1290 xrt_result_t (*layer_quad)(struct xrt_compositor *xc,
1291 struct xrt_device *xdev,
1292 struct xrt_swapchain *xsc,
1293 const struct xrt_layer_data *data);
1294
1295 /*!
1296 * Adds a cube layer for submission.
1297 *
1298 * @param xc Self pointer
1299 * @param xdev The device the layer is relative to.
1300 * @param xsc Swapchain.
1301 * @param data All of the pure data bits (not pointers/handles),
1302 * including what part of the supplied swapchain
1303 * object to use.
1304 */
1305 xrt_result_t (*layer_cube)(struct xrt_compositor *xc,
1306 struct xrt_device *xdev,
1307 struct xrt_swapchain *xsc,
1308 const struct xrt_layer_data *data);
1309
1310 /*!
1311 * Adds a cylinder layer for submission.
1312 *
1313 * @param xc Self pointer
1314 * @param xdev The device the layer is relative to.
1315 * @param xsc Swapchain.
1316 * @param data All of the pure data bits (not pointers/handles),
1317 * including what part of the supplied swapchain
1318 * object to use.
1319 */
1320 xrt_result_t (*layer_cylinder)(struct xrt_compositor *xc,
1321 struct xrt_device *xdev,
1322 struct xrt_swapchain *xsc,
1323 const struct xrt_layer_data *data);
1324
1325 /*!
1326 * Adds a equirect1 layer for submission.
1327 *
1328 * @param xc Self pointer
1329 * @param xdev The device the layer is relative to.
1330 * @param xsc Swapchain.
1331 * @param data All of the pure data bits (not pointers/handles),
1332 * including what part of the supplied swapchain
1333 * object to use.
1334 */
1335 xrt_result_t (*layer_equirect1)(struct xrt_compositor *xc,
1336 struct xrt_device *xdev,
1337 struct xrt_swapchain *xsc,
1338 const struct xrt_layer_data *data);
1339
1340
1341 /*!
1342 * Adds a equirect2 layer for submission.
1343 *
1344 * @param xc Self pointer
1345 * @param xdev The device the layer is relative to.
1346 * @param xsc Swapchain.
1347 * @param data All of the pure data bits (not pointers/handles),
1348 * including what part of the supplied swapchain
1349 * object to use.
1350 */
1351 xrt_result_t (*layer_equirect2)(struct xrt_compositor *xc,
1352 struct xrt_device *xdev,
1353 struct xrt_swapchain *xsc,
1354 const struct xrt_layer_data *data);
1355
1356 /*!
1357 * Adds a passthrough layer for submission.
1358 *
1359 * @param xc Self pointer
1360 * @param xdev The device the layer is relative to.
1361 * @param data All of the pure data bits (not pointers/handles),
1362 * including what part of the supplied swapchain
1363 * object to use.
1364 */
1365 xrt_result_t (*layer_passthrough)(struct xrt_compositor *xc,
1366 struct xrt_device *xdev,
1367 const struct xrt_layer_data *data);
1368
1369 /*!
1370 * @brief Commits all of the submitted layers.
1371 *
1372 * Only after this call will the compositor actually use the layers.
1373 */
1374 xrt_result_t (*layer_commit)(struct xrt_compositor *xc, xrt_graphics_sync_handle_t sync_handle);
1375
1376 /*!
1377 * @brief Commits all of the submitted layers, with a semaphore.
1378 *
1379 * Only after this call will the compositor actually use the layers.
1380 * @param xc Self pointer
1381 * @param xcsem Semaphore that will be signalled when the app GPU
1382 * work has completed.
1383 * @param value Semaphore value upone completion of GPU work.
1384 */
1385 xrt_result_t (*layer_commit_with_semaphore)(struct xrt_compositor *xc,
1386 struct xrt_compositor_semaphore *xcsem,
1387 uint64_t value);
1388
1389 /*! @} */
1390
1391
1392 /*!
1393 * @name Function pointers for XR_FB_display_refresh_rate.
1394 * @{
1395 */
1396
1397 /*!
1398 * Get the current display refresh rate.
1399 *
1400 * @param xc Self pointer
1401 * @param out_display_refresh_rate_hz Current display refresh rate in Hertz.
1402 */
1403 xrt_result_t (*get_display_refresh_rate)(struct xrt_compositor *xc, float *out_display_refresh_rate_hz);
1404
1405 /*!
1406 * Request system to change the display refresh rate to the requested value.
1407 *
1408 * @param xc Self pointer
1409 * @param display_refresh_rate_hz Requested display refresh rate in Hertz.
1410 */
1411 xrt_result_t (*request_display_refresh_rate)(struct xrt_compositor *xc, float display_refresh_rate_hz);
1412
1413 /*! @} */
1414
1415
1416 /*!
1417 * @brief Set CPU/GPU performance level.
1418 */
1419 xrt_result_t (*set_performance_level)(struct xrt_compositor *xc,
1420 enum xrt_perf_domain domain,
1421 enum xrt_perf_set_level level);
1422
1423 /*!
1424 * @brief Get the extents of the reference space's bounds rectangle.
1425 */
1426 xrt_result_t (*get_reference_bounds_rect)(struct xrt_compositor *xc,
1427 enum xrt_reference_space_type reference_space_type,
1428 struct xrt_vec2 *bounds);
1429
1430 /*!
1431 * Teardown the compositor.
1432 *
1433 * The state tracker must have made sure that no frames or sessions are
1434 * currently pending.
1435 *
1436 * @see xrt_compositor::discard_frame or xrt_compositor::end_frame for a pending frame
1437 * @see xrt_compositor::end_session for an open session.
1438 */
1439 void (*destroy)(struct xrt_compositor *xc);
1440
1441 /*!
1442 * @name Function pointers for extensions
1443 * @{
1444 */
1445
1446 /*!
1447 * @brief Set thread attributes according to thread type
1448 */
1449 xrt_result_t (*set_thread_hint)(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id);
1450
1451 /*! @} */
1452};
1453
1454/*!
1455 * @copydoc xrt_compositor::get_swapchain_create_properties
1456 *
1457 * Helper for calling through the function pointer.
1458 *
1459 * @public @memberof xrt_compositor
1460 */
1461XRT_NONNULL_ALL static inline xrt_result_t
1463 const struct xrt_swapchain_create_info *info,
1464 struct xrt_swapchain_create_properties *xsccp)
1465{
1466 return xc->get_swapchain_create_properties(xc, info, xsccp);
1467}
1468
1469/*!
1470 * @name Swapchain and sync creation and import methods
1471 * @{
1472 */
1473
1474/*!
1475 * @copydoc xrt_compositor::create_swapchain
1476 *
1477 * Helper for calling through the function pointer.
1478 *
1479 * @public @memberof xrt_compositor
1480 */
1481XRT_NONNULL_ALL static inline xrt_result_t
1483 const struct xrt_swapchain_create_info *info,
1484 struct xrt_swapchain **out_xsc)
1485{
1486 return xc->create_swapchain(xc, info, out_xsc);
1487}
1488
1489/*!
1490 * @copydoc xrt_compositor::import_swapchain
1491 *
1492 * Helper for calling through the function pointer.
1493 *
1494 * @public @memberof xrt_compositor
1495 */
1496XRT_NONNULL_ALL static inline xrt_result_t
1498 const struct xrt_swapchain_create_info *info,
1499 struct xrt_image_native *native_images,
1500 uint32_t image_count,
1501 struct xrt_swapchain **out_xsc)
1502{
1503 return xc->import_swapchain(xc, info, native_images, image_count, out_xsc);
1504}
1505
1506/*!
1507 * @copydoc xrt_compositor::import_fence
1508 *
1509 * Helper for calling through the function pointer.
1510 *
1511 * @public @memberof xrt_compositor
1512 */
1513XRT_NONNULL_ALL static inline xrt_result_t
1516 struct xrt_compositor_fence **out_xcf)
1517{
1518 return xc->import_fence(xc, handle, out_xcf);
1519}
1520
1521/*!
1522 * @copydoc xrt_compositor::create_semaphore
1523 *
1524 * Helper for calling through the function pointer.
1525 *
1526 * @public @memberof xrt_compositor
1527 */
1528XRT_NONNULL_ALL static inline xrt_result_t
1530 xrt_graphics_sync_handle_t *out_handle,
1531 struct xrt_compositor_semaphore **out_xcsem)
1532{
1533 return xc->create_semaphore(xc, out_handle, out_xcsem);
1534}
1535
1536/*! @} */
1537
1538/*!
1539 * @copydoc xrt_compositor::create_passthrough
1540 *
1541 * Helper for calling through the function pointer.
1542 *
1543 * @public @memberof xrt_compositor
1544 */
1545XRT_NONNULL_ALL static inline xrt_result_t
1547{
1548 return xc->create_passthrough(xc, info);
1549}
1550
1551/*!
1552 * @copydoc xrt_compositor::create_passthrough_layer
1553 *
1554 * Helper for calling through the function pointer.
1555 *
1556 * @public @memberof xrt_compositor
1557 */
1558XRT_NONNULL_ALL static inline xrt_result_t
1560{
1561 return xc->create_passthrough_layer(xc, info);
1562}
1563
1564/*!
1565 * @copydoc xrt_compositor::destroy_passthrough
1566 *
1567 * Helper for calling through the function pointer.
1568 *
1569 * @public @memberof xrt_compositor
1570 */
1571XRT_NONNULL_ALL static inline xrt_result_t
1573{
1574 return xc->destroy_passthrough(xc);
1575}
1576
1577/*!
1578 * @name Session methods
1579 * @{
1580 */
1581
1582/*!
1583 * @copydoc xrt_compositor::begin_session
1584 *
1585 * Helper for calling through the function pointer.
1586 *
1587 * @public @memberof xrt_compositor
1588 */
1589XRT_NONNULL_ALL static inline xrt_result_t
1591{
1592 return xc->begin_session(xc, info);
1593}
1594
1595/*!
1596 * @copydoc xrt_compositor::end_session
1597 *
1598 * Helper for calling through the function pointer.
1599 *
1600 * @public @memberof xrt_compositor
1601 */
1602XRT_NONNULL_ALL static inline xrt_result_t
1604{
1605 return xc->end_session(xc);
1606}
1607
1608/*! @} */
1609
1610
1611/*!
1612 * @name Frame-related methods
1613 * @brief Related to the OpenXR `xr*Frame` functions
1614 * @{
1615 */
1616
1617/*!
1618 * @copydoc xrt_compositor::predict_frame
1619 *
1620 * Helper for calling through the function pointer.
1621 *
1622 * @public @memberof xrt_compositor
1623 */
1624XRT_NONNULL_ALL static inline xrt_result_t
1626 int64_t *out_frame_id,
1627 int64_t *out_wake_time_ns,
1628 int64_t *out_predicted_gpu_time_ns,
1629 int64_t *out_predicted_display_time_ns,
1630 int64_t *out_predicted_display_period_ns)
1631{
1632 return xc->predict_frame( //
1633 xc, //
1634 out_frame_id, //
1635 out_wake_time_ns, //
1636 out_predicted_gpu_time_ns, //
1637 out_predicted_display_time_ns, //
1638 out_predicted_display_period_ns); //
1639}
1640
1641/*!
1642 * @copydoc xrt_compositor::mark_frame
1643 *
1644 * Helper for calling through the function pointer.
1645 *
1646 * @public @memberof xrt_compositor
1647 */
1648XRT_NONNULL_ALL static inline xrt_result_t
1649xrt_comp_mark_frame(struct xrt_compositor *xc, int64_t frame_id, enum xrt_compositor_frame_point point, int64_t when_ns)
1650{
1651 return xc->mark_frame(xc, frame_id, point, when_ns);
1652}
1653
1654/*!
1655 * @copydoc xrt_compositor::wait_frame
1656 *
1657 * Helper for calling through the function pointer.
1658 *
1659 * @public @memberof xrt_compositor
1660 */
1661XRT_NONNULL_ALL static inline xrt_result_t
1663 int64_t *out_frame_id,
1664 int64_t *out_predicted_display_time,
1665 int64_t *out_predicted_display_period)
1666{
1667 return xc->wait_frame(xc, out_frame_id, out_predicted_display_time, out_predicted_display_period);
1668}
1669
1670/*!
1671 * @copydoc xrt_compositor::begin_frame
1672 *
1673 * Helper for calling through the function pointer.
1674 *
1675 * @public @memberof xrt_compositor
1676 */
1677XRT_NONNULL_ALL static inline xrt_result_t
1678xrt_comp_begin_frame(struct xrt_compositor *xc, int64_t frame_id)
1679{
1680 return xc->begin_frame(xc, frame_id);
1681}
1682
1683/*!
1684 * @copydoc xrt_compositor::discard_frame
1685 *
1686 * Helper for calling through the function pointer.
1687 *
1688 * @public @memberof xrt_compositor
1689 */
1690XRT_NONNULL_ALL static inline xrt_result_t
1691xrt_comp_discard_frame(struct xrt_compositor *xc, int64_t frame_id)
1692{
1693 return xc->discard_frame(xc, frame_id);
1694}
1695
1696/*! @} */
1697
1698
1699/*!
1700 * @name Layer submission methods
1701 * @brief Equivalent to `xrEndFrame`, but split across multiple calls.
1702 * @{
1703 */
1704
1705/*!
1706 * @copydoc xrt_compositor::layer_begin
1707 *
1708 * Helper for calling through the function pointer.
1709 *
1710 * @public @memberof xrt_compositor
1711 */
1712XRT_NONNULL_ALL static inline xrt_result_t
1714{
1715 return xc->layer_begin(xc, data);
1716}
1717
1718/*!
1719 * @copydoc xrt_compositor::layer_projection
1720 *
1721 * Helper for calling through the function pointer.
1722 *
1723 * @public @memberof xrt_compositor
1724 */
1725XRT_NONNULL_ALL static inline xrt_result_t
1727 struct xrt_device *xdev,
1728 struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
1729 const struct xrt_layer_data *data)
1730{
1731 return xc->layer_projection(xc, xdev, xsc, data);
1732}
1733
1734/*!
1735 * @copydoc xrt_compositor::layer_projection_depth
1736 *
1737 * Helper for calling through the function pointer.
1738 *
1739 * @public @memberof xrt_compositor
1740 */
1741XRT_NONNULL_ALL static inline xrt_result_t
1743 struct xrt_device *xdev,
1744 struct xrt_swapchain *xsc[XRT_MAX_VIEWS],
1745 struct xrt_swapchain *d_xsc[XRT_MAX_VIEWS],
1746 const struct xrt_layer_data *data)
1747{
1748 return xc->layer_projection_depth(xc, xdev, xsc, d_xsc, data);
1749}
1750
1751/*!
1752 * @copydoc xrt_compositor::layer_quad
1753 *
1754 * Helper for calling through the function pointer.
1755 *
1756 * @public @memberof xrt_compositor
1757 */
1758XRT_NONNULL_ALL static inline xrt_result_t
1760 struct xrt_device *xdev,
1761 struct xrt_swapchain *xsc,
1762 const struct xrt_layer_data *data)
1763{
1764 return xc->layer_quad(xc, xdev, xsc, data);
1765}
1766
1767/*!
1768 * @copydoc xrt_compositor::layer_cube
1769 *
1770 * Helper for calling through the function pointer.
1771 *
1772 * @public @memberof xrt_compositor
1773 */
1774XRT_NONNULL_ALL static inline xrt_result_t
1776 struct xrt_device *xdev,
1777 struct xrt_swapchain *xsc,
1778 const struct xrt_layer_data *data)
1779{
1780 return xc->layer_cube(xc, xdev, xsc, data);
1781}
1782
1783/*!
1784 * @copydoc xrt_compositor::layer_cylinder
1785 *
1786 * Helper for calling through the function pointer.
1787 *
1788 * @public @memberof xrt_compositor
1789 */
1790XRT_NONNULL_ALL static inline xrt_result_t
1792 struct xrt_device *xdev,
1793 struct xrt_swapchain *xsc,
1794 const struct xrt_layer_data *data)
1795{
1796 return xc->layer_cylinder(xc, xdev, xsc, data);
1797}
1798
1799
1800/*!
1801 * @copydoc xrt_compositor::layer_equirect1
1802 *
1803 * Helper for calling through the function pointer.
1804 *
1805 * @public @memberof xrt_compositor
1806 */
1807XRT_NONNULL_ALL static inline xrt_result_t
1809 struct xrt_device *xdev,
1810 struct xrt_swapchain *xsc,
1811 const struct xrt_layer_data *data)
1812{
1813 return xc->layer_equirect1(xc, xdev, xsc, data);
1814}
1815
1816/*!
1817 * @copydoc xrt_compositor::layer_equirect2
1818 *
1819 * Helper for calling through the function pointer.
1820 *
1821 * @public @memberof xrt_compositor
1822 */
1823XRT_NONNULL_ALL static inline xrt_result_t
1825 struct xrt_device *xdev,
1826 struct xrt_swapchain *xsc,
1827 const struct xrt_layer_data *data)
1828{
1829 return xc->layer_equirect2(xc, xdev, xsc, data);
1830}
1831
1832/*!
1833 * @copydoc xrt_compositor::layer_passthrough
1834 *
1835 * Helper for calling through the function pointer.
1836 *
1837 * @public @memberof xrt_compositor
1838 */
1839XRT_NONNULL_ALL static inline xrt_result_t
1840xrt_comp_layer_passthrough(struct xrt_compositor *xc, struct xrt_device *xdev, const struct xrt_layer_data *data)
1841{
1842 return xc->layer_passthrough(xc, xdev, data);
1843}
1844
1845/*!
1846 * @copydoc xrt_compositor::layer_commit
1847 *
1848 * Helper for calling through the function pointer.
1849 *
1850 * @public @memberof xrt_compositor
1851 */
1852XRT_NONNULL_FIRST
1853static inline xrt_result_t
1855{
1856 return xc->layer_commit(xc, sync_handle);
1857}
1858
1859/*!
1860 * @copydoc xrt_compositor::layer_commit_with_semaphore
1861 *
1862 * Helper for calling through the function pointer.
1863 *
1864 * @public @memberof xrt_compositor
1865 */
1866XRT_NONNULL_ALL static inline xrt_result_t
1868{
1869 return xc->layer_commit_with_semaphore(xc, xcsem, value);
1870}
1871
1872/*! @} */
1873
1874/*!
1875 * @copydoc xrt_compositor::get_display_refresh_rate
1876 *
1877 * Helper for calling through the function pointer.
1878 *
1879 * @public @memberof xrt_compositor
1880 */
1881XRT_NONNULL_ALL static inline xrt_result_t
1882xrt_comp_get_display_refresh_rate(struct xrt_compositor *xc, float *out_display_refresh_rate_hz)
1883{
1884 return xc->get_display_refresh_rate(xc, out_display_refresh_rate_hz);
1885}
1886
1887/*!
1888 * @copydoc xrt_compositor::request_display_refresh_rate
1889 *
1890 * Helper for calling through the function pointer.
1891 *
1892 * @public @memberof xrt_compositor
1893 */
1894XRT_NONNULL_ALL static inline xrt_result_t
1895xrt_comp_request_display_refresh_rate(struct xrt_compositor *xc, float display_refresh_rate_hz)
1896{
1897 return xc->request_display_refresh_rate(xc, display_refresh_rate_hz);
1898}
1899
1900
1901/*!
1902 * @copydoc xrt_compositor::set_performance_level
1903 *
1904 * Helper for calling through the function pointer.
1905 *
1906 * @public @memberof xrt_compositor
1907 */
1908XRT_NONNULL_ALL static inline xrt_result_t
1910{
1911 return xc->set_performance_level(xc, domain, level);
1912}
1913
1914/*!
1915 * @copydoc xrt_compositor::get_reference_bounds_rect
1916 *
1917 * Helper for calling through the function pointer.
1918 *
1919 * @public @memberof xrt_compositor
1920 */
1921XRT_NONNULL_ALL static inline xrt_result_t
1923 enum xrt_reference_space_type reference_space_type,
1924 struct xrt_vec2 *bounds)
1925{
1926 if (xc->get_reference_bounds_rect == NULL) {
1928 }
1929
1930 return xc->get_reference_bounds_rect(xc, reference_space_type, bounds);
1931}
1932
1933/*!
1934 * @copydoc xrt_compositor::destroy
1935 *
1936 * Helper for calling through the function pointer: does a null check and sets
1937 * xc_ptr to null if freed.
1938 *
1939 * @public @memberof xrt_compositor
1940 */
1941XRT_NONNULL_ALL static inline void
1943{
1944 struct xrt_compositor *xc = *xc_ptr;
1945 if (xc == NULL) {
1946 return;
1947 }
1948
1949 xc->destroy(xc);
1950 *xc_ptr = NULL;
1951}
1952
1953/*!
1954 * @name Function pointers for extensions
1955 * @{
1956 */
1957
1958/*!
1959 * @brief Set thread attributes according to thread type
1960 */
1961XRT_NONNULL_ALL static inline xrt_result_t
1962xrt_comp_set_thread_hint(struct xrt_compositor *xc, enum xrt_thread_hint hint, uint32_t thread_id)
1963{
1964 return xc->set_thread_hint(xc, hint, thread_id);
1965}
1966
1967/*! @} */
1968
1969/*
1970 *
1971 * OpenGL interface.
1972 *
1973 */
1974
1975/*!
1976 * Base class for an OpenGL (ES) client swapchain.
1977 *
1978 * @ingroup xrt_iface comp_client
1979 * @extends xrt_swapchain
1980 */
1982{
1983 //! @public Base
1984 struct xrt_swapchain base;
1985
1986 // GLuint
1987 unsigned int images[XRT_MAX_SWAPCHAIN_IMAGES];
1988};
1989
1990/*!
1991 * Base class for an OpenGL (ES) client compositor.
1992 *
1993 * @ingroup xrt_iface comp_client
1994 * @extends xrt_compositor
1995 */
1997{
1998 struct xrt_compositor base;
1999};
2000
2001/*!
2002 * Down-cast helper.
2003 *
2004 * @private @memberof xrt_swapchain_gl
2005 *
2006 * @todo unused - remove?
2007 */
2008static inline struct xrt_swapchain_gl *
2010{
2011 return (struct xrt_swapchain_gl *)xsc;
2012}
2013
2014/*!
2015 * Down-cast helper.
2016 *
2017 * @private @memberof xrt_compositor_gl
2018 *
2019 * @todo unused - remove?
2020 */
2021static inline struct xrt_compositor_gl *
2023{
2024 return (struct xrt_compositor_gl *)xc;
2025}
2026
2027
2028/*
2029 *
2030 * Vulkan interface.
2031 *
2032 */
2033
2034/*!
2035 * Base class for a Vulkan client swapchain.
2036 *
2037 * @ingroup xrt_iface comp_client
2038 * @extends xrt_swapchain
2039 */
2041{
2042 //! @public Base
2043 struct xrt_swapchain base;
2044
2045 //! Images to be used by the caller.
2047};
2048
2049/*!
2050 * Base class for a Vulkan client compositor.
2051 *
2052 * @ingroup xrt_iface comp_client
2053 * @extends xrt_compositor
2054 */
2056{
2057 //! @public Base
2058 struct xrt_compositor base;
2059};
2060
2061/*!
2062 * Down-cast helper.
2063 *
2064 * @private @memberof xrt_swapchain_vk
2065 *
2066 * @todo unused - remove?
2067 */
2068static inline struct xrt_swapchain_vk *
2070{
2071 return (struct xrt_swapchain_vk *)xsc;
2072}
2073
2074/*!
2075 * Down-cast helper.
2076 *
2077 * @private @memberof xrt_compositor_vk
2078 *
2079 * @todo unused - remove?
2080 */
2081static inline struct xrt_compositor_vk *
2083{
2084 return (struct xrt_compositor_vk *)xc;
2085}
2086
2087#if defined(XRT_HAVE_D3D11) || defined(XRT_DOXYGEN)
2088
2089/*
2090 *
2091 * D3D11 interface.
2092 *
2093 */
2094
2095/*!
2096 * Base class for a D3D11 client swapchain.
2097 *
2098 * @ingroup xrt_iface comp_client
2099 * @extends xrt_swapchain
2100 */
2102{
2103 //! @public Base
2104 struct xrt_swapchain base;
2105
2106 //! Images to be used by the caller.
2107 ID3D11Texture2D *images[XRT_MAX_SWAPCHAIN_IMAGES];
2108};
2109
2110/*!
2111 * Base class for a D3D11 client compositor.
2112 *
2113 * @ingroup xrt_iface comp_client
2114 * @extends xrt_compositor
2115 */
2117{
2118 //! @public Base
2119 struct xrt_compositor base;
2120};
2121
2122/*!
2123 * Graphics usage requirements for D3D APIs.
2124 *
2125 * @ingroup xrt_iface
2126 */
2128{
2129 LUID adapter_luid;
2130 D3D_FEATURE_LEVEL min_feature_level;
2131};
2132
2133#endif // XRT_OS_WINDOWS
2134
2135
2136#if defined(XRT_HAVE_D3D12) || defined(XRT_DOXYGEN)
2137/*
2138 *
2139 * D3D12 interface.
2140 *
2141 */
2142
2143/*!
2144 * Base class for a D3D12 client swapchain.
2145 *
2146 * @ingroup xrt_iface comp_client
2147 * @extends xrt_swapchain
2148 */
2150{
2151 //! @public Base
2152 struct xrt_swapchain base;
2153
2154 //! Images to be used by the caller.
2155 ID3D12Resource *images[XRT_MAX_SWAPCHAIN_IMAGES];
2156};
2157
2158/*!
2159 * Base class for a D3D12 client compositor.
2160 *
2161 * @ingroup xrt_iface comp_client
2162 * @extends xrt_compositor
2163 */
2165{
2166 //! @public Base
2167 struct xrt_compositor base;
2168};
2169#endif
2170
2171/*
2172 *
2173 * Native interface.
2174 *
2175 * These types are supported by underlying native buffers, which are DMABUF file
2176 * descriptors on Linux.
2177 *
2178 */
2179
2180/*!
2181 * A single image of a swapchain based on native buffer handles.
2182 *
2183 * @ingroup xrt_iface comp
2184 * @see xrt_swapchain_native, xrt_graphics_buffer_handle_t
2185 */
2187{
2188 /*!
2189 * Native buffer handle.
2190 */
2192
2193 /*!
2194 * @brief Buffer size in memory.
2195 *
2196 * Optional, set to 0 if unknown at allocation time.
2197 * If not zero, used for a max memory requirements check when importing
2198 * into Vulkan.
2199 */
2200 uint64_t size;
2201
2202 /*!
2203 * Is the image created with a dedicated allocation or not.
2204 */
2206
2207 /*!
2208 * Is the native buffer handle a DXGI handle?
2209 *
2210 * - If true, it is some kind of weird global handle, not reference counted, but
2211 * widely compatible with various images. Ostensibly deprecated, but works the best
2212 * on Windows.
2213 * - If false, it's either not Windows, or a reference counted "NT Handle"
2214 * which has awkward limitations, such as "usually no depth images allowed".
2215 */
2217};
2218
2219/*!
2220 * @interface xrt_swapchain_native
2221 * Base class for a swapchain that exposes a native buffer handle to be imported
2222 * into a client API.
2223 *
2224 * @ingroup xrt_iface comp
2225 * @extends xrt_swapchain
2226 */
2228{
2229 //! @public Base
2230 struct xrt_swapchain base;
2231
2232 /*!
2233 * Unique id for the swapchain, only unique for the current process, is
2234 * not synchronized between service and any apps via the IPC layer.
2235 */
2237
2239};
2240
2241/*!
2242 * @copydoc xrt_swapchain_reference
2243 *
2244 * @relates xrt_swapchain_native
2245 */
2246static inline void
2248{
2249 xrt_swapchain_reference((struct xrt_swapchain **)dst, (struct xrt_swapchain *)src);
2250}
2251
2252/*!
2253 * @interface xrt_compositor_native
2254 *
2255 * Main compositor server interface.
2256 *
2257 * @ingroup xrt_iface comp
2258 * @extends xrt_compositor
2259 */
2261{
2262 //! @public Base
2263 struct xrt_compositor base;
2264};
2265
2266/*!
2267 * @brief Create a native swapchain with a set of images.
2268 *
2269 * A specialized version of @ref xrt_comp_create_swapchain, for use only on @ref
2270 * xrt_compositor_native.
2271 *
2272 * Helper for calling through the base's function pointer then performing the
2273 * known-safe downcast.
2274 *
2275 * The pointer pointed to by @p out_xsc has to either be NULL or a valid
2276 * @ref xrt_swapchain pointer. If there is a valid @ref xrt_swapchain
2277 * pointed by the pointed pointer it will have it reference decremented.
2278 *
2279 * @public @memberof xrt_compositor_native
2280 */
2281XRT_NONNULL_ALL static inline xrt_result_t
2283 const struct xrt_swapchain_create_info *info,
2284 struct xrt_swapchain_native **out_xscn)
2285{
2286 struct xrt_swapchain *xsc = NULL; // Has to be NULL.
2287
2288 xrt_result_t ret = xrt_comp_create_swapchain(&xcn->base, info, &xsc);
2289 if (ret == XRT_SUCCESS) {
2290 // Need to unref any swapchain already there first.
2291 xrt_swapchain_native_reference(out_xscn, NULL);
2292
2293 // Already referenced.
2294 *out_xscn = (struct xrt_swapchain_native *)xsc;
2295 }
2296
2297 return ret;
2298}
2299
2300/*!
2301 * @copydoc xrt_compositor::destroy
2302 *
2303 * Helper for calling through the function pointer: does a null check and sets
2304 * xcn_ptr to null if freed.
2305 *
2306 * @public @memberof xrt_compositor_native
2307 */
2308XRT_NONNULL_ALL static inline void
2310{
2311 struct xrt_compositor_native *xcn = *xcn_ptr;
2312 if (xcn == NULL) {
2313 return;
2314 }
2315
2316 xcn->base.destroy(&xcn->base);
2317 *xcn_ptr = NULL;
2318}
2319
2320/*!
2321 * Holds information about the view configuration properties for a view in a system compositor.
2322 */
2324{
2325 struct
2326 {
2327 uint32_t width_pixels;
2328 uint32_t height_pixels;
2329 uint32_t sample_count;
2330 } recommended; //!< Recommended for this view.
2331
2332 struct
2333 {
2334 uint32_t width_pixels;
2335 uint32_t height_pixels;
2336 uint32_t sample_count;
2337 } max; //!< Maximums for this view.
2338};
2339
2341{
2342 //! Which view type this is for, mono, stereo, quad_with_inset, etc...
2344
2345 //! Must match the view_type, in the future view_types might have variable views.
2346 uint32_t view_count;
2347
2348 //! The per view information.
2349 struct xrt_view_config_properties views[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_VIEW_COUNT];
2350};
2351
2352
2353/*
2354 *
2355 * System composition: how to composite on a system, either directly or by combining layers from multiple apps
2356 *
2357 */
2358
2359/*!
2360 * Capabilities and information about the system compositor (and its wrapped native compositor, if any),
2361 * and device together.
2362 */
2364{
2365 uint32_t view_type_count;
2366 enum xrt_view_type view_types[XRT_MAX_COMPOSITOR_VIEW_CONFIGS_COUNT];
2367
2368 //! Maximum number of composition layers supported, never changes.
2369 uint32_t max_layers;
2370
2371 /*!
2372 * Blend modes supported by the system (the combination of the
2373 * compositor and the HMD capabilities), never changes.
2374 *
2375 * In preference order. Based on the modes reported by the device,
2376 * but the compositor has a chance to modify this.
2377 */
2378 enum xrt_blend_mode supported_blend_modes[XRT_BLEND_MODE_MAX_ENUM];
2379
2380 //! Number of meaningful elements in xrt_system_compositor_info::supported_blend_modes
2382
2383 uint32_t refresh_rate_count;
2384 float refresh_rates_hz[XRT_MAX_SUPPORTED_REFRESH_RATES];
2385
2386 //! The vk device as used by the compositor, never changes.
2388
2389 //! The vk device suggested for Vulkan clients, never changes.
2391
2392 //! The (Windows) LUID for the GPU device suggested for D3D clients, never changes.
2394
2395 //! Whether @ref client_d3d_deviceLUID is valid
2397
2398 //! Whether submitting projection layers of a differing FOV from the target FOV is supported.
2400};
2401
2403
2404/*!
2405 * @interface xrt_multi_compositor_control
2406 * Special functions to control multi session/clients.
2407 * Effectively an optional aspect of @ref xrt_system_compositor
2408 * exposed by implementations that can combine layers from multiple sessions/clients.
2409 */
2411{
2412 /*!
2413 * Sets the state of the compositor, generating any events to the client
2414 * if the state is actually changed. Input focus is enforced/handled by
2415 * a different component but is still signaled by the compositor.
2416 */
2418 struct xrt_compositor *xc,
2419 bool visible,
2420 bool focused,
2421 int64_t timestamp_ns);
2422
2423 /*!
2424 * Set the rendering Z order for rendering, visible has higher priority
2425 * then z_order but is still saved until visible again. This a signed
2426 * 64 bit integer compared to a unsigned 32 bit integer in OpenXR, so
2427 * that non-overlay clients can be handled like overlay ones.
2428 */
2429 xrt_result_t (*set_z_order)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t z_order);
2430
2431 /*!
2432 * Set the chroma key parameters for the base app's projection layers.
2433 * This is used to punch holes through opaque projection layers and adjust their blend mode.
2434 * Uses HSV min/max range for flexible color targeting.
2435 *
2436 * @param hsv_min Minimum HSV bounds
2437 * @param hsv_max Maximum HSV bounds
2438 * @param curve Power curve for alpha falloff
2439 * @param despill Despill strength
2440 */
2441 xrt_result_t (*set_base_chroma_key_params)(struct xrt_system_compositor *xsc,
2442 struct xrt_colour_hsv_f32 hsv_min,
2443 struct xrt_colour_hsv_f32 hsv_max,
2444 float curve,
2445 float despill);
2446
2447 /*!
2448 * Tell this client/session if the main application is visible or not.
2449 */
2450 xrt_result_t (*set_main_app_visibility)(struct xrt_system_compositor *xsc,
2451 struct xrt_compositor *xc,
2452 bool visible);
2453
2454 /*!
2455 * Notify this client/session if the compositor is going to lose the ability of rendering.
2456 *
2457 * @param loss_time_ns System monotonic timestamps, such as returned by os_monotonic_get_ns().
2458 */
2459 xrt_result_t (*notify_loss_pending)(struct xrt_system_compositor *xsc,
2460 struct xrt_compositor *xc,
2461 int64_t loss_time_ns);
2462
2463 /*!
2464 * Notify this client/session if the compositor lost the ability of rendering.
2465 */
2466 xrt_result_t (*notify_lost)(struct xrt_system_compositor *xsc, struct xrt_compositor *xc);
2467
2468 /*!
2469 * Notify this client/session if the display refresh rate has been changed.
2470 */
2471 xrt_result_t (*notify_display_refresh_changed)(struct xrt_system_compositor *xsc,
2472 struct xrt_compositor *xc,
2473 float from_display_refresh_rate_hz,
2474 float to_display_refresh_rate_hz);
2475};
2476
2477/*!
2478 * The system compositor handles composition for a system.
2479 * It is not itself a "compositor" (as in xrt_compositor), but it can create/own compositors.
2480 * - In a multi-app capable system, the system compositor may own an internal compositor, and
2481 * xrt_system_compositor::create_native_compositor will
2482 * create a compositor that submits layers to a merging mechanism.
2483 * - In a non-multi-app capable system, xrt_system_compositor::create_native_compositor
2484 * creates normal, native compositors, that do not wrap or feed into any other compositor.
2485 *
2486 * This is a long lived object: it has the same life time as an XrSystemID.
2487 */
2489{
2490 /*!
2491 * An optional aspect/additional interface, providing multi-app control.
2492 * Populated if this system compositor supports multi client controls.
2493 */
2495
2496 //! Info regarding the system.
2498
2499 /*!
2500 * Create a new native compositor.
2501 *
2502 * This signals that you want to start XR, and as such implicitly brings
2503 * up a new session. Does not "call" `xrBeginSession`.
2504 *
2505 * Some system compositors might only support one `xrt_compositor`
2506 * active at a time, will return `XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED`
2507 * if this is the case.
2508 *
2509 * In a multi-session capable system compositor, this may return a "proxy"
2510 * for feeding a single client's layers to a compositor or a layer merging mechanism,
2511 * rather than a raw native compositor (not wrapping or forwarding) directly.
2512 */
2513 xrt_result_t (*create_native_compositor)(struct xrt_system_compositor *xsc,
2514 const struct xrt_session_info *xsi,
2515 struct xrt_session_event_sink *xses,
2516 struct xrt_compositor_native **out_xcn);
2517
2518 /*!
2519 * Gets the view configuration for the specified view type.
2520 */
2521 xrt_result_t (*get_view_config)(struct xrt_system_compositor *xsc,
2522 enum xrt_view_type view_type,
2523 struct xrt_view_config *out_view_config);
2524
2525 /*!
2526 * Teardown the system compositor.
2527 *
2528 * The state tracker must make sure that no compositors are alive.
2529 */
2530 void (*destroy)(struct xrt_system_compositor *xsc);
2531};
2532
2533/*!
2534 * @copydoc xrt_multi_compositor_control::set_state
2535 *
2536 * Helper for calling through the function pointer.
2537 *
2538 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2539 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2540 *
2541 * @public @memberof xrt_system_compositor
2542 */
2543XRT_NONNULL_ALL static inline xrt_result_t
2545 struct xrt_system_compositor *xsc, struct xrt_compositor *xc, bool visible, bool focused, int64_t timestamp_ns)
2546{
2547 if (xsc->xmcc == NULL) {
2549 }
2550
2551 return xsc->xmcc->set_state(xsc, xc, visible, focused, timestamp_ns);
2552}
2553
2554/*!
2555 * @copydoc xrt_multi_compositor_control::set_z_order
2556 *
2557 * Helper for calling through the function pointer.
2558 *
2559 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2560 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2561 *
2562 * @public @memberof xrt_system_compositor
2563 */
2564XRT_NONNULL_ALL static inline xrt_result_t
2565xrt_syscomp_set_z_order(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t z_order)
2566{
2567 if (xsc->xmcc == NULL) {
2569 }
2570
2571 return xsc->xmcc->set_z_order(xsc, xc, z_order);
2572}
2573
2574
2575/*!
2576 * @copydoc xrt_multi_compositor_control::set_main_app_visibility
2577 *
2578 * Helper for calling through the function pointer.
2579 *
2580 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2581 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2582 *
2583 * @public @memberof xrt_system_compositor
2584 */
2585XRT_NONNULL_ALL static inline xrt_result_t
2587{
2588 if (xsc->xmcc == NULL) {
2590 }
2591
2592 return xsc->xmcc->set_main_app_visibility(xsc, xc, visible);
2593}
2594
2595/*!
2596 * @copydoc xrt_multi_compositor_control::notify_loss_pending
2597 *
2598 * Helper for calling through the function pointer.
2599 *
2600 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2601 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2602 *
2603 * @public @memberof xrt_system_compositor
2604 */
2605XRT_NONNULL_ALL static inline xrt_result_t
2606xrt_syscomp_notify_loss_pending(struct xrt_system_compositor *xsc, struct xrt_compositor *xc, int64_t loss_time_ns)
2607{
2608 if (xsc->xmcc == NULL) {
2610 }
2611
2612 return xsc->xmcc->notify_loss_pending(xsc, xc, loss_time_ns);
2613}
2614
2615/*!
2616 * @copydoc xrt_multi_compositor_control::notify_lost
2617 *
2618 * Helper for calling through the function pointer.
2619 *
2620 * If the system compositor @p xsc does not implement @ref xrt_multi_compositor_control,
2621 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2622 *
2623 * @public @memberof xrt_system_compositor
2624 */
2625XRT_NONNULL_ALL static inline xrt_result_t
2627{
2628 if (xsc->xmcc == NULL) {
2630 }
2631
2632 return xsc->xmcc->notify_lost(xsc, xc);
2633}
2634
2635/*!
2636 * @copydoc xrt_multi_compositor_control::notify_display_refresh_changed
2637 *
2638 * Helper for calling through the function pointer.
2639 *
2640 * If the system compositor @p xsc does not implement @ref xrt_multi_composition_control,
2641 * this returns @ref XRT_ERROR_MULTI_SESSION_NOT_IMPLEMENTED.
2642 *
2643 * @public @memberof xrt_system_compositor
2644 */
2645XRT_NONNULL_ALL static inline xrt_result_t
2647 struct xrt_compositor *xc,
2648 float from_display_refresh_rate_hz,
2649 float to_display_refresh_rate_hz)
2650{
2651 if (xsc->xmcc == NULL) {
2653 }
2654
2655 return xsc->xmcc->notify_display_refresh_changed(xsc, xc, from_display_refresh_rate_hz,
2656 to_display_refresh_rate_hz);
2657}
2658
2659/*!
2660 * @copydoc xrt_system_compositor::create_native_compositor
2661 *
2662 * Helper for calling through the function pointer.
2663 *
2664 * @public @memberof xrt_system_compositor
2665 */
2666XRT_NONNULL_ALL static inline xrt_result_t
2668 const struct xrt_session_info *xsi,
2669 struct xrt_session_event_sink *xses,
2670 struct xrt_compositor_native **out_xcn)
2671{
2672 return xsc->create_native_compositor(xsc, xsi, xses, out_xcn);
2673}
2674
2675/*!
2676 * @copydoc xrt_system_compositor::get_view_config
2677 *
2678 * Helper for calling through the function pointer.
2679 *
2680 * @public @memberof xrt_system_compositor
2681 */
2682XRT_NONNULL_ALL static inline xrt_result_t
2684 enum xrt_view_type view_type,
2685 struct xrt_view_config *out_view_config)
2686{
2687 return xsc->get_view_config(xsc, view_type, out_view_config);
2688}
2689
2690/*!
2691 * @copydoc xrt_system_compositor::destroy
2692 *
2693 * Helper for calling through the function pointer: does a null check and sets
2694 * xcn_ptr to null if freed.
2695 *
2696 * @public @memberof xrt_system_compositor
2697 */
2698XRT_NONNULL_ALL static inline void
2700{
2701 struct xrt_system_compositor *xsc = *xsc_ptr;
2702 if (xsc == NULL) {
2703 return;
2704 }
2705
2706 xsc->destroy(xsc);
2707 *xsc_ptr = NULL;
2708}
2709
2710
2711/*
2712 *
2713 * Image allocator.
2714 *
2715 */
2716
2717/*!
2718 * Allocator for system native images, in general you do not need to free the
2719 * images as they will be consumed by importing them to the graphics API.
2720 *
2721 * @see xrt_image_native
2722 */
2724{
2725 /*!
2726 * Allocate a set of images suitable to be used to back a swapchain
2727 * with the given create info properties (@p xsci).
2728 */
2729 xrt_result_t (*images_allocate)(struct xrt_image_native_allocator *xina,
2730 const struct xrt_swapchain_create_info *xsci,
2731 size_t image_count,
2732 struct xrt_image_native *out_images);
2733
2734 /*!
2735 * Free the given images.
2736 */
2737 xrt_result_t (*images_free)(struct xrt_image_native_allocator *xina,
2738 size_t image_count,
2739 struct xrt_image_native *images);
2740
2741 /*!
2742 * Destroy the image allocator.
2743 */
2744 void (*destroy)(struct xrt_image_native_allocator *xina);
2745};
2746
2747/*!
2748 * @copydoc xrt_image_native_allocator::xrt_images_allocate
2749 *
2750 * Helper for calling through the function pointer.
2751 *
2752 * @public @memberof xrt_image_native_allocate
2753 */
2754XRT_NONNULL_ALL static inline xrt_result_t
2755xrt_images_allocate(struct xrt_image_native_allocator *xina,
2756 const struct xrt_swapchain_create_info *xsci,
2757 size_t image_count,
2758 struct xrt_image_native *out_images)
2759{
2760 return xina->images_allocate(xina, xsci, image_count, out_images);
2761}
2762
2763/*!
2764 * @copydoc xrt_image_native_allocator::images_free
2765 *
2766 * Helper for calling through the function pointer.
2767 *
2768 * @public @memberof xrt_image_native_allocate
2769 */
2770XRT_NONNULL_ALL static inline xrt_result_t
2771xrt_images_free(struct xrt_image_native_allocator *xina, size_t image_count, struct xrt_image_native *images)
2772{
2773 return xina->images_free(xina, image_count, images);
2774}
2775
2776/*!
2777 * @copydoc xrt_image_native_allocator::destroy
2778 *
2779 * Helper for calling through the function pointer: does a null check and sets
2780 * xina_ptr to null if freed.
2781 *
2782 * @public @memberof xrt_image_native_allocator
2783 */
2784XRT_NONNULL_ALL static inline void
2786{
2787 struct xrt_image_native_allocator *xina = *xina_ptr;
2788 if (xina == NULL) {
2789 return;
2790 }
2791
2792 xina->destroy(xina);
2793 *xina_ptr = NULL;
2794}
2795
2796
2797/*!
2798 * @}
2799 */
2800
2801
2802#ifdef __cplusplus
2803}
2804#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:1867
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:2646
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:1678
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:1662
static XRT_NONNULL_ALL void xrt_comp_destroy(struct xrt_compositor **xc_ptr)
Teardown the compositor.
Definition xrt_compositor.h:1942
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:1462
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:2586
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:1882
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:1713
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:2544
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:2606
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:1909
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:1840
static XRT_NONNULL_ALL void xrt_syscomp_destroy(struct xrt_system_compositor **xsc_ptr)
Teardown the system compositor.
Definition xrt_compositor.h:2699
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:1854
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:1775
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:1791
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:1895
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:1691
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:2282
#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:1590
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:1497
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:1649
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:2565
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:1482
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:2667
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:1742
#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:1625
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:1603
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:2247
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:1546
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:1514
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:1808
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:1001
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:2683
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:1726
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:1962
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:1824
static XRT_NONNULL_ALL void xrt_images_destroy(struct xrt_image_native_allocator **xina_ptr)
Destroy the image allocator.
Definition xrt_compositor.h:2785
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:1559
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:1759
static XRT_NONNULL_ALL void xrt_comp_native_destroy(struct xrt_compositor_native **xcn_ptr)
Teardown the compositor.
Definition xrt_compositor.h:2309
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:1922
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:1529
static XRT_NONNULL_ALL xrt_result_t xrt_comp_destroy_passthrough(struct xrt_compositor *xc)
Destroy a passthrough.
Definition xrt_compositor.h:1572
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:2626
@ 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:2117
Base class for a D3D12 client compositor.
Definition xrt_compositor.h:2165
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:1997
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:2261
struct xrt_compositor base
Base.
Definition xrt_compositor.h:2263
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:2056
Common compositor client interface/base.
Definition xrt_compositor.h:1017
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:1273
void(* destroy)(struct xrt_compositor *xc)
Teardown the compositor.
Definition xrt_compositor.h:1439
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:1374
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:1042
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:1027
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:1449
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:1320
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:1111
xrt_result_t(* discard_frame)(struct xrt_compositor *xc, int64_t frame_id)
Explicitly discard a frame.
Definition xrt_compositor.h:1217
xrt_result_t(* destroy_passthrough)(struct xrt_compositor *xc)
Destroy a passthrough.
Definition xrt_compositor.h:1095
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:1403
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:1411
xrt_result_t(* begin_frame)(struct xrt_compositor *xc, int64_t frame_id)
See xrBeginFrame.
Definition xrt_compositor.h:1199
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:1290
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:1141
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:1251
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:1160
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:1335
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:1053
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:1419
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:1184
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:1062
xrt_result_t(* layer_begin)(struct xrt_compositor *xc, const struct xrt_layer_frame_data *data)
Begins layer submission.
Definition xrt_compositor.h:1235
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:1426
xrt_result_t(* begin_session)(struct xrt_compositor *xc, const struct xrt_begin_session_info *info)
See xrBeginSession.
Definition xrt_compositor.h:1104
xrt_result_t(* create_passthrough)(struct xrt_compositor *xc, const struct xrt_passthrough_create_info *info)
Create a passthrough.
Definition xrt_compositor.h:1084
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:1351
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:1076
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:1365
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:1305
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:1090
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:1385
Graphics usage requirements for D3D APIs.
Definition xrt_compositor.h:2128
A single HMD or input device.
Definition xrt_device.h:311
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:2724
void(* destroy)(struct xrt_image_native_allocator *xina)
Destroy the image allocator.
Definition xrt_compositor.h:2744
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:2729
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:2737
A single image of a swapchain based on native buffer handles.
Definition xrt_compositor.h:2187
bool use_dedicated_allocation
Is the image created with a dedicated allocation or not.
Definition xrt_compositor.h:2205
xrt_graphics_buffer_handle_t handle
Native buffer handle.
Definition xrt_compositor.h:2191
uint64_t size
Buffer size in memory.
Definition xrt_compositor.h:2200
bool is_dxgi_handle
Is the native buffer handle a DXGI handle?
Definition xrt_compositor.h:2216
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:2411
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:2450
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:2471
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:2429
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:2417
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:2459
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:2466
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:2102
Base class for a D3D12 client swapchain.
Definition xrt_compositor.h:2150
Base class for an OpenGL (ES) client swapchain.
Definition xrt_compositor.h:1982
Base class for a swapchain that exposes a native buffer handle to be imported into a client API.
Definition xrt_compositor.h:2228
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:2236
Base class for a Vulkan client swapchain.
Definition xrt_compositor.h:2041
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:2364
uint8_t supported_blend_mode_count
Number of meaningful elements in xrt_system_compositor_info::supported_blend_modes.
Definition xrt_compositor.h:2381
bool client_d3d_deviceLUID_valid
Whether client_d3d_deviceLUID is valid.
Definition xrt_compositor.h:2396
xrt_uuid_t client_vk_deviceUUID
The vk device suggested for Vulkan clients, never changes.
Definition xrt_compositor.h:2390
xrt_luid_t client_d3d_deviceLUID
The (Windows) LUID for the GPU device suggested for D3D clients, never changes.
Definition xrt_compositor.h:2393
bool supports_fov_mutable
Whether submitting projection layers of a differing FOV from the target FOV is supported.
Definition xrt_compositor.h:2399
xrt_uuid_t compositor_vk_deviceUUID
The vk device as used by the compositor, never changes.
Definition xrt_compositor.h:2387
uint32_t max_layers
Maximum number of composition layers supported, never changes.
Definition xrt_compositor.h:2369
The system compositor handles composition for a system.
Definition xrt_compositor.h:2489
void(* destroy)(struct xrt_system_compositor *xsc)
Teardown the system compositor.
Definition xrt_compositor.h:2530
struct xrt_multi_compositor_control * xmcc
An optional aspect/additional interface, providing multi-app control.
Definition xrt_compositor.h:2494
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:2513
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:2521
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:2324
Definition xrt_compositor.h:2341
enum xrt_view_type view_type
Which view type this is for, mono, stereo, quad_with_inset, etc...
Definition xrt_compositor.h:2343
uint32_t view_count
Must match the view_type, in the future view_types might have variable views.
Definition xrt_compositor.h:2346
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:2428
xrt_view_type
View type to be rendered to by the compositor.
Definition xrt_defines.h:2417
xrt_passthrough_create_flags
Special flags for creating passthrough.
Definition xrt_defines.h:125
xrt_perf_set_level
Performance level.
Definition xrt_defines.h:2444
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.