[PATCH weston v2 10/11] [RFC] Account for very large repaint window misses

Pekka Paalanen ppaalanen at gmail.com
Wed Mar 29 12:11:32 UTC 2017


On Wed,  1 Mar 2017 11:34:09 +0000
Daniel Stone <daniels at collabora.com> wrote:

> At the bottom of weston_output_finish_frame(), code exists to account
> for flips which have missed the repaint window, by shifting them to lock
> on to the next repaint window rather than repainting immediately.
> 
> This code only accounted for flips which missed their target by one
> repaint window. If they miss by multiples of the repaint window, adjust
> them until the next repaint timestamp is in the future.
> 
> I was unable to find from discussion of the original development whether
> or not this is desirable; I can see an argument both ways. Hence, RFC
> tag.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Cc: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
> Cc: Mario Kleiner <mario.kleiner.de at gmail.com>
> ---
>  libweston/compositor.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> v2: New in this revision. Unsure if necessary or not.
> 
> diff --git a/libweston/compositor.c b/libweston/compositor.c
> index a64e695..511f85a 100644
> --- a/libweston/compositor.c
> +++ b/libweston/compositor.c
> @@ -2485,9 +2485,14 @@ weston_output_finish_frame(struct weston_output *output,
>  	 * the deadline given by repaint_msec? In that case we delay until
>  	 * the deadline of the next frame, to give clients a more predictable
>  	 * timing of the repaint cycle to lock on. */
> -	if (presented_flags == WP_PRESENTATION_FEEDBACK_INVALID && msec_rel < 0)
> -		timespec_add_nsec(&output->next_repaint, &output->next_repaint,
> -				  refresh_nsec);
> +	if (presented_flags == WP_PRESENTATION_FEEDBACK_INVALID &&
> +	    msec_rel < 0) {
> +		while (timespec_sub_to_nsec(&output->next_repaint, &now) < 0) {
> +			timespec_add_nsec(&output->next_repaint,
> +					  &output->next_repaint,
> +					  refresh_nsec);
> +		}
> +	}
>  
>  out:
>  	output->repaint_status = REPAINT_SCHEDULED;

Hi,

after the long discussions and input from Mario, this patch gets:
Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

I agree that keeping the while-loop is better for readability.

You could add in the commit message that the loop will spin more than
once only in extreme cases where performance is already forfeit or
something like that. It cannot spin more than once under any normal
conditions.


Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170329/80e1f9c5/attachment.sig>


More information about the wayland-devel mailing list