aboutsummaryrefslogtreecommitdiffstats
path: root/calc-gtf-cvt.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-10-12 11:39:53 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-10-12 11:39:53 +0200
commit985024f0ccb7eb0014397f2d562ecebfdd340c3b (patch)
treed1add05516e6122b60d8c524c33b40b40136228a /calc-gtf-cvt.cpp
parentb85a0568e388ef51c444de4ccc724eb76b84c967 (diff)
edid-decode: add CVT 2.0 vblank support
With CVT 2.0 you can select the vertical blank time as input parameter to the calculation. Range 460-705 (higher might not work). Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'calc-gtf-cvt.cpp')
-rw-r--r--calc-gtf-cvt.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/calc-gtf-cvt.cpp b/calc-gtf-cvt.cpp
index 4ce098e..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,
- bool early_vsync_rqd)
+ 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;
@@ -246,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,
- bool early_vsync_rqd)
+ 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, early_vsync_rqd);
+ false, t.rb & RB_ALT, rb_h_blank, rb_v_blank, early_vsync_rqd);
t.hratio = hratio;
t.vratio = vratio;
}

Privacy Policy