105b261ecSmrg/*
2f7df2e56Smrg * Copyright © 2006 Intel Corporation
305b261ecSmrg *
405b261ecSmrg * Permission is hereby granted, free of charge, to any person obtaining a
505b261ecSmrg * copy of this software and associated documentation files (the "Software"),
605b261ecSmrg * to deal in the Software without restriction, including without limitation
705b261ecSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
805b261ecSmrg * and/or sell copies of the Software, and to permit persons to whom the
905b261ecSmrg * Software is furnished to do so, subject to the following conditions:
1005b261ecSmrg *
1105b261ecSmrg * The above copyright notice and this permission notice (including the next
1205b261ecSmrg * paragraph) shall be included in all copies or substantial portions of the
1305b261ecSmrg * Software.
1405b261ecSmrg *
1505b261ecSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1605b261ecSmrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1705b261ecSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1805b261ecSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1905b261ecSmrg * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2005b261ecSmrg * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2105b261ecSmrg * SOFTWARE.
2205b261ecSmrg *
2305b261ecSmrg * Authors:
2405b261ecSmrg *    Eric Anholt <eric@anholt.net>
2505b261ecSmrg *
2605b261ecSmrg */
2705b261ecSmrg
2805b261ecSmrg#ifndef _XF86MODES_H_
2905b261ecSmrg#define _XF86MODES_H_
3005b261ecSmrg
3105b261ecSmrg#include <stddef.h>
3205b261ecSmrg#include <string.h>
3305b261ecSmrg#include <stdio.h>
3405b261ecSmrg
3505b261ecSmrg#include "xf86.h"
3605b261ecSmrg#include "xorgVersion.h"
3705b261ecSmrg#include "edid.h"
3805b261ecSmrg#include "xf86Parser.h"
3905b261ecSmrg
40f7df2e56Smrgextern _X_EXPORT double xf86ModeHSync(const DisplayModeRec * mode);
41f7df2e56Smrgextern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec * mode);
426747b715Smrgextern _X_EXPORT unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
4305b261ecSmrg
446747b715Smrgextern _X_EXPORT int
45f7df2e56Smrg xf86ModeWidth(const DisplayModeRec * mode, Rotation rotation);
46f7df2e56Smrg
476747b715Smrgextern _X_EXPORT int
48f7df2e56Smrg xf86ModeHeight(const DisplayModeRec * mode, Rotation rotation);
4905b261ecSmrg
50f7df2e56Smrgextern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec * pMode);
516747b715Smrgextern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
52f7df2e56Smrg                                                   DisplayModePtr modeList);
536747b715Smrgextern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode);
546747b715Smrgextern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
55f7df2e56Smrgextern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec * pMode1,
56f7df2e56Smrg                                     const DisplayModeRec * pMode2);
57f7df2e56Smrgextern _X_EXPORT void xf86PrintModeline(int scrnIndex, DisplayModePtr mode);
58f7df2e56Smrgextern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes,
59f7df2e56Smrg                                             DisplayModePtr new);
6005b261ecSmrg
616747b715Smrgextern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
62f7df2e56Smrgextern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay,
63f7df2e56Smrg                                            float VRefresh, Bool Reduced,
64f7df2e56Smrg                                            Bool Interlaced);
65f7df2e56Smrgextern _X_EXPORT DisplayModePtr xf86GTFMode(int h_pixels, int v_lines,
66f7df2e56Smrg                                            float freq, int interlaced,
67f7df2e56Smrg                                            int margins);
684642e01fSmrg
696747b715Smrgextern _X_EXPORT Bool
70f7df2e56Smrg xf86ModeIsReduced(const DisplayModeRec * mode);
71f7df2e56Smrg
72f7df2e56Smrgextern _X_EXPORT void
73f7df2e56Smrg xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags);
7405b261ecSmrg
756747b715Smrgextern _X_EXPORT void
76f7df2e56Smrg
7705b261ecSmrgxf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
78f7df2e56Smrg                        int *min, int *max, int n_ranges);
7905b261ecSmrg
806747b715Smrgextern _X_EXPORT void
81f7df2e56Smrg
8205b261ecSmrgxf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
83f7df2e56Smrg                      int maxX, int maxY, int maxPitch);
8405b261ecSmrg
856747b715Smrgextern _X_EXPORT void
86f7df2e56Smrg xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon);
8705b261ecSmrg
886747b715Smrgextern _X_EXPORT void
89f7df2e56Smrg
904642e01fSmrgxf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
91f7df2e56Smrg                           unsigned int bandwidth, int depth);
924642e01fSmrg
936747b715Smrgextern _X_EXPORT void
94f7df2e56Smrg xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList);
954642e01fSmrg
966747b715Smrgextern _X_EXPORT void
9705b261ecSmrg
98f7df2e56Smrgxf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr * modeList,
99f7df2e56Smrg                      Bool verbose);
1006747b715Smrg
101f7df2e56Smrgextern _X_EXPORT DisplayModePtr xf86PruneDuplicateModes(DisplayModePtr modes);
10205b261ecSmrg
1036747b715Smrgextern _X_EXPORT void
104f7df2e56Smrg xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
10505b261ecSmrg
1066747b715Smrgextern _X_EXPORT DisplayModePtr
107f7df2e56Smrgxf86GetMonitorModes(ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
10805b261ecSmrg
109f7df2e56Smrgextern _X_EXPORT DisplayModePtr xf86GetDefaultModes(void);
110f7df2e56Smrg
111f7df2e56Smrgextern _X_EXPORT void
112f7df2e56Smrgxf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode);
11305b261ecSmrg
1146747b715Smrgextern _X_EXPORT void
115f7df2e56Smrg xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC);
1164642e01fSmrg
117f7df2e56Smrg#endif                          /* _XF86MODES_H_ */
118