diff options
-rw-r--r-- | calc-gtf-cvt.cpp | 10 | ||||
-rw-r--r-- | edid-decode.cpp | 6 | ||||
-rw-r--r-- | edid-decode.h | 28 | ||||
-rw-r--r-- | parse-displayid-block.cpp | 8 |
4 files changed, 33 insertions, 19 deletions
diff --git a/calc-gtf-cvt.cpp b/calc-gtf-cvt.cpp index b9d62b2..78c64c3 100644 --- a/calc-gtf-cvt.cpp +++ b/calc-gtf-cvt.cpp @@ -104,7 +104,7 @@ timings edid_state::calc_gtf_mode(unsigned h_pixels, unsigned v_lines, t.vborder = vert_margin; t.pos_pol_hsync = secondary; t.pos_pol_vsync = !secondary; - t.rb = secondary ? RB_GTF : 0; + t.rb = secondary ? RB_GTF : RB_NONE; return t; } @@ -176,7 +176,7 @@ timings edid_state::calc_cvt_mode(unsigned h_pixels, unsigned v_lines, if (rb >= RB_CVT_V2) v_sync = 8; - if (rb == 0) { + if (rb == RB_NONE) { double h_period_est = ((1.0 / v_field_rate_rqd) - CVT_MIN_VSYNC_BP / 1000000.0) / (v_lines_rnd + vert_margin * 2 + CVT_MIN_V_PORCH + interlace) * 1000000.0; v_sync_bp = floor(CVT_MIN_VSYNC_BP / h_period_est) + 1; @@ -219,7 +219,7 @@ timings edid_state::calc_cvt_mode(unsigned h_pixels, unsigned v_lines, t.vborder = vert_margin; t.rb = rb; if (alt && (rb == RB_CVT_V2 || rb == RB_CVT_V3)) - t.rb |= RB_FLAG; + t.rb |= RB_ALT; t.pos_pol_hsync = t.rb; t.pos_pol_vsync = !t.rb; calc_ratio(&t); @@ -231,8 +231,8 @@ void edid_state::edid_cvt_mode(unsigned refresh, struct timings &t) unsigned hratio = t.hratio; unsigned vratio = t.vratio; - t = calc_cvt_mode(t.hact, t.vact, refresh, t.rb & ~RB_FLAG, t.interlaced, - false, t.rb & RB_FLAG); + t = calc_cvt_mode(t.hact, t.vact, refresh, t.rb & ~RB_ALT, t.interlaced, + false, t.rb & RB_ALT); t.hratio = hratio; t.vratio = vratio; } diff --git a/edid-decode.cpp b/edid-decode.cpp index 1470406..78119ae 100644 --- a/edid-decode.cpp +++ b/edid-decode.cpp @@ -502,9 +502,9 @@ bool edid_state::print_timings(const char *prefix, const struct timings *t, double refresh = (double)t->pixclk_khz * 1000.0 / (htotal * vtotal); std::string s; - unsigned rb = t->rb & ~RB_FLAG; + unsigned rb = t->rb & ~RB_ALT; if (rb) { - bool alt = t->rb & RB_FLAG; + bool alt = t->rb & RB_ALT; s = "RB"; // Mark RB_CVT_V3 as preliminary since CVT 1.3 has not been // released yet. @@ -1309,7 +1309,7 @@ static void parse_cvt(char *optarg) { unsigned w = 0, h = 0; double fps = 0; - unsigned rb = 0; + unsigned rb = RB_NONE; bool interlaced = false; bool alt = false; bool overscan = false; diff --git a/edid-decode.h b/edid-decode.h index cadcff4..e62c2ec 100644 --- a/edid-decode.h +++ b/edid-decode.h @@ -22,17 +22,30 @@ #define EDID_PAGE_SIZE 128U #define EDID_MAX_BLOCKS 256U -#define RB_FLAG (1U << 7) +#define RB_ALT (1U << 7) -#define RB_CVT_V1 (1) -#define RB_CVT_V2 (2) -#define RB_CVT_V3 (3) -#define RB_GTF (4) +#define RB_NONE (0U) +#define RB_CVT_V1 (1U) +#define RB_CVT_V2 (2U) +#define RB_CVT_V3 (3U) +#define RB_GTF (4U) // Video Timings // If interlaced is true, then the vertical blanking // for each field is (vfp + vsync + vbp + 0.5), except for // the VIC 39 timings that doesn't have the 0.5 constant. +// +// The sequence of the various video parameters is as follows: +// +// border - front porch - sync - back porch - border - active video +// +// Note: this is slightly different from EDID 1.4 which calls +// 'active video' as 'addressable video' and the EDID 1.4 term +// 'active video' includes the borders. +// +// But since borders are rarely used, the term 'active video' will +// typically be the same as 'addressable video', and that's how I +// use it. struct timings { // Active horizontal and vertical frame height, excluding any // borders, if present. @@ -43,8 +56,9 @@ struct timings { // 0: no reduced blanking // 1: CVT reduced blanking version 1 // 2: CVT reduced blanking version 2 - // 3: CVT reduced blanking version 3 with a horizontal blank of 80 - // 3 | RB_FLAG: CVT reduced blanking version 3 with a horizontal blank of 160 + // 2 | RB_ALT: CVT reduced blanking version 2 video-optimized (1000/1001 fps) + // 3: CVT reduced blanking version 3 + // 3 | RB_ALT: v3 with a horizontal blank of 160 // 4: GTF Secondary Curve unsigned rb; bool interlaced; diff --git a/parse-displayid-block.cpp b/parse-displayid-block.cpp index a1c0eee..b11b0c5 100644 --- a/parse-displayid-block.cpp +++ b/parse-displayid-block.cpp @@ -336,7 +336,7 @@ void edid_state::parse_displayid_type_1_7_timing(const unsigned char *x, unsigned vtot = t.vact + t.vfp + t.vsync + t.vbp; unsigned refresh = (t.pixclk_khz * 1000ULL) / (htot * vtot); - for (unsigned rb = 0; rb <= RB_CVT_V3; rb++) { + for (unsigned rb = RB_NONE; rb <= RB_CVT_V3; rb++) { timings cvt_t = calc_cvt_mode(t.hact, t.vact, refresh, rb); if (match_timings(t, cvt_t)) { fail("This T7VTDB can be represented as a T10VTDB.\n"); @@ -462,7 +462,7 @@ void edid_state::parse_displayid_type_3_timing(const unsigned char *x) break; } - t.rb = ((x[0] & 0x70) >> 4) == 1 ? RB_CVT_V1 : 0; + t.rb = ((x[0] & 0x70) >> 4) == 1 ? RB_CVT_V1 : RB_NONE; t.hact = 8 + 8 * x[1]; t.vact = t.hact * t.vratio / t.hratio; @@ -1407,10 +1407,10 @@ void edid_state::parse_displayid_type_10_timing(const unsigned char *x, bool is_ if (x[0] & 0x10) { if (t.rb == RB_CVT_V2) { s += ", refresh rate * (1000/1001) supported"; - t.rb |= RB_FLAG; + t.rb |= RB_ALT; } else if (t.rb == RB_CVT_V3) { s += ", hblank is 160 pixels"; - t.rb |= RB_FLAG; + t.rb |= RB_ALT; } else { fail("VR_HB must be 0.\n"); } |