aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-02-09 11:01:45 +0100
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-02-09 11:01:45 +0100
commitf78149a5af421b6b40c0c3a465af1d5a9627a034 (patch)
tree3a4ca7f850c8bd69454e7017bb2536a67f034931
parentfc919465e0f23462ff696a9e659c1d53694f557a (diff)
edid-decode: improve GTF/CVT checks
1) Warn if a 1.4 EDID supports GTF instead of CVT (GTF is deprecated) 2) If a 1.4 EDID only supports GTF, then do not report Standard Timings as CVT. 3) Drop the check that GTF and/or CVT support must be present if an explicit GTF or CVT timing is supported: GTF/CVT support indicates that any GTF/CVT timings within the Display Range Limits is accepted, but explicitly indicated GTF/CVT timings are always assumed to be supported as discrete timings. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--edid-decode.h6
-rw-r--r--parse-base-block.cpp64
2 files changed, 47 insertions, 23 deletions
diff --git a/edid-decode.h b/edid-decode.h
index 07469ff..af7af0b 100644
--- a/edid-decode.h
+++ b/edid-decode.h
@@ -110,9 +110,8 @@ struct edid_state {
base.has_name_descriptor = base.has_display_range_descriptor =
base.has_serial_number = base.has_serial_string =
base.supports_continuous_freq = base.supports_gtf =
- base.supports_cvt = base.uses_gtf = base.uses_cvt =
+ base.supports_cvt = base.seen_non_detailed_descriptor =
base.has_640x480p60_est_timing = base.has_spwg =
- base.seen_non_detailed_descriptor =
base.preferred_is_also_native = false;
base.detailed_block_cnt = base.dtd_cnt = 0;
@@ -183,8 +182,6 @@ struct edid_state {
bool supports_continuous_freq;
bool supports_gtf;
bool supports_cvt;
- bool uses_gtf;
- bool uses_cvt;
bool has_spwg;
unsigned detailed_block_cnt;
unsigned dtd_cnt;
@@ -284,6 +281,7 @@ struct edid_state {
void detailed_epi(const unsigned char *x);
void detailed_timings(const char *prefix, const unsigned char *x,
bool base_or_cta = true);
+ void preparse_detailed_block(const unsigned char *x);
void detailed_block(const unsigned char *x);
void parse_base_block(const unsigned char *x);
void check_base_block();
diff --git a/parse-base-block.cpp b/parse-base-block.cpp
index 5911dda..604bd1e 100644
--- a/parse-base-block.cpp
+++ b/parse-base-block.cpp
@@ -735,7 +735,6 @@ void edid_state::detailed_cvt_descriptor(const char *prefix, const unsigned char
if (!first && !memcmp(x, empty, 3))
return;
- base.uses_cvt = true;
cvt_t.vact = x[0];
if (!cvt_t.vact)
fail("CVT byte 0 is 0, which is a reserved value.\n");
@@ -894,18 +893,20 @@ void edid_state::print_standard_timing(const char *prefix, unsigned char b1, uns
formula.vratio = vratio;
if (!gtf_only && base.edid_minor >= 4) {
- base.uses_cvt = true;
- edid_cvt_mode(refresh, formula);
- print_timings(prefix, &formula, "CVT ", "EDID 1.4 source");
+ if (base.supports_cvt) {
+ edid_cvt_mode(refresh, formula);
+ print_timings(prefix, &formula, "CVT ", "EDID 1.4 source");
+ }
/*
- * A EDID 1.3 source will assume GTF, so both GTF and CVT
+ * An EDID 1.3 source will assume GTF, so both GTF and CVT
* have to be supported.
*/
- base.uses_gtf = true;
edid_gtf_mode(refresh, formula);
- print_timings(prefix, &formula, "GTF ", "EDID 1.3 source");
+ if (base.supports_cvt)
+ print_timings(prefix, &formula, "GTF ", "EDID 1.3 source");
+ else
+ print_timings(prefix, &formula, "GTF ");
} else if (gtf_only || base.edid_minor >= 2) {
- base.uses_gtf = true;
edid_gtf_mode(refresh, formula);
print_timings(prefix, &formula, "GTF ");
} else {
@@ -951,7 +952,8 @@ void edid_state::detailed_display_range_limits(const unsigned char *x)
range_class = "GTF";
if (base.edid_minor >= 4 && !base.supports_continuous_freq)
fail("GTF can't be combined with non-continuous frequencies.\n");
- base.supports_gtf = true;
+ if (base.edid_minor >= 4)
+ warn("GTF support is deprecated in EDID 1.4.\n");
break;
case 0x01: /* range limits only */
range_class = "Bare Limits";
@@ -962,7 +964,8 @@ void edid_state::detailed_display_range_limits(const unsigned char *x)
range_class = "Secondary GTF";
if (base.edid_minor >= 4 && !base.supports_continuous_freq)
fail("GTF can't be combined with non-continuous frequencies.\n");
- base.supports_gtf = true;
+ if (base.edid_minor >= 4)
+ warn("GTF support is deprecated in EDID 1.4.\n");
has_sec_gtf = true;
break;
case 0x04: /* cvt */
@@ -972,11 +975,6 @@ void edid_state::detailed_display_range_limits(const unsigned char *x)
fail("'%s' is not allowed for EDID < 1.4.\n", range_class.c_str());
else if (!base.supports_continuous_freq)
fail("CVT can't be combined with non-continuous frequencies.\n");
- if (base.edid_minor >= 4) {
- /* GTF is implied if CVT is signaled */
- base.supports_gtf = true;
- base.supports_cvt = true;
- }
break;
default: /* invalid */
fail("Unknown range class (0x%02x).\n", x[10]);
@@ -1373,6 +1371,28 @@ void edid_state::detailed_timings(const char *prefix, const unsigned char *x,
}
}
+void edid_state::preparse_detailed_block(const unsigned char *x)
+{
+ if (x[0] || x[1])
+ return;
+ if (x[3] != 0xfd)
+ return;
+
+ switch (x[10]) {
+ case 0x00: /* default gtf */
+ case 0x02: /* secondary gtf curve */
+ base.supports_gtf = true;
+ break;
+ case 0x04: /* cvt */
+ if (base.edid_minor >= 4) {
+ /* GTF is implied if CVT is signaled */
+ base.supports_gtf = true;
+ base.supports_cvt = true;
+ }
+ break;
+ }
+}
+
void edid_state::detailed_block(const unsigned char *x)
{
static const unsigned char zero_descr[18] = { 0 };
@@ -1814,6 +1834,15 @@ void edid_state::parse_base_block(const unsigned char *x)
}
base.has_640x480p60_est_timing = x[0x23] & 0x20;
+ /*
+ * Need to find the Display Range Limit info before reading
+ * the standard timings.
+ */
+ preparse_detailed_block(x + 0x36);
+ preparse_detailed_block(x + 0x48);
+ preparse_detailed_block(x + 0x5a);
+ preparse_detailed_block(x + 0x6c);
+
data_block = "Standard Timings";
bool found = false;
for (i = 0; i < 8; i++) {
@@ -1880,10 +1909,7 @@ void edid_state::parse_base_block(const unsigned char *x)
void edid_state::check_base_block()
{
data_block = "Base EDID";
- if (base.uses_gtf && !base.supports_gtf)
- fail("GTF timings are used, but the EDID does not signal GTF support.\n");
- if (base.uses_cvt && !base.supports_cvt)
- fail("CVT timings are used, but the EDID does not signal CVT support.\n");
+
/*
* Allow for regular rounding of vertical and horizontal frequencies.
* The spec says that the pixelclock shall be rounded up, so there is

Privacy Policy