aboutsummaryrefslogtreecommitdiff
path: root/hw/display
diff options
context:
space:
mode:
authorKonstantin Nazarov <mail@knazarov.com>2021-04-27 17:08:23 +0200
committerGerd Hoffmann <kraxel@redhat.com>2021-05-10 11:41:02 +0200
commit5a4e88cf3b64c4a5c92e43a90260c34a6a52d011 (patch)
treebd91e8450f1d3e71994146707dcc3a2193b53546 /hw/display
parent850dc61f5fd320a8d566b7da9365fd723511b7c3 (diff)
downloadqemu-5a4e88cf3b64c4a5c92e43a90260c34a6a52d011.zip
qemu-5a4e88cf3b64c4a5c92e43a90260c34a6a52d011.tar.gz
qemu-5a4e88cf3b64c4a5c92e43a90260c34a6a52d011.tar.bz2
edid: allow arbitrary-length checksums
Some of the EDID extensions like DisplayID do checksums of their subsections. Currently checksums can be only applied to the whole extension blocks which are 128 bytes. This patch allows to checksum arbitrary parts of EDID, and not only whole extension blocks. Based-on: <20210303152948.59943-2-akihiko.odaki@gmail.com> Signed-off-by: Konstantin Nazarov <mail@knazarov.com> Message-Id: <20210315114639.91953-2-mail@knazarov.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20210427150824.638359-1-kraxel@redhat.com Message-Id: <20210427150824.638359-8-kraxel@redhat.com>
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/edid-generate.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index b70ab15..bdd0157 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -159,17 +159,17 @@ static void edid_fill_modes(uint8_t *edid, uint8_t *xtra3, uint8_t *dta,
}
}
-static void edid_checksum(uint8_t *edid)
+static void edid_checksum(uint8_t *edid, size_t len)
{
uint32_t sum = 0;
int i;
- for (i = 0; i < 127; i++) {
+ for (i = 0; i < len; i++) {
sum += edid[i];
}
sum &= 0xff;
if (sum) {
- edid[127] = 0x100 - sum;
+ edid[len] = 0x100 - sum;
}
}
@@ -474,9 +474,9 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
/* =============== finish up =============== */
- edid_checksum(edid);
+ edid_checksum(edid, 127);
if (dta) {
- edid_checksum(dta);
+ edid_checksum(dta, 127);
}
}