1 /*
2  * Copyright © 2006 Intel Corporation
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8  * and/or sell copies of the Software, and to permit persons to whom the
9  * Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  * Authors:
24  *    Eric Anholt <eric@anholt.net>
25  *
26  */
27 
28 #ifndef _XF86MODES_H_
29 #define _XF86MODES_H_
30 
31 #include <stddef.h>
32 #include <string.h>
33 #include <stdio.h>
34 
35 #include "xf86.h"
36 #include "xorgVersion.h"
37 #include "edid.h"
38 #include "xf86Parser.h"
39 
40 extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec * mode);
41 extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec * mode);
42 extern _X_EXPORT unsigned int xf86ModeBandwidth(DisplayModePtr mode, int depth);
43 
44 extern _X_EXPORT int
45  xf86ModeWidth(const DisplayModeRec * mode, Rotation rotation);
46 
47 extern _X_EXPORT int
48  xf86ModeHeight(const DisplayModeRec * mode, Rotation rotation);
49 
50 extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec * pMode);
51 extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn,
52                                                    DisplayModePtr modeList);
53 extern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode);
54 extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
55 extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec * pMode1,
56                                      const DisplayModeRec * pMode2);
57 extern _X_EXPORT void xf86PrintModeline(int scrnIndex, DisplayModePtr mode);
58 extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes,
59                                              DisplayModePtr new);
60 
61 extern _X_EXPORT DisplayModePtr xf86DDCGetModes(int scrnIndex, xf86MonPtr DDC);
62 extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay,
63                                             float VRefresh, Bool Reduced,
64                                             Bool Interlaced);
65 extern _X_EXPORT DisplayModePtr xf86GTFMode(int h_pixels, int v_lines,
66                                             float freq, int interlaced,
67                                             int margins);
68 
69 extern _X_EXPORT Bool
70  xf86ModeIsReduced(const DisplayModeRec * mode);
71 
72 extern _X_EXPORT void
73  xf86ValidateModesFlags(ScrnInfoPtr pScrn, DisplayModePtr modeList, int flags);
74 
75 extern _X_EXPORT void
76 
77 xf86ValidateModesClocks(ScrnInfoPtr pScrn, DisplayModePtr modeList,
78                         int *min, int *max, int n_ranges);
79 
80 extern _X_EXPORT void
81 
82 xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList,
83                       int maxX, int maxY, int maxPitch);
84 
85 extern _X_EXPORT void
86  xf86ValidateModesSync(ScrnInfoPtr pScrn, DisplayModePtr modeList, MonPtr mon);
87 
88 extern _X_EXPORT void
89 
90 xf86ValidateModesBandwidth(ScrnInfoPtr pScrn, DisplayModePtr modeList,
91                            unsigned int bandwidth, int depth);
92 
93 extern _X_EXPORT void
94  xf86ValidateModesReducedBlanking(ScrnInfoPtr pScrn, DisplayModePtr modeList);
95 
96 extern _X_EXPORT void
97 
98 xf86PruneInvalidModes(ScrnInfoPtr pScrn, DisplayModePtr * modeList,
99                       Bool verbose);
100 
101 extern _X_EXPORT DisplayModePtr xf86PruneDuplicateModes(DisplayModePtr modes);
102 
103 extern _X_EXPORT void
104  xf86ValidateModesUserConfig(ScrnInfoPtr pScrn, DisplayModePtr modeList);
105 
106 extern _X_EXPORT DisplayModePtr
107 xf86GetMonitorModes(ScrnInfoPtr pScrn, XF86ConfMonitorPtr conf_monitor);
108 
109 extern _X_EXPORT DisplayModePtr xf86GetDefaultModes(void);
110 
111 extern _X_EXPORT void
112 xf86SaveModeContents(DisplayModePtr intern, const DisplayModeRec *mode);
113 
114 extern _X_EXPORT void
115  xf86DDCApplyQuirks(int scrnIndex, xf86MonPtr DDC);
116 
117 #endif                          /* _XF86MODES_H_ */
118