[igt-dev] [PATCH i-g-t 4/4] lib/igt_edid: merge edid_ext_update_cea_checksum into edid_update_checksum
Simon Ser
simon.ser at intel.com
Fri Jul 19 11:38:47 UTC 2019
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 at 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
More information about the igt-dev
mailing list