[RFCv3 weston 15/15] compositor: add presentation debug functions

Pekka Paalanen ppaalanen at gmail.com
Fri Mar 7 04:04:03 PST 2014


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

These are to be enabled by a developer as needed. They helped to track
down a problem, where the prediction was deemed practically perfect but
feedback was sent on the frame after, leading to incorrect feedback that
looked like all queued updates were always one frame late.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 src/compositor.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/src/compositor.c b/src/compositor.c
index 2e5e6d8..0da8d71 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1470,6 +1470,30 @@ struct weston_queued_update {
 #define NSEC_PER_SEC 1000000000
 #define ONE_PER_PICO 1000000000000
 
+static void
+debug_weston_surface_queue_process(const struct timespec *cutoff,
+				   const struct timespec *target,
+				   const struct timespec *current,
+				   struct weston_queued_update *update)
+{
+#if 0
+	struct weston_presentation_feedback *feedback;
+
+	fprintf(stderr, "cutoff %ld.%09ld, target %ld.%09ld, "
+		"current %ld.%09ld, update %ld.%09ld, feedbacks:",
+		(long)cutoff->tv_sec, (long)cutoff->tv_nsec,
+		(long)target->tv_sec, (long)target->tv_nsec,
+		current ? (long)current->tv_sec : -1,
+		current ? (long)current->tv_nsec : 0,
+		(long)update->timestamp.tv_sec,
+		(long)update->timestamp.tv_nsec);
+
+	wl_list_for_each(feedback, &update->feedback_list, link)
+		fprintf(stderr, " %d", wl_resource_get_id(feedback->resource));
+	fprintf(stderr, "\n");
+#endif
+}
+
 static int
 timespec_cmp(const struct timespec *a, const struct timespec *b)
 {
@@ -1613,6 +1637,7 @@ weston_surface_queue_process(struct weston_surface *surface,
 	 */
 
 	current = weston_timestamp_get_time(surface->presentation_time);
+	debug_weston_surface_queue_process(cutoff, target, current, update);
 	if (!current)
 		current = target;
 
@@ -2043,6 +2068,18 @@ weston_compositor_build_view_list(struct weston_compositor *compositor)
 }
 
 static void
+debug_weston_output_predict_presentation(const struct timespec *now,
+					 const struct timespec *last,
+					 int64_t inc)
+{
+#if 0
+	fprintf(stderr, "\nnow %ld.%09ld, last finish %ld.%09ld, "
+		"inc %" PRIi64 "\n", (long)now->tv_sec, (long)now->tv_nsec,
+		(long)last->tv_sec, (long)last->tv_nsec, inc);
+#endif
+}
+
+static void
 timespec_add_nsec(struct timespec *result,
 		  const struct timespec *base, int64_t ns)
 {
@@ -2086,6 +2123,8 @@ weston_output_predict_presentation(struct weston_output *output,
 
 	inc = timespec_diff_to_cycles_floor(now, &output->last_finish_time,
 					    output->current_mode->refresh);
+	debug_weston_output_predict_presentation(now, &output->last_finish_time,
+						 inc);
 
 	if (inc < -1)
 		weston_log("warning in %s: inc = %" PRIi64
-- 
1.8.3.2



More information about the wayland-devel mailing list