diff mbox series

[4/9] edid: use dta extension block descriptors

Message ID 20210316143812.2363588-5-kraxel@redhat.com
State New
Headers show
Series edid: windows fixes | expand

Commit Message

Gerd Hoffmann March 16, 2021, 2:38 p.m. UTC
When the 4 descriptors in the base edid block are filled, jump to the
dta extension block.  This allows for more than four descriptors.
Happens for example when generating an edid blob with a serial number
(qemu-edid -s $serial).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/display/edid-generate.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index 259ef7315217..489532c3bc5f 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -151,6 +151,14 @@  static uint8_t *edid_desc_next(uint8_t *edid, uint8_t *dta, uint8_t *desc)
     if (desc + 18 + 18 < edid + 127) {
         return desc + 18;
     }
+    if (dta) {
+        if (desc < edid + 127) {
+            return dta + dta[2];
+        }
+        if (desc + 18 + 18 < dta + 127) {
+            return desc + 18;
+        }
+    }
     return NULL;
 }