From 100437cf02a3faafec59e9e863117fa53e925aa6 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 31 Oct 2023 12:30:25 +0100 Subject: [PATCH] edid-decode: check if DTD == HDMI 2 but VICs HDMI 1 If the DTD matches a VIC with pixelclock > 340 MHz, and the highest VIC pixelclock <= 340 MHz, then report a mismatch: DTD is an HDMI 2.x timing, while all VICs are HDMI 1.x timings. This suggests that the display has HDMI 2.x support disabled (a common menu setting), and that HDMI 2.x VICs are removed from the CTA Extension Block, but the DTD in the Base Block is not updated and still lists an HDMI 2.x timing. Signed-off-by: Hans Verkuil --- edid-decode.cpp | 7 ++++++- edid-decode.h | 4 ++++ parse-cta-block.cpp | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/edid-decode.cpp b/edid-decode.cpp index a6138a9..dfeb2b9 100644 --- a/edid-decode.cpp +++ b/edid-decode.cpp @@ -643,9 +643,14 @@ bool edid_state::print_timings(const char *prefix, const struct timings *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]) + !cta.preparsed_has_vic[0][vic]) { warn("DTD is identical to VIC %u, which is not present in the CTA Ext Block.\n", vic); + if (cta.preparsed_max_vic_pixclk_khz && t->pixclk_khz > 340000 && + t->pixclk_khz > cta.preparsed_max_vic_pixclk_khz) + cta.warn_about_hdmi_2x_dtd = true; + } + 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 7ae6702..bf6c6b6 100644 --- a/edid-decode.h +++ b/edid-decode.h @@ -190,6 +190,8 @@ struct edid_state { cta.preparsed_total_vtdbs = 0; cta.preparsed_has_t8vtdb = false; cta.preparsed_t8vtdb_dmt = 0; + cta.preparsed_max_vic_pixclk_khz = 0; + cta.warn_about_hdmi_2x_dtd = false; // DisplayID block state dispid.version = 0; @@ -310,6 +312,8 @@ struct edid_state { unsigned short vics[256][2]; bool preparsed_has_vic[2][256]; std::vector preparsed_svds[2]; + unsigned preparsed_max_vic_pixclk_khz; + bool warn_about_hdmi_2x_dtd; } cta; // DisplayID block state diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp index 6907b52..e2002b1 100644 --- a/parse-cta-block.cpp +++ b/parse-cta-block.cpp @@ -2807,6 +2807,12 @@ void edid_state::preparse_cta_block(unsigned char *x) vic &= 0x7f; cta.preparsed_svds[for_ycbcr420].push_back(vic); cta.preparsed_has_vic[for_ycbcr420][vic] = true; + + const struct timings *t = find_vic_id(vic); + + if (!for_ycbcr420 && t && + t->pixclk_khz > cta.preparsed_max_vic_pixclk_khz) + cta.preparsed_max_vic_pixclk_khz = t->pixclk_khz; } break; } @@ -2995,6 +3001,14 @@ void edid_state::check_cta_blocks() unsigned max_pref_ilace_vact = 0; data_block = "CTA-861"; + + // HDMI 1.4 goes up to 340 MHz. Dubious to have a DTD above that, + // but no VICs. Displays often have a setting to turn off HDMI 2.x + // support, dropping any HDMI 2.x VICs, but they sometimes forget + // to replace the DTD in the base block as well. + if (cta.warn_about_hdmi_2x_dtd) + warn("DTD pixelclock indicates HDMI 2.x support, VICs indicate HDMI 1.x.\n"); + for (vec_timings_ext::iterator iter = cta.preferred_timings.begin(); iter != cta.preferred_timings.end(); ++iter) { if (iter->t.interlaced && -- 2.11.4.GIT