117ca54c3Smrg/*
217ca54c3Smrg * Copyright © 2000 Compaq Computer Corporation
317ca54c3Smrg * Copyright © 2002 Hewlett Packard Company
417ca54c3Smrg * Copyright © 2006 Intel Corporation
517ca54c3Smrg * Copyright © 2008 Red Hat, Inc.
617ca54c3Smrg *
717ca54c3Smrg * Permission to use, copy, modify, distribute, and sell this software and its
817ca54c3Smrg * documentation for any purpose is hereby granted without fee, provided that
917ca54c3Smrg * the above copyright notice appear in all copies and that both that copyright
1017ca54c3Smrg * notice and this permission notice appear in supporting documentation, and
1117ca54c3Smrg * that the name of the copyright holders not be used in advertising or
1217ca54c3Smrg * publicity pertaining to distribution of the software without specific,
1317ca54c3Smrg * written prior permission.  The copyright holders make no representations
1417ca54c3Smrg * about the suitability of this software for any purpose.  It is provided "as
1517ca54c3Smrg * is" without express or implied warranty.
1617ca54c3Smrg *
1717ca54c3Smrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1817ca54c3Smrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1917ca54c3Smrg * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2017ca54c3Smrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
2117ca54c3Smrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
2217ca54c3Smrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
2317ca54c3Smrg * OF THIS SOFTWARE.
2417ca54c3Smrg *
2517ca54c3Smrg * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc.
2617ca54c3Smrg *	    Keith Packard, Intel Corporation
2717ca54c3Smrg */
2817ca54c3Smrg
2917ca54c3Smrg#ifndef _RANDR_H_
3017ca54c3Smrg#define _RANDR_H_
3117ca54c3Smrg
3217ca54c3Smrgtypedef unsigned short	Rotation;
3317ca54c3Smrgtypedef unsigned short	SizeID;
3417ca54c3Smrgtypedef unsigned short	SubpixelOrder;
3517ca54c3Smrgtypedef unsigned short	Connection;
3617ca54c3Smrgtypedef unsigned short	XRandrRotation;
3717ca54c3Smrgtypedef unsigned short	XRandrSizeID;
3817ca54c3Smrgtypedef unsigned short	XRandrSubpixelOrder;
3917ca54c3Smrgtypedef unsigned long	XRandrModeFlags;
4017ca54c3Smrg
4117ca54c3Smrg#define RANDR_NAME		"RANDR"
4217ca54c3Smrg#define RANDR_MAJOR		1
4317ca54c3Smrg#define RANDR_MINOR		6
4417ca54c3Smrg
4517ca54c3Smrg#define RRNumberErrors		5
4617ca54c3Smrg#define RRNumberEvents		2
4717ca54c3Smrg#define RRNumberRequests	47
4817ca54c3Smrg
4917ca54c3Smrg#define X_RRQueryVersion	0
5017ca54c3Smrg/* we skip 1 to make old clients fail pretty immediately */
5117ca54c3Smrg#define X_RROldGetScreenInfo	1
5217ca54c3Smrg#define X_RR1_0SetScreenConfig	2
5317ca54c3Smrg/* V1.0 apps share the same set screen config request id */
5417ca54c3Smrg#define X_RRSetScreenConfig	2
5517ca54c3Smrg#define X_RROldScreenChangeSelectInput	3
5617ca54c3Smrg/* 3 used to be ScreenChangeSelectInput; deprecated */
5717ca54c3Smrg#define X_RRSelectInput		4
5817ca54c3Smrg#define X_RRGetScreenInfo	5
5917ca54c3Smrg
6017ca54c3Smrg/* V1.2 additions */
6117ca54c3Smrg#define X_RRGetScreenSizeRange	    6
6217ca54c3Smrg#define X_RRSetScreenSize	    7
6317ca54c3Smrg#define X_RRGetScreenResources	    8
6417ca54c3Smrg#define X_RRGetOutputInfo	    9
6517ca54c3Smrg#define X_RRListOutputProperties    10
6617ca54c3Smrg#define X_RRQueryOutputProperty	    11
6717ca54c3Smrg#define X_RRConfigureOutputProperty 12
6817ca54c3Smrg#define X_RRChangeOutputProperty    13
6917ca54c3Smrg#define X_RRDeleteOutputProperty    14
7017ca54c3Smrg#define X_RRGetOutputProperty	    15
7117ca54c3Smrg#define X_RRCreateMode		    16
7217ca54c3Smrg#define X_RRDestroyMode		    17
7317ca54c3Smrg#define X_RRAddOutputMode	    18
7417ca54c3Smrg#define X_RRDeleteOutputMode	    19
7517ca54c3Smrg#define X_RRGetCrtcInfo		    20
7617ca54c3Smrg#define X_RRSetCrtcConfig	    21
7717ca54c3Smrg#define X_RRGetCrtcGammaSize	    22
7817ca54c3Smrg#define X_RRGetCrtcGamma	    23
7917ca54c3Smrg#define X_RRSetCrtcGamma	    24
8017ca54c3Smrg
8117ca54c3Smrg/* V1.3 additions */
8217ca54c3Smrg#define X_RRGetScreenResourcesCurrent	25
8317ca54c3Smrg#define X_RRSetCrtcTransform	    26
8417ca54c3Smrg#define X_RRGetCrtcTransform	    27
8517ca54c3Smrg#define X_RRGetPanning		    28
8617ca54c3Smrg#define X_RRSetPanning		    29
8717ca54c3Smrg#define X_RRSetOutputPrimary	    30
8817ca54c3Smrg#define X_RRGetOutputPrimary	    31
8917ca54c3Smrg
9017ca54c3Smrg#define RRTransformUnit		    (1L << 0)
9117ca54c3Smrg#define RRTransformScaleUp	    (1L << 1)
9217ca54c3Smrg#define RRTransformScaleDown	    (1L << 2)
9317ca54c3Smrg#define RRTransformProjective	    (1L << 3)
9417ca54c3Smrg
9517ca54c3Smrg/* v1.4 */
9617ca54c3Smrg#define X_RRGetProviders	      32
9717ca54c3Smrg#define X_RRGetProviderInfo	      33
9817ca54c3Smrg#define X_RRSetProviderOffloadSink    34
9917ca54c3Smrg#define X_RRSetProviderOutputSource   35
10017ca54c3Smrg#define X_RRListProviderProperties    36
10117ca54c3Smrg#define X_RRQueryProviderProperty     37
10217ca54c3Smrg#define X_RRConfigureProviderProperty 38
10317ca54c3Smrg#define X_RRChangeProviderProperty    39
10417ca54c3Smrg#define X_RRDeleteProviderProperty    40
10517ca54c3Smrg#define X_RRGetProviderProperty	      41
10617ca54c3Smrg
10717ca54c3Smrg/* v1.5 */
10817ca54c3Smrg#define X_RRGetMonitors		      42
10917ca54c3Smrg#define X_RRSetMonitor		      43
11017ca54c3Smrg#define X_RRDeleteMonitor	      44
11117ca54c3Smrg
11217ca54c3Smrg/* v1.6 */
11317ca54c3Smrg#define X_RRCreateLease		      45
11417ca54c3Smrg#define X_RRFreeLease		      46
11517ca54c3Smrg
11617ca54c3Smrg/* Event selection bits */
11717ca54c3Smrg#define RRScreenChangeNotifyMask  (1L << 0)
11817ca54c3Smrg/* V1.2 additions */
11917ca54c3Smrg#define RRCrtcChangeNotifyMask	    (1L << 1)
12017ca54c3Smrg#define RROutputChangeNotifyMask    (1L << 2)
12117ca54c3Smrg#define RROutputPropertyNotifyMask  (1L << 3)
12217ca54c3Smrg/* V1.4 additions */
12317ca54c3Smrg#define RRProviderChangeNotifyMask   (1L << 4)
12417ca54c3Smrg#define RRProviderPropertyNotifyMask (1L << 5)
12517ca54c3Smrg#define RRResourceChangeNotifyMask   (1L << 6)
12617ca54c3Smrg/* V1.6 additions */
12717ca54c3Smrg#define RRLeaseNotifyMask            (1L << 7)
12817ca54c3Smrg
12917ca54c3Smrg/* Event codes */
13017ca54c3Smrg#define RRScreenChangeNotify	0
13117ca54c3Smrg/* V1.2 additions */
13217ca54c3Smrg#define RRNotify		    1
13317ca54c3Smrg/* RRNotify Subcodes */
13417ca54c3Smrg#define  RRNotify_CrtcChange	    0
13517ca54c3Smrg#define  RRNotify_OutputChange	    1
13617ca54c3Smrg#define  RRNotify_OutputProperty    2
13717ca54c3Smrg#define  RRNotify_ProviderChange    3
13817ca54c3Smrg#define  RRNotify_ProviderProperty  4
13917ca54c3Smrg#define  RRNotify_ResourceChange    5
14017ca54c3Smrg/* V1.6 additions */
14117ca54c3Smrg#define  RRNotify_Lease             6
14217ca54c3Smrg/* used in the rotation field; rotation and reflection in 0.1 proto. */
14317ca54c3Smrg#define RR_Rotate_0		1
14417ca54c3Smrg#define RR_Rotate_90		2
14517ca54c3Smrg#define RR_Rotate_180		4
14617ca54c3Smrg#define RR_Rotate_270		8
14717ca54c3Smrg
14817ca54c3Smrg/* new in 1.0 protocol, to allow reflection of screen */
14917ca54c3Smrg
15017ca54c3Smrg#define RR_Reflect_X		16
15117ca54c3Smrg#define RR_Reflect_Y		32
15217ca54c3Smrg
15317ca54c3Smrg#define RRSetConfigSuccess		0
15417ca54c3Smrg#define RRSetConfigInvalidConfigTime	1
15517ca54c3Smrg#define RRSetConfigInvalidTime		2
15617ca54c3Smrg#define RRSetConfigFailed		3
15717ca54c3Smrg
15817ca54c3Smrg/* new in 1.2 protocol */
15917ca54c3Smrg
16017ca54c3Smrg#define RR_HSyncPositive	0x00000001
16117ca54c3Smrg#define RR_HSyncNegative	0x00000002
16217ca54c3Smrg#define RR_VSyncPositive	0x00000004
16317ca54c3Smrg#define RR_VSyncNegative	0x00000008
16417ca54c3Smrg#define RR_Interlace		0x00000010
16517ca54c3Smrg#define RR_DoubleScan		0x00000020
16617ca54c3Smrg#define RR_CSync		0x00000040
16717ca54c3Smrg#define RR_CSyncPositive	0x00000080
16817ca54c3Smrg#define RR_CSyncNegative	0x00000100
16917ca54c3Smrg#define RR_HSkewPresent		0x00000200
17017ca54c3Smrg#define RR_BCast		0x00000400
17117ca54c3Smrg#define RR_PixelMultiplex	0x00000800
17217ca54c3Smrg#define RR_DoubleClock		0x00001000
17317ca54c3Smrg#define RR_ClockDivideBy2	0x00002000
17417ca54c3Smrg
17517ca54c3Smrg#define RR_Connected		0
17617ca54c3Smrg#define RR_Disconnected		1
17717ca54c3Smrg#define RR_UnknownConnection	2
17817ca54c3Smrg
17917ca54c3Smrg#define BadRROutput		0
18017ca54c3Smrg#define BadRRCrtc		1
18117ca54c3Smrg#define BadRRMode		2
18217ca54c3Smrg#define BadRRProvider		3
18317ca54c3Smrg#define BadRRLease		4
18417ca54c3Smrg
18517ca54c3Smrg/* Conventional RandR output properties */
18617ca54c3Smrg
18717ca54c3Smrg#define RR_PROPERTY_BACKLIGHT		"Backlight"
18817ca54c3Smrg#define RR_PROPERTY_RANDR_EDID		"EDID"
18917ca54c3Smrg#define RR_PROPERTY_SIGNAL_FORMAT	"SignalFormat"
19017ca54c3Smrg#define RR_PROPERTY_SIGNAL_PROPERTIES	"SignalProperties"
19117ca54c3Smrg#define RR_PROPERTY_CONNECTOR_TYPE	"ConnectorType"
19217ca54c3Smrg#define RR_PROPERTY_CONNECTOR_NUMBER	"ConnectorNumber"
19317ca54c3Smrg#define RR_PROPERTY_COMPATIBILITY_LIST	"CompatibilityList"
19417ca54c3Smrg#define RR_PROPERTY_CLONE_LIST		"CloneList"
19517ca54c3Smrg#define RR_PROPERTY_BORDER		"Border"
19617ca54c3Smrg#define RR_PROPERTY_BORDER_DIMENSIONS	"BorderDimensions"
19717ca54c3Smrg#define RR_PROPERTY_GUID		"GUID"
19817ca54c3Smrg#define RR_PROPERTY_RANDR_TILE		"TILE"
19917ca54c3Smrg#define RR_PROPERTY_NON_DESKTOP		"non-desktop"
20017ca54c3Smrg
20117ca54c3Smrg/* roles this device can carry out */
20217ca54c3Smrg#define RR_Capability_None 0
20317ca54c3Smrg#define RR_Capability_SourceOutput 1
20417ca54c3Smrg#define RR_Capability_SinkOutput 2
20517ca54c3Smrg#define RR_Capability_SourceOffload 4
20617ca54c3Smrg#define RR_Capability_SinkOffload 8
20717ca54c3Smrg
20817ca54c3Smrg#endif	/* _RANDR_H_ */
209