[PATCH weston v3 26/36] libweston: stop auto-adding the implicit head

Pekka Paalanen ppaalanen at gmail.com
Tue Oct 31 11:48:36 UTC 2017


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

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 <pekka.paalanen at collabora.co.uk>
---
 libweston/compositor.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/libweston/compositor.c b/libweston/compositor.c
index 7d6cd3ed..3a2930e2 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -5407,7 +5407,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.
@@ -5443,7 +5443,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",
@@ -5451,6 +5450,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);
 
@@ -5479,12 +5484,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)
-- 
2.13.6



More information about the wayland-devel mailing list