diff mbox series

[v2,4/8] edid: use dta extension block descriptors

Message ID 20210427150824.638359-5-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show
Series edid: windows fixes | expand

Commit Message

Gerd Hoffmann April 27, 2021, 3:08 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(+)

Comments

Marc-André Lureau April 27, 2021, 3:59 p.m. UTC | #1
On Tue, Apr 27, 2021 at 7:23 PM Gerd Hoffmann <kraxel@redhat.com> wrote:

> 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>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

---
>  hw/display/edid-generate.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
> index 25f790c7bd85..42a130f0ff5c 100644
> --- a/hw/display/edid-generate.c
> +++ b/hw/display/edid-generate.c
> @@ -152,6 +152,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;
>  }
>
> --
> 2.30.2
>
>
>
diff mbox series

Patch

diff --git a/hw/display/edid-generate.c b/hw/display/edid-generate.c
index 25f790c7bd85..42a130f0ff5c 100644
--- a/hw/display/edid-generate.c
+++ b/hw/display/edid-generate.c
@@ -152,6 +152,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;
 }