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

Ander Conselvan de Oliveira conselvan2 at gmail.com
Tue Sep 11 07:37:29 PDT 2012


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.
---
 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;
-- 
1.7.9.5



More information about the wayland-devel mailing list