mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
a/util: Rename app_time_* in u_pc to comp_time_*
This commit is contained in:
parent
d176b18598
commit
6345962d66
|
@ -468,7 +468,7 @@ struct u_pc_display_timing_config
|
|||
{
|
||||
//! How long after "present" is the image actually displayed
|
||||
uint64_t present_offset_ns;
|
||||
//! Extra margin that is added to app time, between end of draw and present
|
||||
//! Extra margin that is added to compositor time, between end of draw and present
|
||||
uint64_t margin_ns;
|
||||
/*!
|
||||
* @name Frame-Relative Values
|
||||
|
@ -476,10 +476,10 @@ struct u_pc_display_timing_config
|
|||
* devices of varying refresh rate/display interval.
|
||||
* @{
|
||||
*/
|
||||
//! The initial estimate of how much time the app needs
|
||||
uint32_t app_time_fraction;
|
||||
//! The maximum time we allow to the app
|
||||
uint32_t app_time_max_fraction;
|
||||
//! The initial estimate of how much time the compositor needs
|
||||
uint32_t comp_time_fraction;
|
||||
//! The maximum time we allow to the compositor
|
||||
uint32_t comp_time_max_fraction;
|
||||
//! When missing a frame, back off in these increments
|
||||
uint32_t adjust_missed_fraction;
|
||||
//! When not missing frames but adjusting app time at these increments
|
||||
|
|
|
@ -104,7 +104,7 @@ struct display_timing
|
|||
/*!
|
||||
* The amount of time that the application needs to render frame.
|
||||
*/
|
||||
uint64_t app_time_ns;
|
||||
uint64_t comp_time_ns;
|
||||
|
||||
/*!
|
||||
* The amount of time that the application needs to render frame.
|
||||
|
@ -119,7 +119,7 @@ struct display_timing
|
|||
/*!
|
||||
* The maximum amount we give to the 'app'.
|
||||
*/
|
||||
uint64_t app_time_max_ns;
|
||||
uint64_t comp_time_max_ns;
|
||||
|
||||
/*!
|
||||
* If we missed a frame, back off this much.
|
||||
|
@ -172,7 +172,7 @@ get_percent_of_time(uint64_t time_ns, uint32_t fraction_percent)
|
|||
static uint64_t
|
||||
calc_total_app_time(struct display_timing *dt)
|
||||
{
|
||||
return dt->app_time_ns + dt->margin_ns;
|
||||
return dt->comp_time_ns + dt->margin_ns;
|
||||
}
|
||||
|
||||
static uint64_t
|
||||
|
@ -351,7 +351,7 @@ predict_next_frame(struct display_timing *dt, uint64_t now_ns)
|
|||
|
||||
f->predicted_display_time_ns = calc_display_time_from_present_time(dt, f->desired_present_time_ns);
|
||||
f->wake_up_time_ns = f->desired_present_time_ns - calc_total_app_time(dt);
|
||||
f->current_app_time_ns = dt->app_time_ns;
|
||||
f->current_app_time_ns = dt->comp_time_ns;
|
||||
|
||||
return f;
|
||||
}
|
||||
|
@ -359,19 +359,19 @@ predict_next_frame(struct display_timing *dt, uint64_t now_ns)
|
|||
static void
|
||||
adjust_app_time(struct display_timing *dt, struct frame *f)
|
||||
{
|
||||
uint64_t app_time_ns = dt->app_time_ns;
|
||||
uint64_t comp_time_ns = dt->comp_time_ns;
|
||||
|
||||
if (f->actual_present_time_ns > f->desired_present_time_ns &&
|
||||
!is_within_half_ms(f->actual_present_time_ns, f->desired_present_time_ns)) {
|
||||
double missed_ms = ns_to_ms(f->actual_present_time_ns - f->desired_present_time_ns);
|
||||
FT_LOG_W("Frame %" PRIu64 " missed by %.2f!", f->frame_id, missed_ms);
|
||||
|
||||
app_time_ns += dt->adjust_missed_ns;
|
||||
if (app_time_ns > dt->app_time_max_ns) {
|
||||
app_time_ns = dt->app_time_max_ns;
|
||||
comp_time_ns += dt->adjust_missed_ns;
|
||||
if (comp_time_ns > dt->comp_time_max_ns) {
|
||||
comp_time_ns = dt->comp_time_max_ns;
|
||||
}
|
||||
|
||||
dt->app_time_ns = app_time_ns;
|
||||
dt->comp_time_ns = comp_time_ns;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -388,10 +388,10 @@ adjust_app_time(struct display_timing *dt, struct frame *f)
|
|||
// We didn't miss the frame but we were outside the range adjust the app time.
|
||||
if (f->present_margin_ns > dt->margin_ns) {
|
||||
// Approach the present time.
|
||||
dt->app_time_ns -= dt->adjust_non_miss_ns;
|
||||
dt->comp_time_ns -= dt->adjust_non_miss_ns;
|
||||
} else {
|
||||
// Back off the present time.
|
||||
dt->app_time_ns += dt->adjust_non_miss_ns;
|
||||
dt->comp_time_ns += dt->adjust_non_miss_ns;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,8 +669,10 @@ const struct u_pc_display_timing_config U_PC_DISPLAY_TIMING_CONFIG_DEFAULT = {
|
|||
// Just a wild guess.
|
||||
.present_offset_ns = U_TIME_1MS_IN_NS * 4,
|
||||
.margin_ns = U_TIME_1MS_IN_NS,
|
||||
.app_time_fraction = 10,
|
||||
.app_time_max_fraction = 30,
|
||||
// Start by assuming the compositor takes 10% of the frame.
|
||||
.comp_time_fraction = 10,
|
||||
// Don't allow the compositor to take more than 30% of the frame.
|
||||
.comp_time_max_fraction = 30,
|
||||
.adjust_missed_fraction = 4,
|
||||
.adjust_non_miss_fraction = 2,
|
||||
};
|
||||
|
@ -692,9 +694,9 @@ u_pc_display_timing_create(uint64_t estimated_frame_period_ns,
|
|||
dt->present_offset_ns = config->present_offset_ns;
|
||||
|
||||
// Start at this of frame time.
|
||||
dt->app_time_ns = get_percent_of_time(estimated_frame_period_ns, config->app_time_fraction);
|
||||
// Max app time, write a better compositor.
|
||||
dt->app_time_max_ns = get_percent_of_time(estimated_frame_period_ns, config->app_time_max_fraction);
|
||||
dt->comp_time_ns = get_percent_of_time(estimated_frame_period_ns, config->comp_time_fraction);
|
||||
// Max compositor time: if we ever hit this, write a better compositor.
|
||||
dt->comp_time_max_ns = get_percent_of_time(estimated_frame_period_ns, config->comp_time_max_fraction);
|
||||
// When missing, back off in these increments
|
||||
dt->adjust_missed_ns = get_percent_of_time(estimated_frame_period_ns, config->adjust_missed_fraction);
|
||||
// When not missing frames but adjusting app time at these increments
|
||||
|
|
|
@ -50,7 +50,7 @@ struct fake_timing
|
|||
uint64_t present_offset_ns;
|
||||
|
||||
// The amount of time that the application needs to render frame.
|
||||
uint64_t app_time_ns;
|
||||
uint64_t comp_time_ns;
|
||||
|
||||
int64_t frame_id_generator;
|
||||
};
|
||||
|
@ -71,7 +71,7 @@ fake_timing(struct u_pacing_compositor *upc)
|
|||
static uint64_t
|
||||
predict_next_frame(struct fake_timing *ft, uint64_t now_ns)
|
||||
{
|
||||
uint64_t time_needed_ns = ft->present_offset_ns + ft->app_time_ns;
|
||||
uint64_t time_needed_ns = ft->present_offset_ns + ft->comp_time_ns;
|
||||
uint64_t predicted_display_time_ns = ft->last_display_time_ns + ft->frame_period_ns;
|
||||
|
||||
while (now_ns + time_needed_ns > predicted_display_time_ns) {
|
||||
|
@ -111,7 +111,7 @@ pc_predict(struct u_pacing_compositor *upc,
|
|||
int64_t frame_id = ft->frame_id_generator++;
|
||||
uint64_t predicted_display_time_ns = predict_next_frame(ft, now_ns);
|
||||
uint64_t desired_present_time_ns = predicted_display_time_ns - ft->present_offset_ns;
|
||||
uint64_t wake_up_time_ns = desired_present_time_ns - ft->app_time_ns;
|
||||
uint64_t wake_up_time_ns = desired_present_time_ns - ft->comp_time_ns;
|
||||
uint64_t present_slop_ns = U_TIME_HALF_MS_IN_NS;
|
||||
uint64_t predicted_display_period_ns = ft->frame_period_ns;
|
||||
uint64_t min_display_period_ns = ft->frame_period_ns;
|
||||
|
@ -194,7 +194,7 @@ u_pc_fake_create(uint64_t estimated_frame_period_ns, uint64_t now_ns, struct u_p
|
|||
ft->present_offset_ns = U_TIME_1MS_IN_NS * 4;
|
||||
|
||||
// 20% of the frame time.
|
||||
ft->app_time_ns = get_percent_of_time(estimated_frame_period_ns, 20);
|
||||
ft->comp_time_ns = get_percent_of_time(estimated_frame_period_ns, 20);
|
||||
|
||||
// Make the next display time be in the future.
|
||||
ft->last_display_time_ns = now_ns + U_TIME_1MS_IN_NS * 50.0;
|
||||
|
|
Loading…
Reference in a new issue