Monado OpenXR Runtime
comp_settings.h
Go to the documentation of this file.
1// Copyright 2019, Collabora, Ltd.
2// SPDX-License-Identifier: BSL-1.0
3/*!
4 * @file
5 * @brief Settings struct for compositor header.
6 * @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
7 * @author Jakob Bornecrantz <jakob@collabora.com>
8 * @ingroup comp_main
9 */
10
11#pragma once
12
13#include "xrt/xrt_device.h"
14#include "xrt/xrt_compositor.h"
16
17#include "util/u_logging.h"
18
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24
25/*!
26 * Since NVidia direct mode lets us 'acquire' any display, we need to
27 * be careful about which displays we attempt to acquire.
28 * We may wish to allow user configuration to extend this list.
29 */
30XRT_MAYBE_UNUSED static const char *NV_DIRECT_ALLOWLIST[] = {
31 "Sony SIE HMD *08", // PSVR
32 "HTC Corporation HTC-VIVE", // HTC Vive
33 "HTC Corporation VIVE Pro", // HTC Vive Pro
34 "Oculus VR Inc. Rift", // DK1, DK2 and CV1
35 "Valve Corporation Index HMD", // Valve Index
36 "Seiko/Epson SEC144A", // Samsung Odyssey+
37 "HPN", // Reverb G2
38 "PNP", // NorthStar (Generic)
39};
40
41/*!
42 * Settings for the compositor.
43 *
44 * @ingroup comp_main
45 */
47{
48 int display;
49
50 bool use_compute;
51
52 VkFormat formats[XRT_MAX_SWAPCHAIN_FORMATS];
53 uint32_t format_count;
54
55 VkColorSpaceKHR color_space;
56 VkPresentModeKHR present_mode;
57
58 //! Preferred window type to use, not actual used.
59 const char *target_identifier;
60
61 //! display string forced by user or NULL
62 const char *nvidia_display;
63
64 //! vk display number to use when forcing vk_display
66
67 struct
68 {
69 uint32_t width;
70 uint32_t height;
71 } preferred;
72
73 //! Percentage to scale the viewport by.
75
76 //! Not used with direct mode.
78
79 //! Logging level.
81
82 //! Print information about available modes for direct mode.
84
85 //! Nominal frame interval
87
88 //! Vulkan physical device selected by comp_settings_check_vulkan_caps
89 //! may be forced by user
91
92 //! Vulkan physical device index for clients to use, forced by user
94
95
96 //! Vulkan device UUID selected by comp_settings_check_vulkan_caps, valid across Vulkan instances
98
99 //! Vulkan device UUID to suggest to clients
101
102 //! The Windows LUID for the GPU device suggested for D3D clients, never changes.
104
105 //! Whether @ref client_gpu_deviceLUID is valid
107
108 //! Try to choose the mode with this index for direct mode
110};
111
112/*!
113 * Initialize the settings struct with either defaults or loaded setting.
114 *
115 * @ingroup comp_main
116 */
117void
118comp_settings_init(struct comp_settings *s, struct xrt_device *xdev);
119
120
121#ifdef __cplusplus
122}
123#endif
static XRT_MAYBE_UNUSED const char * NV_DIRECT_ALLOWLIST[]
Since NVidia direct mode lets us 'acquire' any display, we need to be careful about which displays we...
Definition: comp_settings.h:30
u_logging_level
Logging level enum.
Definition: u_logging.h:43
void comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
Initialize the settings struct with either defaults or loaded setting.
Definition: comp_settings.c:58
#define XRT_MAX_SWAPCHAIN_FORMATS
Max formats supported by a compositor, artificial limit.
Definition: xrt_limits.h:39
Settings for the compositor.
Definition: comp_settings.h:47
int client_gpu_index
Vulkan physical device index for clients to use, forced by user.
Definition: comp_settings.h:93
int vk_display
vk display number to use when forcing vk_display
Definition: comp_settings.h:65
const char * target_identifier
Preferred window type to use, not actual used.
Definition: comp_settings.h:59
bool print_modes
Print information about available modes for direct mode.
Definition: comp_settings.h:83
xrt_uuid_t selected_gpu_deviceUUID
Vulkan device UUID selected by comp_settings_check_vulkan_caps, valid across Vulkan instances.
Definition: comp_settings.h:97
xrt_luid_t client_gpu_deviceLUID
The Windows LUID for the GPU device suggested for D3D clients, never changes.
Definition: comp_settings.h:103
int selected_gpu_index
Vulkan physical device selected by comp_settings_check_vulkan_caps may be forced by user.
Definition: comp_settings.h:90
int desired_mode
Try to choose the mode with this index for direct mode.
Definition: comp_settings.h:109
const char * nvidia_display
display string forced by user or NULL
Definition: comp_settings.h:62
bool client_gpu_deviceLUID_valid
Whether client_gpu_deviceLUID is valid.
Definition: comp_settings.h:106
bool fullscreen
Not used with direct mode.
Definition: comp_settings.h:77
enum u_logging_level log_level
Logging level.
Definition: comp_settings.h:80
xrt_uuid_t client_gpu_deviceUUID
Vulkan device UUID to suggest to clients.
Definition: comp_settings.h:100
double viewport_scale
Percentage to scale the viewport by.
Definition: comp_settings.h:74
int64_t nominal_frame_interval_ns
Nominal frame interval.
Definition: comp_settings.h:86
A single HMD or input device.
Definition: xrt_device.h:241
To transport LUIDs between different APIs.
Definition: xrt_defines.h:60
To transport UUIDs between different APIs.
Definition: xrt_defines.h:36
Basic logging functionality.
Header declaring XRT graphics interfaces.
Header defining an xrt display or controller device.
Include all of the Vulkan headers in one place, and cope with any "messy" includes implied by it.