1/*
2
3Copyright 1995  Kaleb S. KEITHLEY
4
5Permission is hereby granted, free of charge, to any person obtaining
6a copy of this software and associated documentation files (the
7"Software"), to deal in the Software without restriction, including
8without limitation the rights to use, copy, modify, merge, publish,
9distribute, sublicense, and/or sell copies of the Software, and to
10permit persons to whom the Software is furnished to do so, subject to
11the following conditions:
12
13The above copyright notice and this permission notice shall be
14included in all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19IN NO EVENT SHALL Kaleb S. KEITHLEY BE LIABLE FOR ANY CLAIM, DAMAGES
20OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22OTHER DEALINGS IN THE SOFTWARE.
23
24Except as contained in this notice, the name of Kaleb S. KEITHLEY
25shall not be used in advertising or otherwise to promote the sale, use
26or other dealings in this Software without prior written authorization
27from Kaleb S. KEITHLEY
28
29*/
30
31/* THIS IS NOT AN X CONSORTIUM STANDARD OR AN X PROJECT TEAM SPECIFICATION */
32
33#ifndef _XF86VIDMODE_H_
34#define _XF86VIDMODE_H_
35
36#include <X11/Xfuncproto.h>
37#include <X11/Xmd.h>
38#include <X11/extensions/xf86vm.h>
39
40#define CLKFLAG_PROGRAMABLE		1
41
42#ifdef XF86VIDMODE_EVENTS
43#define XF86VidModeNotify		0
44#define XF86VidModeNumberEvents		(XF86VidModeNotify + 1)
45
46#define XF86VidModeNotifyMask		0x00000001
47
48#define XF86VidModeNonEvent		0
49#define XF86VidModeModeChange		1
50#else
51#define XF86VidModeNumberEvents		0
52#endif
53
54#define XF86VidModeBadClock		0
55#define XF86VidModeBadHTimings		1
56#define XF86VidModeBadVTimings		2
57#define XF86VidModeModeUnsuitable	3
58#define XF86VidModeExtensionDisabled	4
59#define XF86VidModeClientNotLocal	5
60#define XF86VidModeZoomLocked		6
61#define XF86VidModeNumberErrors		(XF86VidModeZoomLocked + 1)
62
63#define XF86VM_READ_PERMISSION	1
64#define XF86VM_WRITE_PERMISSION	2
65
66#ifndef _XF86VIDMODE_SERVER_
67
68typedef struct {
69    unsigned short	hdisplay;
70    unsigned short	hsyncstart;
71    unsigned short	hsyncend;
72    unsigned short	htotal;
73    unsigned short	hskew;
74    unsigned short	vdisplay;
75    unsigned short	vsyncstart;
76    unsigned short	vsyncend;
77    unsigned short	vtotal;
78    unsigned int	flags;
79    int			privsize;
80#if defined(__cplusplus) || defined(c_plusplus)
81    /* private is a C++ reserved word */
82    INT32		*c_private;
83#else
84    INT32		*private;
85#endif
86} XF86VidModeModeLine;
87
88typedef struct {
89    unsigned int	dotclock;
90    unsigned short	hdisplay;
91    unsigned short	hsyncstart;
92    unsigned short	hsyncend;
93    unsigned short	htotal;
94    unsigned short	hskew;
95    unsigned short	vdisplay;
96    unsigned short	vsyncstart;
97    unsigned short	vsyncend;
98    unsigned short	vtotal;
99    unsigned int	flags;
100    int			privsize;
101#if defined(__cplusplus) || defined(c_plusplus)
102    /* private is a C++ reserved word */
103    INT32		*c_private;
104#else
105    INT32		*private;
106#endif
107} XF86VidModeModeInfo;
108
109typedef struct {
110    float		hi;
111    float		lo;
112} XF86VidModeSyncRange;
113
114typedef struct {
115    char*			vendor;
116    char*			model;
117    float			EMPTY;
118    unsigned char		nhsync;
119    XF86VidModeSyncRange*	hsync;
120    unsigned char		nvsync;
121    XF86VidModeSyncRange*	vsync;
122} XF86VidModeMonitor;
123
124typedef struct {
125    int type;			/* of event */
126    unsigned long serial;	/* # of last request processed by server */
127    Bool send_event;		/* true if this came from a SendEvent req */
128    Display *display;		/* Display the event was read from */
129    Window root;		/* root window of event screen */
130    int state;			/* What happened */
131    int kind;			/* What happened */
132    Bool forced;		/* extents of new region */
133    Time time;			/* event timestamp */
134} XF86VidModeNotifyEvent;
135
136typedef struct {
137    float red;			/* Red Gamma value */
138    float green;		/* Green Gamma value */
139    float blue;			/* Blue Gamma value */
140} XF86VidModeGamma;
141
142
143#define XF86VidModeSelectNextMode(disp, scr) \
144	XF86VidModeSwitchMode(disp, scr, 1)
145#define XF86VidModeSelectPrevMode(disp, scr) \
146	XF86VidModeSwitchMode(disp, scr, -1)
147
148_XFUNCPROTOBEGIN
149
150Bool XF86VidModeQueryVersion(
151    Display*		/* dpy */,
152    int*		/* majorVersion */,
153    int*		/* minorVersion */
154);
155
156Bool XF86VidModeQueryExtension(
157    Display*		/* dpy */,
158    int*		/* event_base */,
159    int*		/* error_base */
160);
161
162Bool XF86VidModeSetClientVersion(
163    Display*		/* dpy */
164);
165
166Bool XF86VidModeGetModeLine(
167    Display*			/* dpy */,
168    int				/* screen */,
169    int*			/* dotclock */,
170    XF86VidModeModeLine*	/* modeline */
171);
172
173Bool XF86VidModeGetAllModeLines(
174    Display*			/* dpy */,
175    int				/* screen */,
176    int*			/* modecount */,
177    XF86VidModeModeInfo***	/* modelinesPtr */
178);
179
180Bool XF86VidModeAddModeLine(
181    Display*			/* dpy */,
182    int				/* screen */,
183    XF86VidModeModeInfo*	/* new modeline */,
184    XF86VidModeModeInfo*	/* after modeline */
185);
186
187Bool XF86VidModeDeleteModeLine(
188    Display*			/* dpy */,
189    int				/* screen */,
190    XF86VidModeModeInfo*	/* modeline */
191);
192
193Bool XF86VidModeModModeLine(
194    Display*			/* dpy */,
195    int				/* screen */,
196    XF86VidModeModeLine*	/* modeline */
197);
198
199Status XF86VidModeValidateModeLine(
200    Display*			/* dpy */,
201    int				/* screen */,
202    XF86VidModeModeInfo*	/* modeline */
203);
204
205Bool XF86VidModeSwitchMode(
206    Display*		/* dpy */,
207    int			/* screen */,
208    int			/* zoom */
209);
210
211Bool XF86VidModeSwitchToMode(
212    Display*			/* dpy */,
213    int				/* screen */,
214    XF86VidModeModeInfo*	/* modeline */
215);
216
217Bool XF86VidModeLockModeSwitch(
218    Display*		/* dpy */,
219    int			/* screen */,
220    int			/* lock */
221);
222
223Bool XF86VidModeGetMonitor(
224    Display*		/* dpy */,
225    int			/* screen */,
226    XF86VidModeMonitor*	/* monitor */
227);
228
229Bool XF86VidModeGetViewPort(
230    Display*		/* dpy */,
231    int			/* screen */,
232    int*		/* x return */,
233    int*		/* y return */
234);
235
236Bool XF86VidModeSetViewPort(
237    Display*		/* dpy */,
238    int			/* screen */,
239    int			/* x */,
240    int			/* y */
241);
242
243Bool XF86VidModeGetDotClocks(
244    Display*		/* dpy */,
245    int			/* screen */,
246    int*		/* flags return */,
247    int*		/* number of clocks return */,
248    int*		/* max dot clock return */,
249    int**		/* clocks return */
250);
251
252Bool XF86VidModeGetGamma(
253    Display*			/* dpy */,
254    int				/* screen */,
255    XF86VidModeGamma*		/* Gamma */
256);
257
258Bool XF86VidModeSetGamma(
259    Display*			/* dpy */,
260    int				/* screen */,
261    XF86VidModeGamma*		/* Gamma */
262);
263
264Bool XF86VidModeSetGammaRamp(
265    Display*                    /* dpy */,
266    int                         /* screen */,
267    int				/* size */,
268    unsigned short*             /* red array */,
269    unsigned short*             /* green array */,
270    unsigned short*             /* blue array */
271);
272
273Bool XF86VidModeGetGammaRamp(
274    Display*                    /* dpy */,
275    int                         /* screen */,
276    int                         /* size */,
277    unsigned short*             /* red array */,
278    unsigned short*             /* green array */,
279    unsigned short*             /* blue array */
280);
281
282Bool XF86VidModeGetGammaRampSize(
283    Display*                    /* dpy */,
284    int                         /* screen */,
285    int*                        /* size */
286);
287
288Bool XF86VidModeGetPermissions(
289    Display*                    /* dpy */,
290    int                         /* screen */,
291    int*			/* permissions */
292);
293
294_XFUNCPROTOEND
295
296#endif
297
298#endif
299