compositor-drm: unify head status logging
authorPekka Paalanen <pekka.paalanen@collabora.co.uk>
Thu, 9 Nov 2017 13:10:11 +0000 (15:10 +0200)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Wed, 18 Apr 2018 09:00:52 +0000 (12:00 +0300)
Previously the log contained one line for EDID data and another line for
the head, and you just had to know they belong together. Make it more
obvious to read by putting both head and EDID info on the same line.

We no longer print EDID data every time it is parsed (on every hotplug
event), but only if it changes. I did take a shortcut here and use
weston_head::device_changed as the print condition which relies on the
compositor clearing it, but a failure to do so just means we print stuff
even if it didn't change.

Head info updates also print the head info and not just the EDID data.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Acked-by: Derek Foreman <derekf@osg.samsung.com>
libweston/compositor-drm.c

index 9aaf903..750f458 100644 (file)
@@ -4316,10 +4316,6 @@ find_and_parse_output_edid(struct drm_head *head,
                        edid_blob->data,
                        edid_blob->length);
        if (!rc) {
-               weston_log("EDID data '%s', '%s', '%s'\n",
-                          head->edid.pnp_id,
-                          head->edid.monitor_name,
-                          head->edid.serial_number);
                if (head->edid.pnp_id[0] != '\0')
                        *make = head->edid.pnp_id;
                if (head->edid.monitor_name[0] != '\0')
@@ -5024,6 +5020,21 @@ drm_head_assign_connector_info(struct drm_head *head,
        return 0;
 }
 
+static void
+drm_head_log_info(struct drm_head *head, const char *msg)
+{
+       if (head->base.connected) {
+               weston_log("DRM: head '%s' %s, connector %d is connected, "
+                          "EDID make '%s', model '%s', serial '%s'\n",
+                          head->base.name, msg, head->connector_id,
+                          head->base.make, head->base.model,
+                          head->base.serial_number ?: "");
+       } else {
+               weston_log("DRM: head '%s' %s, connector %d is disconnected.\n",
+                          head->base.name, msg, head->connector_id);
+       }
+}
+
 /** Update connector and monitor information
  *
  * @param head The head to update.
@@ -5047,6 +5058,9 @@ drm_head_update_info(struct drm_head *head)
 
        if (drm_head_assign_connector_info(head, connector) < 0)
                drmModeFreeConnector(connector);
+
+       if (head->base.device_changed)
+               drm_head_log_info(head, "updated");
 }
 
 /**
@@ -5103,10 +5117,7 @@ drm_head_create(struct drm_backend *backend, uint32_t connector_id,
        }
 
        weston_compositor_add_head(backend->compositor, &head->base);
-
-       weston_log("DRM: found head '%s', connector %d %s.\n",
-                  head->base.name, head->connector_id,
-                  head->base.connected ? "connected" : "disconnected");
+       drm_head_log_info(head, "found");
 
        return head;