From cfb1ca3052b538f78cb525594422bb09b18c98b0 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 31 Aug 2019 14:12:14 +0100 Subject: [PATCH] comp: Ensure nominal_frame_interval_ns is a sane value --- src/xrt/compositor/main/comp_settings.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xrt/compositor/main/comp_settings.c b/src/xrt/compositor/main/comp_settings.c index 1abbd9aea..3d1f63226 100644 --- a/src/xrt/compositor/main/comp_settings.c +++ b/src/xrt/compositor/main/comp_settings.c @@ -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();