[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/25] edid: allow arbitrary-length checksums
From: |
Gerd Hoffmann |
Subject: |
[PULL 07/25] edid: allow arbitrary-length checksums |
Date: |
Mon, 10 May 2021 15:20:33 +0200 |
From: Konstantin Nazarov <mail@knazarov.com>
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>
---
hw/display/edid-generate.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index b70ab1557e50..bdd01571fc9b 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);
}
}
--
2.31.1
- [PULL 00/25] Vga 20210510 patches, Gerd Hoffmann, 2021/05/10
- [PULL 01/25] qemu-edid: use qemu_edid_size(), Gerd Hoffmann, 2021/05/10
- [PULL 02/25] edid: edid_desc_next, Gerd Hoffmann, 2021/05/10
- [PULL 03/25] edid: move xtra3 descriptor, Gerd Hoffmann, 2021/05/10
- [PULL 04/25] edid: use dta extension block descriptors, Gerd Hoffmann, 2021/05/10
- [PULL 05/25] edid: Make refresh rate configurable, Gerd Hoffmann, 2021/05/10
- [PULL 06/25] edid: move timing generation into a separate function, Gerd Hoffmann, 2021/05/10
- [PULL 08/25] edid: add support for DisplayID extension (5k resolution), Gerd Hoffmann, 2021/05/10
- [PULL 07/25] edid: allow arbitrary-length checksums,
Gerd Hoffmann <=
- [PULL 10/25] virtio-gpu: rename virgl source file., Gerd Hoffmann, 2021/05/10
- [PULL 11/25] virtio-gpu: add virtio-gpu-gl-device, Gerd Hoffmann, 2021/05/10
- [PULL 12/25] virtio-gpu: move virgl realize + properties, Gerd Hoffmann, 2021/05/10
- [PULL 09/25] virtio-gpu: handle partial maps properly, Gerd Hoffmann, 2021/05/10
- [PULL 14/25] virtio-gpu: use class function for ctrl queue handlers, Gerd Hoffmann, 2021/05/10
- [PULL 13/25] virtio-gpu: move virgl reset, Gerd Hoffmann, 2021/05/10