This is an automatic generated email to let you know that the following patch 
were queued:

Subject: edid-decode: report if a DTD matches an absent VIC
Author:  Hans Verkuil <hverkuil-ci...@xs4all.nl>
Date:    Tue Oct 31 10:53:32 2023 +0100

If a DTD is identical to a VIC, and that VIC is not listed in the
CTA Extension Block, then warn about that.

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

 edid-decode.cpp     |  8 +++++++-
 edid-decode.h       |  3 ++-
 parse-cta-block.cpp | 14 ++++++++++++++
 3 files changed, 23 insertions(+), 2 deletions(-)

---

diff --git a/edid-decode.cpp b/edid-decode.cpp
index a30165319cac..a6138a91c3e5 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -306,7 +306,7 @@ std::string edid_state::dtd_type(unsigned cnt)
        return buf;
 }
 
-bool edid_state::match_timings(const timings &t1, const timings &t2)
+bool match_timings(const timings &t1, const timings &t2)
 {
        if (t1.hact != t2.hact ||
            t1.vact != t2.vact ||
@@ -637,9 +637,15 @@ bool edid_state::print_timings(const char *prefix, const 
struct timings *t,
                unsigned vic, dmt;
                const timings *vic_t = cta_close_match_to_vic(*t, vic);
 
+               // We report this even if there is no CTA block since it
+               // is still likely that the actual VIC timings were intended.
                if (vic_t)
                        warn("DTD is similar but not identical to VIC %u.\n", 
vic);
 
+               if (cta_matches_vic(*t, vic) && has_cta &&
+                   !cta.preparsed_has_vic[0][vic])
+                       warn("DTD is identical to VIC %u, which is not present 
in the CTA Ext Block.\n", vic);
+
                const timings *dmt_t = close_match_to_dmt(*t, dmt);
                if (!vic_t && dmt_t)
                        warn("DTD is similar but not identical to DMT 
0x%02x.\n", dmt);
diff --git a/edid-decode.h b/edid-decode.h
index 9eb1e0af0c3a..7ae67028613d 100644
--- a/edid-decode.h
+++ b/edid-decode.h
@@ -351,7 +351,6 @@ struct edid_state {
                return print_timings(prefix, &t.t, t.type.c_str(), 
t.flags.c_str(),
                                     detailed, do_checks);
        };
-       bool match_timings(const timings &t1, const timings &t2);
        timings calc_gtf_mode(unsigned h_pixels, unsigned v_lines,
                              double ip_freq_rqd, bool int_rqd = false,
                              enum gtf_ip_parm ip_parm = gtf_ip_vert_freq,
@@ -526,6 +525,7 @@ void calc_ratio(struct timings *t);
 const char *oui_name(unsigned oui, unsigned *ouinum = NULL);
 unsigned gcd(unsigned a, unsigned b);
 
+bool match_timings(const timings &t1, const timings &t2);
 bool timings_close_match(const timings &t1, const timings &t2);
 const struct timings *find_dmt_id(unsigned char dmt_id);
 const struct timings *close_match_to_dmt(const timings &t, unsigned &dmt);
@@ -533,6 +533,7 @@ const struct timings *find_vic_id(unsigned char vic);
 const struct cta_rid *find_rid(unsigned char rid);
 const struct timings *find_hdmi_vic_id(unsigned char hdmi_vic);
 const struct timings *cta_close_match_to_vic(const timings &t, unsigned &vic);
+bool cta_matches_vic(const timings &t, unsigned &vic);
 unsigned char hdmi_vic_to_vic(unsigned char hdmi_vic);
 char *extract_string(const unsigned char *x, unsigned len);
 
diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index 0a6013c64576..6907b5291134 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -319,6 +319,20 @@ const struct timings *cta_close_match_to_vic(const timings 
&t, unsigned &vic)
        return NULL;
 }
 
+bool cta_matches_vic(const timings &t, unsigned &vic)
+{
+       for (vic = 1; vic <= ARRAY_SIZE(edid_cta_modes1); vic++) {
+               if (match_timings(t, edid_cta_modes1[vic - 1]))
+                       return true;
+       }
+       for (vic = 193; vic < ARRAY_SIZE(edid_cta_modes2) + 193; vic++) {
+               if (match_timings(t, edid_cta_modes1[vic - 193]))
+                       return true;
+       }
+       vic = 0;
+       return false;
+}
+
 void edid_state::cta_list_vics()
 {
        char type[16];

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to