From 8c97342732c1deac0a23535076d682a2004a3d5c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 8 May 2023 12:09:04 +0100 Subject: [PATCH] u/pacing: Add minimum compositor time --- src/xrt/auxiliary/util/u_pacing_compositor_fake.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/xrt/auxiliary/util/u_pacing_compositor_fake.c b/src/xrt/auxiliary/util/u_pacing_compositor_fake.c index bd15ae60b..c9d181c6d 100644 --- a/src/xrt/auxiliary/util/u_pacing_compositor_fake.c +++ b/src/xrt/auxiliary/util/u_pacing_compositor_fake.c @@ -29,6 +29,8 @@ * */ +DEBUG_GET_ONCE_FLOAT_OPTION(min_comp_time_ms, "U_PACING_COMP_MIN_TIME_MS", 3.0f) + /*! * A very simple pacer that tries it best to pace a compositor. Used when the * compositor can't get any good or limited feedback from the presentation @@ -284,9 +286,12 @@ u_pc_fake_create(uint64_t estimated_frame_period_ns, uint64_t now_ns, struct u_p // 20% of the frame time. ft->comp_time_ns = get_percent_of_time(estimated_frame_period_ns, 20); - // Or at least 2ms. - if (ft->comp_time_ns < U_TIME_1MS_IN_NS * 2) { - ft->comp_time_ns = U_TIME_1MS_IN_NS * 2; + // Or at least a certain amount of time. + float min_comp_time_ms_f = debug_get_float_option_min_comp_time_ms(); + uint64_t min_comp_time_ns = time_ms_f_to_ns(min_comp_time_ms_f); + + if (ft->comp_time_ns < min_comp_time_ns) { + ft->comp_time_ns = min_comp_time_ns; } // Make the next present time be in the future.