2019-03-18 05:52:32 +00:00
|
|
|
// Copyright 2019, Collabora, Ltd.
|
|
|
|
// SPDX-License-Identifier: BSL-1.0
|
|
|
|
/*!
|
|
|
|
* @file
|
|
|
|
* @brief Settings struct for compositor.
|
|
|
|
* @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
|
2020-03-01 10:31:21 +00:00
|
|
|
* @ingroup comp_main
|
2019-03-18 05:52:32 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "util/u_debug.h"
|
|
|
|
#include "comp_settings.h"
|
|
|
|
|
2019-03-31 21:37:34 +00:00
|
|
|
// clang-format off
|
2019-03-18 05:52:32 +00:00
|
|
|
DEBUG_GET_ONCE_BOOL_OPTION(print_spew, "XRT_COMPOSITOR_PRINT_SPEW", false)
|
|
|
|
DEBUG_GET_ONCE_BOOL_OPTION(print_debug, "XRT_COMPOSITOR_PRINT_DEBUG", false)
|
2020-02-15 01:53:03 +00:00
|
|
|
DEBUG_GET_ONCE_BOOL_OPTION(print_modes, "XRT_COMPOSITOR_PRINT_MODES", false)
|
2019-03-31 21:37:34 +00:00
|
|
|
DEBUG_GET_ONCE_BOOL_OPTION(force_randr, "XRT_COMPOSITOR_FORCE_RANDR", false)
|
|
|
|
DEBUG_GET_ONCE_BOOL_OPTION(force_nvidia, "XRT_COMPOSITOR_FORCE_NVIDIA", false)
|
2019-03-18 05:52:32 +00:00
|
|
|
DEBUG_GET_ONCE_BOOL_OPTION(force_xcb, "XRT_COMPOSITOR_FORCE_XCB", false)
|
|
|
|
DEBUG_GET_ONCE_BOOL_OPTION(force_wayland, "XRT_COMPOSITOR_FORCE_WAYLAND", false)
|
2020-01-25 20:19:13 +00:00
|
|
|
DEBUG_GET_ONCE_BOOL_OPTION(wireframe, "XRT_COMPOSITOR_WIREFRAME", false)
|
2019-10-25 19:05:06 +00:00
|
|
|
DEBUG_GET_ONCE_NUM_OPTION(force_gpu_index, "XRT_COMPOSITOR_FORCE_GPU_INDEX", -1)
|
2020-02-15 02:02:11 +00:00
|
|
|
DEBUG_GET_ONCE_NUM_OPTION(desired_mode, "XRT_COMPOSITOR_DESIRED_MODE", -1)
|
2019-03-31 21:37:34 +00:00
|
|
|
// clang-format on
|
2019-03-18 05:52:32 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
|
|
|
|
{
|
2019-08-31 13:12:14 +00:00
|
|
|
uint64_t interval_ns = xdev->hmd->screens[0].nominal_frame_interval_ns;
|
|
|
|
if (interval_ns == 0) {
|
|
|
|
// 60hz
|
|
|
|
interval_ns = (1000 * 1000 * 1000) / 60;
|
|
|
|
}
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
s->display = -1;
|
|
|
|
s->color_format = VK_FORMAT_B8G8R8A8_UNORM;
|
|
|
|
s->color_space = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR;
|
|
|
|
s->present_mode = VK_PRESENT_MODE_FIFO_KHR;
|
|
|
|
s->window_type = WINDOW_AUTO;
|
|
|
|
s->fullscreen = false;
|
|
|
|
s->flip_y = false;
|
2019-05-09 10:54:48 +00:00
|
|
|
s->distortion_model = xdev->hmd->distortion.preferred;
|
|
|
|
s->width = xdev->hmd->screens[0].w_pixels;
|
|
|
|
s->height = xdev->hmd->screens[0].h_pixels;
|
2019-08-31 13:12:14 +00:00
|
|
|
s->nominal_frame_interval_ns = interval_ns;
|
2019-03-18 05:52:32 +00:00
|
|
|
s->print_spew = debug_get_bool_option_print_spew();
|
|
|
|
s->print_debug = debug_get_bool_option_print_debug();
|
2020-02-15 01:53:03 +00:00
|
|
|
s->print_modes = debug_get_bool_option_print_modes();
|
2019-10-25 19:05:06 +00:00
|
|
|
s->gpu_index = debug_get_num_option_force_gpu_index();
|
2020-01-25 20:19:13 +00:00
|
|
|
s->debug.wireframe = debug_get_bool_option_wireframe();
|
2020-02-15 02:02:11 +00:00
|
|
|
s->desired_mode = debug_get_num_option_desired_mode();
|
2019-03-18 05:52:32 +00:00
|
|
|
|
2019-03-31 21:37:34 +00:00
|
|
|
if (debug_get_bool_option_force_nvidia()) {
|
|
|
|
s->window_type = WINDOW_DIRECT_NVIDIA;
|
2019-03-18 05:52:32 +00:00
|
|
|
}
|
2019-03-31 21:37:34 +00:00
|
|
|
if (debug_get_bool_option_force_randr()) {
|
|
|
|
s->window_type = WINDOW_DIRECT_RANDR;
|
|
|
|
}
|
|
|
|
|
2019-03-18 05:52:32 +00:00
|
|
|
if (debug_get_bool_option_force_xcb()) {
|
|
|
|
s->window_type = WINDOW_XCB;
|
|
|
|
// HMD screen tends to be much larger then monitors.
|
|
|
|
s->width /= 2;
|
|
|
|
s->height /= 2;
|
|
|
|
}
|
|
|
|
if (debug_get_bool_option_force_wayland()) {
|
|
|
|
s->window_type = WINDOW_WAYLAND;
|
|
|
|
// HMD screen tends to be much larger then monitors.
|
|
|
|
s->width /= 2;
|
|
|
|
s->height /= 2;
|
|
|
|
}
|
|
|
|
}
|