···2027202720282028 // Save for timestamps below.
20292029 uint64_t frame_id = c->frame.rendering.id;
20302030+ uint64_t desired_present_time_ns = c->frame.rendering.desired_present_time_ns;
2030203120312032 // Clear the rendered frame.
20322033 comp_frame_clear_locked(&c->frame.rendering);
···20762077 * Only do this if we are ready.
20772078 */
20782079 if (comp_target_check_ready(r->c->target)) {
20802080+ // For estimating frame misses.
20812081+ uint64_t then_ns = os_monotonic_get_ns();
20822082+20832083+ // Do the acquire
20792084 renderer_acquire_swapchain_image(r);
20852085+20862086+ // How long did it take?
20872087+ uint64_t now_ns = os_monotonic_get_ns();
20882088+20892089+ /*
20902090+ * Make sure we at least waited 1ms before warning. Then check
20912091+ * if we are more then 1ms behind when we wanted to present.
20922092+ */
20932093+ if (then_ns + U_TIME_1MS_IN_NS < now_ns && //
20942094+ desired_present_time_ns + U_TIME_1MS_IN_NS < now_ns) {
20952095+ uint64_t diff_ns = now_ns - desired_present_time_ns;
20962096+ double diff_ms_f = time_ns_to_ms_f(diff_ns);
20972097+ COMP_WARN(c, "Compositor probably missed frame by %.2fms", diff_ms_f);
20982098+ }
20802099 }
2081210020822101 comp_target_update_timings(ct);