1 /*
2  * Copyright © 2000 Compaq Computer Corporation
3  * Copyright © 2002 Hewlett Packard Company
4  * Copyright © 2006 Intel Corporation
5  * Copyright © 2008 Red Hat, Inc.
6  *
7  * Permission to use, copy, modify, distribute, and sell this software and its
8  * documentation for any purpose is hereby granted without fee, provided that
9  * the above copyright notice appear in all copies and that both that copyright
10  * notice and this permission notice appear in supporting documentation, and
11  * that the name of the copyright holders not be used in advertising or
12  * publicity pertaining to distribution of the software without specific,
13  * written prior permission.  The copyright holders make no representations
14  * about the suitability of this software for any purpose.  It is provided "as
15  * is" without express or implied warranty.
16  *
17  * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19  * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23  * OF THIS SOFTWARE.
24  *
25  * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc.
26  *	    Keith Packard, Intel Corporation
27  */
28 
29 #ifndef _RANDR_H_
30 #define _RANDR_H_
31 
32 typedef unsigned short	Rotation;
33 typedef unsigned short	SizeID;
34 typedef unsigned short	SubpixelOrder;
35 typedef unsigned short	Connection;
36 typedef unsigned short	XRandrRotation;
37 typedef unsigned short	XRandrSizeID;
38 typedef unsigned short	XRandrSubpixelOrder;
39 typedef unsigned long	XRandrModeFlags;
40 
41 #define RANDR_NAME		"RANDR"
42 #define RANDR_MAJOR		1
43 #define RANDR_MINOR		6
44 
45 #define RRNumberErrors		5
46 #define RRNumberEvents		2
47 #define RRNumberRequests	47
48 
49 #define X_RRQueryVersion	0
50 /* we skip 1 to make old clients fail pretty immediately */
51 #define X_RROldGetScreenInfo	1
52 #define X_RR1_0SetScreenConfig	2
53 /* V1.0 apps share the same set screen config request id */
54 #define X_RRSetScreenConfig	2
55 #define X_RROldScreenChangeSelectInput	3
56 /* 3 used to be ScreenChangeSelectInput; deprecated */
57 #define X_RRSelectInput		4
58 #define X_RRGetScreenInfo	5
59 
60 /* V1.2 additions */
61 #define X_RRGetScreenSizeRange	    6
62 #define X_RRSetScreenSize	    7
63 #define X_RRGetScreenResources	    8
64 #define X_RRGetOutputInfo	    9
65 #define X_RRListOutputProperties    10
66 #define X_RRQueryOutputProperty	    11
67 #define X_RRConfigureOutputProperty 12
68 #define X_RRChangeOutputProperty    13
69 #define X_RRDeleteOutputProperty    14
70 #define X_RRGetOutputProperty	    15
71 #define X_RRCreateMode		    16
72 #define X_RRDestroyMode		    17
73 #define X_RRAddOutputMode	    18
74 #define X_RRDeleteOutputMode	    19
75 #define X_RRGetCrtcInfo		    20
76 #define X_RRSetCrtcConfig	    21
77 #define X_RRGetCrtcGammaSize	    22
78 #define X_RRGetCrtcGamma	    23
79 #define X_RRSetCrtcGamma	    24
80 
81 /* V1.3 additions */
82 #define X_RRGetScreenResourcesCurrent	25
83 #define X_RRSetCrtcTransform	    26
84 #define X_RRGetCrtcTransform	    27
85 #define X_RRGetPanning		    28
86 #define X_RRSetPanning		    29
87 #define X_RRSetOutputPrimary	    30
88 #define X_RRGetOutputPrimary	    31
89 
90 #define RRTransformUnit		    (1L << 0)
91 #define RRTransformScaleUp	    (1L << 1)
92 #define RRTransformScaleDown	    (1L << 2)
93 #define RRTransformProjective	    (1L << 3)
94 
95 /* v1.4 */
96 #define X_RRGetProviders	      32
97 #define X_RRGetProviderInfo	      33
98 #define X_RRSetProviderOffloadSink    34
99 #define X_RRSetProviderOutputSource   35
100 #define X_RRListProviderProperties    36
101 #define X_RRQueryProviderProperty     37
102 #define X_RRConfigureProviderProperty 38
103 #define X_RRChangeProviderProperty    39
104 #define X_RRDeleteProviderProperty    40
105 #define X_RRGetProviderProperty	      41
106 
107 /* v1.5 */
108 #define X_RRGetMonitors		      42
109 #define X_RRSetMonitor		      43
110 #define X_RRDeleteMonitor	      44
111 
112 /* v1.6 */
113 #define X_RRCreateLease		      45
114 #define X_RRFreeLease		      46
115 
116 /* Event selection bits */
117 #define RRScreenChangeNotifyMask  (1L << 0)
118 /* V1.2 additions */
119 #define RRCrtcChangeNotifyMask	    (1L << 1)
120 #define RROutputChangeNotifyMask    (1L << 2)
121 #define RROutputPropertyNotifyMask  (1L << 3)
122 /* V1.4 additions */
123 #define RRProviderChangeNotifyMask   (1L << 4)
124 #define RRProviderPropertyNotifyMask (1L << 5)
125 #define RRResourceChangeNotifyMask   (1L << 6)
126 /* V1.6 additions */
127 #define RRLeaseNotifyMask            (1L << 7)
128 
129 /* Event codes */
130 #define RRScreenChangeNotify	0
131 /* V1.2 additions */
132 #define RRNotify		    1
133 /* RRNotify Subcodes */
134 #define  RRNotify_CrtcChange	    0
135 #define  RRNotify_OutputChange	    1
136 #define  RRNotify_OutputProperty    2
137 #define  RRNotify_ProviderChange    3
138 #define  RRNotify_ProviderProperty  4
139 #define  RRNotify_ResourceChange    5
140 /* V1.6 additions */
141 #define  RRNotify_Lease             6
142 /* used in the rotation field; rotation and reflection in 0.1 proto. */
143 #define RR_Rotate_0		1
144 #define RR_Rotate_90		2
145 #define RR_Rotate_180		4
146 #define RR_Rotate_270		8
147 
148 /* new in 1.0 protocol, to allow reflection of screen */
149 
150 #define RR_Reflect_X		16
151 #define RR_Reflect_Y		32
152 
153 #define RRSetConfigSuccess		0
154 #define RRSetConfigInvalidConfigTime	1
155 #define RRSetConfigInvalidTime		2
156 #define RRSetConfigFailed		3
157 
158 /* new in 1.2 protocol */
159 
160 #define RR_HSyncPositive	0x00000001
161 #define RR_HSyncNegative	0x00000002
162 #define RR_VSyncPositive	0x00000004
163 #define RR_VSyncNegative	0x00000008
164 #define RR_Interlace		0x00000010
165 #define RR_DoubleScan		0x00000020
166 #define RR_CSync		0x00000040
167 #define RR_CSyncPositive	0x00000080
168 #define RR_CSyncNegative	0x00000100
169 #define RR_HSkewPresent		0x00000200
170 #define RR_BCast		0x00000400
171 #define RR_PixelMultiplex	0x00000800
172 #define RR_DoubleClock		0x00001000
173 #define RR_ClockDivideBy2	0x00002000
174 
175 #define RR_Connected		0
176 #define RR_Disconnected		1
177 #define RR_UnknownConnection	2
178 
179 #define BadRROutput		0
180 #define BadRRCrtc		1
181 #define BadRRMode		2
182 #define BadRRProvider		3
183 #define BadRRLease		4
184 
185 /* Conventional RandR output properties */
186 
187 #define RR_PROPERTY_BACKLIGHT		"Backlight"
188 #define RR_PROPERTY_RANDR_EDID		"EDID"
189 #define RR_PROPERTY_SIGNAL_FORMAT	"SignalFormat"
190 #define RR_PROPERTY_SIGNAL_PROPERTIES	"SignalProperties"
191 #define RR_PROPERTY_CONNECTOR_TYPE	"ConnectorType"
192 #define RR_PROPERTY_CONNECTOR_NUMBER	"ConnectorNumber"
193 #define RR_PROPERTY_COMPATIBILITY_LIST	"CompatibilityList"
194 #define RR_PROPERTY_CLONE_LIST		"CloneList"
195 #define RR_PROPERTY_BORDER		"Border"
196 #define RR_PROPERTY_BORDER_DIMENSIONS	"BorderDimensions"
197 #define RR_PROPERTY_GUID		"GUID"
198 #define RR_PROPERTY_RANDR_TILE		"TILE"
199 #define RR_PROPERTY_NON_DESKTOP		"non-desktop"
200 
201 /* roles this device can carry out */
202 #define RR_Capability_None 0
203 #define RR_Capability_SourceOutput 1
204 #define RR_Capability_SinkOutput 2
205 #define RR_Capability_SourceOffload 4
206 #define RR_Capability_SinkOffload 8
207 
208 #endif	/* _RANDR_H_ */
209