[PATCH weston 6/6] compositor: fix plane coords in view_accumulate_damage()

Pekka Paalanen ppaalanen at gmail.com
Wed Feb 25 05:49:01 PST 2015


From: Pekka Paalanen <pekka.paalanen at collabora.co.uk>

All things everywhere, except this one case, assume weston_plane::damage
is in global coordinates. Document it.

view_accumulate_damage() is wrong in converting damage to plane
coordinates (similar to global coordinate except translated). Fix this
by removing the unwanted translation, and use only global coordinates.

We have not seen this bug manifest in real life because we get lucky:
the origin of the primary plane is always at 0, 0. We do not use
non-primary planes, except cursor plane on DRM backend where the actual
damage coordinates are ignored.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 src/compositor.c | 6 +-----
 src/compositor.h | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 50ff373..46e3756 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -1832,14 +1832,10 @@ view_accumulate_damage(struct weston_view *view,
 
 		extents = pixman_region32_extents(&view->surface->damage);
 		view_compute_bbox(view, extents, &damage);
-		pixman_region32_translate(&damage,
-					  -view->plane->x,
-					  -view->plane->y);
 	} else {
 		pixman_region32_copy(&damage, &view->surface->damage);
 		pixman_region32_translate(&damage,
-					  view->geometry.x - view->plane->x,
-					  view->geometry.y - view->plane->y);
+					  view->geometry.x, view->geometry.y);
 	}
 
 	pixman_region32_subtract(&damage, &damage, opaque);
diff --git a/src/compositor.h b/src/compositor.h
index 57b671d..12fc617 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -555,7 +555,7 @@ struct weston_layer {
 
 struct weston_plane {
 	struct weston_compositor *compositor;
-	pixman_region32_t damage;
+	pixman_region32_t damage; /**< in global coords */
 	pixman_region32_t clip;
 	int32_t x, y;
 	struct wl_list link;
-- 
2.0.5



More information about the wayland-devel mailing list