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 handling of preferred/native timings
Author:  Hans Verkuil <hverk...@xs4all.nl>
Date:    Thu Apr 24 10:35:32 2025 +0200

- if the first VIC has width or height >= 4096, warn and mention that
  you should add a VFPDB and NVRDB.
- if !base.preferred_is_also_native, then base.preferred_timing was
  cleared, but that should only happen if !has_preferred_timing.
- only add the first DTD to the native timings if cta.byte3 & 0xf
  is non-zero.
- don't complain about missing native resolutions for analog displays
  as it doesn't apply to such displays.

Signed-off-by: Hans Verkuil <hverk...@xs4all.nl>

 utils/edid-decode/edid-decode.cpp      |  7 +++++++
 utils/edid-decode/edid-decode.h        |  2 ++
 utils/edid-decode/parse-base-block.cpp | 14 +++++++-------
 utils/edid-decode/parse-cta-block.cpp  | 16 +++++++++++++---
 4 files changed, 29 insertions(+), 10 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=1bcfbc774746830a0eca8e8ab6ad2cf562554677
diff --git a/utils/edid-decode/edid-decode.cpp 
b/utils/edid-decode/edid-decode.cpp
index 9dee00a9507c..64d3efcbda7d 100644
--- a/utils/edid-decode/edid-decode.cpp
+++ b/utils/edid-decode/edid-decode.cpp
@@ -1463,6 +1463,13 @@ void edid_state::print_native_res()
                }
        }
 
+       if (!base.is_analog && native_width == 0 && native_width_int == 0) {
+               warn("No Native Video Resolution was defined.\n");
+               // See also section 7.2.2 in the CTA-861-I (or later) standard:
+               if (has_cta)
+                       warn("  Hint: set 'Native detailed modes' to a non-0 
value, or add a Native Video Resolution Data Block.\n");
+       }
+
        if (!options[OptNativeResolution])
                return;
 
diff --git a/utils/edid-decode/edid-decode.h b/utils/edid-decode/edid-decode.h
index 7270400d4459..b22e273ea8c8 100644
--- a/utils/edid-decode/edid-decode.h
+++ b/utils/edid-decode/edid-decode.h
@@ -171,6 +171,7 @@ struct edid_state {
                        base.preferred_is_also_native = false;
                base.serial_number = 0;
                base.week = base.year = 0;
+               base.is_analog = false;
                base.supports_sec_gtf = false;
                base.sec_gtf_start_freq = 0;
                base.C = base.M = base.K = base.J = 0;
@@ -275,6 +276,7 @@ struct edid_state {
                bool has_display_range_descriptor;
                unsigned serial_number;
                unsigned char week, year;
+               bool is_analog;
                bool supports_continuous_freq;
                bool supports_gtf;
                bool supports_sec_gtf;
diff --git a/utils/edid-decode/parse-base-block.cpp 
b/utils/edid-decode/parse-base-block.cpp
index f6bc064d79b7..a579c65a4772 100644
--- a/utils/edid-decode/parse-base-block.cpp
+++ b/utils/edid-decode/parse-base-block.cpp
@@ -1137,7 +1137,9 @@ void edid_state::detailed_timings(const char *prefix, 
const unsigned char *x,
                base.preferred_timing = te;
                if (has_cta) {
                        cta.preferred_timings.push_back(te);
-                       cta.native_timings.push_back(te);
+                       if (cta.byte3 & 0xf) {
+                               cta.native_timings.push_back(te);
+                       }
                }
        }
        if (base_or_cta)
@@ -1479,7 +1481,6 @@ void edid_state::parse_base_block(const unsigned char *x)
 {
        time_t the_time;
        struct tm *ptm;
-       int analog;
        unsigned col_x, col_y;
        bool has_preferred_timing = false;
        char *manufacturer;
@@ -1564,7 +1565,7 @@ void edid_state::parse_base_block(const unsigned char *x)
        data_block = "Basic Display Parameters & Features";
        printf("  %s:\n", data_block.c_str());
        if (x[0x14] & 0x80) {
-               analog = 0;
+               base.is_analog = false;
                printf("    Digital display\n");
                if (base.edid_minor >= 4) {
                        if ((x[0x14] & 0x70) == 0x00)
@@ -1607,7 +1608,7 @@ void edid_state::parse_base_block(const unsigned char *x)
                unsigned voltage = (x[0x14] & 0x60) >> 5;
                unsigned sync = (x[0x14] & 0x0f);
 
-               analog = 1;
+               base.is_analog = true;
                printf("    Analog display\n");
                printf("    Signal Level Standard: %s\n", voltages[voltage]);
 
@@ -1662,7 +1663,7 @@ void edid_state::parse_base_block(const unsigned char *x)
                printf("\n");
        }
 
-       if (analog || base.edid_minor < 4) {
+       if (base.is_analog || base.edid_minor < 4) {
                printf("    ");
                switch (x[0x18] & 0x18) {
                case 0x00: printf("Monochrome or grayscale display\n"); break;
@@ -1803,8 +1804,7 @@ void edid_state::parse_base_block(const unsigned char *x)
        detailed_block(x + 0x5a);
        detailed_block(x + 0x6c);
        base.has_spwg = false;
-       if (!base.preferred_is_also_native) {
-               cta.native_timings.clear();
+       if (!has_preferred_timing) {
                base.preferred_timing = timings_ext();
        }
 
diff --git a/utils/edid-decode/parse-cta-block.cpp 
b/utils/edid-decode/parse-cta-block.cpp
index 4817afcf96c2..9aac64ae53b4 100644
--- a/utils/edid-decode/parse-cta-block.cpp
+++ b/utils/edid-decode/parse-cta-block.cpp
@@ -641,10 +641,17 @@ void edid_state::cta_svd(const unsigned char *x, unsigned 
n, bool for_ycbcr420)
                                print_timings("    ", t, type, flags);
                        }
                        if (first_svd && !cta.preferred_timings.empty()) {
-                               if (!match_timings(cta.preferred_timings[0].t, 
*t))
-                                       warn("VIC %u and the first DTD are not 
identical. Is this intended?\n", vic);
-                               else if (cta.first_svd_might_be_preferred)
+                               if (!match_timings(cta.preferred_timings[0].t, 
*t)) {
+                                       // The DTD can't handle width or height 
>= 4096. If the first
+                                       // VIC has a width or height >= 4096, 
then adding VFPDB and
+                                       // NVRDB data blocks is strongly 
recommended.
+                                       if (t->vact < 4096 && t->hact < 4096)
+                                               warn("VIC %u and the first DTD 
are not identical. Is this intended?\n", vic);
+                                       else if (!cta.has_vfpdb)
+                                               warn("The first VIC %u has 
width or height >= 4096, adding a VFPDB and NVRDB is strongly recommended.\n", 
vic);
+                               } else if (cta.first_svd_might_be_preferred) {
                                        warn("For improved preferred timing 
interoperability, set 'Native detailed modes' to 1.\n");
+                               }
                        }
                        if (first_svd) {
                                if (cta.first_svd_might_be_preferred)
@@ -2850,6 +2857,9 @@ void edid_state::preparse_cta_block(unsigned char *x)
        if (version < 3)
                return;
 
+       if (!cta.byte3)
+               cta.byte3 = x[3];
+
        for (unsigned i = 4; i < offset; i += (x[i] & 0x1f) + 1) {
                bool for_ycbcr420 = false;
                unsigned oui;

Reply via email to