[PATCH weston] compositor: Assign new views to the primary plane

Daniel Stone daniels at collabora.com
Fri Dec 9 16:35:21 UTC 2016


When we create a new view, assign it to the primary plane from the
beginning.

This made no difference before, since the next surface repaint would
forcibly assign all views to a plane, either through DRM's
assign_planes() hook, or the fallback inside core repaint.

However, this is undesirable for DRM. In a multi-output situation,
we would see a view only visible on another output, reasonably decide we
didn't want it in a plane on our output, and move it to the primary
plane, causing damage, and an output repaint. The plane wouldn't be
assigned until the other output ran through repaint.

For large SHM buffers (weston_surface->keep_buffer as false), this means
that the other output would assign it to a plane later, which caused
weston_surface_damage to be called - in the exact way the comment says
it shouldn't - which triggered a flush and buffer upload. By this stage,
the buffer content would be gone and we would upload garbage.

Avoid this problem for now by assigning the view to the primary plane on
creation, thus short-circuiting weston_view_move_to_plane when we do
call it during output repaint. This is arguably the right thing to do if
definitely the wrong way to fix it, but the atomic series is long enough
for now.

Signed-off-by: Daniel Stone <daniels at collabora.com>
Cc: Pekka Paalanen <pekka.paalanen at collabora.co.uk>
---
 libweston/compositor.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libweston/compositor.c b/libweston/compositor.c
index 6a69394..895a040 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -269,6 +269,7 @@ weston_view_create(struct weston_surface *surface)
 		return NULL;
 
 	view->surface = surface;
+	view->plane = &surface->compositor->primary_plane;
 
 	/* Assign to surface */
 	wl_list_insert(&surface->views, &view->surface_link);
-- 
2.9.3



More information about the wayland-devel mailing list