summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-10-19 13:19:50 +0300
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-10-23 10:29:42 +0300
commit4dab58343bd6eebda5da77b165be93926d147b67 (patch)
tree306775e0f0054897f485eeda41403cad34cce69b
parentafee695adc4879d88a7d7d25d6a5e87de3986d10 (diff)
compositor-wayland: fix mode_list corruption on --sprawl
The wayland-backend with --sprawl is one way to trigger wayland_output_create_for_parent_output(), which intends to find a mode from the parent mode list and use it. Calling wayland_output_set_size() initialized an embedded struct weston_mode and inserts that into the mode list. Then the assignment output->mode = *mode; corrupts the mode_list by overwriting the link entry. This leads to an endless loop in bind_output() in compositor.c. Fix this by manually doing the setup that wayland_output_set_size() did and do not call it. As a side effect, it now relays the parent compositor's physical output size to our own clients. It no longer smashes the refresh rate either. Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Quentin Glidic <sardemff7+git@sardemff7.net> Acked-by: Daniel Stone <daniels@collabora.com>
-rw-r--r--libweston/compositor-wayland.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libweston/compositor-wayland.c b/libweston/compositor-wayland.c
index d61f08c1..c0f67e9a 100644
--- a/libweston/compositor-wayland.c
+++ b/libweston/compositor-wayland.c
@@ -1376,18 +1376,22 @@ wayland_output_create_for_parent_output(struct wayland_backend *b,
output->base.scale = 1;
output->base.transform = WL_OUTPUT_TRANSFORM_NORMAL;
- if (wayland_output_set_size(&output->base, mode->width, mode->height) < 0)
- goto out;
-
- output->mode = *mode;
output->parent.output = poutput->global;
output->base.make = poutput->physical.make;
output->base.model = poutput->physical.model;
+ output->base.mm_width = poutput->physical.width;
+ output->base.mm_height = poutput->physical.height;
wl_list_insert_list(&output->base.mode_list, &poutput->mode_list);
wl_list_init(&poutput->mode_list);
+ /* No other mode should have CURRENT already. */
+ mode->flags |= WL_OUTPUT_MODE_CURRENT;
+ output->base.current_mode = mode;
+
+ /* output->mode is unused in this path. */
+
weston_compositor_add_pending_output(&output->base, b->compositor);
return 0;