u/pacing: Split draw into draw and wait, improve pipelining

This commit is contained in:
Jakob Bornecrantz 2022-04-01 00:05:06 +01:00 committed by Jakob Bornecrantz
parent 47649f56b6
commit 0595070132

View file

@ -92,8 +92,10 @@ struct pacing_app
{
//! App time between wait returning and begin being called.
uint64_t cpu_time_ns;
//! Time between begin and frame rendering completing.
//! Time between begin and frame data being delivered.
uint64_t draw_time_ns;
//! Time between the frame data being delivered and GPU completing.
uint64_t wait_time_ns;
//! Extra time between end of draw time and when the compositor wakes up.
uint64_t margin_ns;
} app; //!< App statistics.
@ -196,6 +198,10 @@ calc_period(const struct pacing_app *pa)
period_ns += base_period_ns;
}
while (pa->app.wait_time_ns > period_ns) {
period_ns += base_period_ns;
}
return period_ns;
}
@ -361,20 +367,24 @@ pa_mark_gpu_done(struct u_pacing_app *upa, int64_t frame_id, uint64_t when_ns)
#define NS_TO_MS_F(ns) (time_ns_to_s(ns) * 1000.0)
uint64_t diff_cpu_ns = f->when.begin_ns - f->when.wait_woke_ns;
uint64_t diff_draw_ns = f->when.gpu_done_ns - f->when.begin_ns;
uint64_t diff_draw_ns = f->when.delivered_ns - f->when.begin_ns;
uint64_t diff_wait_ns = f->when.gpu_done_ns - f->when.delivered_ns;
UPA_LOG_D(
"Delivered frame %.2fms %s." //
"\n\tperiod: %.2f" //
"\n\tcpu o: %.2f, n: %.2f" //
"\n\tdraw o: %.2f, n: %.2f", //
"\n\tdraw o: %.2f, n: %.2f" //
"\n\twait o: %.2f, n: %.2f", //
time_ns_to_ms_f(diff_ns), late ? "late" : "early", //
time_ns_to_ms_f(f->predicted_display_period_ns), //
time_ns_to_ms_f(pa->app.cpu_time_ns), time_ns_to_ms_f(diff_cpu_ns), //
time_ns_to_ms_f(pa->app.draw_time_ns), time_ns_to_ms_f(diff_draw_ns)); //
time_ns_to_ms_f(pa->app.draw_time_ns), time_ns_to_ms_f(diff_draw_ns), //
time_ns_to_ms_f(pa->app.wait_time_ns), time_ns_to_ms_f(diff_wait_ns)); //
do_iir_filter(&pa->app.cpu_time_ns, IIR_ALPHA_LT, IIR_ALPHA_GT, diff_cpu_ns);
do_iir_filter(&pa->app.draw_time_ns, IIR_ALPHA_LT, IIR_ALPHA_GT, diff_draw_ns);
do_iir_filter(&pa->app.wait_time_ns, IIR_ALPHA_LT, IIR_ALPHA_GT, diff_wait_ns);
// Trace the data.
#ifdef XRT_FEATURE_TRACING