[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Git][xorg-team/lib/libxcvt][upstream-unstable] 7 commits: Fix hsync_start computation



Title: GitLab

Timo Aaltonen pushed to branch upstream-unstable at X Strike Force / lib / libxcvt

Commits:

  • 26164df0
    by nyanpasu64 at 2023-05-02T18:20:29-07:00
    Fix hsync_start computation
    
    The CVT v1.2 specification says, in section 3.4.1 "Standard CRT-based
    Timing":
    
    > The Horizontal Sync Pulse duration will in all cases be set as closely
    > as possible to 8% of the Total Horizontal time, rounded down to the
    > nearest cell width.
    
    The previous code achieved this by first setting mode_info->hsync_end to
    a multiple of the cell width, then calculating mode_info->hsync_start
    and rounding its position up to a cell width. However, if
    mode_info->hsync_start was already a multiple of 8 (for example on
    640x480@60), the rounding code would erroneously add 8 to it, shortening
    the hsync duration by 8 pixels.
    
    This commit fixes the bug by calculating and rounding the sync width
    separately, closer to the specification's wording.
    
    Signed-off-by: nyanpasu64 <nyanpasu64@tuta.io>
    Closes: https://gitlab.freedesktop.org/xorg/lib/libxcvt/-/issues/6
    Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
    
  • e1c7adb0
    by nyanpasu64 at 2023-05-05T10:30:45+00:00
    Fix too-small back porch at very low resolutions
    
    Previously the code erroneously used CVT_MIN_V_PORCH=3 instead of the
    specified CVT_MIN_V_BPORCH=6, when calculating the minimum size of the
    back porch in scanlines. As a result, when generating 320x240@60, the
    vtotal would be be incorrectly set to 252 instead of 253.
    
    This commit fixes the typo.
    
    Signed-off-by: nyanpasu64 <nyanpasu64@tuta.io>
    Closes: https://gitlab.freedesktop.org/xorg/lib/libxcvt/-/issues/7
    Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
    
  • 55aa4ae7
    by nyanpasu64 at 2023-05-05T10:30:45+00:00
    Rename constant to CVT_MIN_V_PORCH_RND
    
    Signed-off-by: nyanpasu64 <nyanpasu64@tuta.io>
    
  • 0adc5fc8
    by Peter Hutterer at 2024-07-22T16:23:38+10:00
    README: remove double dollar sign
    
    We're not getting paid enough to use that many dollars.
    
    Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxcvt/-/merge_requests/15>
    
  • 922c7e1f
    by Olivier Fourdan at 2024-07-22T07:07:18+00:00
    ci: Update CI and enable static analysis
    
    Update the CI to add the template Security/SAST.gitlab-ci.yml as most of
    the other xorg projects do.
    
    Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
    Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxcvt/-/merge_requests/12>
    
  • 0e3d127e
    by Alan Coopersmith at 2024-09-30T13:32:08-07:00
    cvt: fix -Wmissing-prototypes warning for cvt_is_standard
    
    ../cvt/cvt.c:34:1: warning: no previous prototype for ‘cvt_is_standard’ [-Wmissing-prototypes]
       34 | cvt_is_standard(int hdisplay, int vdisplay, float vrefresh, bool reduced, bool verbose)
          | ^~~~~~~~~~~~~~~
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    
  • dd8631c6
    by Alan Coopersmith at 2024-12-13T17:42:24-08:00
    libxcvt 0.1.3
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
    

