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 margin

+24 -4
+24 -4
src/xrt/auxiliary/util/u_pacing_app.c
··· 24 24 25 25 DEBUG_GET_ONCE_LOG_OPTION(log_level, "U_PACING_APP_LOG", U_LOGGING_WARN) 26 26 DEBUG_GET_ONCE_FLOAT_OPTION(min_app_time_ms, "U_PACING_APP_MIN_TIME_MS", 1.0f) 27 + DEBUG_GET_ONCE_FLOAT_OPTION(min_margin_ms, "U_PACING_APP_MIN_MARGIN_MS", 2.0f) 27 28 28 29 #define UPA_LOG_T(...) U_LOG_IFL_T(debug_get_log_option_log_level(), __VA_ARGS__) 29 30 #define UPA_LOG_D(...) U_LOG_IFL_D(debug_get_log_option_log_level(), __VA_ARGS__) ··· 129 130 */ 130 131 struct u_var_draggable_f32 min_app_time_ms; 131 132 133 + /*! 134 + * Minimum margin to use for calculating the app pacing. Currently this 135 + * is the actual margin time used, but in the future we might calculate 136 + * a margin time so this is called minimum to future proof. 137 + */ 138 + struct u_var_draggable_f32 min_margin_ms; 139 + 132 140 struct 133 141 { 134 142 //! App time between wait returning and begin being called. ··· 137 145 uint64_t draw_time_ns; 138 146 //! Time between the frame data being delivered and GPU completing. 139 147 uint64_t gpu_time_ns; 140 - //! Extra time between end of draw time and when the compositor wakes up. 141 - uint64_t margin_ns; 142 148 } app; //!< App statistics. 143 149 144 150 struct ··· 225 231 } 226 232 227 233 static uint64_t 234 + margin_time(const struct pacing_app *pa) 235 + { 236 + return (uint64_t)(pa->min_margin_ms.val * (double)U_TIME_1MS_IN_NS); 237 + } 238 + 239 + static uint64_t 228 240 last_sample_displayed(const struct pacing_app *pa) 229 241 { 230 242 return pa->last_input.predicted_display_time_ns; ··· 252 264 static uint64_t 253 265 total_compositor_time_ns(const struct pacing_app *pa) 254 266 { 255 - return pa->app.margin_ns + pa->last_input.extra_ns; 267 + return margin_time(pa) + pa->last_input.extra_ns; 256 268 } 257 269 258 270 static uint64_t ··· 682 694 pa->session_id = session_id; 683 695 pa->app.cpu_time_ns = U_TIME_1MS_IN_NS * 2; 684 696 pa->app.draw_time_ns = U_TIME_1MS_IN_NS * 2; 685 - pa->app.margin_ns = U_TIME_1MS_IN_NS * 2; 697 + 698 + pa->min_margin_ms = (struct u_var_draggable_f32){ 699 + .val = debug_get_float_option_min_margin_ms(), 700 + .min = 1.0, // This can never be negative. 701 + .step = 1.0, 702 + .max = +120.0, // There are some really slow applications out there. 703 + }; 704 + 686 705 pa->min_app_time_ms = (struct u_var_draggable_f32){ 687 706 .val = (float)debug_get_float_option_min_app_time_ms(), 688 707 .min = 1.0, // This can never be negative. ··· 697 716 698 717 // U variable tracking. 699 718 u_var_add_root(pa, "App timing info", true); 719 + u_var_add_draggable_f32(pa, &pa->min_margin_ms, "Minimum margin(ms)"); 700 720 u_var_add_draggable_f32(pa, &pa->min_app_time_ms, "Minimum app time(ms)"); 701 721 u_var_add_ro_u64(pa, &pa->app.cpu_time_ns, "CPU time(ns)"); 702 722 u_var_add_ro_u64(pa, &pa->app.draw_time_ns, "Draw time(ns)");