This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: edid-decode: improve Image Size checks
Author:  Hans Verkuil <[email protected]>
Date:    Fri Jul 10 17:37:33 2026 +0200

If cta.preparsed_image_size == hdmi_image_size_ratio, then also
check if there is a valid image size (NVRDB or DisplayID Display
Parameters). In that case, check against the valid image size.

This combination can happen with a display > 255 cm. Without
this check it accepted any DTD image size.

Signed-off-by: Hans Verkuil <[email protected]>

 utils/edid-decode/edid-decode.cpp           | 6 ++++--
 utils/edid-decode/edid-decode.h             | 5 +++++
 utils/edid-decode/parse-base-block.cpp      | 6 ++++++
 utils/edid-decode/parse-cta-block.cpp       | 1 +
 utils/edid-decode/parse-displayid-block.cpp | 2 ++
 5 files changed, 18 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e608b330fe96d3b95a95e503ed2820575eb2ee06
diff --git a/utils/edid-decode/edid-decode.cpp 
b/utils/edid-decode/edid-decode.cpp
index b54182f6832d..d8a1c63a3e8f 100644
--- a/utils/edid-decode/edid-decode.cpp
+++ b/utils/edid-decode/edid-decode.cpp
@@ -764,8 +764,10 @@ bool edid_state::print_timings(const char *prefix, const 
struct timings *t,
                /* this is valid */
        } else if (!t->hsize_mm && !t->vsize_mm) {
                /* this is valid */
-       } else if (cta.preparsed_image_size == hdmi_image_size_ratio) {
-               /* this is valid */
+       } else if (cta.preparsed_image_size == hdmi_image_size_ratio &&
+                  (!has_valid_image_size || image_width > 40950 || 
image_height > 40950)) {
+               if (has_valid_image_size && t->hsize_mm != 4095 && t->vsize_mm 
!= 4095)
+                       warn("For displays > 4095 mm the image size is expected 
to be set to 4095 mm.\n");
        } else if (t->hsize_mm > image_width / 10.0 + 9 ||
                   t->vsize_mm > image_height / 10.0 + 9) {
                fail("Mismatch of image size %ux%u mm vs display size %ux%u 
mm.\n",
diff --git a/utils/edid-decode/edid-decode.h b/utils/edid-decode/edid-decode.h
index 9a527818875f..70628213ce28 100644
--- a/utils/edid-decode/edid-decode.h
+++ b/utils/edid-decode/edid-decode.h
@@ -159,6 +159,7 @@ struct edid_state {
                dtd_max_vsize_mm = dtd_max_hsize_mm = 0;
                warnings = failures = 0;
                has_cta = has_dispid = false;
+               has_valid_image_size = false;
                // Note: for now we do not support native DisplayID data,
                // so this is always false. But some tests are different
                // depending on whether it is a native DisplayID structure
@@ -258,6 +259,10 @@ struct edid_state {
        unsigned unused_bytes;
        bool has_cta;
        bool has_dispid;
+
+       // true if CTA has NVRDB with image size, or DisplayID has
+       // Display Parameters with non-0 Image Size values.
+       bool has_valid_image_size;
        bool native_dispid;
        bool hide_serial_numbers;
        bool replace_unique_ids;
diff --git a/utils/edid-decode/parse-base-block.cpp 
b/utils/edid-decode/parse-base-block.cpp
index f999f73eaae0..a2e32886d782 100644
--- a/utils/edid-decode/parse-base-block.cpp
+++ b/utils/edid-decode/parse-base-block.cpp
@@ -1657,6 +1657,8 @@ void edid_state::parse_base_block(const unsigned char *x)
                        image_width = base.max_display_width_mm * 10;
                        image_height = base.max_display_height_mm * 10;
                }
+               if (cta.preparsed_image_size >= hdmi_image_size_rounded)
+                       has_valid_image_size = true;
                if (x[0x15] < 10 || x[0x16] < 10)
                        warn("Dubious maximum image size (%ux%u is smaller than 
%ux%u cm).\n",
                             x[0x15] * factor, x[0x16] * factor,
@@ -1670,6 +1672,10 @@ void edid_state::parse_base_block(const unsigned char *x)
        } else {
                /* Either or both can be zero for 1.3 and before */
                printf("    Image size is variable\n");
+               if (cta.preparsed_image_size)
+                       fail("Image size is variable, but the HDMI VSDB 
indicates a fixed image size.\n");
+               else if (has_valid_image_size)
+                       fail("Image size is variable, but a fixed Image Size is 
reported in CTA or DisplayID blocks.\n");
        }
 
        if (x[0x17] == 0xff)
diff --git a/utils/edid-decode/parse-cta-block.cpp 
b/utils/edid-decode/parse-cta-block.cpp
index 950455f71b6e..0d5c2d022b81 100644
--- a/utils/edid-decode/parse-cta-block.cpp
+++ b/utils/edid-decode/parse-cta-block.cpp
@@ -3085,6 +3085,7 @@ void edid_state::preparse_cta_block(unsigned char *x)
                                }
                                cta.image_width = w;
                                cta.image_height = h;
+                               has_valid_image_size = true;
                                if (cta.image_width > image_width ||
                                    cta.image_height > image_height) {
                                        image_width = cta.image_width;
diff --git a/utils/edid-decode/parse-displayid-block.cpp 
b/utils/edid-decode/parse-displayid-block.cpp
index dd2f0f283c1d..1013af92fe81 100644
--- a/utils/edid-decode/parse-displayid-block.cpp
+++ b/utils/edid-decode/parse-displayid-block.cpp
@@ -2387,6 +2387,8 @@ void edid_state::preparse_displayid_block(unsigned char 
*x)
                        }
                        dispid.image_width = hor_size;
                        dispid.image_height = vert_size;
+                       if (hor_size && vert_size)
+                               has_valid_image_size = true;
                        if (dispid.image_width > image_width ||
                            dispid.image_height > image_height) {
                                image_width = dispid.image_width;
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to