[PATCH 5/7] compositor-drm: Gracefully handle vblank and flip invalid timestamps

Daniel Stone daniel at fooishbar.org
Tue Mar 22 08:47:12 UTC 2016


Hi Miguel,

On 21 March 2016 at 16:37, Miguel A. Vico <mvicomoya at nvidia.com> wrote:
> Instant query for vblank timestamp may always fail, resulting in
> never scheduling a full repaint in drm_output_start_repaint_loop().
>
> Additionally, timestamp provided in page_flip_handler() may also be
> invalid.
>
> [...]
>
> @@ -869,6 +878,15 @@ page_flip_handler(int fd, unsigned int frame,
>         else if (!output->vblank_pending) {
>                 ts.tv_sec = sec;
>                 ts.tv_nsec = usec * 1000;
> +
> +               /* Zero timestamp means failure to get valid timestamp, so immediately
> +                * finish frame */
> +               if (ts.tv_sec == 0 && ts.tv_nsec == 0) {
> +                       weston_compositor_read_presentation_clock(output->base.compositor,
> +                                                                 &ts);
> +                       flags = WP_PRESENTATION_FEEDBACK_INVALID;
> +               }
> +
>                 weston_output_finish_frame(&output->base, &ts, flags);
>
>                 /* We can't call this from frame_notify, because the output's

This is odd. Instant queries failing is fine, but in which
circumstances can you fail to return a valid timestamp in a pageflip
event ... ? I don't know of any other kernel driver which does this -
at the very least, if you don't have a hardware timestamp, then you
log the time in your kernel driver which handles the hardware event
(e.g. softirq handler), and use that instead.

Cheers,
Daniel


More information about the wayland-devel mailing list