summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Ã…dahl <jadahl@gmail.com>2021-10-26 11:27:56 +0200
committerMarge Bot <marge-bot@gnome.org>2022-09-01 14:31:40 +0000
commit8446cd9f4f53550ab0fbd38b0ba3eea4ef6bf653 (patch)
tree0b089a73cd66578276e4252db8805ebd7076363c
parent15bbded86b70f86682f4cdc324199344885e4b94 (diff)
downloadmutter-8446cd9f4f53550ab0fbd38b0ba3eea4ef6bf653.tar.gz
monitor: Add getter for EDID MD5 checksum
Will be used for colord device matching. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
-rw-r--r--src/backends/meta-monitor.c9
-rw-r--r--src/backends/meta-monitor.h2
-rw-r--r--src/backends/meta-output.c8
-rw-r--r--src/backends/meta-output.h3
4 files changed, 21 insertions, 1 deletions
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 3ad02ee3a..e002f9d93 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -473,6 +473,15 @@ meta_monitor_get_serial (MetaMonitor *monitor)
return output_info->serial;
}
+const char *
+meta_monitor_get_edid_checksum_md5 (MetaMonitor *monitor)
+{
+ const MetaOutputInfo *output_info =
+ meta_monitor_get_main_output_info (monitor);
+
+ return output_info->edid_checksum_md5;
+}
+
MetaConnectorType
meta_monitor_get_connector_type (MetaMonitor *monitor)
{
diff --git a/src/backends/meta-monitor.h b/src/backends/meta-monitor.h
index 4d61f1d4b..b24eaabfb 100644
--- a/src/backends/meta-monitor.h
+++ b/src/backends/meta-monitor.h
@@ -155,6 +155,8 @@ const char * meta_monitor_get_product (MetaMonitor *monitor);
META_EXPORT_TEST
const char * meta_monitor_get_serial (MetaMonitor *monitor);
+const char * meta_monitor_get_edid_checksum_md5 (MetaMonitor *monitor);
+
META_EXPORT_TEST
MetaConnectorType meta_monitor_get_connector_type (MetaMonitor *monitor);
diff --git a/src/backends/meta-output.c b/src/backends/meta-output.c
index a02feca90..551be67e8 100644
--- a/src/backends/meta-output.c
+++ b/src/backends/meta-output.c
@@ -94,6 +94,7 @@ meta_output_info_unref (MetaOutputInfo *output_info)
g_free (output_info->vendor);
g_free (output_info->product);
g_free (output_info->serial);
+ g_free (output_info->edid_checksum_md5);
g_free (output_info->modes);
g_free (output_info->possible_crtcs);
g_free (output_info->possible_clones);
@@ -310,11 +311,16 @@ meta_output_info_parse_edid (MetaOutputInfo *output_info,
{
MetaEdidInfo *parsed_edid;
size_t len;
+ gconstpointer data;
if (!edid)
goto out;
- parsed_edid = meta_edid_info_new_parse (g_bytes_get_data (edid, &len));
+ data = g_bytes_get_data (edid, &len);
+ parsed_edid = meta_edid_info_new_parse (data);
+
+ output_info->edid_checksum_md5 = g_compute_checksum_for_data (G_CHECKSUM_MD5,
+ data, len);
if (parsed_edid)
{
diff --git a/src/backends/meta-output.h b/src/backends/meta-output.h
index 9970a7a45..02ec0fa09 100644
--- a/src/backends/meta-output.h
+++ b/src/backends/meta-output.h
@@ -84,6 +84,9 @@ typedef struct _MetaOutputInfo
char *vendor;
char *product;
char *serial;
+
+ char *edid_checksum_md5;
+
int width_mm;
int height_mm;
CoglSubpixelOrder subpixel_order;