aboutsummaryrefslogtreecommitdiffstats
path: root/calc-gtf-cvt.cpp
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2021-06-26 10:39:39 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2021-06-26 10:39:39 +0200
commit6e6c6cec0e50e21146a4348a4f8d63be53118bda (patch)
tree949ce5aba45bd881b80a47e7704e8e5e00091435 /calc-gtf-cvt.cpp
parentb68fa01af15c31a794cfb60d1865a0b694ad3225 (diff)
edid-decode: fix the CVT vertical backporch calculation
For CVT without reduced blanking and for CVT with RBv1 the vertical backporch must be 7 lines or more. For RBv2 and RBv3 it is fixed to 6 lines. This follows the text in the CVT specification. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Diffstat (limited to 'calc-gtf-cvt.cpp')
-rw-r--r--calc-gtf-cvt.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/calc-gtf-cvt.cpp b/calc-gtf-cvt.cpp
index 36f89f2..9cd6e5e 100644
--- a/calc-gtf-cvt.cpp
+++ b/calc-gtf-cvt.cpp
@@ -119,7 +119,10 @@ void edid_state::edid_gtf_mode(unsigned refresh, struct timings &t)
#define CVT_MIN_VSYNC_BP 550.0
#define CVT_MIN_V_PORCH 3
-#define CVT_MIN_V_BPORCH 6
+/* Minimum vertical backporch for CVT and CVT RBv1 */
+#define CVT_MIN_V_BPORCH 7
+/* Fixed vertical backporch for CVT RBv2 and RBv3 */
+#define CVT_FIXED_V_BPORCH 6
#define CVT_C_PRIME 30.0
#define CVT_M_PRIME 300.0
#define CVT_RB_MIN_VBLANK 460.0
@@ -208,13 +211,14 @@ 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 + CVT_MIN_V_BPORCH;
+ double rb_min_vbi = rb_v_fporch + v_sync +
+ (rb == RB_CVT_V1 ? CVT_MIN_V_BPORCH : CVT_FIXED_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_V1)
v_sync_bp = v_blank - rb_v_fporch;
else
- v_sync_bp = v_sync + CVT_MIN_V_BPORCH;
+ v_sync_bp = v_sync + CVT_FIXED_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)

Privacy Policy