[PATCH] compositor: Don't use empty bounding boxes for output assigninment

Kristian Høgsberg hoegsberg at gmail.com
Wed Sep 12 13:25:11 PDT 2012

On Tue, Sep 11, 2012 at 05:37:29PM +0300, Ander Conselvan de Oliveira wrote:
> From: Ander Conselvan de Oliveira <ander.conselvan.de.oliveira at intel.com>
> When weston_surface_assign_output() is called for an unmap'd surface,
> its bounding box is empty causing no output to be assigned. This later
> causes calls to weston_surface_schedule_repaint() to schedule no
> repaint at all. This is the cause of surfaces not being shown on the
> screen until a some input event or other drawing causes a repaint.
> This patch fix this by forcing an update of the bouding box if it is
> empty. Although doing this can cause problems if the surface is
> already mapped on the screen, for the particular case it should be safe
> as described in the comment in the code.

I've wanted to make weston_surface_assign_output() more of an internal
thing to the repaint process.  I'd like to see all uses of
weston_surface_assign_output() go away and just happen automatically
when we repaint, much like how the transformation and bounding box are
derived state.  They're still in shell.c because for most surfaces we
need to know which ouput it starts out on so we can schedule the
zoom/fade animation there.

What I'd like to do instead is just call
weston_surface_update_transform() where we now call
weston_surface_assign_output() in shell.c.  That will flush the
transform, bounding box state etc and then assign output correctly.
We also avoid having assign_ouput call update_transform as well as the
other way around.


> ---
>  src/compositor.c |   13 +++++++++++++
>  1 file changed, 13 insertions(+)
> diff --git a/src/compositor.c b/src/compositor.c
> index 911eaba..840a2a9 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -1109,6 +1109,19 @@ weston_surface_assign_output(struct weston_surface *es)
>  	uint32_t max, area, mask;
>  	pixman_box32_t *e;
> +	/* Update the surface's bounding box if it is empty to make sure
> +	 * we end up with a surface assigned. This is done only on the
> +	 * empty case though so that weston_surface_damage_below() isn't
> +	 * broken. Some places expect the bouding box to be the old
> +	 * surface position and updating it here could cause portions of
> +	 * the output to not be damaged correctly. For the empty case,
> +	 * however, this is not a problem since damaging below an empty
> +	 * surface would result in no damage. Damaging below the surface
> +	 * after the update will not produce any artifacts, although it
> +	 * may result in some extra drawing. */
> +	if (!pixman_region32_not_empty(&es->transform.boundingbox))
> +		weston_surface_update_transform(es);
> +
>  	new_output = NULL;
>  	max = 0;
>  	mask = 0;
> -- 
> _______________________________________________
> 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