diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-10-27 16:09:59 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2021-10-27 16:09:59 +0000 |
commit | 54b04809c2a999bbdd04887a3fd87ba4bc6fd0c8 (patch) | |
tree | 5e7116769e941a95d349c3e70f91beecc38579a7 /lib | |
parent | 8171a39099b23abfe93455450a309bc9c7d732c2 (diff) |
oops typo in path
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcvt/.gitlab-ci.yml | 110 | ||||
-rw-r--r-- | lib/libcvt/.gitlab-ci/ci.template | 116 | ||||
-rw-r--r-- | lib/libcvt/.gitlab-ci/config.yml | 9 | ||||
-rwxr-xr-x | lib/libcvt/.gitlab-ci/meson-build.sh | 48 | ||||
-rw-r--r-- | lib/libcvt/COPYING | 67 | ||||
-rw-r--r-- | lib/libcvt/README.md | 36 | ||||
-rw-r--r-- | lib/libcvt/cvt/cvt.c | 257 | ||||
-rw-r--r-- | lib/libcvt/cvt/meson.build | 10 | ||||
-rw-r--r-- | lib/libcvt/include/libxcvt/libxcvt.h | 46 | ||||
-rw-r--r-- | lib/libcvt/include/libxcvt/libxcvt_mode.h | 56 | ||||
-rw-r--r-- | lib/libcvt/include/libxcvt/meson.build | 1 | ||||
-rw-r--r-- | lib/libcvt/include/meson.build | 1 | ||||
-rw-r--r-- | lib/libcvt/lib/libxcvt.c | 301 | ||||
-rw-r--r-- | lib/libcvt/lib/meson.build | 6 | ||||
-rw-r--r-- | lib/libcvt/man/cvt.man | 41 | ||||
-rw-r--r-- | lib/libcvt/man/meson.build | 12 | ||||
-rw-r--r-- | lib/libcvt/meson.build | 28 |
17 files changed, 0 insertions, 1145 deletions
diff --git a/lib/libcvt/.gitlab-ci.yml b/lib/libcvt/.gitlab-ci.yml deleted file mode 100644 index 4fcacf4c1..000000000 --- a/lib/libcvt/.gitlab-ci.yml +++ /dev/null @@ -1,110 +0,0 @@ - -##################################################### -# # -# THIS FILE IS GENERATED, DO NOT EDIT! # -# # -# Generated with "ci-fairy generate-template", edit # -# .gitlab-ci/ci.template and .gitlab-ci/config.yml # -# and rerun "ci-fairy generate-template" to change # -# this file. # -# # -##################################################### - -.templates_sha: &template_sha 3d03cccd770c04e63b40325b42223495274d6a1d - -include: - - project: 'freedesktop/ci-templates' - ref: *template_sha - file: - - '/templates/ci-fairy.yml' - - '/templates/fedora.yml' - -stages: - - sanity check - - prep - - build - -variables: - FDO_UPSTREAM_REPO: xorg/lib/libxcvt - MESON_BUILDDIR: "builddir" - NINJA_ARGS: '' - MESON_ARGS: '' - MESON_TEST_ARGS: '' - GIT_DEPTH: 1 - -.policy: - retry: - max: 2 - when: - - runner_system_failure - - stuck_or_timeout_failure - # cancel run when a newer version is pushed to the branch - interruptible: true - - -# Re-generate the CI script and make sure it's the one currently checked in -# If this job fails, re-generate the gitlab-ci.yml script, see -# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py -# -check-ci-script: - extends: - - .fdo.ci-fairy - stage: sanity check - script: - - ci-fairy generate-template --verify && exit 0 || true - - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify" - - exit 1 - -# -# Verify that commit messages are as expected, signed-off, etc. -# -check-commit: - extends: - - .fdo.ci-fairy - stage: sanity check - script: - - ci-fairy check-commits --signed-off-by --junit-xml=results.xml - except: - - master@xorg/lib/libxcvt - variables: - GIT_DEPTH: 100 - artifacts: - reports: - junit: results.xml - -# -# Verify that merge request has the "allow collaboration" checkbox ticked -# -check-merge-request: - extends: - - .fdo.ci-fairy - stage: sanity check - script: - - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml - artifacts: - when: on_failure - reports: - junit: results.xml - allow_failure: true - - -.fedora.34: - variables: - FDO_DISTRIBUTION_VERSION: '34' - FDO_DISTRIBUTION_TAG: '2021-07-26.0' - -prep-fedora-34: - extends: - - .fdo.container-build@fedora - - .fedora.34 - stage: prep - variables: - FDO_DISTRIBUTION_PACKAGES: "meson gcc" - -build-fedora-34: - extends: - - .fdo.distribution-image@fedora - - .fedora.34 - stage: build - script: - - .gitlab-ci/meson-build.sh diff --git a/lib/libcvt/.gitlab-ci/ci.template b/lib/libcvt/.gitlab-ci/ci.template deleted file mode 100644 index 465c65342..000000000 --- a/lib/libcvt/.gitlab-ci/ci.template +++ /dev/null @@ -1,116 +0,0 @@ -{# You're looking at the template here, so you can ignore the below - warning. This is the right file to edit #} - -##################################################### -# # -# THIS FILE IS GENERATED, DO NOT EDIT! # -# # -# Generated with "ci-fairy generate-template", edit # -# .gitlab-ci/ci.template and .gitlab-ci/config.yml # -# and rerun "ci-fairy generate-template" to change # -# this file. # -# # -##################################################### - -.templates_sha: &template_sha 3d03cccd770c04e63b40325b42223495274d6a1d - -include: - - project: 'freedesktop/ci-templates' - ref: *template_sha - file: - - '/templates/ci-fairy.yml' - {% for d in distributions %} - - '/templates/{{d.name}}.yml' - {% endfor %} - -stages: - - sanity check - - prep - - build - -variables: - FDO_UPSTREAM_REPO: xorg/lib/libxcvt - MESON_BUILDDIR: "builddir" - NINJA_ARGS: '' - MESON_ARGS: '' - MESON_TEST_ARGS: '' - GIT_DEPTH: 1 - -.policy: - retry: - max: 2 - when: - - runner_system_failure - - stuck_or_timeout_failure - # cancel run when a newer version is pushed to the branch - interruptible: true - - -# Re-generate the CI script and make sure it's the one currently checked in -# If this job fails, re-generate the gitlab-ci.yml script, see -# $SRCDIR/.gitlab-ci/generate-gitlab-ci.py -# -check-ci-script: - extends: - - .fdo.ci-fairy - stage: sanity check - script: - - ci-fairy generate-template --verify && exit 0 || true - - echo "Committed gitlab-ci.yml differs from generated gitlab-ci.yml. Please verify" - - exit 1 - -# -# Verify that commit messages are as expected, signed-off, etc. -# -check-commit: - extends: - - .fdo.ci-fairy - stage: sanity check - script: - - ci-fairy check-commits --signed-off-by --junit-xml=results.xml - except: - - master@xorg/lib/libxcvt - variables: - GIT_DEPTH: 100 - artifacts: - reports: - junit: results.xml - -# -# Verify that merge request has the "allow collaboration" checkbox ticked -# -check-merge-request: - extends: - - .fdo.ci-fairy - stage: sanity check - script: - - ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml - artifacts: - when: on_failure - reports: - junit: results.xml - allow_failure: true - -{% for d in distributions %} - -.{{d.name}}.{{d.version}}: - variables: - FDO_DISTRIBUTION_VERSION: '{{d.version}}' - FDO_DISTRIBUTION_TAG: '{{d.tag}}' - -prep-{{d.name}}-{{d.version}}: - extends: - - .fdo.container-build@{{d.name}} - - .{{d.name}}.{{d.version}} - stage: prep - variables: - FDO_DISTRIBUTION_PACKAGES: "{{' '.join(d.packages)}}" - -build-{{d.name}}-{{d.version}}: - extends: - - .fdo.distribution-image@{{d.name}} - - .{{d.name}}.{{d.version}} - stage: build - script: - - .gitlab-ci/meson-build.sh -{% endfor %} diff --git a/lib/libcvt/.gitlab-ci/config.yml b/lib/libcvt/.gitlab-ci/config.yml deleted file mode 100644 index 26c50e7a0..000000000 --- a/lib/libcvt/.gitlab-ci/config.yml +++ /dev/null @@ -1,9 +0,0 @@ -.default_tag: &default_tag '2021-07-26.0' - -distributions: - - name: fedora - tag: *default_tag - version: 34 - packages: - - meson - - gcc diff --git a/lib/libcvt/.gitlab-ci/meson-build.sh b/lib/libcvt/.gitlab-ci/meson-build.sh deleted file mode 100755 index 50b84b018..000000000 --- a/lib/libcvt/.gitlab-ci/meson-build.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -if [[ -f .meson_environment ]]; then - . .meson_environment -fi - -if [[ -z "$MESON_BUILDDIR" ]]; then - echo "\$MESON_BUILDDIR undefined." - exit 1 -fi - -# emulate a few gitlab variables to make it easier to -# run and debug locally. -if [[ -z "$CI_JOB_ID" ]] || [[ -z "$CI_JOB_NAME" ]] || [[ -z "$CI_PROJECT_NAME" ]]; then - echo "Missing \$CI_JOB_ID or \$CI_JOB_NAME". - CI_PROJECT_NAME=$(basename $PWD) - CI_JOB_ID=$(date +%s) - CI_JOB_NAME='${CI_PROJECT_NAME}-job-local' - echo "Simulating gitlab environment: " - echo " CI_JOB_ID=$CI_JOB_ID" - echo " CI_JOB_NAME=$CI_JOB_NAME" - echo " CI_PROJECT_NAME=$CI_PROJECT_NAME" -fi - - -echo "*************************************************" -echo "builddir: $MESON_BUILDDIR" -echo "meson args: $MESON_ARGS" -echo "ninja args: $NINJA_ARGS" -echo "meson test args: $MESON_TEST_ARGS" -echo "*************************************************" - -set -e - -rm -rf "$MESON_BUILDDIR" -meson "$MESON_BUILDDIR" $MESON_ARGS -meson configure "$MESON_BUILDDIR" -ninja -C "$MESON_BUILDDIR" $NINJA_ARGS - -if [[ -z "$MESON_TEST_ARGS" ]]; then - exit 0 -fi - -# we still want to generate the reports, even if meson test fails -meson test -C "$MESON_BUILDDIR" $MESON_TEST_ARGS --print-errorlogs -exit_code=$? - -exit $exit_code diff --git a/lib/libcvt/COPYING b/lib/libcvt/COPYING deleted file mode 100644 index 274db76b2..000000000 --- a/lib/libcvt/COPYING +++ /dev/null @@ -1,67 +0,0 @@ -Copyright 2005-2006 Luc Verhaegen. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - - - -Copyright 2005-2006 Luc Verhaegen. -Copyright © 2021 Red Hat, Inc. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - - - -Copyright © 2000 Compaq Computer Corporation -Copyright © 2002 Hewlett Packard Company -Copyright © 2006 Intel Corporation -Copyright © 2008, 2021 Red Hat, Inc. - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that copyright -notice and this permission notice appear in supporting documentation, and -that the name of the copyright holders not be used in advertising or -publicity pertaining to distribution of the software without specific, -written prior permission. The copyright holders make no representations -about the suitability of this software for any purpose. It is provided "as -is" without express or implied warranty. - -THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR -CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -OF THIS SOFTWARE. diff --git a/lib/libcvt/README.md b/lib/libcvt/README.md deleted file mode 100644 index 619b354c0..000000000 --- a/lib/libcvt/README.md +++ /dev/null @@ -1,36 +0,0 @@ -libxcvt -======= - -`libxcvt` is a library providing a standalone version of the X server -implementation of the VESA CVT standard timing modelines generator. - -`libxcvt` also provides a standalone version of the command line tool -`cvt` copied from the Xorg implementation and is meant to be a direct -replacement to the version provided by the `Xorg` server. - -An example output is: - -``` -$ $ cvt --verbose 1920 1200 75 -# 1920x1200 74.93 Hz (CVT 2.30MA) hsync: 94.04 kHz; pclk: 245.25 MHz -Modeline "1920x1200_75.00" 245.25 1920 2064 2264 2608 1200 1203 1209 1255 -hsync +vsync -``` - -Building -======== - -`libxcvt` is built using [Meson](https://mesonbuild.com/) - - $ git clone https://gitlab.freedesktop.org/xorg/lib/libxcvt.git - $ cd libxcvt - $ meson build/ --prefix=... - $ ninja -C build/ install - $ cd .. - -Credit -====== - -The code base of `libxcvt` is identical to `xf86CVTMode()` therefore -all credits for `libxcvt` go to the author (Luc Verhaegen) and -contributors of `xf86CVTMode()` and the `cvt` utility as found in the -[xserver](https://gitlab.freedesktop.org/xorg/xserver/) repository. diff --git a/lib/libcvt/cvt/cvt.c b/lib/libcvt/cvt/cvt.c deleted file mode 100644 index b1aecf631..000000000 --- a/lib/libcvt/cvt/cvt.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 2005-2006 Luc Verhaegen. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - */ - -/* Standalone VESA CVT standard timing modelines generator. */ - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> - -#include <libxcvt/libxcvt.h> - -bool -cvt_is_standard(int hdisplay, int vdisplay, float vrefresh, bool reduced, bool verbose) -{ - bool is_cvt = true; - - if ((!(vdisplay % 3) && ((vdisplay * 4 / 3) == hdisplay)) || - (!(vdisplay % 9) && ((vdisplay * 16 / 9) == hdisplay)) || - (!(vdisplay % 10) && ((vdisplay * 16 / 10) == hdisplay)) || - (!(vdisplay % 4) && ((vdisplay * 5 / 4) == hdisplay)) || - (!(vdisplay % 9) && ((vdisplay * 15 / 9) == hdisplay))); - else { - if (verbose) - fprintf(stderr, "Warning: Aspect Ratio is not CVT standard.\n"); - is_cvt = false; - } - - if ((vrefresh != 50.0) && (vrefresh != 60.0) && - (vrefresh != 75.0) && (vrefresh != 85.0)) { - if (verbose) - fprintf(stderr, "Warning: Refresh Rate %.2f is not CVT standard " - "(50, 60, 75 or 85Hz).\n", vrefresh); - is_cvt = false; - } - - return is_cvt; -} -/* - * I'm not documenting --interlaced for obvious reasons, even though I did - * implement it. I also can't deny having looked at gtf here. - */ -static void -print_usage(char *Name) -{ - fprintf(stderr, "\n"); - fprintf(stderr, "usage: %s [-v|--verbose] [-r|--reduced] X Y [refresh]\n", - Name); - fprintf(stderr, "\n"); - fprintf(stderr, " -v|--verbose : Warn about CVT standard adherence.\n"); - fprintf(stderr, " -r|--reduced : Create a mode with reduced blanking " - "(default: normal blanking).\n"); - fprintf(stderr, " X : Desired horizontal resolution " - "(multiple of 8, required).\n"); - fprintf(stderr, - " Y : Desired vertical resolution (required).\n"); - fprintf(stderr, - " refresh : Desired refresh rate (default: 60.0Hz).\n"); - fprintf(stderr, "\n"); - - fprintf(stderr, "Calculates VESA CVT (Coordinated Video Timing) modelines" - " for use with X.\n"); -} - -/* - * - */ -static void -print_comment(struct libxcvt_mode_info *mode_info, bool is_cvt, bool reduced) -{ - printf("# %dx%d %.2f Hz ", mode_info->hdisplay, mode_info->vdisplay, mode_info->vrefresh); - - if (is_cvt) { - printf("(CVT %.2fM", - ((float) mode_info->hdisplay * mode_info->vdisplay) / 1000000.0); - - if (!(mode_info->vdisplay % 3) && - ((mode_info->vdisplay * 4 / 3) == mode_info->hdisplay)) - printf("3"); - else if (!(mode_info->vdisplay % 9) && - ((mode_info->vdisplay * 16 / 9) == mode_info->hdisplay)) - printf("9"); - else if (!(mode_info->vdisplay % 10) && - ((mode_info->vdisplay * 16 / 10) == mode_info->hdisplay)) - printf("A"); - else if (!(mode_info->vdisplay % 4) && - ((mode_info->vdisplay * 5 / 4) == mode_info->hdisplay)) - printf("4"); - else if (!(mode_info->vdisplay % 9) && - ((mode_info->vdisplay * 15 / 9) == mode_info->hdisplay)) - printf("9"); - - if (reduced) - printf("-R"); - - printf(") "); - } - else - printf("(CVT) "); - - printf("hsync: %.2f kHz; ", mode_info->hsync); - printf("pclk: %.2f MHz", ((float) mode_info->dot_clock) / 1000.0); - - printf("\n"); -} - -/* - * Originally grabbed from xf86Mode.c. - * - * Ignoring the actual mode_info->name, as the user will want something solid - * to grab hold of. - */ -static void -print_mode_line(struct libxcvt_mode_info *mode_info, int hdisplay, int vdisplay, float vrefresh, - bool reduced) -{ - if (reduced) - printf("Modeline \"%dx%dR\" ", hdisplay, vdisplay); - else - printf("Modeline \"%dx%d_%.2f\" ", hdisplay, vdisplay, vrefresh); - - printf("%6.2f %i %i %i %i %i %i %i %i", mode_info->dot_clock / 1000., - mode_info->hdisplay, mode_info->hsync_start, mode_info->hsync_end, mode_info->htotal, - mode_info->vdisplay, mode_info->vsync_start, mode_info->vsync_end, mode_info->vtotal); - - if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_INTERLACE) - printf(" interlace"); - if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_HSYNC_POSITIVE) - printf(" +hsync"); - if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_HSYNC_NEGATIVE) - printf(" -hsync"); - if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_VSYNC_POSITIVE) - printf(" +vsync"); - if (mode_info->mode_flags & LIBXCVT_MODE_FLAG_VSYNC_NEGATIVE) - printf(" -vsync"); - - printf("\n"); -} - -/* - * - */ -int -main(int argc, char *argv[]) -{ - struct libxcvt_mode_info *mode_info; - int hdisplay = 0, vdisplay = 0; - float vrefresh = 0.0; - bool reduced = false, verbose = false, is_cvt; - bool interlaced = false; - int n; - - if ((argc < 3) || (argc > 7)) { - print_usage(argv[0]); - return 1; - } - - /* This doesn't filter out bad flags properly. Bad flags get passed down - * to atoi/atof, which then return 0, so that these variables can get - * filled next time round. So this is just a cosmetic problem. - */ - for (n = 1; n < argc; n++) { - if (!strcmp(argv[n], "-r") || !strcmp(argv[n], "--reduced")) - reduced = true; - else if (!strcmp(argv[n], "-i") || !strcmp(argv[n], "--interlaced")) - interlaced = true; - else if (!strcmp(argv[n], "-v") || !strcmp(argv[n], "--verbose")) - verbose = true; - else if (!strcmp(argv[n], "-h") || !strcmp(argv[n], "--help")) { - print_usage(argv[0]); - return 0; - } - else if (!hdisplay) { - hdisplay = atoi(argv[n]); - if (!hdisplay) { - print_usage(argv[0]); - return 1; - } - } - else if (!vdisplay) { - vdisplay = atoi(argv[n]); - if (!vdisplay) { - print_usage(argv[0]); - return 1; - } - } - else if (!vrefresh) { - vrefresh = atof(argv[n]); - if (!vrefresh) { - print_usage(argv[0]); - return 1; - } - } - else { - print_usage(argv[0]); - return 1; - } - } - - if (!hdisplay || !vdisplay) { - print_usage(argv[0]); - return 0; - } - - /* Default to 60.0Hz */ - if (!vrefresh) - vrefresh = 60.0; - - /* Horizontal timing is always a multiple of 8: round up. */ - if (hdisplay & 0x07) { - hdisplay &= ~0x07; - hdisplay += 8; - } - - if (reduced) { - if ((vrefresh / 60.0) != floor(vrefresh / 60.0)) { - fprintf(stderr, - "\nERROR: Multiple of 60Hz refresh rate required for " - " reduced blanking.\n"); - print_usage(argv[0]); - return 0; - } - } - - mode_info = libxcvt_gen_mode_info(hdisplay, vdisplay, vrefresh, reduced, interlaced); - if (!mode_info) { - fprintf(stderr, "Out of memory!\n"); - return 0; - } - - is_cvt = cvt_is_standard(hdisplay, vdisplay, vrefresh, reduced, verbose); - print_comment(mode_info, is_cvt, reduced); - print_mode_line(mode_info, hdisplay, vdisplay, vrefresh, reduced); - free(mode_info); - - return 0; -} diff --git a/lib/libcvt/cvt/meson.build b/lib/libcvt/cvt/meson.build deleted file mode 100644 index 526247196..000000000 --- a/lib/libcvt/cvt/meson.build +++ /dev/null @@ -1,10 +0,0 @@ -cvt_src = [ - 'cvt.c', -] - -executable('cvt', - cvt_src, - include_directories : inc, - link_with : libxcvt, - dependencies: mdep, - install : true) diff --git a/lib/libcvt/include/libxcvt/libxcvt.h b/lib/libcvt/include/libxcvt/libxcvt.h deleted file mode 100644 index 051a87128..000000000 --- a/lib/libcvt/include/libxcvt/libxcvt.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2005-2006 Luc Verhaegen. - * Copyright © 2021 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - */ - -#ifndef _LIBCVT_H_ -#define _LIBCVT_H_ - -#include <stdbool.h> -#include <libxcvt/libxcvt_mode.h> - -#ifdef __cplusplus -extern "C" { -#endif - -struct libxcvt_mode_info * -libxcvt_gen_mode_info(int hdisplay, - int vdisplay, - float vrefresh, - bool reduced, - bool interlaced); - -#ifdef __cplusplus -} -#endif - -#endif /* _LIBCVT_H_ */ diff --git a/lib/libcvt/include/libxcvt/libxcvt_mode.h b/lib/libcvt/include/libxcvt/libxcvt_mode.h deleted file mode 100644 index f29739e73..000000000 --- a/lib/libcvt/include/libxcvt/libxcvt_mode.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright © 2000 Compaq Computer Corporation - * Copyright © 2002 Hewlett Packard Company - * Copyright © 2006 Intel Corporation - * Copyright © 2008, 2021 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - * - */ - -#ifndef _LIBXCVT_MODE_H_ -#define _LIBXCVT_MODE_H_ - -#include <stdint.h> - -/* Conveniently chosen to match the RandR definitions */ -enum libxcvt_mode_flags { - LIBXCVT_MODE_FLAG_HSYNC_POSITIVE = (1 << 0), - LIBXCVT_MODE_FLAG_HSYNC_NEGATIVE = (1 << 1), - LIBXCVT_MODE_FLAG_VSYNC_POSITIVE = (1 << 2), - LIBXCVT_MODE_FLAG_VSYNC_NEGATIVE = (1 << 3), - LIBXCVT_MODE_FLAG_INTERLACE = (1 << 4), -}; - -struct libxcvt_mode_info { - uint32_t hdisplay; - uint32_t vdisplay; - float vrefresh; - float hsync; - uint64_t dot_clock; - uint16_t hsync_start; - uint16_t hsync_end; - uint16_t htotal; - uint16_t vsync_start; - uint16_t vsync_end; - uint16_t vtotal; - enum libxcvt_mode_flags mode_flags; -}; - -#endif /* _LIBXCVT_MODE_H_ */ diff --git a/lib/libcvt/include/libxcvt/meson.build b/lib/libcvt/include/libxcvt/meson.build deleted file mode 100644 index fde2cbe05..000000000 --- a/lib/libcvt/include/libxcvt/meson.build +++ /dev/null @@ -1 +0,0 @@ -install_headers('libxcvt.h','libxcvt_mode.h', subdir: 'libxcvt') diff --git a/lib/libcvt/include/meson.build b/lib/libcvt/include/meson.build deleted file mode 100644 index 4fbe7bddb..000000000 --- a/lib/libcvt/include/meson.build +++ /dev/null @@ -1 +0,0 @@ -subdir('libxcvt') diff --git a/lib/libcvt/lib/libxcvt.c b/lib/libcvt/lib/libxcvt.c deleted file mode 100644 index 886581306..000000000 --- a/lib/libcvt/lib/libxcvt.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright 2005-2006 Luc Verhaegen. - * Copyright © 2021 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - */ - -/* Standalone VESA CVT standard timing modelines generator. */ - - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#include <libxcvt/libxcvt.h> - -/* - * Generate a CVT standard mode from hdisplay, vdisplay and vrefresh. - * - * These calculations are stolen from the CVT calculation spreadsheet written - * by Graham Loveridge. He seems to be claiming no copyright and there seems to - * be no license attached to this. He apparently just wants to see his name - * mentioned. - * - * This file can be found at http://www.vesa.org/Public/CVT/CVTd6r1.xls - * - * Comments and structure corresponds to the comments and structure of the xls. - * This should ease importing of future changes to the standard (not very - * likely though). - * - * About margins; i'm sure that they are to be the bit between HDisplay and - * HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and - * VTotal, where the overscan colour is shown. FB seems to call _all_ blanking - * outside sync "margin" for some reason. Since we prefer seeing proper - * blanking instead of the overscan colour, and since the Crtc* values will - * probably get altered after us, we will disable margins altogether. With - * these calculations, Margins will plainly expand H/VDisplay, and we don't - * want that. -- libv - * - */ -struct libxcvt_mode_info * -libxcvt_gen_mode_info(int hdisplay, int vdisplay, float vrefresh, bool reduced, bool interlaced) -{ - bool margins = false; - float vfield_rate, hperiod; - int hdisplay_rnd, hmargin; - int vdisplay_rnd, vmargin, vsync; - float interlace; /* Please rename this */ - struct libxcvt_mode_info *mode_info; - - mode_info = calloc(1, sizeof *mode_info); - if (!mode_info) - return NULL; - - mode_info->hdisplay = hdisplay; - mode_info->vdisplay = vdisplay; - mode_info->vrefresh = vrefresh; - - /* 1) top/bottom margin size (% of height) - default: 1.8 */ -#define CVT_MARGIN_PERCENTAGE 1.8 - - /* 2) character cell horizontal granularity (pixels) - default 8 */ -#define CVT_H_GRANULARITY 8 - - /* 4) Minimum vertical porch (lines) - default 3 */ -#define CVT_MIN_V_PORCH 3 - - /* 4) Minimum number of vertical back porch lines - default 6 */ -#define CVT_MIN_V_BPORCH 6 - - /* Pixel Clock step (kHz) */ -#define CVT_CLOCK_STEP 250 - - /* CVT default is 60.0Hz */ - if (!mode_info->vrefresh) - mode_info->vrefresh = 60.0; - - /* 1. Required field rate */ - if (interlaced) - vfield_rate = mode_info->vrefresh * 2; - else - vfield_rate = mode_info->vrefresh; - - /* 2. Horizontal pixels */ - hdisplay_rnd = mode_info->hdisplay - (mode_info->hdisplay % CVT_H_GRANULARITY); - - /* 3. Determine left and right borders */ - if (margins) { - /* right margin is actually exactly the same as left */ - hmargin = (((float) hdisplay_rnd) * CVT_MARGIN_PERCENTAGE / 100.0); - hmargin -= hmargin % CVT_H_GRANULARITY; - } - else { - hmargin = 0; - } - - /* 4. Find total active pixels */ - mode_info->hdisplay = hdisplay_rnd + 2 * hmargin; - - /* 5. Find number of lines per field */ - if (interlaced) - vdisplay_rnd = mode_info->vdisplay / 2; - else - vdisplay_rnd = mode_info->vdisplay; - - /* 6. Find top and bottom margins */ - /* nope. */ - if (margins) - /* top and bottom margins are equal again. */ - vmargin = (((float) vdisplay_rnd) * CVT_MARGIN_PERCENTAGE / 100.0); - else - vmargin = 0; - - mode_info->vdisplay = mode_info->vdisplay + 2 * vmargin; - - /* 7. interlace */ - if (interlaced) - interlace = 0.5; - else - interlace = 0.0; - - /* Determine vsync Width from aspect ratio */ - if (!(mode_info->vdisplay % 3) && ((mode_info->vdisplay * 4 / 3) == mode_info->hdisplay)) - vsync = 4; - else if (!(mode_info->vdisplay % 9) && ((mode_info->vdisplay * 16 / 9) == mode_info->hdisplay)) - vsync = 5; - else if (!(mode_info->vdisplay % 10) && ((mode_info->vdisplay * 16 / 10) == mode_info->hdisplay)) - vsync = 6; - else if (!(mode_info->vdisplay % 4) && ((mode_info->vdisplay * 5 / 4) == mode_info->hdisplay)) - vsync = 7; - else if (!(mode_info->vdisplay % 9) && ((mode_info->vdisplay * 15 / 9) == mode_info->hdisplay)) - vsync = 7; - else /* Custom */ - vsync = 10; - - if (!reduced) { /* simplified GTF calculation */ - - /* 4) Minimum time of vertical sync + back porch interval (µs) - * default 550.0 */ -#define CVT_MIN_VSYNC_BP 550.0 - - /* 3) Nominal HSync width (% of line period) - default 8 */ -#define CVT_HSYNC_PERCENTAGE 8 - - float hblank_percentage; - int vsync_and_back_porch, vback_porch; - int hblank; - - /* 8. Estimated Horizontal period */ - hperiod = ((float) (1000000.0 / vfield_rate - CVT_MIN_VSYNC_BP)) / - (vdisplay_rnd + 2 * vmargin + CVT_MIN_V_PORCH + interlace); - - /* 9. Find number of lines in sync + backporch */ - if (((int) (CVT_MIN_VSYNC_BP / hperiod) + 1) < - (vsync + CVT_MIN_V_PORCH)) - vsync_and_back_porch = vsync + CVT_MIN_V_PORCH; - else - vsync_and_back_porch = (int) (CVT_MIN_VSYNC_BP / hperiod) + 1; - - /* 10. Find number of lines in back porch */ - vback_porch = vsync_and_back_porch - vsync; - (void) vback_porch; - - /* 11. Find total number of lines in vertical field */ - mode_info->vtotal = - vdisplay_rnd + 2 * vmargin + vsync_and_back_porch + interlace + - CVT_MIN_V_PORCH; - - /* 5) Definition of Horizontal blanking time limitation */ - /* Gradient (%/kHz) - default 600 */ -#define CVT_M_FACTOR 600 - - /* Offset (%) - default 40 */ -#define CVT_C_FACTOR 40 - - /* Blanking time scaling factor - default 128 */ -#define CVT_K_FACTOR 128 - - /* Scaling factor weighting - default 20 */ -#define CVT_J_FACTOR 20 - -#define CVT_M_PRIME CVT_M_FACTOR * CVT_K_FACTOR / 256 -#define CVT_C_PRIME (CVT_C_FACTOR - CVT_J_FACTOR) * CVT_K_FACTOR / 256 + \ - CVT_J_FACTOR - - /* 12. Find ideal blanking duty cycle from formula */ - hblank_percentage = CVT_C_PRIME - CVT_M_PRIME * hperiod / 1000.0; - - /* 13. Blanking time */ - if (hblank_percentage < 20) - hblank_percentage = 20; - - hblank = mode_info->hdisplay * hblank_percentage / (100.0 - hblank_percentage); - hblank -= hblank % (2 * CVT_H_GRANULARITY); - - /* 14. Find total number of pixels in a line. */ - mode_info->htotal = mode_info->hdisplay + hblank; - - /* Fill in HSync values */ - mode_info->hsync_end = mode_info->hdisplay + hblank / 2; - - mode_info->hsync_start = mode_info->hsync_end - - (mode_info->htotal * CVT_HSYNC_PERCENTAGE) / 100; - mode_info->hsync_start += CVT_H_GRANULARITY - - mode_info->hsync_start % CVT_H_GRANULARITY; - - /* Fill in vsync values */ - mode_info->vsync_start = mode_info->vdisplay + CVT_MIN_V_PORCH; - mode_info->vsync_end = mode_info->vsync_start + vsync; - - } - else { /* reduced blanking */ - /* Minimum vertical blanking interval time (µs) - default 460 */ -#define CVT_RB_MIN_VBLANK 460.0 - - /* Fixed number of clocks for horizontal sync */ -#define CVT_RB_H_SYNC 32.0 - - /* Fixed number of clocks for horizontal blanking */ -#define CVT_RB_H_BLANK 160.0 - - /* Fixed number of lines for vertical front porch - default 3 */ -#define CVT_RB_VFPORCH 3 - - int vblank_interval_lines; - - /* 8. Estimate Horizontal period. */ - hperiod = ((float) (1000000.0 / vfield_rate - CVT_RB_MIN_VBLANK)) / - (vdisplay_rnd + 2 * vmargin); - - /* 9. Find number of lines in vertical blanking */ - vblank_interval_lines = ((float) CVT_RB_MIN_VBLANK) / hperiod + 1; - - /* 10. Check if vertical blanking is sufficient */ - if (vblank_interval_lines < (CVT_RB_VFPORCH + vsync + CVT_MIN_V_BPORCH)) - vblank_interval_lines = CVT_RB_VFPORCH + vsync + CVT_MIN_V_BPORCH; - - /* 11. Find total number of lines in vertical field */ - mode_info->vtotal = vdisplay_rnd + 2 * vmargin + interlace + vblank_interval_lines; - - /* 12. Find total number of pixels in a line */ - mode_info->htotal = mode_info->hdisplay + CVT_RB_H_BLANK; - - /* Fill in HSync values */ - mode_info->hsync_end = mode_info->hdisplay + CVT_RB_H_BLANK / 2; - mode_info->hsync_start = mode_info->hsync_end - CVT_RB_H_SYNC; - - /* Fill in vsync values */ - mode_info->vsync_start = mode_info->vdisplay + CVT_RB_VFPORCH; - mode_info->vsync_end = mode_info->vsync_start + vsync; - } - - /* 15/13. Find pixel clock frequency (kHz for xf86) */ - mode_info->dot_clock = mode_info->htotal * 1000.0 / hperiod; - mode_info->dot_clock -= mode_info->dot_clock % CVT_CLOCK_STEP; - - /* 16/14. Find actual Horizontal Frequency (kHz) */ - mode_info->hsync = ((float) mode_info->dot_clock) / ((float) mode_info->htotal); - - /* 17/15. Find actual Field rate */ - mode_info->vrefresh = (1000.0 * ((float) mode_info->dot_clock)) / - ((float) (mode_info->htotal * mode_info->vtotal)); - - /* 18/16. Find actual vertical frame frequency */ - /* ignore - just set the mode flag for interlaced */ - if (interlaced) - mode_info->vtotal *= 2; - - if (reduced) - mode_info->mode_flags |= LIBXCVT_MODE_FLAG_HSYNC_POSITIVE | LIBXCVT_MODE_FLAG_VSYNC_NEGATIVE; - else - mode_info->mode_flags |= LIBXCVT_MODE_FLAG_HSYNC_NEGATIVE | LIBXCVT_MODE_FLAG_VSYNC_POSITIVE; - - if (interlaced) - mode_info->mode_flags |= LIBXCVT_MODE_FLAG_INTERLACE; - - /* FWXGA hack adapted from hw/xfree86/modes/xf86EdidModes.c, because you can't say 1366 */ - if (mode_info->hdisplay == 1366 && mode_info->vdisplay == 768) { - mode_info->hsync_start--; - mode_info->hsync_end--; - } - - return mode_info; -} diff --git a/lib/libcvt/lib/meson.build b/lib/libcvt/lib/meson.build deleted file mode 100644 index b3ff615c6..000000000 --- a/lib/libcvt/lib/meson.build +++ /dev/null @@ -1,6 +0,0 @@ -libxcvt_sources = ['libxcvt.c'] -libxcvt = shared_library('xcvt', - libxcvt_sources, - include_directories : inc, - version: meson.project_version(), - install : true) diff --git a/lib/libcvt/man/cvt.man b/lib/libcvt/man/cvt.man deleted file mode 100644 index 009ab6540..000000000 --- a/lib/libcvt/man/cvt.man +++ /dev/null @@ -1,41 +0,0 @@ -.TH CVT 1 @vendorversion@ -.SH NAME -cvt - calculate VESA CVT mode lines -.SH SYNOPSIS -.B cvt -.RB [ \-v | \-\-verbose ] -.RB [ \-r | \-\-reduced ] -.I h-resolution -.I v-resolution -.RB [ refresh ] -.SH DESCRIPTION -.I Cvt -is a utility for calculating VESA Coordinated Video Timing modes. Given the -desired horizontal and vertical resolutions, a modeline adhering to the CVT -standard is printed. This modeline can be included in Xorg -.B xorg.conf(@filemansuffix@) -. - -.SH OPTIONS -.TP 8 -.BR refresh -Provide a vertical refresh rate in Hz. The CVT standard prefers either 50.0, -60.0, 75.0 or 85.0Hz. The default is 60.0Hz. -.TP 8 -.BR \-v | \-\-verbose -Warn verbosely when a given mode does not completely correspond with CVT -standards. -.TP 8 -.BR \-r | \-\-reduced -Create a mode with reduced blanking. This allows for higher frequency signals, -with a lower or equal dotclock. Not for Cathode Ray Tube based displays though. - -.SH "SEE ALSO" -xorg.conf(@filemansuffix@), gtf(@appmansuffix@) -.SH AUTHOR -Luc Verhaegen. -.PP -This program is based on the Coordinated Video Timing sample -implementation written by Graham Loveridge. This file is publicly -available at <http://www.vesa.org/Public/CVT/CVTd6r1.xls>. CVT is a -VESA trademark. diff --git a/lib/libcvt/man/meson.build b/lib/libcvt/man/meson.build deleted file mode 100644 index 5234b162c..000000000 --- a/lib/libcvt/man/meson.build +++ /dev/null @@ -1,12 +0,0 @@ -man_conf = configuration_data() -man_conf.set('appmansuffix', '1') -man_conf.set('filemansuffix', '5') -man_conf.set('vendorversion', - '"libxcvt @0@" "X Version 11"'.format(meson.project_version())) - -configure_file( - input: 'cvt.man', - output: 'cvt.1', - install_dir: join_paths(man, 'man1'), - configuration: man_conf -) diff --git a/lib/libcvt/meson.build b/lib/libcvt/meson.build deleted file mode 100644 index b5b657f55..000000000 --- a/lib/libcvt/meson.build +++ /dev/null @@ -1,28 +0,0 @@ -project('libxcvt', 'c', - version: '0.1.1', - meson_version: '>= 0.40.0', - default_options: ['warning_level=1', - 'buildtype=debugoptimized']) - -libcvt_version = meson.project_version().split('.') - -cc = meson.get_compiler('c') -mdep = cc.find_library('m', required : false) - -prefix = get_option('prefix') -inc = include_directories('include') -man = join_paths(prefix, get_option('mandir')) - -subdir('include') -subdir('lib') -subdir('cvt') -subdir('man') - -pkg_mod = import('pkgconfig') -pkg_mod.generate(libraries : libxcvt, - version : meson.project_version(), - name : 'libxcvt', - description : 'A Library to generate VESA CVT standard timing modelines.') - -libxcvt_dep = declare_dependency(link_with: libxcvt, - include_directories: inc) |