From: Pekka Paalanen <pekka.paala...@collabora.co.uk>

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.paala...@collabora.co.uk>
---
 libweston/compositor-drm.c | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/libweston/compositor-drm.c b/libweston/compositor-drm.c
index b77c1879..d7d58cc3 100644
--- a/libweston/compositor-drm.c
+++ b/libweston/compositor-drm.c
@@ -4334,10 +4334,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')
@@ -5042,6 +5038,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.
@@ -5065,6 +5076,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");
 }
 
 /**
@@ -5121,10 +5135,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;
 
-- 
2.13.6

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

Reply via email to