libweston: add name to weston_head
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Mon, 14 Aug 2017 11:43:13 +0000 (14:43 +0300)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 12 Apr 2018 11:26:17 +0000 (14:26 +0300)
Heads need to be named, so they can be referenced in logs and
configuration sources.

When clone mode is implemented, output and head names may differ.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Derek Foreman <derekf@osg.samsung.com>
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
libweston/compositor.h

index f5695f8..5ae35d3 100644 (file)
@@ -4424,14 +4424,18 @@ weston_head_from_resource(struct wl_resource *resource)
 /** Initialize a pre-allocated weston_head
  *
  * \param head The head to initialize.
+ * \param name The head name, e.g. the connector name or equivalent.
  *
  * The head will be safe to attach, detach and release.
  *
+ * The name is used in logs, and can be used by compositors as a configuration
+ * identifier.
+ *
  * \memberof weston_head
  * \internal
  */
 static void
-weston_head_init(struct weston_head *head)
+weston_head_init(struct weston_head *head, const char *name)
 {
        /* Add some (in)sane defaults which can be used
         * for checking if an output was properly configured
@@ -4440,6 +4444,7 @@ weston_head_init(struct weston_head *head)
 
        wl_list_init(&head->output_link);
        wl_list_init(&head->resource_list);
+       head->name = strdup(name);
 }
 
 /** Attach a head to an inactive output
@@ -4515,6 +4520,7 @@ weston_head_release(struct weston_head *head)
        free(head->make);
        free(head->model);
        free(head->serial_number);
+       free(head->name);
 }
 
 /** Store monitor make, model and serial number
@@ -5019,7 +5025,7 @@ weston_output_init(struct weston_output *output,
 
        wl_list_init(&output->head_list);
 
-       weston_head_init(&output->head);
+       weston_head_init(&output->head, name);
 
        /* Add some (in)sane defaults which can be used
         * for checking if an output was properly configured
index d606fc9..e7d96c9 100644 (file)
@@ -166,6 +166,8 @@ struct weston_head {
        char *serial_number;            /**< monitor serial */
        uint32_t subpixel;              /**< enum wl_output_subpixel */
        bool connection_internal;       /**< embedded monitor (e.g. laptop) */
+
+       char *name;                     /**< head name, e.g. connector name */
 };
 
 struct weston_output {