[PATCH weston 09/10] compositor-wayland: fix damage coordinates with pixman renderer

Pekka Paalanen ppaalanen at gmail.com
Tue Oct 24 10:16:06 UTC 2017

From: Armin Krezović <krezovic.armin at gmail.com>

Damage coordinates are in global coordinate space, and they need to
be translated to local coordinate space so multiple outputs can work.

This path now matches the similar path in the X11 backend.

This patch fixes the appearance of multiple windows in the parent
compositor. Previously, all windows except the one with nested output
position 0,0 would have their damage for the parent wl_surface always
fall outside of the wl_surface, save the decorations which were handled
separately. If the parent compositor was Weston/GL, this would lead to
the output area remaining black as partial GL texture uploads would
practically never update the texture. If the parent compositor was
Weston/pixman, the parent windows would not update on screen unless
something else caused the area to be repainted.

[Pekka: adjusted commit message]
Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
 libweston/compositor-wayland.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
index bc78cbdb..eacf385d 100644
--- a/libweston/compositor-wayland.c
+++ b/libweston/compositor-wayland.c
@@ -558,11 +558,15 @@ wayland_shm_buffer_attach(struct wayland_shm_buffer *sb)
 	int i, n;
+	pixman_region32_copy(&damage, &sb->damage);
+	pixman_region32_translate(&damage, -sb->output->base.x,
+				  -sb->output->base.y);
-				  &sb->damage, &damage);
+				  &damage, &damage);
 	if (sb->output->frame) {
 		frame_interior(sb->output->frame, &ix, &iy, &iwidth, &iheight);

More information about the wayland-devel mailing list