|
Monado OpenXR Runtime
|
Shared frame timing code. More...
#include "os/os_time.h"#include "util/u_var.h"#include "util/u_time.h"#include "util/u_misc.h"#include "util/u_debug.h"#include "util/u_pacing.h"#include "util/u_metrics.h"#include "util/u_logging.h"#include "util/u_trace_marker.h"#include <stdio.h>#include <assert.h>
Data Structures | |
| struct | u_pa_frame |
| struct | pacing_app |
Macros | |
| #define | UPA_LOG_T(...) U_LOG_IFL_T(debug_get_log_option_log_level(), __VA_ARGS__) |
| #define | UPA_LOG_D(...) U_LOG_IFL_D(debug_get_log_option_log_level(), __VA_ARGS__) |
| #define | UPA_LOG_I(...) U_LOG_IFL_I(debug_get_log_option_log_level(), __VA_ARGS__) |
| #define | UPA_LOG_W(...) U_LOG_IFL_W(debug_get_log_option_log_level(), __VA_ARGS__) |
| #define | UPA_LOG_E(...) U_LOG_IFL_E(debug_get_log_option_log_level(), __VA_ARGS__) |
| #define | FRAME_COUNT (128) |
| #define | IMMEDIATE_WAIT_FRAME_RETURN_MARGIN_NS U_TIME_HALF_MS_IN_NS |
| #define | DEBUG_PRINT_ID(ID) UPA_LOG_T("%" PRIi64, ID) |
| #define | DEBUG_PRINT_ID_FRAME(ID, F) UPA_LOG_T("%" PRIi64 " (%" PRIi64 ", %s)", ID, F->frame_id, state_to_str(F->state)) |
| #define | DEBUG_PRINT_ID_FRAME_POINT(ID, F, P) UPA_LOG_T("%" PRIi64 " (%" PRIi64 ", %s) %s", frame_id, F->frame_id, state_to_str(F->state), point_to_str(P)); |
| #define | GET_INDEX_FROM_ID(RT, ID) ((int64_t)(ID) % FRAME_COUNT) |
| #define | IIR_ALPHA_LT 0.8 |
| #define | IIR_ALPHA_GT 0.8 |
Functions | |
| DEBUG_GET_ONCE_BOOL_OPTION (immediate_wait_frame_return_below_refresh, "U_PACING_APP_IMMEDIATE_WAIT_FRAME_RETURN_BELOW_REFRESH", false) | |
| Define to validate latched and retired call. | |
| static struct pacing_app * | pacing_app (struct u_pacing_app *upa) |
| static const char * | state_to_str (enum u_pa_state state) |
| static const char * | point_to_str (enum u_timing_point point) |
| static void | do_iir_filter (int64_t *target, double alpha_lt, double alpha_gt, int64_t sample) |
| static int64_t | display_period (const struct pacing_app *pa) |
| static int64_t | min_app_time (const struct pacing_app *pa) |
| static int64_t | margin_time (const struct pacing_app *pa) |
| static int64_t | last_sample_displayed (const struct pacing_app *pa) |
| static int64_t | last_return_predicted_display (const struct pacing_app *pa) |
| static int64_t | total_app_time_ns (const struct pacing_app *pa) |
| static int64_t | total_compositor_time_ns (const struct pacing_app *pa) |
| static int64_t | total_app_and_compositor_time_ns (const struct pacing_app *pa) |
| static int64_t | calc_app_period (const struct pacing_app *pa, int64_t display_period_ns) |
| static int64_t | predict_display_time (const struct pacing_app *pa, int64_t now_ns, int64_t display_period_ns, int64_t app_period_ns) |
| static bool | should_return_immediately (int64_t frame_time_ns, int64_t display_period_ns) |
| static void | do_metrics (struct pacing_app *pa, struct u_pa_frame *f, bool discarded) |
| static void | do_tracing (struct pacing_app *pa, struct u_pa_frame *f) |
| static void | pa_predict (struct u_pacing_app *upa, int64_t now_ns, int64_t *out_frame_id, int64_t *out_wake_up_time, int64_t *out_predicted_display_time, int64_t *out_predicted_display_period) |
| static void | pa_mark_point (struct u_pacing_app *upa, int64_t frame_id, enum u_timing_point point, int64_t when_ns) |
| static void | pa_mark_discarded (struct u_pacing_app *upa, int64_t frame_id, int64_t when_ns) |
| static void | pa_mark_delivered (struct u_pacing_app *upa, int64_t frame_id, int64_t when_ns, int64_t display_time_ns) |
| static void | pa_mark_gpu_done (struct u_pacing_app *upa, int64_t frame_id, int64_t when_ns) |
| static void | pa_latched (struct u_pacing_app *upa, int64_t frame_id, int64_t when_ns, int64_t system_frame_id) |
| static void | pa_retired (struct u_pacing_app *upa, int64_t frame_id, int64_t when_ns) |
| static void | pa_info (struct u_pacing_app *upa, int64_t predicted_display_time_ns, int64_t predicted_display_period_ns, int64_t extra_ns) |
| static void | pa_destroy (struct u_pacing_app *upa) |
| static xrt_result_t | pa_create (int64_t session_id, struct u_pacing_app **out_upa) |
| static xrt_result_t | paf_create (struct u_pacing_app_factory *upaf, struct u_pacing_app **out_upa) |
| static void | paf_destroy (struct u_pacing_app_factory *upaf) |
| xrt_result_t | u_pa_factory_create (struct u_pacing_app_factory **out_upaf) |
| Creates a new application pacing factory helper. | |
Shared frame timing code.
| DEBUG_GET_ONCE_BOOL_OPTION | ( | immediate_wait_frame_return_below_refresh | , |
| "U_PACING_APP_IMMEDIATE_WAIT_FRAME_RETURN_BELOW_REFRESH" | , | ||
| false | |||
| ) |
Define to validate latched and retired call.
Currently disabled due to simplistic frame allocation code, enable once improved.
This controls how many frames are in the allocation array.
How much the total app time has to be above the display refresh period to cause an immediate return from wait_frame if the immediate_wait_frame_return_below_refresh option is enabled.