comp: Ensure nominal_frame_interval_ns is a sane value

This commit is contained in:
Jakob Bornecrantz 2019-08-31 14:12:14 +01:00
parent cfa89b84c1
commit cfb1ca3052

View file

@ -23,6 +23,12 @@ DEBUG_GET_ONCE_BOOL_OPTION(validate_vulkan, "XRT_COMPOSITOR_VULKAN_VALIDATION",
void
comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
{
uint64_t interval_ns = xdev->hmd->screens[0].nominal_frame_interval_ns;
if (interval_ns == 0) {
// 60hz
interval_ns = (1000 * 1000 * 1000) / 60;
}
s->display = -1;
s->mode = -1;
s->color_format = VK_FORMAT_B8G8R8A8_UNORM;
@ -34,8 +40,7 @@ comp_settings_init(struct comp_settings *s, struct xrt_device *xdev)
s->distortion_model = xdev->hmd->distortion.preferred;
s->width = xdev->hmd->screens[0].w_pixels;
s->height = xdev->hmd->screens[0].h_pixels;
s->nominal_frame_interval_ns =
xdev->hmd->screens[0].nominal_frame_interval_ns;
s->nominal_frame_interval_ns = interval_ns;
s->print_spew = debug_get_bool_option_print_spew();
s->print_debug = debug_get_bool_option_print_debug();
s->validate_vulkan = debug_get_bool_option_validate_vulkan();