compositor: warn about insane repaint delay
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 19 Mar 2015 10:27:29 +0000 (12:27 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 20 Mar 2015 10:19:33 +0000 (12:19 +0200)
Make the sanity check more explicit and log a warning if it happens.

Small negative values are ok because it just means the compositor is
lagging behind, or more likely the user specified a too long repaint
window.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-By: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
src/compositor.c

index 3f6aa7d627b4430debdd53e96c358ed73332b72a..be2309a3a65754f64e260ca720b2c1e24d561aa4 100644 (file)
@@ -2412,8 +2412,18 @@ weston_output_finish_frame(struct weston_output *output,
        msec = (refresh_nsec - timespec_to_nsec(&gone)) / 1000000; /* floor */
        msec -= compositor->repaint_msec;
 
-       /* Also sanity check. */
-       if (msec < 1 || msec > 1000)
+       if (msec < -1000 || msec > 1000) {
+               static bool warned;
+
+               if (!warned)
+                       weston_log("Warning: computed repaint delay is "
+                                  "insane: %d msec\n", msec);
+               warned = true;
+
+               msec = 0;
+       }
+
+       if (msec < 1)
                output_repaint_timer_handler(output);
        else
                wl_event_source_timer_update(output->repaint_timer, msec);