Commit e7992fc5 authored by Gerd Hoffmann's avatar Gerd Hoffmann
Browse files

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: default avatarGerd Hoffmann <kraxel@redhat.com>
Message-id: 20180925075646.25114-3-kraxel@redhat.com
parent 72d277a7
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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);
}
+1 −0
Original line number Diff line number Diff line
@@ -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 */