diff options
-rw-r--r-- | edid-decode.h | 3 | ||||
-rw-r--r-- | parse-base-block.cpp | 14 | ||||
-rw-r--r-- | parse-displayid-block.cpp | 9 | ||||
-rw-r--r-- | parse-vtb-ext-block.cpp | 2 |
4 files changed, 15 insertions, 13 deletions
diff --git a/edid-decode.h b/edid-decode.h index 3be9e5b..1abccd1 100644 --- a/edid-decode.h +++ b/edid-decode.h @@ -182,7 +182,8 @@ struct edid_state { bool gtf_only = false, unsigned vrefresh_offset = 60); void detailed_display_range_limits(const unsigned char *x); void detailed_epi(const unsigned char *x); - void detailed_timings(const char *prefix, const unsigned char *x); + void detailed_timings(const char *prefix, const unsigned char *x, + bool base_or_cta = true); void detailed_block(const unsigned char *x); void parse_base_block(const unsigned char *x); diff --git a/parse-base-block.cpp b/parse-base-block.cpp index 9f0147e..14cea1e 100644 --- a/parse-base-block.cpp +++ b/parse-base-block.cpp @@ -1205,13 +1205,16 @@ void edid_state::detailed_epi(const unsigned char *x) printf(" EPI Version: %u.%u\n", (x[17] & 0xf0) >> 4, x[17] & 0x0f); } -void edid_state::detailed_timings(const char *prefix, const unsigned char *x) +void edid_state::detailed_timings(const char *prefix, const unsigned char *x, + bool base_or_cta) { struct timings t = {}; unsigned hbl, vbl; std::string s_sync, s_flags; - dtd_cnt++; + // Only count DTDs in base block 0 or CTA extension blocks + if (base_or_cta) + dtd_cnt++; data_block = "Detailed Timing Descriptor #" + std::to_string(dtd_cnt); t.pixclk_khz = (x[0] + (x[1] << 8)) * 10; if (t.pixclk_khz < 10000) { @@ -1324,11 +1327,12 @@ void edid_state::detailed_timings(const char *prefix, const unsigned char *x) calc_ratio(&t); - bool ok = print_timings(prefix, &t, dtd_type().c_str(), s_flags.c_str(), true); + std::string s_type = base_or_cta ? dtd_type() : "DTD"; + bool ok = print_timings(prefix, &t, s_type.c_str(), s_flags.c_str(), true); - if (block_nr == 0 && dtd_cnt == 1) { + if (block_nr == 0 && dtd_cnt == 1 && base_or_cta) { preferred_timings = t; - preferred_type = dtd_type(); + preferred_type = s_type; preferred_flags = s_flags; } diff --git a/parse-displayid-block.cpp b/parse-displayid-block.cpp index b436f34..4164687 100644 --- a/parse-displayid-block.cpp +++ b/parse-displayid-block.cpp @@ -302,8 +302,7 @@ void edid_state::parse_displayid_type_1_7_timing(const unsigned char *x, bool ty if (x[3] & 0x80) s += ", preferred"; - dtd_cnt++; - print_timings(" ", &t, dtd_type().c_str(), s.c_str(), true); + print_timings(" ", &t, "DTD", s.c_str(), true); } // tag 0x04 @@ -359,8 +358,7 @@ void edid_state::parse_displayid_type_2_timing(const unsigned char *x) if (x[3] & 0x80) s += ", preferred"; - dtd_cnt++; - print_timings(" ", &t, dtd_type().c_str(), s.c_str(), true); + print_timings(" ", &t, "DTD", s.c_str(), true); } // tag 0x05 @@ -1007,8 +1005,7 @@ void edid_state::parse_displayid_type_6_timing(const unsigned char *x) if (x[2] & 0x80) s += ", preferred"; - dtd_cnt++; - print_timings(" ", &t, dtd_type().c_str(), s.c_str(), true); + print_timings(" ", &t, "DTD", s.c_str(), true); } static std::string ieee7542d(unsigned short fp) diff --git a/parse-vtb-ext-block.cpp b/parse-vtb-ext-block.cpp index cd1553a..fb0606d 100644 --- a/parse-vtb-ext-block.cpp +++ b/parse-vtb-ext-block.cpp @@ -26,7 +26,7 @@ void edid_state::parse_vtb_ext_block(const unsigned char *x) if (num_dtd) { printf(" Detailed Timing Descriptors:\n"); for (unsigned i = 0; i < num_dtd; i++, x += 18) - detailed_timings(" ", x); + detailed_timings(" ", x, false); } if (num_cvt) { printf(" Coordinated Video Timings:\n"); |