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

Subject: edid-decode: keep track of the max HDMI TMDS rate
Author:  Hans Verkuil <hverkuil-ci...@xs4all.nl>
Date:    Mon Jan 15 09:41:13 2024 +0100

Warn if timings are used that exceed this rate.

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

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

---

diff --git a/edid-decode.h b/edid-decode.h
index e3e479f2a782..9afc9b5e2f86 100644
--- a/edid-decode.h
+++ b/edid-decode.h
@@ -176,6 +176,7 @@ struct edid_state {
                        cta.has_nvrdb = false;
                cta.previous_cta_tag = 0xfff;
                cta.have_hf_vsdb = cta.have_hf_scdb = false;
+               cta.hdmi_max_rate = 0;
                cta.hf_eeodb_blocks = 0;
                cta.image_width = cta.image_height = 0;
                cta.block_number = 0;
@@ -297,6 +298,7 @@ struct edid_state {
                bool first_svd_might_be_preferred;
                unsigned char byte3;
                bool has_hdmi;
+               unsigned hdmi_max_rate;
                bool has_vcdb;
                bool has_vfpdb;
                bool has_nvrdb;
@@ -409,6 +411,7 @@ struct edid_state {
        void cta_preparse_sldb(const unsigned char *x, unsigned length);
        void cta_colorimetry_block(const unsigned char *x, unsigned length);
        void cta_hdmi_block(const unsigned char *x, unsigned length);
+       void cta_hf_scdb(const unsigned char *x, unsigned length);
        void cta_displayid_type_7(const unsigned char *x, unsigned length);
        void cta_displayid_type_8(const unsigned char *x, unsigned length);
        void cta_displayid_type_10(const unsigned char *x, unsigned length);
diff --git a/parse-cta-block.cpp b/parse-cta-block.cpp
index 25cf276f6250..4bcc2717899c 100644
--- a/parse-cta-block.cpp
+++ b/parse-cta-block.cpp
@@ -1009,8 +1009,10 @@ void edid_state::cta_hdmi_block(const unsigned char *x, 
unsigned length)
        if (length < 4)
                return;
 
-       printf("    Maximum TMDS clock: %u MHz\n", x[3] * 5);
-       if (x[3] * 5 > 340)
+       unsigned rate = x[3] * 5;
+       printf("    Maximum TMDS clock: %u MHz\n", rate);
+       cta.hdmi_max_rate = rate;
+       if (rate > 340)
                fail("HDMI VSDB Max TMDS rate is > 340.\n");
 
        if (length < 5)
@@ -1250,7 +1252,7 @@ static void cta_hf_eeodb(const unsigned char *x, unsigned 
length)
                fail("Extension Block Count == %u.\n", x[0]);
 }
 
-static void cta_hf_scdb(const unsigned char *x, unsigned length)
+void edid_state::cta_hf_scdb(const unsigned char *x, unsigned length)
 {
        unsigned rate = x[1] * 5;
        unsigned v;
@@ -1260,6 +1262,10 @@ static void cta_hf_scdb(const unsigned char *x, unsigned 
length)
                printf("    Maximum TMDS Character Rate: %u MHz\n", rate);
                if (rate <= 340 || rate > 600)
                        fail("Max TMDS rate is > 0 and <= 340 or > 600.\n");
+               if (rate < cta.hdmi_max_rate)
+                       fail("HDMI Forum VSDB rate < HDMI VSDB rate.\n");
+               else
+                       cta.hdmi_max_rate = rate;
        }
        if (x[2] & 0x80)
                printf("    SCDC Present\n");
@@ -1291,6 +1297,12 @@ static void cta_hf_scdb(const unsigned char *x, unsigned 
length)
                        fail("Max Fixed Rate Link is 1, but Max TMDS rate < 
300.\n");
                else if (max_frl_rate >= 2 && rate < 600)
                        fail("Max Fixed Rate Link is >= 2, but Max TMDS rate < 
600.\n");
+
+               // FIXME:
+               // Currently I do not really know how to translate the
+               // Max FRL value to an equivalent max clock frequency.
+               // So reset this field to 0 to skip any clock rate checks.
+               cta.hdmi_max_rate = 0;
        }
        if (x[3] & 0x08)
                printf("    Supports UHD VIC\n");
@@ -3031,6 +3043,10 @@ void edid_state::check_cta_blocks()
        if (cta.warn_about_hdmi_2x_dtd)
                warn("DTD pixelclock indicates HDMI 2.x support, VICs indicate 
HDMI 1.x.\n");
 
+       if (cta.hdmi_max_rate && max_pixclk_khz > cta.hdmi_max_rate * 1000)
+               fail("The maximum HDMI TMDS clock is %u kHz, but one or more 
video timings go up to %u kHz.\n",
+                    cta.hdmi_max_rate * 1000, max_pixclk_khz);
+
        for (vec_timings_ext::iterator iter = cta.preferred_timings.begin();
             iter != cta.preferred_timings.end(); ++iter) {
                if (iter->t.interlaced &&
_______________________________________________
linuxtv-commits mailing list -- linuxtv-commits@linuxtv.org
To unsubscribe send an email to linuxtv-commits-le...@linuxtv.org
%(web_page_url)slistinfo/%(_internal_name)s

Reply via email to