7 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -18,11 +18,13 @@ include:
    18 18
         file:
    
    19 19
           - '/templates/ci-fairy.yml'
    
    20 20
           - '/templates/fedora.yml'
    
    21
    +  - template: Security/SAST.gitlab-ci.yml
    
    21 22
     
    
    22 23
     stages:
    
    23 24
       - sanity check
    
    24 25
       - prep
    
    25 26
       - build
    
    27
    +  - test
    
    26 28
     
    
    27 29
     variables:
    
    28 30
       FDO_UPSTREAM_REPO: xorg/lib/libxcvt
    
    ... ... @@ -91,7 +93,7 @@ check-merge-request:
    91 93
     .fedora.34:
    
    92 94
       variables:
    
    93 95
         FDO_DISTRIBUTION_VERSION: '34'
    
    94
    -    FDO_DISTRIBUTION_TAG: '2021-07-26.0'
    
    96
    +    FDO_DISTRIBUTION_TAG: '2022-08-03.0'
    
    95 97
     
    
    96 98
     prep-fedora-34:
    
    97 99
       extends:
    

  • .gitlab-ci/ci.template
    ... ... @@ -22,11 +22,13 @@ include:
    22 22
         {% for d in distributions %}
    
    23 23
           - '/templates/{{d.name}}.yml'
    
    24 24
         {% endfor %}
    
    25
    +  - template: Security/SAST.gitlab-ci.yml
    
    25 26
     
    
    26 27
     stages:
    
    27 28
       - sanity check
    
    28 29
       - prep
    
    29 30
       - build
    
    31
    +  - test
    
    30 32
     
    
    31 33
     variables:
    
    32 34
       FDO_UPSTREAM_REPO: xorg/lib/libxcvt
    

  • .gitlab-ci/config.yml
    1
    -.default_tag: &default_tag '2021-07-26.0'
    
    1
    +.default_tag: &default_tag '2022-08-03.0'
    
    2 2
     
    
    3 3
     distributions:
    
    4 4
       - name: fedora
    

  • README.md
    ... ... @@ -11,7 +11,7 @@ replacement to the version provided by the `Xorg` server.
    11 11
     An example output is:
    
    12 12
     
    
    13 13
     ```
    
    14
    -$ $ cvt --verbose 1920 1200 75
    
    14
    +$ cvt --verbose 1920 1200 75
    
    15 15
     # 1920x1200 74.93 Hz (CVT 2.30MA) hsync: 94.04 kHz; pclk: 245.25 MHz
    
    16 16
     Modeline "1920x1200_75.00"  245.25  1920 2064 2264 2608  1200 1203 1209 1255 -hsync +vsync
    
    17 17
     ```
    

  • cvt/cvt.c
    ... ... @@ -30,7 +30,7 @@
    30 30
     
    
    31 31
     #include <libxcvt/libxcvt.h>
    
    32 32
     
    
    33
    -bool
    
    33
    +static bool
    
    34 34
     cvt_is_standard(int hdisplay, int vdisplay, float vrefresh, bool reduced, bool verbose)
    
    35 35
     {
    
    36 36
         bool is_cvt = true;
    

  • lib/libxcvt.c
    ... ... @@ -79,8 +79,8 @@ libxcvt_gen_mode_info(int hdisplay, int vdisplay, float vrefresh, bool reduced,
    79 79
         /* 2) character cell horizontal granularity (pixels) - default 8 */
    
    80 80
     #define CVT_H_GRANULARITY 8
    
    81 81
     
    
    82
    -    /* 4) Minimum vertical porch (lines) - default 3 */
    
    83
    -#define CVT_MIN_V_PORCH 3
    
    82
    +    /* 4) Minimum vertical front porch (lines) - default 3 */
    
    83
    +#define CVT_MIN_V_PORCH_RND 3
    
    84 84
     
    
    85 85
         /* 4) Minimum number of vertical back porch lines - default 6 */
    
    86 86
     #define CVT_MIN_V_BPORCH 6
    
    ... ... @@ -161,16 +161,16 @@ libxcvt_gen_mode_info(int hdisplay, int vdisplay, float vrefresh, bool reduced,
    161 161
     
    
    162 162
             float hblank_percentage;
    
    163 163
             int vsync_and_back_porch, vback_porch;
    
    164
    -        int hblank;
    
    164
    +        int hblank, hsync_w;
    
    165 165
     
    
    166 166
             /* 8. Estimated Horizontal period */
    
    167 167
             hperiod = ((float) (1000000.0 / vfield_rate - CVT_MIN_VSYNC_BP)) /
    
    168
    -            (vdisplay_rnd + 2 * vmargin + CVT_MIN_V_PORCH + interlace);
    
    168
    +            (vdisplay_rnd + 2 * vmargin + CVT_MIN_V_PORCH_RND + interlace);
    
    169 169
     
    
    170 170
             /* 9. Find number of lines in sync + backporch */
    
    171 171
             if (((int) (CVT_MIN_VSYNC_BP / hperiod) + 1) <
    
    172
    -            (vsync + CVT_MIN_V_PORCH))
    
    173
    -            vsync_and_back_porch = vsync + CVT_MIN_V_PORCH;
    
    172
    +            (vsync + CVT_MIN_V_BPORCH))
    
    173
    +            vsync_and_back_porch = vsync + CVT_MIN_V_BPORCH;
    
    174 174
             else
    
    175 175
                 vsync_and_back_porch = (int) (CVT_MIN_VSYNC_BP / hperiod) + 1;
    
    176 176
     
    
    ... ... @@ -181,7 +181,7 @@ libxcvt_gen_mode_info(int hdisplay, int vdisplay, float vrefresh, bool reduced,
    181 181
             /* 11. Find total number of lines in vertical field */
    
    182 182
             mode_info->vtotal =
    
    183 183
                 vdisplay_rnd + 2 * vmargin + vsync_and_back_porch + interlace +
    
    184
    -            CVT_MIN_V_PORCH;
    
    184
    +            CVT_MIN_V_PORCH_RND;
    
    185 185
     
    
    186 186
             /* 5) Definition of Horizontal blanking time limitation */
    
    187 187
             /* Gradient (%/kHz) - default 600 */
    
    ... ... @@ -216,13 +216,12 @@ libxcvt_gen_mode_info(int hdisplay, int vdisplay, float vrefresh, bool reduced,
    216 216
             /* Fill in HSync values */
    
    217 217
             mode_info->hsync_end = mode_info->hdisplay + hblank / 2;
    
    218 218
     
    
    219
    -        mode_info->hsync_start = mode_info->hsync_end -
    
    220
    -            (mode_info->htotal * CVT_HSYNC_PERCENTAGE) / 100;
    
    221
    -        mode_info->hsync_start += CVT_H_GRANULARITY -
    
    222
    -            mode_info->hsync_start % CVT_H_GRANULARITY;
    
    219
    +        hsync_w = (mode_info->htotal * CVT_HSYNC_PERCENTAGE) / 100;
    
    220
    +        hsync_w -= hsync_w % CVT_H_GRANULARITY;
    
    221
    +        mode_info->hsync_start = mode_info->hsync_end - hsync_w;
    
    223 222
     
    
    224 223
             /* Fill in vsync values */
    
    225
    -        mode_info->vsync_start = mode_info->vdisplay + CVT_MIN_V_PORCH;
    
    224
    +        mode_info->vsync_start = mode_info->vdisplay + CVT_MIN_V_PORCH_RND;
    
    226 225
             mode_info->vsync_end = mode_info->vsync_start + vsync;
    
    227 226
     
    
    228 227
         }
    

  • meson.build
    1 1
     project('libxcvt', 'c',
    
    2
    -        version: '0.1.2',
    
    2
    +        version: '0.1.3',
    
    3 3
             meson_version: '>= 0.40.0',
    
    4 4
             default_options: ['warning_level=1',
    
    5 5
                               'buildtype=debugoptimized'])
    


  • Reply to: