diff options
-rw-r--r-- | hw/display/edid-generate.c | 14 | ||||
-rw-r--r-- | include/hw/display/edid.h | 1 |
2 files changed, 15 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); +} diff --git a/include/hw/display/edid.h b/include/hw/display/edid.h index 63b60015c3..96910ada0f 100644 --- a/include/hw/display/edid.h +++ b/include/hw/display/edid.h @@ -14,5 +14,6 @@ typedef struct qemu_edid_info { void qemu_edid_generate(uint8_t *edid, size_t size, qemu_edid_info *info); +size_t qemu_edid_size(uint8_t *edid); #endif /* EDID_H */ |