From: Pekka Paalanen <pekka.paala...@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.paala...@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 a8df7e94..11b9bc4d 100644
--- a/libweston/compositor.c
+++ b/libweston/compositor.c
@@ -5427,7 +5427,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.
@@ -5463,7 +5463,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",
@@ -5471,6 +5470,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);
 
@@ -5499,12 +5504,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

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to