[PATCH 1/4] compositor: When redrawing, don't clip opaque regions from other planes

Kristian Høgsberg hoegsberg at gmail.com
Thu Aug 9 12:05:55 PDT 2012

On Thu, Aug 09, 2012 at 04:44:58PM +0300, Ander Conselvan de Oliveira wrote:
> When accumulating damage in the repaint loop, the opaque region of
> surfaces in other planes is added to the overall opaque region. This
> causes surface->clip to contain the areas obscured by surfaces in
> other planes. Change it to contain only the opaque region of surfaces
> in the primary plane
> This fixes a bug where moving a window that was just moved from the
> primary plane to another would leave artifacts on the screen. The
> problem was that the damage generated by weston_surface_move_to_plane()
> would be clipped on weston_surface_redraw(), leaving the contets below
> it unchanged. Moving the overlaid surface would no longer generate
> damage on the primary plane, so the contents would remain unchanged
> (i.e. wrong) indefinitely.

I applied this for now, but there are other ways to fix this.  With
this patch, we no longer cull repaints below opaqeue surface when we
move them to their own plane.

What I was thinking is that we could change the repainting to only
clear damage that we actually repaint, as opposed to subtracting the
entire output region.  That way the damage stays around in the primary
plane when we move a surface to it's own plane, and when/if we move
the opaque surface, that damage will become visible and get repainted.


> ---
>  src/compositor.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> diff --git a/src/compositor.c b/src/compositor.c
> index a3273dc..6a22f1c 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -1120,7 +1120,8 @@ surface_accumulate_damage(struct weston_surface *surface,
>  			      &surface->plane->damage, &surface->damage);
>  	empty_region(&surface->damage);
>  	pixman_region32_copy(&surface->clip, opaque);
> -	pixman_region32_union(opaque, opaque, &surface->transform.opaque);
> +	if (surface->plane == &surface->compositor->primary_plane)
> +		pixman_region32_union(opaque, opaque, &surface->transform.opaque);
>  }
>  static void
> -- 
> _______________________________________________
> 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