[PATCH weston 10/10] compositor-wayland: fix shm_buffer damage init

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


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

It appears that wayland_shm_buffer::damage is in the global coordinate
space. Therefore initializing it to width x height at 0,0 is not correct
for any output not positioned at 0,0. That is, all outputs after the
first one get it wrong.

Initialize it from the output region, which is in the global coordinate
space.

While at it, add a comment to note that damage is in global coordinate
space. As I can see, this was the last confusion about it.

Signed-off-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 libweston/compositor-wayland.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
index eacf385d..a0d0e62a 100644
--- a/libweston/compositor-wayland.c
+++ b/libweston/compositor-wayland.c
@@ -168,7 +168,7 @@ struct wayland_shm_buffer {
 	struct wl_buffer *buffer;
 	void *data;
 	size_t size;
-	pixman_region32_t damage;
+	pixman_region32_t damage;		/**< in global coords */
 	int frame_damaged;
 
 	pixman_image_t *pm_image;
@@ -311,8 +311,8 @@ wayland_output_get_shm_buffer(struct wayland_output *output)
 	wl_list_init(&sb->free_link);
 	wl_list_insert(&output->shm.buffers, &sb->link);
 
-	pixman_region32_init_rect(&sb->damage, 0, 0,
-				  output->base.width, output->base.height);
+	pixman_region32_init(&sb->damage);
+	pixman_region32_copy(&sb->damage, &output->base.region);
 	sb->frame_damaged = 1;
 
 	sb->data = data;
-- 
2.13.6



More information about the wayland-devel mailing list