The open source OpenXR runtime

u/pacing: Add minimum wake period

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

authored by

Bones and committed by
Marge Bot
f86705a8 0c8793b5

+15 -1
+15 -1
src/xrt/auxiliary/util/u_pacing_app.c
··· 25 25 DEBUG_GET_ONCE_FLOAT_OPTION(min_app_time_ms, "U_PACING_APP_MIN_TIME_MS", 1.0f) 26 26 DEBUG_GET_ONCE_FLOAT_OPTION(min_margin_ms, "U_PACING_APP_MIN_MARGIN_MS", 2.0f) 27 27 DEBUG_GET_ONCE_BOOL_OPTION(use_min_frame_period, "U_PACING_APP_USE_MIN_FRAME_PERIOD", false) 28 + DEBUG_GET_ONCE_BOOL_OPTION(immediate_wait_frame_return, "U_PACING_APP_IMMEDIATE_WAIT_FRAME_RETURN", false) 28 29 29 30 #define UPA_LOG_T(...) U_LOG_IFL_T(debug_get_log_option_log_level(), __VA_ARGS__) 30 31 #define UPA_LOG_D(...) U_LOG_IFL_D(debug_get_log_option_log_level(), __VA_ARGS__) ··· 462 463 // How long we think the frame should take. 463 464 int64_t frame_time_ns = total_app_time_ns(pa); 464 465 // When should the client wake up. 465 - int64_t wake_up_time_ns = predict_ns - total_app_and_compositor_time_ns(pa); 466 + int64_t wake_up_time_ns; 467 + 468 + /* 469 + * We can either wake the app to render as fast as possible or at the 470 + * predicted time period minus some app and compositor time. 471 + * The former uses substantially more power but is sometimes useful in debugging 472 + *.or as a workaround. 473 + */ 474 + if (debug_get_bool_option_immediate_wait_frame_return()) { 475 + wake_up_time_ns = now_ns; 476 + } else { 477 + wake_up_time_ns = predict_ns - total_app_and_compositor_time_ns(pa); 478 + } 479 + 466 480 // When the client's GPU work should have completed. 467 481 int64_t gpu_done_time_ns = predict_ns - total_compositor_time_ns(pa); 468 482