The open source OpenXR runtime
0
fork

Configure Feed

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

u/pacing: Add minimum app time option

+19 -1
+19 -1
src/xrt/auxiliary/util/u_pacing_app.c
··· 22 22 #include <inttypes.h> 23 23 24 24 DEBUG_GET_ONCE_LOG_OPTION(log_level, "U_PACING_APP_LOG", U_LOGGING_WARN) 25 + DEBUG_GET_ONCE_FLOAT_OPTION(min_app_time_ms, "U_PACING_APP_MIN_TIME_MS", 1.0f) 25 26 26 27 #define UPA_LOG_T(...) U_LOG_IFL_T(debug_get_log_option_log_level(), __VA_ARGS__) 27 28 #define UPA_LOG_D(...) U_LOG_IFL_D(debug_get_log_option_log_level(), __VA_ARGS__) ··· 111 112 112 113 int64_t frame_counter; 113 114 115 + // Minimum calculated frame (total app time). 116 + double min_app_time_ms; 117 + 114 118 struct 115 119 { 116 120 //! App time between wait returning and begin being called. ··· 198 202 min_period(const struct pacing_app *pa) 199 203 { 200 204 return pa->last_input.predicted_display_period_ns; 205 + } 206 + 207 + static uint64_t 208 + min_app_time(const struct pacing_app *pa) 209 + { 210 + return (uint64_t)(pa->min_app_time_ms * (double)U_TIME_1MS_IN_NS); 201 211 } 202 212 203 213 static uint64_t ··· 215 225 static uint64_t 216 226 total_app_time_ns(const struct pacing_app *pa) 217 227 { 218 - return pa->app.cpu_time_ns + pa->app.draw_time_ns + pa->app.wait_time_ns; 228 + uint64_t total_ns = pa->app.cpu_time_ns + pa->app.draw_time_ns + pa->app.wait_time_ns; 229 + uint64_t min_ns = min_app_time(pa); 230 + 231 + if (total_ns < min_ns) { 232 + total_ns = min_ns; 233 + } 234 + 235 + return total_ns; 219 236 } 220 237 221 238 static uint64_t ··· 650 667 pa->app.cpu_time_ns = U_TIME_1MS_IN_NS * 2; 651 668 pa->app.draw_time_ns = U_TIME_1MS_IN_NS * 2; 652 669 pa->app.margin_ns = U_TIME_1MS_IN_NS * 2; 670 + pa->min_app_time_ms = debug_get_float_option_min_app_time_ms(); 653 671 654 672 for (size_t i = 0; i < ARRAY_SIZE(pa->frames); i++) { 655 673 pa->frames[i].state = U_PA_READY;