2007-02-16 05:36:20 +01:00
|
|
|
/*
|
|
|
|
* 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"
|
2007-02-16 09:41:29 +01:00
|
|
|
#include "xf86Modes.h"
|
2007-02-16 05:36:20 +01:00
|
|
|
|
|
|
|
#include <string.h>
|
2021-03-25 10:19:55 +01:00
|
|
|
#include <libxcvt/libxcvt.h>
|
2007-02-16 05:36:20 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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
|
2014-10-31 00:45:12 +01:00
|
|
|
* HBlankStart, HBlankEnd and HTotal, VDisplay and VBlankStart, VBlankEnd and
|
2007-02-16 05:36:20 +01:00
|
|
|
* 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
|
|
|
|
*
|
|
|
|
*/
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
DisplayModePtr
|
2007-02-16 05:36:20 +01:00
|
|
|
xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, Bool Reduced,
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool Interlaced)
|
2007-02-16 05:36:20 +01:00
|
|
|
{
|
2021-03-25 10:19:55 +01:00
|
|
|
struct libxcvt_mode_info *libxcvt_mode_info;
|
2012-03-21 20:55:09 +01:00
|
|
|
DisplayModeRec *Mode = xnfcalloc(1, sizeof(DisplayModeRec));
|
2007-02-16 05:36:20 +01:00
|
|
|
|
2021-03-25 10:19:55 +01:00
|
|
|
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);
|
2007-02-16 05:36:20 +01:00
|
|
|
|
|
|
|
return Mode;
|
|
|
|
}
|