aboutsummaryrefslogtreecommitdiffstats
path: root/calc-gtf-cvt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'calc-gtf-cvt.cpp')
-rw-r--r--calc-gtf-cvt.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/calc-gtf-cvt.cpp b/calc-gtf-cvt.cpp
index 9cd6e5e..dc22ad5 100644
--- a/calc-gtf-cvt.cpp
+++ b/calc-gtf-cvt.cpp
@@ -132,7 +132,7 @@ void edid_state::edid_gtf_mode(unsigned refresh, struct timings &t)
timings edid_state::calc_cvt_mode(unsigned h_pixels, unsigned v_lines,
double ip_freq_rqd, unsigned rb, bool int_rqd,
bool margins_rqd, bool alt, unsigned rb_h_blank,
- double add_vert_time)
+ unsigned rb_v_blank, bool early_vsync_rqd)
{
timings t = {};
@@ -140,6 +140,9 @@ timings edid_state::calc_cvt_mode(unsigned h_pixels, unsigned v_lines,
t.vact = v_lines;
t.interlaced = int_rqd;
+ if (rb_v_blank < CVT_RB_MIN_VBLANK)
+ rb_v_blank = CVT_RB_MIN_VBLANK;
+
double cell_gran = rb == RB_CVT_V2 ? 1 : CELL_GRAN;
double h_pixels_rnd = floor(h_pixels / cell_gran) * cell_gran;
double v_lines_rnd = int_rqd ? floor(v_lines / 2.0) : v_lines;
@@ -153,7 +156,7 @@ timings edid_state::calc_cvt_mode(unsigned h_pixels, unsigned v_lines,
double h_blank = (rb == RB_CVT_V1 || (rb == RB_CVT_V3 && alt)) ? 160 : 80;
double rb_v_fporch = rb == RB_CVT_V1 ? 3 : 1;
double refresh_multiplier = (rb == RB_CVT_V2 && alt) ? 1000.0 / 1001.0 : 1;
- double rb_min_vblank = CVT_RB_MIN_VBLANK;
+ double rb_min_vblank = rb == RB_CVT_V3 ? rb_v_blank : CVT_RB_MIN_VBLANK;
double h_sync = 32;
double v_sync;
@@ -161,11 +164,6 @@ timings edid_state::calc_cvt_mode(unsigned h_pixels, unsigned v_lines,
double v_blank;
double v_sync_bp;
- if (rb == RB_CVT_V3 && add_vert_time) {
- if (add_vert_time + rb_min_vblank <= 1000000.0 / ip_freq_rqd / 4.0)
- rb_min_vblank += add_vert_time;
- }
-
if (rb == RB_CVT_V3 && rb_h_blank) {
h_blank = rb_h_blank & ~7;
if (h_blank < 80)
@@ -211,14 +209,16 @@ timings edid_state::calc_cvt_mode(unsigned h_pixels, unsigned v_lines,
double h_period_est = ((1000000.0 / v_field_rate_rqd) - rb_min_vblank) /
(v_lines_rnd + vert_margin * 2);
double vbi_lines = floor(rb_min_vblank / h_period_est) + 1;
- double rb_min_vbi = rb_v_fporch + v_sync +
- (rb == RB_CVT_V1 ? CVT_MIN_V_BPORCH : CVT_FIXED_V_BPORCH);
+ double rb_v_bporch = (rb == RB_CVT_V1 ? CVT_MIN_V_BPORCH : CVT_FIXED_V_BPORCH);
+ double rb_min_vbi = rb_v_fporch + v_sync + rb_v_bporch;
v_blank = vbi_lines < rb_min_vbi ? rb_min_vbi : vbi_lines;
double total_v_lines = v_blank + v_lines_rnd + vert_margin * 2 + interlace;
+ if (rb == RB_CVT_V3 && early_vsync_rqd)
+ rb_v_bporch = floor(vbi_lines / 2.0);
if (rb == RB_CVT_V1)
v_sync_bp = v_blank - rb_v_fporch;
else
- v_sync_bp = v_sync + CVT_FIXED_V_BPORCH;
+ v_sync_bp = v_sync + rb_v_bporch;
double total_pixels = h_blank + total_active_pixels;
double freq = v_field_rate_rqd * total_v_lines * total_pixels * refresh_multiplier;
if (rb == RB_CVT_V3)
@@ -249,13 +249,13 @@ timings edid_state::calc_cvt_mode(unsigned h_pixels, unsigned v_lines,
}
void edid_state::edid_cvt_mode(unsigned refresh, struct timings &t, unsigned rb_h_blank,
- double add_vert_time)
+ unsigned rb_v_blank, bool early_vsync_rqd)
{
unsigned hratio = t.hratio;
unsigned vratio = t.vratio;
t = calc_cvt_mode(t.hact, t.vact, refresh, t.rb & ~RB_ALT, t.interlaced,
- false, t.rb & RB_ALT, rb_h_blank, add_vert_time);
+ false, t.rb & RB_ALT, rb_h_blank, rb_v_blank, early_vsync_rqd);
t.hratio = hratio;
t.vratio = vratio;
}

Privacy Policy