aboutsummaryrefslogtreecommitdiff
path: root/hw/display
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2018-09-25 09:56:43 +0200
committerGerd Hoffmann <kraxel@redhat.com>2018-09-27 08:07:51 +0200
commite7992fc5a002003ae865685ad4635b952c1ca9bf (patch)
tree4c814ddd0f854ea605de4b3911575f9a068d1383 /hw/display
parent72d277a70e8b2d4eb1b3667ab934fb1fecf41410 (diff)
display/edid: add qemu_edid_size()
Helper function to figure the size of a edid blob, by checking how many extensions are present. Both the base edid blob and the extensions are 128 bytes in size. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20180925075646.25114-3-kraxel@redhat.com
Diffstat (limited to 'hw/display')
-rw-r--r--hw/display/edid-generate.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index b3e493da19..c80397ea96 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -423,3 +423,17 @@ void qemu_edid_generate(uint8_t *edid, size_t size,
edid_checksum(dta);
}
}
+
+size_t qemu_edid_size(uint8_t *edid)
+{
+ uint32_t exts;
+
+ if (edid[0] != 0x00 ||
+ edid[1] != 0xff) {
+ /* doesn't look like a valid edid block */
+ return 0;
+ }
+
+ exts = edid[126];
+ return 128 * (exts + 1);
+}