[PATCH weston v6 27/73] libweston: stop auto-adding the implicit head

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


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 2a2ec845..59b7fe24 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -5486,7 +5486,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.
@@ -5522,7 +5522,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",
@@ -5530,6 +5529,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);
 
@@ -5558,12 +5563,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