compositor-wayland: fix mode_list corruption on --sprawl
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 19 Oct 2017 10:19:50 +0000 (13:19 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 23 Oct 2017 07:29:42 +0000 (10:29 +0300)
commit4dab58343bd6eebda5da77b165be93926d147b67
tree306775e0f0054897f485eeda41403cad34cce69b
parentafee695adc4879d88a7d7d25d6a5e87de3986d10
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>
libweston/compositor-wayland.c