libweston: stop auto-adding the implicit head
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 23 Aug 2017 13:00:21 +0000 (16:00 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Tue, 17 Apr 2018 12:19:57 +0000 (15:19 +0300)
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@collabora.co.uk>
Reviewed-by: Ian Ray <ian.ray@ge.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
libweston/compositor.c

index d013273..0efd570 100644 (file)
@@ -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)