kms/impl-device: Allow the expected presentation time to be unknown

It is not trivial to accurately estimate the expected presentation
time with variable refresh rate, and not doing so only affects debug
prints.

No change in behavior for now because the expected presentation time
is always calculated. A following commit will introduce a case where
it is not.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1154>
This commit is contained in:
Dor Askayo 2024-02-02 22:40:44 +02:00 committed by Marge Bot
parent 4ad282cf26
commit 2a3fc9b830

View File

@ -72,6 +72,7 @@ typedef struct _CrtcDeadline
gboolean armed; gboolean armed;
gboolean is_deadline_page_flip; gboolean is_deadline_page_flip;
int64_t expected_presentation_time_us; int64_t expected_presentation_time_us;
gboolean has_expected_presentation_time;
} deadline; } deadline;
} CrtcFrame; } CrtcFrame;
@ -1138,6 +1139,7 @@ arm_crtc_frame_deadline_timer (CrtcFrame *crtc_frame,
TFD_TIMER_ABSTIME, &its, NULL); TFD_TIMER_ABSTIME, &its, NULL);
crtc_frame->deadline.expected_presentation_time_us = next_presentation_us; crtc_frame->deadline.expected_presentation_time_us = next_presentation_us;
crtc_frame->deadline.has_expected_presentation_time = next_presentation_us != 0;
crtc_frame->deadline.armed = TRUE; crtc_frame->deadline.armed = TRUE;
} }
@ -1179,14 +1181,23 @@ crtc_page_flip_feedback_flipped (MetaKmsCrtc *crtc,
}; };
presentation_time_us = meta_timeval_to_microseconds (&page_flip_timeval); presentation_time_us = meta_timeval_to_microseconds (&page_flip_timeval);
meta_topic (META_DEBUG_KMS, if (crtc_frame->deadline.has_expected_presentation_time)
"Deadline page flip presentation time: %"G_GINT64_FORMAT" us, " {
"expected %"G_GINT64_FORMAT" us " meta_topic (META_DEBUG_KMS,
"(diff: %"G_GINT64_FORMAT")", "Deadline page flip presentation time: %" G_GINT64_FORMAT " us, "
presentation_time_us, "expected %" G_GINT64_FORMAT " us "
crtc_frame->deadline.expected_presentation_time_us, "(diff: %" G_GINT64_FORMAT ")",
crtc_frame->deadline.expected_presentation_time_us - presentation_time_us,
presentation_time_us); crtc_frame->deadline.expected_presentation_time_us,
crtc_frame->deadline.expected_presentation_time_us -
presentation_time_us);
}
else
{
meta_topic (META_DEBUG_KMS,
"Deadline page flip presentation time: %" G_GINT64_FORMAT " us",
presentation_time_us);
}
} }
notify_crtc_frame_ready (crtc_frame); notify_crtc_frame_ready (crtc_frame);