The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

u/pacing: Add U_PACING_COMP_TIME_FRACTION_PERCENT option

This adds the option U_PACING_COMP_TIME_FRACTION_PERCENT that allows
us to set the default compositor time as a percentage of the estimated
frame time.

This will be an easier way to tweak compositor time independently of
the particular HMD frame rate, when doing so is necessary for
performance reasons. This is currently often the case on NVIDIA
proprietary driver when used together with
XRT_COMPOSITOR_USE_PRESENT_WAIT=TRUE

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2526>

authored by

xantoz and committed by
Marge Bot
1de41762 b92280c2

+8 -5
+8 -5
src/xrt/auxiliary/util/u_pacing_compositor_fake.c
··· 21 21 22 22 #include <stdio.h> 23 23 #include <assert.h> 24 + #include <math.h> 24 25 25 26 26 27 /* ··· 31 32 32 33 DEBUG_GET_ONCE_FLOAT_OPTION(present_to_display_offset_ms, "U_PACING_COMP_PRESENT_TO_DISPLAY_OFFSET_MS", 4.0f) 33 34 DEBUG_GET_ONCE_FLOAT_OPTION(min_comp_time_ms, "U_PACING_COMP_MIN_TIME_MS", 3.0f) 35 + DEBUG_GET_ONCE_FLOAT_OPTION(comp_time_fraction_percent, "U_PACING_COMP_TIME_FRACTION_PERCENT", 20.0f) 34 36 DEBUG_GET_ONCE_BOOL_OPTION(live_stats, "U_PACING_LIVE_STATS", false) 35 37 36 38 // We keep track of this number of frames. ··· 187 189 } 188 190 189 191 static int64_t 190 - get_percent_of_time(int64_t time_ns, uint32_t fraction_percent) 192 + get_percent_of_time(int64_t time_ns, double fraction_percent) 191 193 { 192 - double fraction = (double)fraction_percent / 100.0; 194 + double fraction = fraction_percent / 100.0; 193 195 return time_s_to_ns(time_ns_to_s(time_ns) * fraction); 194 196 } 195 197 ··· 471 473 .max = +40.0, 472 474 }; 473 475 474 - // 20% of the frame time. 475 - ft->comp_time_ns = get_percent_of_time(estimated_frame_period_ns, 20); 476 + // Set comp_time_ms to a percentage of the frame time. 477 + float comp_time_fraction_percent = fabs(debug_get_float_option_comp_time_fraction_percent()); 478 + ft->comp_time_ns = get_percent_of_time(estimated_frame_period_ns, comp_time_fraction_percent); 476 479 477 480 // Or at least a certain amount of time. 478 - float min_comp_time_ms_f = debug_get_float_option_min_comp_time_ms(); 481 + double min_comp_time_ms_f = debug_get_float_option_min_comp_time_ms(); 479 482 int64_t min_comp_time_ns = time_ms_f_to_ns(min_comp_time_ms_f); 480 483 481 484 if (ft->comp_time_ns < min_comp_time_ns) {