[PATCH weston v6 29/73] libweston: assert current_mode in weston_output_enable()

Pekka Paalanen ppaalanen at gmail.com
Fri Feb 16 14:57:14 UTC 2018


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

The functions called here, particularly
weston_output_transform_scale_init(), rely on current mode being set.
The current mode must also be found in the mode list, though we don't
explicitly check it here.

current_mode not being set is a programmer error. It could be a backend
bug, but it could also be a libweston user bug not calling a set size
function.

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

diff --git a/libweston/compositor.c b/libweston/compositor.c
index e69d8f35..4b215ec2 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -5536,6 +5536,12 @@ weston_output_enable(struct weston_output *output)
 		return -1;
 	}
 
+	if (wl_list_empty(&output->mode_list) || !output->current_mode) {
+		weston_log("Error: no video mode for output '%s'.\n",
+			   output->name);
+		return -1;
+	}
+
 	wl_list_for_each(head, &output->head_list, output_link) {
 		assert(head->make);
 		assert(head->model);
-- 
2.13.6



More information about the wayland-devel mailing list