From ddce54de3aab242f746c44bd4c09d6e04e987d06 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Wed, 23 Aug 2017 16:00:21 +0300 Subject: [PATCH] libweston: stop auto-adding the implicit head All frontends have been converted to the new head-based output management API, which means that weston_compositor_create_output_with_head() is calling weston_output_attach_head(). We will never hit the implicit attach anymore. Therefore we can now require that an output has at least one head when calling weston_output_enable(). An output without heads is useless. The auto-add code is removed as dead. Signed-off-by: Pekka Paalanen Reviewed-by: Ian Ray Reviewed-by: Daniel Stone Acked-by: Derek Foreman --- libweston/compositor.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libweston/compositor.c b/libweston/compositor.c index d013273c..0efd5707 100644 --- a/libweston/compositor.c +++ b/libweston/compositor.c @@ -5489,7 +5489,7 @@ weston_compositor_add_pending_output(struct weston_output *output, /** Constructs a weston_output object that can be used by the compositor. * * \param output The weston_output object that needs to be enabled. Must not - * be enabled already. + * be enabled already. Must have at least one head attached. * * Output coordinates are calculated and each new output is by default * assigned to the right of previous one. @@ -5525,7 +5525,6 @@ weston_output_enable(struct weston_output *output) struct weston_compositor *c = output->compositor; struct weston_output *iterator; int x = 0, y = 0; - int ret; if (output->enabled) { weston_log("Error: attempt to enable an enabled output '%s'\n", @@ -5533,6 +5532,12 @@ weston_output_enable(struct weston_output *output) return -1; } + if (wl_list_empty(&output->head_list)) { + weston_log("Error: cannot enable output '%s' without heads.\n", + output->name); + return -1; + } + iterator = container_of(c->output_list.prev, struct weston_output, link); @@ -5561,12 +5566,6 @@ weston_output_enable(struct weston_output *output) wl_list_init(&output->animation_list); wl_list_init(&output->feedback_list); - /* XXX: Temporary until all backends are converted. */ - if (wl_list_empty(&output->head_list)) { - ret = weston_output_attach_head(output, &output->head); - assert(ret == 0); - } - /* Enable the output (set up the crtc or create a * window representing the output, set up the * renderer, etc)