diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2021-03-26 15:48:23 +0100 |
---|---|---|
committer | Povilas Kanapickas <povilas@radix.lt> | 2021-08-06 11:29:29 +0000 |
commit | 7eba412072afdc9d27896410872e40364a8010bf (patch) | |
tree | e382b1e6b6780d4f3c397bfa24c78d9c77448274 | |
parent | f2781e95369583259991cd3add6f90f33be32171 (diff) |
xfree86: Move xf86CVTMode() function
The xf86CVTMode() was implemented in a standalone source file because it
was being used for both the xfree86 API and the standalone cvt utility.
Now that the cvt utility is removed (as part of libxcvt) we can move the
small xf86CVTMode() function with the rest of the xf86Modes sources.
Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1142
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
-rw-r--r-- | hw/xfree86/modes/Makefile.am | 1 | ||||
-rw-r--r-- | hw/xfree86/modes/meson.build | 1 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86Modes.c | 31 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86cvt.c | 82 |
4 files changed, 31 insertions, 84 deletions
diff --git a/hw/xfree86/modes/Makefile.am b/hw/xfree86/modes/Makefile.am index 6eb162a89..35a174b5b 100644 --- a/hw/xfree86/modes/Makefile.am +++ b/hw/xfree86/modes/Makefile.am @@ -8,7 +8,6 @@ libxf86modes_la_SOURCES = \ xf86Crtc.c \ xf86Crtc.h \ xf86Cursors.c \ - xf86cvt.c \ xf86gtf.c \ xf86EdidModes.c \ xf86Modes.c \ diff --git a/hw/xfree86/modes/meson.build b/hw/xfree86/modes/meson.build index 52c7ef9b3..8a40018ca 100644 --- a/hw/xfree86/modes/meson.build +++ b/hw/xfree86/modes/meson.build @@ -1,7 +1,6 @@ srcs_xorg_modes = [ 'xf86Crtc.c', 'xf86Cursors.c', - 'xf86cvt.c', 'xf86gtf.c', 'xf86EdidModes.c', 'xf86Modes.c', diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 5651f1ef8..384996724 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -29,6 +29,7 @@ #include <xorg-config.h> #endif +#include <libxcvt/libxcvt.h> #include "xf86Modes.h" #include "xf86Priv.h" @@ -792,3 +793,33 @@ xf86PruneDuplicateModes(DisplayModePtr modes) return modes; } + +/* + * Generate a CVT standard mode from HDisplay, VDisplay and VRefresh. + */ +DisplayModePtr +xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, + Bool Interlaced) +{ + struct libxcvt_mode_info *libxcvt_mode_info; + DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec)); + + libxcvt_mode_info = + libxcvt_gen_mode_info(HDisplay, VDisplay, VRefresh, Reduced, Interlaced); + + Mode->VDisplay = libxcvt_mode_info->vdisplay; + Mode->HDisplay = libxcvt_mode_info->hdisplay; + Mode->Clock = libxcvt_mode_info->dot_clock; + Mode->HSyncStart = libxcvt_mode_info->hsync_start; + Mode->HSyncEnd = libxcvt_mode_info->hsync_end; + Mode->HTotal = libxcvt_mode_info->htotal; + Mode->VSyncStart = libxcvt_mode_info->vsync_start; + Mode->VSyncEnd = libxcvt_mode_info->vsync_end; + Mode->VTotal = libxcvt_mode_info->vtotal; + Mode->VRefresh = libxcvt_mode_info->vrefresh; + Mode->Flags = libxcvt_mode_info->mode_flags; + + free(libxcvt_mode_info); + + return Mode; +} diff --git a/hw/xfree86/modes/xf86cvt.c b/hw/xfree86/modes/xf86cvt.c deleted file mode 100644 index be5021c89..000000000 --- a/hw/xfree86/modes/xf86cvt.c +++ /dev/null @@ -1,82 +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. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86.h" -#include "xf86Modes.h" - -#include <string.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 - * - */ -DisplayModePtr -xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced, - Bool Interlaced) -{ - struct libxcvt_mode_info *libxcvt_mode_info; - DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec)); - - libxcvt_mode_info = - libxcvt_gen_mode_info(HDisplay, VDisplay, VRefresh, Reduced, Interlaced); - - Mode->VDisplay = libxcvt_mode_info->vdisplay; - Mode->HDisplay = libxcvt_mode_info->hdisplay; - Mode->Clock = libxcvt_mode_info->dot_clock; - Mode->HSyncStart = libxcvt_mode_info->hsync_start; - Mode->HSyncEnd = libxcvt_mode_info->hsync_end; - Mode->HTotal = libxcvt_mode_info->htotal; - Mode->VSyncStart = libxcvt_mode_info->vsync_start; - Mode->VSyncEnd = libxcvt_mode_info->vsync_end; - Mode->VTotal = libxcvt_mode_info->vtotal; - Mode->VRefresh = libxcvt_mode_info->vrefresh; - Mode->Flags = libxcvt_mode_info->mode_flags; - - free(libxcvt_mode_info); - - return Mode; -} |