randrstr.h revision 05b261ec
105b261ecSmrg/*
205b261ecSmrg * Copyright © 2000 Compaq Computer Corporation
305b261ecSmrg * Copyright © 2002 Hewlett-Packard Company
405b261ecSmrg * Copyright © 2006 Intel Corporation
505b261ecSmrg *
605b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
705b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
805b261ecSmrg * the above copyright notice appear in all copies and that both that copyright
905b261ecSmrg * notice and this permission notice appear in supporting documentation, and
1005b261ecSmrg * that the name of the copyright holders not be used in advertising or
1105b261ecSmrg * publicity pertaining to distribution of the software without specific,
1205b261ecSmrg * written prior permission.  The copyright holders make no representations
1305b261ecSmrg * about the suitability of this software for any purpose.  It is provided "as
1405b261ecSmrg * is" without express or implied warranty.
1505b261ecSmrg *
1605b261ecSmrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1705b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1805b261ecSmrg * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
1905b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
2005b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
2105b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
2205b261ecSmrg * OF THIS SOFTWARE.
2305b261ecSmrg *
2405b261ecSmrg * Author:  Jim Gettys, Hewlett-Packard Company, Inc.
2505b261ecSmrg *	    Keith Packard, Intel Corporation
2605b261ecSmrg */
2705b261ecSmrg
2805b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
2905b261ecSmrg#include <dix-config.h>
3005b261ecSmrg#endif
3105b261ecSmrg
3205b261ecSmrg#ifndef _RANDRSTR_H_
3305b261ecSmrg#define _RANDRSTR_H_
3405b261ecSmrg
3505b261ecSmrg#include <X11/X.h>
3605b261ecSmrg#include <X11/Xproto.h>
3705b261ecSmrg#include "misc.h"
3805b261ecSmrg#include "os.h"
3905b261ecSmrg#include "dixstruct.h"
4005b261ecSmrg#include "resource.h"
4105b261ecSmrg#include "scrnintstr.h"
4205b261ecSmrg#include "windowstr.h"
4305b261ecSmrg#include "pixmapstr.h"
4405b261ecSmrg#include "extnsionst.h"
4505b261ecSmrg#include "servermd.h"
4605b261ecSmrg#include <X11/extensions/randr.h>
4705b261ecSmrg#include <X11/extensions/randrproto.h>
4805b261ecSmrg#ifdef RENDER
4905b261ecSmrg#include <X11/extensions/render.h> 	/* we share subpixel order information */
5005b261ecSmrg#include "picturestr.h"
5105b261ecSmrg#endif
5205b261ecSmrg#include <X11/Xfuncproto.h>
5305b261ecSmrg
5405b261ecSmrg/* required for ABI compatibility for now */
5505b261ecSmrg#define RANDR_10_INTERFACE 1
5605b261ecSmrg#define RANDR_12_INTERFACE 1
5705b261ecSmrg
5805b261ecSmrgtypedef XID	RRMode;
5905b261ecSmrgtypedef XID	RROutput;
6005b261ecSmrgtypedef XID	RRCrtc;
6105b261ecSmrg
6205b261ecSmrgextern int	RREventBase, RRErrorBase;
6305b261ecSmrg
6405b261ecSmrgextern int (*ProcRandrVector[RRNumberRequests])(ClientPtr);
6505b261ecSmrgextern int (*SProcRandrVector[RRNumberRequests])(ClientPtr);
6605b261ecSmrg
6705b261ecSmrg/*
6805b261ecSmrg * Modeline for a monitor. Name follows directly after this struct
6905b261ecSmrg */
7005b261ecSmrg
7105b261ecSmrg#define RRModeName(pMode) ((char *) (pMode + 1))
7205b261ecSmrgtypedef struct _rrMode		RRModeRec, *RRModePtr;
7305b261ecSmrgtypedef struct _rrPropertyValue	RRPropertyValueRec, *RRPropertyValuePtr;
7405b261ecSmrgtypedef struct _rrProperty	RRPropertyRec, *RRPropertyPtr;
7505b261ecSmrgtypedef struct _rrCrtc		RRCrtcRec, *RRCrtcPtr;
7605b261ecSmrgtypedef struct _rrOutput	RROutputRec, *RROutputPtr;
7705b261ecSmrg
7805b261ecSmrgstruct _rrMode {
7905b261ecSmrg    int		    refcnt;
8005b261ecSmrg    xRRModeInfo	    mode;
8105b261ecSmrg    char	    *name;
8205b261ecSmrg    ScreenPtr	    userScreen;
8305b261ecSmrg};
8405b261ecSmrg
8505b261ecSmrgstruct _rrPropertyValue {
8605b261ecSmrg    Atom	    type;       /* ignored by server */
8705b261ecSmrg    short	    format;     /* format of data for swapping - 8,16,32 */
8805b261ecSmrg    long	    size;	/* size of data in (format/8) bytes */
8905b261ecSmrg    pointer         data;	/* private to client */
9005b261ecSmrg};
9105b261ecSmrg
9205b261ecSmrgstruct _rrProperty {
9305b261ecSmrg    RRPropertyPtr   next;
9405b261ecSmrg    ATOM 	    propertyName;
9505b261ecSmrg    Bool	    is_pending;
9605b261ecSmrg    Bool	    range;
9705b261ecSmrg    Bool	    immutable;
9805b261ecSmrg    int		    num_valid;
9905b261ecSmrg    INT32	    *valid_values;
10005b261ecSmrg    RRPropertyValueRec	current, pending;
10105b261ecSmrg};
10205b261ecSmrg
10305b261ecSmrgstruct _rrCrtc {
10405b261ecSmrg    RRCrtc	    id;
10505b261ecSmrg    ScreenPtr	    pScreen;
10605b261ecSmrg    RRModePtr	    mode;
10705b261ecSmrg    int		    x, y;
10805b261ecSmrg    Rotation	    rotation;
10905b261ecSmrg    Rotation	    rotations;
11005b261ecSmrg    Bool	    changed;
11105b261ecSmrg    int		    numOutputs;
11205b261ecSmrg    RROutputPtr	    *outputs;
11305b261ecSmrg    int		    gammaSize;
11405b261ecSmrg    CARD16	    *gammaRed;
11505b261ecSmrg    CARD16	    *gammaBlue;
11605b261ecSmrg    CARD16	    *gammaGreen;
11705b261ecSmrg    void	    *devPrivate;
11805b261ecSmrg};
11905b261ecSmrg
12005b261ecSmrgstruct _rrOutput {
12105b261ecSmrg    RROutput	    id;
12205b261ecSmrg    ScreenPtr	    pScreen;
12305b261ecSmrg    char	    *name;
12405b261ecSmrg    int		    nameLength;
12505b261ecSmrg    CARD8	    connection;
12605b261ecSmrg    CARD8	    subpixelOrder;
12705b261ecSmrg    int		    mmWidth;
12805b261ecSmrg    int		    mmHeight;
12905b261ecSmrg    RRCrtcPtr	    crtc;
13005b261ecSmrg    int		    numCrtcs;
13105b261ecSmrg    RRCrtcPtr	    *crtcs;
13205b261ecSmrg    int		    numClones;
13305b261ecSmrg    RROutputPtr	    *clones;
13405b261ecSmrg    int		    numModes;
13505b261ecSmrg    int		    numPreferred;
13605b261ecSmrg    RRModePtr	    *modes;
13705b261ecSmrg    int		    numUserModes;
13805b261ecSmrg    RRModePtr	    *userModes;
13905b261ecSmrg    Bool	    changed;
14005b261ecSmrg    RRPropertyPtr   properties;
14105b261ecSmrg    Bool	    pendingProperties;
14205b261ecSmrg    void	    *devPrivate;
14305b261ecSmrg};
14405b261ecSmrg
14505b261ecSmrg#if RANDR_12_INTERFACE
14605b261ecSmrgtypedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr	pScreen,
14705b261ecSmrg					CARD16		width,
14805b261ecSmrg					CARD16		height,
14905b261ecSmrg					CARD32		mmWidth,
15005b261ecSmrg					CARD32		mmHeight);
15105b261ecSmrg
15205b261ecSmrgtypedef Bool (*RRCrtcSetProcPtr) (ScreenPtr		pScreen,
15305b261ecSmrg				  RRCrtcPtr		crtc,
15405b261ecSmrg				  RRModePtr		mode,
15505b261ecSmrg				  int			x,
15605b261ecSmrg				  int			y,
15705b261ecSmrg				  Rotation		rotation,
15805b261ecSmrg				  int			numOutputs,
15905b261ecSmrg				  RROutputPtr		*outputs);
16005b261ecSmrg
16105b261ecSmrgtypedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr	pScreen,
16205b261ecSmrg				       RRCrtcPtr	crtc);
16305b261ecSmrg
16405b261ecSmrgtypedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr		pScreen,
16505b261ecSmrg					    RROutputPtr		output,
16605b261ecSmrg					    Atom		property,
16705b261ecSmrg					    RRPropertyValuePtr	value);
16805b261ecSmrg
16905b261ecSmrgtypedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr		pScreen,
17005b261ecSmrg					     RROutputPtr	output,
17105b261ecSmrg					     RRModePtr		mode);
17205b261ecSmrg
17305b261ecSmrgtypedef void (*RRModeDestroyProcPtr) (ScreenPtr	    pScreen,
17405b261ecSmrg				      RRModePtr	    mode);
17505b261ecSmrg
17605b261ecSmrg#endif
17705b261ecSmrg
17805b261ecSmrgtypedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation *rotations);
17905b261ecSmrgtypedef Bool (*RRCloseScreenProcPtr) ( int i, ScreenPtr pscreen);
18005b261ecSmrg
18105b261ecSmrg/* These are for 1.0 compatibility */
18205b261ecSmrg
18305b261ecSmrgtypedef struct _rrRefresh {
18405b261ecSmrg    CARD16	    rate;
18505b261ecSmrg    RRModePtr	    mode;
18605b261ecSmrg} RRScreenRate, *RRScreenRatePtr;
18705b261ecSmrg
18805b261ecSmrgtypedef struct _rrScreenSize {
18905b261ecSmrg    int		    id;
19005b261ecSmrg    short	    width, height;
19105b261ecSmrg    short	    mmWidth, mmHeight;
19205b261ecSmrg    int		    nRates;
19305b261ecSmrg    RRScreenRatePtr pRates;
19405b261ecSmrg} RRScreenSize, *RRScreenSizePtr;
19505b261ecSmrg
19605b261ecSmrg#ifdef RANDR_10_INTERFACE
19705b261ecSmrg
19805b261ecSmrgtypedef Bool (*RRSetConfigProcPtr) (ScreenPtr		pScreen,
19905b261ecSmrg				    Rotation		rotation,
20005b261ecSmrg				    int			rate,
20105b261ecSmrg				    RRScreenSizePtr	pSize);
20205b261ecSmrg
20305b261ecSmrg#endif
20405b261ecSmrg
20505b261ecSmrg
20605b261ecSmrgtypedef struct _rrScrPriv {
20705b261ecSmrg    /*
20805b261ecSmrg     * 'public' part of the structure; DDXen fill this in
20905b261ecSmrg     * as they initialize
21005b261ecSmrg     */
21105b261ecSmrg#if RANDR_10_INTERFACE
21205b261ecSmrg    RRSetConfigProcPtr	    rrSetConfig;
21305b261ecSmrg#endif
21405b261ecSmrg    RRGetInfoProcPtr	    rrGetInfo;
21505b261ecSmrg#if RANDR_12_INTERFACE
21605b261ecSmrg    RRScreenSetSizeProcPtr  rrScreenSetSize;
21705b261ecSmrg    RRCrtcSetProcPtr	    rrCrtcSet;
21805b261ecSmrg    RRCrtcSetGammaProcPtr   rrCrtcSetGamma;
21905b261ecSmrg    RROutputSetPropertyProcPtr	rrOutputSetProperty;
22005b261ecSmrg    RROutputValidateModeProcPtr	rrOutputValidateMode;
22105b261ecSmrg    RRModeDestroyProcPtr	rrModeDestroy;
22205b261ecSmrg#endif
22305b261ecSmrg
22405b261ecSmrg    /*
22505b261ecSmrg     * Private part of the structure; not considered part of the ABI
22605b261ecSmrg     */
22705b261ecSmrg    TimeStamp		    lastSetTime;	/* last changed by client */
22805b261ecSmrg    TimeStamp		    lastConfigTime;	/* possible configs changed */
22905b261ecSmrg    RRCloseScreenProcPtr    CloseScreen;
23005b261ecSmrg
23105b261ecSmrg    Bool		    changed;		/* some config changed */
23205b261ecSmrg    Bool		    configChanged;	/* configuration changed */
23305b261ecSmrg    Bool		    layoutChanged;	/* screen layout changed */
23405b261ecSmrg
23505b261ecSmrg    CARD16		    minWidth, minHeight;
23605b261ecSmrg    CARD16		    maxWidth, maxHeight;
23705b261ecSmrg    CARD16		    width, height;	/* last known screen size */
23805b261ecSmrg    CARD16		    mmWidth, mmHeight;	/* last known screen size */
23905b261ecSmrg
24005b261ecSmrg    int			    numOutputs;
24105b261ecSmrg    RROutputPtr		    *outputs;
24205b261ecSmrg
24305b261ecSmrg    int			    numCrtcs;
24405b261ecSmrg    RRCrtcPtr		    *crtcs;
24505b261ecSmrg
24605b261ecSmrg    /* Last known pointer position */
24705b261ecSmrg    RRCrtcPtr		    pointerCrtc;
24805b261ecSmrg
24905b261ecSmrg#ifdef RANDR_10_INTERFACE
25005b261ecSmrg    /*
25105b261ecSmrg     * Configuration information
25205b261ecSmrg     */
25305b261ecSmrg    Rotation		    rotations;
25405b261ecSmrg    CARD16		    reqWidth, reqHeight;
25505b261ecSmrg
25605b261ecSmrg    int			    nSizes;
25705b261ecSmrg    RRScreenSizePtr	    pSizes;
25805b261ecSmrg
25905b261ecSmrg    Rotation		    rotation;
26005b261ecSmrg    int			    rate;
26105b261ecSmrg    int			    size;
26205b261ecSmrg#endif
26305b261ecSmrg} rrScrPrivRec, *rrScrPrivPtr;
26405b261ecSmrg
26505b261ecSmrgextern int rrPrivIndex;
26605b261ecSmrg
26705b261ecSmrg#define rrGetScrPriv(pScr)  ((rrScrPrivPtr) (pScr)->devPrivates[rrPrivIndex].ptr)
26805b261ecSmrg#define rrScrPriv(pScr)	rrScrPrivPtr    pScrPriv = rrGetScrPriv(pScr)
26905b261ecSmrg#define SetRRScreen(s,p) ((s)->devPrivates[rrPrivIndex].ptr = (pointer) (p))
27005b261ecSmrg
27105b261ecSmrg/*
27205b261ecSmrg * each window has a list of clients requesting
27305b261ecSmrg * RRNotify events.  Each client has a resource
27405b261ecSmrg * for each window it selects RRNotify input for,
27505b261ecSmrg * this resource is used to delete the RRNotifyRec
27605b261ecSmrg * entry from the per-window queue.
27705b261ecSmrg */
27805b261ecSmrg
27905b261ecSmrgtypedef struct _RREvent *RREventPtr;
28005b261ecSmrg
28105b261ecSmrgtypedef struct _RREvent {
28205b261ecSmrg    RREventPtr  next;
28305b261ecSmrg    ClientPtr	client;
28405b261ecSmrg    WindowPtr	window;
28505b261ecSmrg    XID		clientResource;
28605b261ecSmrg    int		mask;
28705b261ecSmrg} RREventRec;
28805b261ecSmrg
28905b261ecSmrgtypedef struct _RRTimes {
29005b261ecSmrg    TimeStamp	setTime;
29105b261ecSmrg    TimeStamp	configTime;
29205b261ecSmrg} RRTimesRec, *RRTimesPtr;
29305b261ecSmrg
29405b261ecSmrgtypedef struct _RRClient {
29505b261ecSmrg    int		major_version;
29605b261ecSmrg    int		minor_version;
29705b261ecSmrg/*  RRTimesRec	times[0]; */
29805b261ecSmrg} RRClientRec, *RRClientPtr;
29905b261ecSmrg
30005b261ecSmrgextern RESTYPE	RRClientType, RREventType; /* resource types for event masks */
30105b261ecSmrgextern int	RRClientPrivateIndex;
30205b261ecSmrgextern RESTYPE	RRCrtcType, RRModeType, RROutputType;
30305b261ecSmrg
30405b261ecSmrg#define LookupOutput(client,id,a) ((RROutputPtr) \
30505b261ecSmrg				   (SecurityLookupIDByType (client, id, \
30605b261ecSmrg							    RROutputType, a)))
30705b261ecSmrg#define LookupCrtc(client,id,a) ((RRCrtcPtr) \
30805b261ecSmrg				 (SecurityLookupIDByType (client, id, \
30905b261ecSmrg							  RRCrtcType, a)))
31005b261ecSmrg#define LookupMode(client,id,a) ((RRModePtr) \
31105b261ecSmrg				 (SecurityLookupIDByType (client, id, \
31205b261ecSmrg							  RRModeType, a)))
31305b261ecSmrg
31405b261ecSmrg#define GetRRClient(pClient)    ((RRClientPtr) (pClient)->devPrivates[RRClientPrivateIndex].ptr)
31505b261ecSmrg#define rrClientPriv(pClient)	RRClientPtr pRRClient = GetRRClient(pClient)
31605b261ecSmrg
31705b261ecSmrg/* Initialize the extension */
31805b261ecSmrgvoid
31905b261ecSmrgRRExtensionInit (void);
32005b261ecSmrg
32105b261ecSmrg#ifdef RANDR_12_INTERFACE
32205b261ecSmrg/*
32305b261ecSmrg * Set the range of sizes for the screen
32405b261ecSmrg */
32505b261ecSmrgvoid
32605b261ecSmrgRRScreenSetSizeRange (ScreenPtr	pScreen,
32705b261ecSmrg		      CARD16	minWidth,
32805b261ecSmrg		      CARD16	minHeight,
32905b261ecSmrg		      CARD16	maxWidth,
33005b261ecSmrg		      CARD16	maxHeight);
33105b261ecSmrg#endif
33205b261ecSmrg
33305b261ecSmrg/* rrscreen.c */
33405b261ecSmrg/*
33505b261ecSmrg * Notify the extension that the screen size has been changed.
33605b261ecSmrg * The driver is responsible for calling this whenever it has changed
33705b261ecSmrg * the size of the screen
33805b261ecSmrg */
33905b261ecSmrgvoid
34005b261ecSmrgRRScreenSizeNotify (ScreenPtr	pScreen);
34105b261ecSmrg
34205b261ecSmrg/*
34305b261ecSmrg * Request that the screen be resized
34405b261ecSmrg */
34505b261ecSmrgBool
34605b261ecSmrgRRScreenSizeSet (ScreenPtr  pScreen,
34705b261ecSmrg		 CARD16	    width,
34805b261ecSmrg		 CARD16	    height,
34905b261ecSmrg		 CARD32	    mmWidth,
35005b261ecSmrg		 CARD32	    mmHeight);
35105b261ecSmrg
35205b261ecSmrg/*
35305b261ecSmrg * Send ConfigureNotify event to root window when 'something' happens
35405b261ecSmrg */
35505b261ecSmrgvoid
35605b261ecSmrgRRSendConfigNotify (ScreenPtr pScreen);
35705b261ecSmrg
35805b261ecSmrg/*
35905b261ecSmrg * screen dispatch
36005b261ecSmrg */
36105b261ecSmrgint
36205b261ecSmrgProcRRGetScreenSizeRange (ClientPtr client);
36305b261ecSmrg
36405b261ecSmrgint
36505b261ecSmrgProcRRSetScreenSize (ClientPtr client);
36605b261ecSmrg
36705b261ecSmrgint
36805b261ecSmrgProcRRGetScreenResources (ClientPtr client);
36905b261ecSmrg
37005b261ecSmrgint
37105b261ecSmrgProcRRSetScreenConfig (ClientPtr client);
37205b261ecSmrg
37305b261ecSmrgint
37405b261ecSmrgProcRRGetScreenInfo (ClientPtr client);
37505b261ecSmrg
37605b261ecSmrg/*
37705b261ecSmrg * Deliver a ScreenNotify event
37805b261ecSmrg */
37905b261ecSmrgvoid
38005b261ecSmrgRRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
38105b261ecSmrg
38205b261ecSmrg/* mirandr.c */
38305b261ecSmrgBool
38405b261ecSmrgmiRandRInit (ScreenPtr pScreen);
38505b261ecSmrg
38605b261ecSmrgBool
38705b261ecSmrgmiRRGetInfo (ScreenPtr pScreen, Rotation *rotations);
38805b261ecSmrg
38905b261ecSmrgBool
39005b261ecSmrgmiRRGetScreenInfo (ScreenPtr pScreen);
39105b261ecSmrg
39205b261ecSmrgBool
39305b261ecSmrgmiRRCrtcSet (ScreenPtr	pScreen,
39405b261ecSmrg	     RRCrtcPtr	crtc,
39505b261ecSmrg	     RRModePtr	mode,
39605b261ecSmrg	     int	x,
39705b261ecSmrg	     int	y,
39805b261ecSmrg	     Rotation	rotation,
39905b261ecSmrg	     int	numOutput,
40005b261ecSmrg	     RROutputPtr *outputs);
40105b261ecSmrg
40205b261ecSmrgBool
40305b261ecSmrgmiRROutputSetProperty (ScreenPtr	    pScreen,
40405b261ecSmrg		       RROutputPtr	    output,
40505b261ecSmrg		       Atom		    property,
40605b261ecSmrg		       RRPropertyValuePtr   value);
40705b261ecSmrg
40805b261ecSmrgBool
40905b261ecSmrgmiRROutputValidateMode (ScreenPtr	    pScreen,
41005b261ecSmrg			RROutputPtr	    output,
41105b261ecSmrg			RRModePtr	    mode);
41205b261ecSmrg
41305b261ecSmrgvoid
41405b261ecSmrgmiRRModeDestroy (ScreenPtr  pScreen,
41505b261ecSmrg		 RRModePtr  mode);
41605b261ecSmrg
41705b261ecSmrg/* randr.c */
41805b261ecSmrg/*
41905b261ecSmrg * Send all pending events
42005b261ecSmrg */
42105b261ecSmrgvoid
42205b261ecSmrgRRTellChanged (ScreenPtr pScreen);
42305b261ecSmrg
42405b261ecSmrg/*
42505b261ecSmrg * Poll the driver for changed information
42605b261ecSmrg */
42705b261ecSmrgBool
42805b261ecSmrgRRGetInfo (ScreenPtr pScreen);
42905b261ecSmrg
43005b261ecSmrgBool RRInit (void);
43105b261ecSmrg
43205b261ecSmrgBool RRScreenInit(ScreenPtr pScreen);
43305b261ecSmrg
43405b261ecSmrgRROutputPtr
43505b261ecSmrgRRFirstOutput (ScreenPtr pScreen);
43605b261ecSmrg
43705b261ecSmrgRotation
43805b261ecSmrgRRGetRotation (ScreenPtr pScreen);
43905b261ecSmrg
44005b261ecSmrgCARD16
44105b261ecSmrgRRVerticalRefresh (xRRModeInfo *mode);
44205b261ecSmrg
44305b261ecSmrg#ifdef RANDR_10_INTERFACE
44405b261ecSmrg/*
44505b261ecSmrg * This is the old interface, deprecated but left
44605b261ecSmrg * around for compatibility
44705b261ecSmrg */
44805b261ecSmrg
44905b261ecSmrg/*
45005b261ecSmrg * Then, register the specific size with the screen
45105b261ecSmrg */
45205b261ecSmrg
45305b261ecSmrgRRScreenSizePtr
45405b261ecSmrgRRRegisterSize (ScreenPtr		pScreen,
45505b261ecSmrg		short			width,
45605b261ecSmrg		short			height,
45705b261ecSmrg		short			mmWidth,
45805b261ecSmrg		short			mmHeight);
45905b261ecSmrg
46005b261ecSmrgBool RRRegisterRate (ScreenPtr		pScreen,
46105b261ecSmrg		     RRScreenSizePtr	pSize,
46205b261ecSmrg		     int		rate);
46305b261ecSmrg
46405b261ecSmrg/*
46505b261ecSmrg * Finally, set the current configuration of the screen
46605b261ecSmrg */
46705b261ecSmrg
46805b261ecSmrgvoid
46905b261ecSmrgRRSetCurrentConfig (ScreenPtr		pScreen,
47005b261ecSmrg		    Rotation		rotation,
47105b261ecSmrg		    int			rate,
47205b261ecSmrg		    RRScreenSizePtr	pSize);
47305b261ecSmrg
47405b261ecSmrgBool RRScreenInit (ScreenPtr pScreen);
47505b261ecSmrg
47605b261ecSmrgRotation
47705b261ecSmrgRRGetRotation (ScreenPtr pScreen);
47805b261ecSmrg
47905b261ecSmrgint
48005b261ecSmrgRRSetScreenConfig (ScreenPtr		pScreen,
48105b261ecSmrg		   Rotation		rotation,
48205b261ecSmrg		   int			rate,
48305b261ecSmrg		   RRScreenSizePtr	pSize);
48405b261ecSmrg
48505b261ecSmrg#endif
48605b261ecSmrg
48705b261ecSmrg/* rrcrtc.c */
48805b261ecSmrg
48905b261ecSmrg/*
49005b261ecSmrg * Notify the CRTC of some change; layoutChanged indicates that
49105b261ecSmrg * some position or size element changed
49205b261ecSmrg */
49305b261ecSmrgvoid
49405b261ecSmrgRRCrtcChanged (RRCrtcPtr crtc, Bool layoutChanged);
49505b261ecSmrg
49605b261ecSmrg/*
49705b261ecSmrg * Create a CRTC
49805b261ecSmrg */
49905b261ecSmrgRRCrtcPtr
50005b261ecSmrgRRCrtcCreate (ScreenPtr pScreen, void	*devPrivate);
50105b261ecSmrg
50205b261ecSmrg/*
50305b261ecSmrg * Set the allowed rotations on a CRTC
50405b261ecSmrg */
50505b261ecSmrgvoid
50605b261ecSmrgRRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations);
50705b261ecSmrg
50805b261ecSmrg/*
50905b261ecSmrg * Notify the extension that the Crtc has been reconfigured,
51005b261ecSmrg * the driver calls this whenever it has updated the mode
51105b261ecSmrg */
51205b261ecSmrgBool
51305b261ecSmrgRRCrtcNotify (RRCrtcPtr	    crtc,
51405b261ecSmrg	      RRModePtr	    mode,
51505b261ecSmrg	      int	    x,
51605b261ecSmrg	      int	    y,
51705b261ecSmrg	      Rotation	    rotation,
51805b261ecSmrg	      int	    numOutputs,
51905b261ecSmrg	      RROutputPtr   *outputs);
52005b261ecSmrg
52105b261ecSmrgvoid
52205b261ecSmrgRRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
52305b261ecSmrg
52405b261ecSmrg/*
52505b261ecSmrg * Request that the Crtc be reconfigured
52605b261ecSmrg */
52705b261ecSmrgBool
52805b261ecSmrgRRCrtcSet (RRCrtcPtr    crtc,
52905b261ecSmrg	   RRModePtr	mode,
53005b261ecSmrg	   int		x,
53105b261ecSmrg	   int		y,
53205b261ecSmrg	   Rotation	rotation,
53305b261ecSmrg	   int		numOutput,
53405b261ecSmrg	   RROutputPtr  *outputs);
53505b261ecSmrg
53605b261ecSmrg/*
53705b261ecSmrg * Request that the Crtc gamma be changed
53805b261ecSmrg */
53905b261ecSmrg
54005b261ecSmrgBool
54105b261ecSmrgRRCrtcGammaSet (RRCrtcPtr   crtc,
54205b261ecSmrg		CARD16	    *red,
54305b261ecSmrg		CARD16	    *green,
54405b261ecSmrg		CARD16	    *blue);
54505b261ecSmrg
54605b261ecSmrg/*
54705b261ecSmrg * Notify the extension that the Crtc gamma has been changed
54805b261ecSmrg * The driver calls this whenever it has changed the gamma values
54905b261ecSmrg * in the RRCrtcRec
55005b261ecSmrg */
55105b261ecSmrg
55205b261ecSmrgBool
55305b261ecSmrgRRCrtcGammaNotify (RRCrtcPtr	crtc);
55405b261ecSmrg
55505b261ecSmrg/*
55605b261ecSmrg * Set the size of the gamma table at server startup time
55705b261ecSmrg */
55805b261ecSmrg
55905b261ecSmrgBool
56005b261ecSmrgRRCrtcGammaSetSize (RRCrtcPtr	crtc,
56105b261ecSmrg		    int		size);
56205b261ecSmrg
56305b261ecSmrg/*
56405b261ecSmrg * Return the area of the frame buffer scanned out by the crtc,
56505b261ecSmrg * taking into account the current mode and rotation
56605b261ecSmrg */
56705b261ecSmrg
56805b261ecSmrgvoid
56905b261ecSmrgRRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
57005b261ecSmrg
57105b261ecSmrg/*
57205b261ecSmrg * Destroy a Crtc at shutdown
57305b261ecSmrg */
57405b261ecSmrgvoid
57505b261ecSmrgRRCrtcDestroy (RRCrtcPtr crtc);
57605b261ecSmrg
57705b261ecSmrg/*
57805b261ecSmrg * Initialize crtc type
57905b261ecSmrg */
58005b261ecSmrgBool
58105b261ecSmrgRRCrtcInit (void);
58205b261ecSmrg
58305b261ecSmrg/*
58405b261ecSmrg * Crtc dispatch
58505b261ecSmrg */
58605b261ecSmrg
58705b261ecSmrgint
58805b261ecSmrgProcRRGetCrtcInfo (ClientPtr client);
58905b261ecSmrg
59005b261ecSmrgint
59105b261ecSmrgProcRRSetCrtcConfig (ClientPtr client);
59205b261ecSmrg
59305b261ecSmrgint
59405b261ecSmrgProcRRGetCrtcGammaSize (ClientPtr client);
59505b261ecSmrg
59605b261ecSmrgint
59705b261ecSmrgProcRRGetCrtcGamma (ClientPtr client);
59805b261ecSmrg
59905b261ecSmrgint
60005b261ecSmrgProcRRSetCrtcGamma (ClientPtr client);
60105b261ecSmrg
60205b261ecSmrg/* rrdispatch.c */
60305b261ecSmrgBool
60405b261ecSmrgRRClientKnowsRates (ClientPtr	pClient);
60505b261ecSmrg
60605b261ecSmrg/* rrmode.c */
60705b261ecSmrg/*
60805b261ecSmrg * Find, and if necessary, create a mode
60905b261ecSmrg */
61005b261ecSmrg
61105b261ecSmrgRRModePtr
61205b261ecSmrgRRModeGet (xRRModeInfo	*modeInfo,
61305b261ecSmrg	   const char	*name);
61405b261ecSmrg
61505b261ecSmrgvoid
61605b261ecSmrgRRModePruneUnused (ScreenPtr pScreen);
61705b261ecSmrg
61805b261ecSmrg/*
61905b261ecSmrg * Destroy a mode.
62005b261ecSmrg */
62105b261ecSmrg
62205b261ecSmrgvoid
62305b261ecSmrgRRModeDestroy (RRModePtr mode);
62405b261ecSmrg
62505b261ecSmrg/*
62605b261ecSmrg * Return a list of modes that are valid for some output in pScreen
62705b261ecSmrg */
62805b261ecSmrgRRModePtr *
62905b261ecSmrgRRModesForScreen (ScreenPtr pScreen, int *num_ret);
63005b261ecSmrg
63105b261ecSmrg/*
63205b261ecSmrg * Initialize mode type
63305b261ecSmrg */
63405b261ecSmrgBool
63505b261ecSmrgRRModeInit (void);
63605b261ecSmrg
63705b261ecSmrgint
63805b261ecSmrgProcRRCreateMode (ClientPtr client);
63905b261ecSmrg
64005b261ecSmrgint
64105b261ecSmrgProcRRDestroyMode (ClientPtr client);
64205b261ecSmrg
64305b261ecSmrgint
64405b261ecSmrgProcRRAddOutputMode (ClientPtr client);
64505b261ecSmrg
64605b261ecSmrgint
64705b261ecSmrgProcRRDeleteOutputMode (ClientPtr client);
64805b261ecSmrg
64905b261ecSmrg/* rroutput.c */
65005b261ecSmrg
65105b261ecSmrg/*
65205b261ecSmrg * Notify the output of some change. configChanged indicates whether
65305b261ecSmrg * any external configuration (mode list, clones, connected status)
65405b261ecSmrg * has changed, or whether the change was strictly internal
65505b261ecSmrg * (which crtc is in use)
65605b261ecSmrg */
65705b261ecSmrgvoid
65805b261ecSmrgRROutputChanged (RROutputPtr output, Bool configChanged);
65905b261ecSmrg
66005b261ecSmrg/*
66105b261ecSmrg * Create an output
66205b261ecSmrg */
66305b261ecSmrg
66405b261ecSmrgRROutputPtr
66505b261ecSmrgRROutputCreate (ScreenPtr   pScreen,
66605b261ecSmrg		const char  *name,
66705b261ecSmrg		int	    nameLength,
66805b261ecSmrg		void	    *devPrivate);
66905b261ecSmrg
67005b261ecSmrg/*
67105b261ecSmrg * Notify extension that output parameters have been changed
67205b261ecSmrg */
67305b261ecSmrgBool
67405b261ecSmrgRROutputSetClones (RROutputPtr  output,
67505b261ecSmrg		   RROutputPtr  *clones,
67605b261ecSmrg		   int		numClones);
67705b261ecSmrg
67805b261ecSmrgBool
67905b261ecSmrgRROutputSetModes (RROutputPtr	output,
68005b261ecSmrg		  RRModePtr	*modes,
68105b261ecSmrg		  int		numModes,
68205b261ecSmrg		  int		numPreferred);
68305b261ecSmrg
68405b261ecSmrgint
68505b261ecSmrgRROutputAddUserMode (RROutputPtr    output,
68605b261ecSmrg		     RRModePtr	    mode);
68705b261ecSmrg
68805b261ecSmrgint
68905b261ecSmrgRROutputDeleteUserMode (RROutputPtr output,
69005b261ecSmrg			RRModePtr   mode);
69105b261ecSmrg
69205b261ecSmrgBool
69305b261ecSmrgRROutputSetCrtcs (RROutputPtr	output,
69405b261ecSmrg		  RRCrtcPtr	*crtcs,
69505b261ecSmrg		  int		numCrtcs);
69605b261ecSmrg
69705b261ecSmrgBool
69805b261ecSmrgRROutputSetConnection (RROutputPtr  output,
69905b261ecSmrg		       CARD8	    connection);
70005b261ecSmrg
70105b261ecSmrgBool
70205b261ecSmrgRROutputSetSubpixelOrder (RROutputPtr output,
70305b261ecSmrg			  int	      subpixelOrder);
70405b261ecSmrg
70505b261ecSmrgBool
70605b261ecSmrgRROutputSetPhysicalSize (RROutputPtr	output,
70705b261ecSmrg			 int		mmWidth,
70805b261ecSmrg			 int		mmHeight);
70905b261ecSmrg
71005b261ecSmrgvoid
71105b261ecSmrgRRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
71205b261ecSmrg
71305b261ecSmrgvoid
71405b261ecSmrgRROutputDestroy (RROutputPtr	output);
71505b261ecSmrg
71605b261ecSmrgint
71705b261ecSmrgProcRRGetOutputInfo (ClientPtr client);
71805b261ecSmrg
71905b261ecSmrg/*
72005b261ecSmrg * Initialize output type
72105b261ecSmrg */
72205b261ecSmrgBool
72305b261ecSmrgRROutputInit (void);
72405b261ecSmrg
72505b261ecSmrg/* rrpointer.c */
72605b261ecSmrgvoid
72705b261ecSmrgRRPointerMoved (ScreenPtr pScreen, int x, int y);
72805b261ecSmrg
72905b261ecSmrgvoid
73005b261ecSmrgRRPointerScreenConfigured (ScreenPtr pScreen);
73105b261ecSmrg
73205b261ecSmrg/* rrproperty.c */
73305b261ecSmrg
73405b261ecSmrgvoid
73505b261ecSmrgRRDeleteAllOutputProperties (RROutputPtr output);
73605b261ecSmrg
73705b261ecSmrgRRPropertyValuePtr
73805b261ecSmrgRRGetOutputProperty (RROutputPtr output, Atom property, Bool pending);
73905b261ecSmrg
74005b261ecSmrgRRPropertyPtr
74105b261ecSmrgRRQueryOutputProperty (RROutputPtr output, Atom property);
74205b261ecSmrg
74305b261ecSmrgvoid
74405b261ecSmrgRRDeleteOutputProperty (RROutputPtr output, Atom property);
74505b261ecSmrg
74605b261ecSmrgBool
74705b261ecSmrgRRPostPendingProperties (RROutputPtr output);
74805b261ecSmrg
74905b261ecSmrgint
75005b261ecSmrgRRChangeOutputProperty (RROutputPtr output, Atom property, Atom type,
75105b261ecSmrg			int format, int mode, unsigned long len,
75205b261ecSmrg			pointer value, Bool sendevent, Bool pending);
75305b261ecSmrg
75405b261ecSmrgint
75505b261ecSmrgRRConfigureOutputProperty (RROutputPtr output, Atom property,
75605b261ecSmrg			   Bool pending, Bool range, Bool immutable,
75705b261ecSmrg			   int num_values, INT32 *values);
75805b261ecSmrgint
75905b261ecSmrgProcRRChangeOutputProperty (ClientPtr client);
76005b261ecSmrg
76105b261ecSmrgint
76205b261ecSmrgProcRRGetOutputProperty (ClientPtr client);
76305b261ecSmrg
76405b261ecSmrgint
76505b261ecSmrgProcRRListOutputProperties (ClientPtr client);
76605b261ecSmrg
76705b261ecSmrgint
76805b261ecSmrgProcRRQueryOutputProperty (ClientPtr client);
76905b261ecSmrg
77005b261ecSmrgint
77105b261ecSmrgProcRRConfigureOutputProperty (ClientPtr client);
77205b261ecSmrg
77305b261ecSmrgint
77405b261ecSmrgProcRRDeleteOutputProperty (ClientPtr client);
77505b261ecSmrg
77605b261ecSmrg/* rrxinerama.c */
77705b261ecSmrgvoid
77805b261ecSmrgRRXineramaExtensionInit(void);
77905b261ecSmrg
78005b261ecSmrg#endif /* _RANDRSTR_H_ */
78105b261ecSmrg
78205b261ecSmrg/*
78305b261ecSmrg
78405b261ecSmrgrandr extension implementation structure
78505b261ecSmrg
78605b261ecSmrgQuery state:
78705b261ecSmrg    ProcRRGetScreenInfo/ProcRRGetScreenResources
78805b261ecSmrg	RRGetInfo
78905b261ecSmrg
79005b261ecSmrg	    • Request configuration from driver, either 1.0 or 1.2 style
79105b261ecSmrg	    • These functions only record state changes, all
79205b261ecSmrg	      other actions are pended until RRTellChanged is called
79305b261ecSmrg
79405b261ecSmrg	    ->rrGetInfo
79505b261ecSmrg	    1.0:
79605b261ecSmrg		RRRegisterSize
79705b261ecSmrg		RRRegisterRate
79805b261ecSmrg		RRSetCurrentConfig
79905b261ecSmrg	    1.2:
80005b261ecSmrg		RRScreenSetSizeRange
80105b261ecSmrg		RROutputSetCrtcs
80205b261ecSmrg		RRModeGet
80305b261ecSmrg		RROutputSetModes
80405b261ecSmrg		RROutputSetConnection
80505b261ecSmrg		RROutputSetSubpixelOrder
80605b261ecSmrg		RROutputSetClones
80705b261ecSmrg		RRCrtcNotify
80805b261ecSmrg
80905b261ecSmrg	• Must delay scanning configuration until after ->rrGetInfo returns
81005b261ecSmrg	  because some drivers will call SetCurrentConfig in the middle
81105b261ecSmrg	  of the ->rrGetInfo operation.
81205b261ecSmrg
81305b261ecSmrg	1.0:
81405b261ecSmrg
81505b261ecSmrg	    • Scan old configuration, mirror to new structures
81605b261ecSmrg
81705b261ecSmrg	    RRScanOldConfig
81805b261ecSmrg		RRCrtcCreate
81905b261ecSmrg		RROutputCreate
82005b261ecSmrg		RROutputSetCrtcs
82105b261ecSmrg		RROutputSetConnection
82205b261ecSmrg		RROutputSetSubpixelOrder
82305b261ecSmrg		RROldModeAdd	• This adds modes one-at-a-time
82405b261ecSmrg		    RRModeGet
82505b261ecSmrg		RRCrtcNotify
82605b261ecSmrg
82705b261ecSmrg	• send events, reset pointer if necessary
82805b261ecSmrg
82905b261ecSmrg	RRTellChanged
83005b261ecSmrg	    WalkTree (sending events)
83105b261ecSmrg
83205b261ecSmrg	    • when layout has changed:
83305b261ecSmrg		RRPointerScreenConfigured
83405b261ecSmrg		RRSendConfigNotify
83505b261ecSmrg
83605b261ecSmrgAsynchronous state setting (1.2 only)
83705b261ecSmrg    When setting state asynchronously, the driver invokes the
83805b261ecSmrg    ->rrGetInfo function and then calls RRTellChanged to flush
83905b261ecSmrg    the changes to the clients and reset pointer if necessary
84005b261ecSmrg
84105b261ecSmrgSet state
84205b261ecSmrg
84305b261ecSmrg    ProcRRSetScreenConfig
84405b261ecSmrg	RRCrtcSet
84505b261ecSmrg	    1.2:
84605b261ecSmrg		->rrCrtcSet
84705b261ecSmrg		    RRCrtcNotify
84805b261ecSmrg	    1.0:
84905b261ecSmrg		->rrSetConfig
85005b261ecSmrg		RRCrtcNotify
85105b261ecSmrg	    RRTellChanged
85205b261ecSmrg */
853