This is an automatic generated email to let you know that the following patch 
were queued:

Subject: edid-decode: incorporate CVT 2.1 changes
Author:  Hans Verkuil <hverkuil-ci...@xs4all.nl>
Date:    Wed Jul 3 08:57:00 2024 +0200

Added support for CVT 2.1.

Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 calc-gtf-cvt.cpp | 17 ++++++++++++++---
 edid-decode.1    |  2 +-
 edid-decode.cpp  |  2 +-
 3 files changed, 16 insertions(+), 5 deletions(-)

---

diff --git a/calc-gtf-cvt.cpp b/calc-gtf-cvt.cpp
index 7d53ad9625a1..9bf31437b96d 100644
--- a/calc-gtf-cvt.cpp
+++ b/calc-gtf-cvt.cpp
@@ -126,6 +126,7 @@ void edid_state::edid_gtf_mode(unsigned refresh, struct 
timings &t)
 #define CVT_C_PRIME 30.0
 #define CVT_M_PRIME 300.0
 #define CVT_RB_MIN_VBLANK 460.0
+#define CVT_RB_ALT_MIN_VBLANK 300.0
 
 // If rb == RB_CVT_V2, then alt means video-optimized (i.e. 59.94 instead of 
60 Hz, etc.).
 // If rb == RB_CVT_V3, then alt means that rb_h_blank is 160 instead of 80.
@@ -140,8 +141,15 @@ 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;
+       if (rb == RB_CVT_V3) {
+               if (rb_v_blank < CVT_RB_ALT_MIN_VBLANK)
+                       rb_v_blank = CVT_RB_ALT_MIN_VBLANK;
+               else if (rb_v_blank > CVT_RB_ALT_MIN_VBLANK + 140 &&
+                        rb_v_blank < CVT_RB_MIN_VBLANK)
+                       rb_v_blank = CVT_RB_MIN_VBLANK;
+               else if (rb_v_blank > CVT_RB_MIN_VBLANK + 460)
+                       rb_v_blank = CVT_RB_MIN_VBLANK + 460;
+       }
 
        double cell_gran = rb == RB_CVT_V2 ? 1 : CELL_GRAN;
        double h_pixels_rnd = floor(h_pixels / cell_gran) * cell_gran;
@@ -213,8 +221,11 @@ timings edid_state::calc_cvt_mode(unsigned h_pixels, 
unsigned v_lines,
                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)
+               if (rb == RB_CVT_V3 && early_vsync_rqd) {
                        rb_v_bporch = floor(vbi_lines / 2.0);
+                       if (v_blank - rb_v_bporch - v_sync < rb_v_fporch)
+                               rb_v_bporch = v_blank - v_sync - rb_v_fporch;
+               }
                if (rb == RB_CVT_V1)
                        v_sync_bp = v_blank - rb_v_fporch;
                else
diff --git a/edid-decode.1 b/edid-decode.1
index 63509b42f799..2f5c4fe781ef 100644
--- a/edid-decode.1
+++ b/edid-decode.1
@@ -150,7 +150,7 @@ The following related standards are also used by 
edid-decode:
 .TP
 DMT 1.3: VESA and Industry Standards and Guidelines for Computer Display 
Monitor Timing (DMT), Version 1.0, Rev. 13
 .TP
-CVT 2.0: VESA Coordinated Video Timings (CVT) Standard, Version 2.0
+CVT 2.1: VESA Coordinated Video Timings (CVT) Standard, Version 2.1
 .TP
 CVT 1.2: VESA Coordinated Video Timings (CVT) Standard, Version 1.2
 .TP
diff --git a/edid-decode.cpp b/edid-decode.cpp
index 48e5c4d51eb8..ce4f1fd5a4af 100644
--- a/edid-decode.cpp
+++ b/edid-decode.cpp
@@ -170,7 +170,7 @@ static void usage(void)
               "                        If 'hblank' is given and <rb>=3, then 
the horizontal blanking\n"
               "                        is <hblank> pixels (range of 80-200), 
overriding 'alt'.\n"
               "                        If 'vblank' is given and <rb>=3, then 
the vertical blanking\n"
-              "                        time is <vblank> microseconds (range of 
460-705).\n"
+              "                        time is <vblank> microseconds (range of 
460-705 or 300-440).\n"
               "                        If 'early-vsync' is given and <rb=3>, 
then select early vsync.\n"
               "  --gtf 
w=<width>,h=<height>[,fps=<fps>][,horfreq=<horfreq>][,pixclk=<pixclk>][,interlaced]\n"
               "        
[,overscan][,secondary][,C=<c>][,M=<m>][,K=<k>][,J=<j>]\n"

Reply via email to