[PATCH] compositor-drm: Fix output still scanout framebuffer after the scanout client was interrupted.

Kristian Hoegsberg hoegsberg at gmail.com
Wed Feb 22 10:35:08 PST 2012


On Fri, Feb 17, 2012 at 11:57:58AM +0800, zhiwen.wu at linux.intel.com wrote:
> From: Alex Wu <zhiwen.wu at intel.com>
> 
>         If the scanout client was interrupted (e.g. by Ctrl-C), compositor-drm.c::page_flip_handler()
>         was not guaranteed to be invoked for the last scanout drmModePageFlip(), so that pending_fs_surf_fb_id
>         has no chance to reset to 0, and the output will still scanout the old framebuffer with pending_fs_surf_fb_id.

Ah yup, I see what could go wrong here.  I think a more logic fix is to
just change:

        if (output->pending_fs_surf_fb_id != 0) {

in drm_output_repaint() to

        if (output->pending_scanout_surface) {

since that's really what indicates whether the other fields are valid
or not.  Does that work for your case?

Kristian

> ---
>  src/compositor-drm.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/src/compositor-drm.c b/src/compositor-drm.c
> index de6feb4..d5a8d28 100644
> --- a/src/compositor-drm.c
> +++ b/src/compositor-drm.c
> @@ -159,7 +159,10 @@ drm_output_repaint(struct weston_output *output_base)
>  	if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
>  		return;
>  
> -	drm_output_prepare_scanout_surface(output);
> +	if (drm_output_prepare_scanout_surface(output)) {
> +		if (output->pending_fs_surf_fb_id != 0)
> +			output->pending_fs_surf_fb_id = 0;
> +	}
>  
>  	wl_list_for_each_reverse(surface, &compositor->base.surface_list, link)
>  		weston_surface_draw(surface, &output->base);
> -- 
> 1.7.5.4
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list