[PATCH weston v10 14/61] compositor-drm: Turn vblank_pending from bool to refcount

Pekka Paalanen ppaalanen at gmail.com
Fri Apr 7 13:43:39 UTC 2017


On Tue,  4 Apr 2017 17:54:32 +0100
Daniel Stone <daniels at collabora.com> wrote:

> vblank_pending is currently a bool, which is reset on every vblank
> requests (i.e. sprite pageflip). This can occur more than once per
> frame, so turn it into a callback, so we only fire frame-done when we've
> collected all the events.
> 
> This fixes unexpected behaviour when multiple views per output have been
> promoted to DRM planes.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> 
> Differential Revision: https://phabricator.freedesktop.org/D1418
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> ---
>  libweston/compositor-drm.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
> index 7004ef9a..21415775 100644
> --- a/libweston/compositor-drm.c
> +++ b/libweston/compositor-drm.c
> @@ -937,7 +937,7 @@ drm_output_repaint(struct weston_output *output_base,
>  		s->fb_last = s->fb_current;
>  		s->fb_current = s->fb_pending;
>  		s->fb_pending = NULL;
> -		output->vblank_pending = 1;
> +		output->vblank_pending++;
>  	}
>  
>  	return 0;
> @@ -1048,13 +1048,14 @@ vblank_handler(int fd, unsigned int frame, unsigned int sec, unsigned int usec,
>  			 WP_PRESENTATION_FEEDBACK_KIND_HW_CLOCK;
>  
>  	drm_output_update_msc(output, frame);
> -	output->vblank_pending = 0;
> +	output->vblank_pending--;
> +	assert(output->vblank_pending >= 0);
>  
>  	assert(s->fb_last || s->fb_current);
>  	drm_fb_unref(s->fb_last);
>  	s->fb_last = NULL;
>  
> -	if (!output->page_flip_pending) {
> +	if (!output->page_flip_pending && !output->vblank_pending) {
>  		/* Stop the pageflip timer instead of rearming it here */
>  		if (output->pageflip_timer)
>  			wl_event_source_timer_update(output->pageflip_timer, 0);

Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


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/20170407/302a52a1/attachment-0001.sig>


More information about the wayland-devel mailing list