public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t 4/4] lib/igt_edid: merge edid_ext_update_cea_checksum into edid_update_checksum
Date: Fri, 19 Jul 2019 14:38:47 +0300	[thread overview]
Message-ID: <20190719113847.32626-5-simon.ser@intel.com> (raw)
In-Reply-To: <20190719113847.32626-1-simon.ser@intel.com>

Callers no longer need to call edid_ext_update_cea_checksum on each extension
block. This makes it less error-prone to miss one block by mistake.

Signed-off-by: Simon Ser <simon.ser@intel.com>
---
 lib/igt_edid.c | 20 +++++++++++++-------
 lib/igt_edid.h |  1 -
 lib/igt_kms.c  |  3 ---
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/lib/igt_edid.c b/lib/igt_edid.c
index af31d66f3a57..dcc909bc63bb 100644
--- a/lib/igt_edid.c
+++ b/lib/igt_edid.c
@@ -296,12 +296,24 @@ static uint8_t compute_checksum(const uint8_t *buf, size_t size)
 }
 
 /**
- * edid_update_checksum: compute and update the EDID checksum
+ * edid_update_checksum: compute and update the checksums of the main EDID
+ * block and all extension blocks
  */
 void edid_update_checksum(struct edid *edid)
 {
+	size_t i;
+	struct edid_ext *ext;
+
 	edid->checksum = compute_checksum((uint8_t *) edid,
 					  sizeof(struct edid));
+
+	for (i = 0; i < edid->extensions_len; i++) {
+		ext = &edid->extensions[i];
+		if (ext->tag == EDID_EXT_CEA)
+			ext->data.cea.checksum =
+				compute_checksum((uint8_t *) ext,
+						 sizeof(struct edid_ext));
+	}
 }
 
 /**
@@ -464,9 +476,3 @@ void edid_ext_set_cea(struct edid_ext *ext, size_t data_blocks_size,
 	cea->dtd_start = 4 + data_blocks_size;
 	cea->misc = flags | num_native_dtds;
 }
-
-void edid_ext_update_cea_checksum(struct edid_ext *ext)
-{
-	ext->data.cea.checksum = compute_checksum((uint8_t *) ext,
-						  sizeof(struct edid_ext));
-}
diff --git a/lib/igt_edid.h b/lib/igt_edid.h
index d256b7896c90..59b47a977fe3 100644
--- a/lib/igt_edid.h
+++ b/lib/igt_edid.h
@@ -368,7 +368,6 @@ void detailed_timing_set_string(struct detailed_timing *dt,
 
 void cea_sad_init_pcm(struct cea_sad *sad, int channels,
 		      uint8_t sampling_rates, uint8_t sample_sizes);
-void edid_ext_update_cea_checksum(struct edid_ext *ext);
 const struct cea_vsdb *cea_vsdb_get_hdmi_default(size_t *size);
 size_t edid_cea_data_block_set_sad(struct edid_cea_data_block *block,
 				   const struct cea_sad *sads, size_t sads_len);
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index e66f5af2083c..9dcf0ebd6416 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -205,7 +205,6 @@ generate_audio_edid(unsigned char raw_edid[static AUDIO_EDID_SIZE],
 	edid_ext_set_cea(edid_ext, cea_data_size, 0, EDID_CEA_BASIC_AUDIO);
 
 	edid_update_checksum(edid);
-	edid_ext_update_cea_checksum(edid_ext);
 
 	return edid;
 }
@@ -314,7 +313,6 @@ const struct edid *igt_kms_get_4k_edid(void)
 	edid_ext_set_cea(edid_ext, cea_data_size, 0, 0);
 
 	edid_update_checksum(edid);
-	edid_ext_update_cea_checksum(edid_ext);
 
 	return edid;
 }
@@ -366,7 +364,6 @@ const struct edid *igt_kms_get_3d_edid(void)
 	edid_ext_set_cea(edid_ext, cea_data_size, 0, 0);
 
 	edid_update_checksum(edid);
-	edid_ext_update_cea_checksum(edid_ext);
 
 	return edid;
 }
-- 
2.22.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  parent reply	other threads:[~2019-07-19 11:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 11:38 [igt-dev] [PATCH i-g-t 0/4] lib/igt_edid: misc quality-of-life improvements Simon Ser
2019-07-19 11:38 ` [igt-dev] [PATCH i-g-t 1/4] lib/igt_kms: use struct edid instead of unsigned char Simon Ser
2019-07-19 11:38 ` [igt-dev] [PATCH i-g-t 2/4] lib/igt_kms: drop EDID_LENGTH, replace with EDID_BLOCK_SIZE Simon Ser
2019-07-19 11:38 ` [igt-dev] [PATCH i-g-t 3/4] lib/igt_edid: make HDMI VSDB data array unsigned Simon Ser
2019-07-19 11:38 ` Simon Ser [this message]
2019-07-19 12:11 ` [igt-dev] ✗ Fi.CI.BAT: failure for lib/igt_edid: misc quality-of-life improvements Patchwork
2019-07-19 12:13   ` Ser, Simon
2019-07-19 13:49     ` Martin Peres
2019-07-19 14:26 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2019-07-19 17:11 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2019-08-15  8:25 ` [igt-dev] [PATCH i-g-t 0/4] " Arkadiusz Hiler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190719113847.32626-5-simon.ser@intel.com \
    --to=simon.ser@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox