105b261ecSmrg/*
205b261ecSmrg * Copyright © 2000 Compaq Computer Corporation
305b261ecSmrg * Copyright © 2002 Hewlett-Packard Company
405b261ecSmrg * Copyright © 2006 Intel Corporation
54642e01fSmrg * Copyright © 2008 Red Hat, Inc.
605b261ecSmrg *
705b261ecSmrg * Permission to use, copy, modify, distribute, and sell this software and its
805b261ecSmrg * documentation for any purpose is hereby granted without fee, provided that
905b261ecSmrg * the above copyright notice appear in all copies and that both that copyright
1005b261ecSmrg * notice and this permission notice appear in supporting documentation, and
1105b261ecSmrg * that the name of the copyright holders not be used in advertising or
1205b261ecSmrg * publicity pertaining to distribution of the software without specific,
1305b261ecSmrg * written prior permission.  The copyright holders make no representations
1405b261ecSmrg * about the suitability of this software for any purpose.  It is provided "as
1505b261ecSmrg * is" without express or implied warranty.
1605b261ecSmrg *
1705b261ecSmrg * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
1805b261ecSmrg * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
1905b261ecSmrg * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
2005b261ecSmrg * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
2105b261ecSmrg * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
2205b261ecSmrg * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
2305b261ecSmrg * OF THIS SOFTWARE.
2405b261ecSmrg *
2505b261ecSmrg * Author:  Jim Gettys, Hewlett-Packard Company, Inc.
2605b261ecSmrg *	    Keith Packard, Intel Corporation
2705b261ecSmrg */
2805b261ecSmrg
2905b261ecSmrg#ifdef HAVE_DIX_CONFIG_H
3005b261ecSmrg#include <dix-config.h>
3105b261ecSmrg#endif
3205b261ecSmrg
3305b261ecSmrg#ifndef _RANDRSTR_H_
3405b261ecSmrg#define _RANDRSTR_H_
3505b261ecSmrg
3605b261ecSmrg#include <X11/X.h>
3705b261ecSmrg#include <X11/Xproto.h>
3805b261ecSmrg#include "misc.h"
3905b261ecSmrg#include "os.h"
4005b261ecSmrg#include "dixstruct.h"
4105b261ecSmrg#include "resource.h"
4205b261ecSmrg#include "scrnintstr.h"
4305b261ecSmrg#include "windowstr.h"
4405b261ecSmrg#include "pixmapstr.h"
4505b261ecSmrg#include "extnsionst.h"
4605b261ecSmrg#include "servermd.h"
474642e01fSmrg#include "rrtransform.h"
4805b261ecSmrg#include <X11/extensions/randr.h>
4905b261ecSmrg#include <X11/extensions/randrproto.h>
50f7df2e56Smrg#include <X11/extensions/render.h>      /* we share subpixel order information */
5105b261ecSmrg#include "picturestr.h"
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
57f7df2e56Smrg#define RANDR_13_INTERFACE 1    /* requires RANDR_12_INTERFACE */
584642e01fSmrg#define RANDR_GET_CRTC_INTERFACE 1
594642e01fSmrg
60f7df2e56Smrg#define RANDR_INTERFACE_VERSION 0x0104
6105b261ecSmrg
62b150493bSchristos/* All also defined in <X11/extensions/randrproto.h> */
63b150493bSchristos#ifndef RROutput
64b150493bSchristos#define RROutput CARD32
65b150493bSchristos#define RRMode CARD32
66b150493bSchristos#define RRCrtc CARD32
67b150493bSchristos#define RRProvider CARD32
68b150493bSchristos#define RRModeFlags CARD32
69b150493bSchristos#define RRLease CARD32
70b150493bSchristos#endif
7105b261ecSmrg
72f7df2e56Smrgextern int RREventBase, RRErrorBase;
73f7df2e56Smrg
74f7df2e56Smrgextern int (*ProcRandrVector[RRNumberRequests]) (ClientPtr);
75f7df2e56Smrgextern int (*SProcRandrVector[RRNumberRequests]) (ClientPtr);
7605b261ecSmrg
7705b261ecSmrg/*
7805b261ecSmrg * Modeline for a monitor. Name follows directly after this struct
7905b261ecSmrg */
8005b261ecSmrg
8105b261ecSmrg#define RRModeName(pMode) ((char *) (pMode + 1))
82f7df2e56Smrgtypedef struct _rrMode RRModeRec, *RRModePtr;
83f7df2e56Smrgtypedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr;
84f7df2e56Smrgtypedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
85f7df2e56Smrgtypedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
86f7df2e56Smrgtypedef struct _rrOutput RROutputRec, *RROutputPtr;
87f7df2e56Smrgtypedef struct _rrProvider RRProviderRec, *RRProviderPtr;
88f7df2e56Smrgtypedef struct _rrMonitor RRMonitorRec, *RRMonitorPtr;
897e31ba66Smrgtypedef struct _rrLease RRLeaseRec, *RRLeasePtr;
9005b261ecSmrg
9105b261ecSmrgstruct _rrMode {
92f7df2e56Smrg    int refcnt;
93f7df2e56Smrg    xRRModeInfo mode;
94f7df2e56Smrg    char *name;
95f7df2e56Smrg    ScreenPtr userScreen;
9605b261ecSmrg};
9705b261ecSmrg
9805b261ecSmrgstruct _rrPropertyValue {
99f7df2e56Smrg    Atom type;                  /* ignored by server */
100f7df2e56Smrg    short format;               /* format of data for swapping - 8,16,32 */
101f7df2e56Smrg    long size;                  /* size of data in (format/8) bytes */
102f7df2e56Smrg    void *data;                 /* private to client */
10305b261ecSmrg};
10405b261ecSmrg
10505b261ecSmrgstruct _rrProperty {
106f7df2e56Smrg    RRPropertyPtr next;
107f7df2e56Smrg    ATOM propertyName;
108f7df2e56Smrg    Bool is_pending;
109f7df2e56Smrg    Bool range;
110f7df2e56Smrg    Bool immutable;
111f7df2e56Smrg    int num_valid;
112f7df2e56Smrg    INT32 *valid_values;
113f7df2e56Smrg    RRPropertyValueRec current, pending;
11405b261ecSmrg};
11505b261ecSmrg
11605b261ecSmrgstruct _rrCrtc {
117f7df2e56Smrg    RRCrtc id;
118f7df2e56Smrg    ScreenPtr pScreen;
119f7df2e56Smrg    RRModePtr mode;
120f7df2e56Smrg    int x, y;
121f7df2e56Smrg    Rotation rotation;
122f7df2e56Smrg    Rotation rotations;
123f7df2e56Smrg    Bool changed;
124f7df2e56Smrg    int numOutputs;
125f7df2e56Smrg    RROutputPtr *outputs;
126f7df2e56Smrg    int gammaSize;
127f7df2e56Smrg    CARD16 *gammaRed;
128f7df2e56Smrg    CARD16 *gammaBlue;
129f7df2e56Smrg    CARD16 *gammaGreen;
130f7df2e56Smrg    void *devPrivate;
131f7df2e56Smrg    Bool transforms;
132f7df2e56Smrg    RRTransformRec client_pending_transform;
133f7df2e56Smrg    RRTransformRec client_current_transform;
134f7df2e56Smrg    PictTransform transform;
1354642e01fSmrg    struct pict_f_transform f_transform;
1364642e01fSmrg    struct pict_f_transform f_inverse;
137f7df2e56Smrg
138f7df2e56Smrg    PixmapPtr scanout_pixmap;
1397e31ba66Smrg    PixmapPtr scanout_pixmap_back;
14005b261ecSmrg};
14105b261ecSmrg
14205b261ecSmrgstruct _rrOutput {
143f7df2e56Smrg    RROutput id;
144f7df2e56Smrg    ScreenPtr pScreen;
145f7df2e56Smrg    char *name;
146f7df2e56Smrg    int nameLength;
147f7df2e56Smrg    CARD8 connection;
148f7df2e56Smrg    CARD8 subpixelOrder;
149f7df2e56Smrg    int mmWidth;
150f7df2e56Smrg    int mmHeight;
151f7df2e56Smrg    RRCrtcPtr crtc;
152f7df2e56Smrg    int numCrtcs;
153f7df2e56Smrg    RRCrtcPtr *crtcs;
154f7df2e56Smrg    int numClones;
155f7df2e56Smrg    RROutputPtr *clones;
156f7df2e56Smrg    int numModes;
157f7df2e56Smrg    int numPreferred;
158f7df2e56Smrg    RRModePtr *modes;
159f7df2e56Smrg    int numUserModes;
160f7df2e56Smrg    RRModePtr *userModes;
161f7df2e56Smrg    Bool changed;
1627e31ba66Smrg    Bool nonDesktop;
163f7df2e56Smrg    RRPropertyPtr properties;
164f7df2e56Smrg    Bool pendingProperties;
165f7df2e56Smrg    void *devPrivate;
166f7df2e56Smrg};
167f7df2e56Smrg
168f7df2e56Smrgstruct _rrProvider {
169f7df2e56Smrg    RRProvider id;
170f7df2e56Smrg    ScreenPtr pScreen;
171f7df2e56Smrg    uint32_t capabilities;
172f7df2e56Smrg    char *name;
173f7df2e56Smrg    int nameLength;
174f7df2e56Smrg    RRPropertyPtr properties;
175f7df2e56Smrg    Bool pendingProperties;
176f7df2e56Smrg    Bool changed;
177f7df2e56Smrg    struct _rrProvider *offload_sink;
178f7df2e56Smrg    struct _rrProvider *output_source;
179f7df2e56Smrg};
180f7df2e56Smrg
181f7df2e56Smrgtypedef struct _rrMonitorGeometry {
182f7df2e56Smrg    BoxRec box;
183f7df2e56Smrg    CARD32 mmWidth;
184f7df2e56Smrg    CARD32 mmHeight;
185f7df2e56Smrg} RRMonitorGeometryRec, *RRMonitorGeometryPtr;
186f7df2e56Smrg
187f7df2e56Smrgstruct _rrMonitor {
188f7df2e56Smrg    Atom name;
189f7df2e56Smrg    ScreenPtr pScreen;
190f7df2e56Smrg    int numOutputs;
191f7df2e56Smrg    RROutput *outputs;
192f7df2e56Smrg    Bool primary;
193f7df2e56Smrg    Bool automatic;
194f7df2e56Smrg    RRMonitorGeometryRec geometry;
19505b261ecSmrg};
19605b261ecSmrg
1977e31ba66Smrgtypedef enum _rrLeaseState { RRLeaseCreating, RRLeaseRunning, RRLeaseTerminating } RRLeaseState;
1987e31ba66Smrg
1997e31ba66Smrgstruct _rrLease {
2007e31ba66Smrg    struct xorg_list list;
2017e31ba66Smrg    ScreenPtr screen;
2027e31ba66Smrg    RRLease id;
2037e31ba66Smrg    RRLeaseState state;
2047e31ba66Smrg    void *devPrivate;
2057e31ba66Smrg    int numCrtcs;
2067e31ba66Smrg    RRCrtcPtr *crtcs;
2077e31ba66Smrg    int numOutputs;
2087e31ba66Smrg    RROutputPtr *outputs;
2097e31ba66Smrg};
2107e31ba66Smrg
21105b261ecSmrg#if RANDR_12_INTERFACE
212f7df2e56Smrgtypedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
213f7df2e56Smrg                                        CARD16 width,
214f7df2e56Smrg                                        CARD16 height,
215f7df2e56Smrg                                        CARD32 mmWidth, CARD32 mmHeight);
216f7df2e56Smrg
217f7df2e56Smrgtypedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
218f7df2e56Smrg                                  RRCrtcPtr crtc,
219f7df2e56Smrg                                  RRModePtr mode,
220f7df2e56Smrg                                  int x,
221f7df2e56Smrg                                  int y,
222f7df2e56Smrg                                  Rotation rotation,
223f7df2e56Smrg                                  int numOutputs, RROutputPtr * outputs);
224f7df2e56Smrg
225f7df2e56Smrgtypedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
226f7df2e56Smrg
227f7df2e56Smrgtypedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
228f7df2e56Smrg
229f7df2e56Smrgtypedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
230f7df2e56Smrg                                            RROutputPtr output,
231f7df2e56Smrg                                            Atom property,
232f7df2e56Smrg                                            RRPropertyValuePtr value);
233f7df2e56Smrg
234f7df2e56Smrgtypedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
235f7df2e56Smrg                                             RROutputPtr output,
236f7df2e56Smrg                                             RRModePtr mode);
237f7df2e56Smrg
238f7df2e56Smrgtypedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, RRModePtr mode);
23905b261ecSmrg
24005b261ecSmrg#endif
24105b261ecSmrg
2424642e01fSmrg#if RANDR_13_INTERFACE
243f7df2e56Smrgtypedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen,
244f7df2e56Smrg                                            RROutputPtr output, Atom property);
245f7df2e56Smrgtypedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn,
246f7df2e56Smrg                                     RRCrtcPtr crtc,
247f7df2e56Smrg                                     BoxPtr totalArea,
248f7df2e56Smrg                                     BoxPtr trackingArea, INT16 *border);
249f7df2e56Smrgtypedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn,
250f7df2e56Smrg                                     RRCrtcPtr crtc,
251f7df2e56Smrg                                     BoxPtr totalArea,
252f7df2e56Smrg                                     BoxPtr trackingArea, INT16 *border);
253f7df2e56Smrg
254f7df2e56Smrg#endif                          /* RANDR_13_INTERFACE */
255f7df2e56Smrg
256f7df2e56Smrgtypedef Bool (*RRProviderGetPropertyProcPtr) (ScreenPtr pScreen,
257f7df2e56Smrg                                            RRProviderPtr provider, Atom property);
258f7df2e56Smrgtypedef Bool (*RRProviderSetPropertyProcPtr) (ScreenPtr pScreen,
259f7df2e56Smrg                                              RRProviderPtr provider,
260f7df2e56Smrg                                              Atom property,
261f7df2e56Smrg                                              RRPropertyValuePtr value);
262f7df2e56Smrg
263f7df2e56Smrgtypedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation * rotations);
264f7df2e56Smrgtypedef Bool (*RRCloseScreenProcPtr) (ScreenPtr pscreen);
265f7df2e56Smrg
266f7df2e56Smrgtypedef Bool (*RRProviderSetOutputSourceProcPtr)(ScreenPtr pScreen,
267f7df2e56Smrg                                          RRProviderPtr provider,
268f7df2e56Smrg                                          RRProviderPtr output_source);
269f7df2e56Smrg
270f7df2e56Smrgtypedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen,
271f7df2e56Smrg                                         RRProviderPtr provider,
272f7df2e56Smrg                                         RRProviderPtr offload_sink);
273f7df2e56Smrg
274f7df2e56Smrg
275f7df2e56Smrgtypedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen,
276f7df2e56Smrg                                         RRProviderPtr provider);
27705b261ecSmrg
2787e31ba66Smrg/* Additions for 1.6 */
2797e31ba66Smrg
2807e31ba66Smrgtypedef int (*RRCreateLeaseProcPtr)(ScreenPtr screen,
2817e31ba66Smrg                                    RRLeasePtr lease,
2827e31ba66Smrg                                    int *fd);
2837e31ba66Smrg
2847e31ba66Smrgtypedef void (*RRTerminateLeaseProcPtr)(ScreenPtr screen,
2857e31ba66Smrg                                        RRLeasePtr lease);
2867e31ba66Smrg
28705b261ecSmrg/* These are for 1.0 compatibility */
288f7df2e56Smrg
28905b261ecSmrgtypedef struct _rrRefresh {
290f7df2e56Smrg    CARD16 rate;
291f7df2e56Smrg    RRModePtr mode;
29205b261ecSmrg} RRScreenRate, *RRScreenRatePtr;
29305b261ecSmrg
29405b261ecSmrgtypedef struct _rrScreenSize {
295f7df2e56Smrg    int id;
296f7df2e56Smrg    short width, height;
297f7df2e56Smrg    short mmWidth, mmHeight;
298f7df2e56Smrg    int nRates;
29905b261ecSmrg    RRScreenRatePtr pRates;
30005b261ecSmrg} RRScreenSize, *RRScreenSizePtr;
30105b261ecSmrg
30205b261ecSmrg#ifdef RANDR_10_INTERFACE
30305b261ecSmrg
304f7df2e56Smrgtypedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
305f7df2e56Smrg                                    Rotation rotation,
306f7df2e56Smrg                                    int rate, RRScreenSizePtr pSize);
30705b261ecSmrg
30805b261ecSmrg#endif
309f7df2e56Smrg
310f7df2e56Smrgtypedef Bool (*RRCrtcSetScanoutPixmapProcPtr)(RRCrtcPtr crtc, PixmapPtr pixmap);
31105b261ecSmrg
3127e31ba66Smrgtypedef Bool (*RRStartFlippingPixmapTrackingProcPtr)(RRCrtcPtr, DrawablePtr,
3137e31ba66Smrg                                                     PixmapPtr, PixmapPtr,
3147e31ba66Smrg                                                     int x, int y,
3157e31ba66Smrg                                                     int dst_x, int dst_y,
3167e31ba66Smrg                                                     Rotation rotation);
3177e31ba66Smrg
3187e31ba66Smrgtypedef Bool (*RREnableSharedPixmapFlippingProcPtr)(RRCrtcPtr,
3197e31ba66Smrg                                                    PixmapPtr front,
3207e31ba66Smrg                                                    PixmapPtr back);
3217e31ba66Smrg
3227e31ba66Smrgtypedef void (*RRDisableSharedPixmapFlippingProcPtr)(RRCrtcPtr);
3237e31ba66Smrg
3247e31ba66Smrg
32505b261ecSmrgtypedef struct _rrScrPriv {
32605b261ecSmrg    /*
32705b261ecSmrg     * 'public' part of the structure; DDXen fill this in
32805b261ecSmrg     * as they initialize
32905b261ecSmrg     */
33005b261ecSmrg#if RANDR_10_INTERFACE
331f7df2e56Smrg    RRSetConfigProcPtr rrSetConfig;
33205b261ecSmrg#endif
333f7df2e56Smrg    RRGetInfoProcPtr rrGetInfo;
33405b261ecSmrg#if RANDR_12_INTERFACE
335f7df2e56Smrg    RRScreenSetSizeProcPtr rrScreenSetSize;
336f7df2e56Smrg    RRCrtcSetProcPtr rrCrtcSet;
337f7df2e56Smrg    RRCrtcSetGammaProcPtr rrCrtcSetGamma;
338f7df2e56Smrg    RRCrtcGetGammaProcPtr rrCrtcGetGamma;
339f7df2e56Smrg    RROutputSetPropertyProcPtr rrOutputSetProperty;
340f7df2e56Smrg    RROutputValidateModeProcPtr rrOutputValidateMode;
341f7df2e56Smrg    RRModeDestroyProcPtr rrModeDestroy;
34205b261ecSmrg#endif
3434642e01fSmrg#if RANDR_13_INTERFACE
344f7df2e56Smrg    RROutputGetPropertyProcPtr rrOutputGetProperty;
345f7df2e56Smrg    RRGetPanningProcPtr rrGetPanning;
346f7df2e56Smrg    RRSetPanningProcPtr rrSetPanning;
3474642e01fSmrg#endif
348f7df2e56Smrg    /* TODO #if RANDR_15_INTERFACE */
349f7df2e56Smrg    RRCrtcSetScanoutPixmapProcPtr rrCrtcSetScanoutPixmap;
350f7df2e56Smrg
3517e31ba66Smrg    RRStartFlippingPixmapTrackingProcPtr rrStartFlippingPixmapTracking;
3527e31ba66Smrg    RREnableSharedPixmapFlippingProcPtr rrEnableSharedPixmapFlipping;
3537e31ba66Smrg    RRDisableSharedPixmapFlippingProcPtr rrDisableSharedPixmapFlipping;
3547e31ba66Smrg
355f7df2e56Smrg    RRProviderSetOutputSourceProcPtr rrProviderSetOutputSource;
356f7df2e56Smrg    RRProviderSetOffloadSinkProcPtr rrProviderSetOffloadSink;
357f7df2e56Smrg    RRProviderGetPropertyProcPtr rrProviderGetProperty;
358f7df2e56Smrg    RRProviderSetPropertyProcPtr rrProviderSetProperty;
3597e31ba66Smrg
3607e31ba66Smrg    RRCreateLeaseProcPtr rrCreateLease;
3617e31ba66Smrg    RRTerminateLeaseProcPtr rrTerminateLease;
3627e31ba66Smrg
36305b261ecSmrg    /*
36405b261ecSmrg     * Private part of the structure; not considered part of the ABI
36505b261ecSmrg     */
366f7df2e56Smrg    TimeStamp lastSetTime;      /* last changed by client */
367f7df2e56Smrg    TimeStamp lastConfigTime;   /* possible configs changed */
368f7df2e56Smrg    RRCloseScreenProcPtr CloseScreen;
36905b261ecSmrg
370f7df2e56Smrg    Bool changed;               /* some config changed */
371f7df2e56Smrg    Bool configChanged;         /* configuration changed */
372f7df2e56Smrg    Bool layoutChanged;         /* screen layout changed */
373f7df2e56Smrg    Bool resourcesChanged;      /* screen resources change */
3747e31ba66Smrg    Bool leasesChanged;         /* leases change */
37505b261ecSmrg
376f7df2e56Smrg    CARD16 minWidth, minHeight;
377f7df2e56Smrg    CARD16 maxWidth, maxHeight;
378f7df2e56Smrg    CARD16 width, height;       /* last known screen size */
379f7df2e56Smrg    CARD16 mmWidth, mmHeight;   /* last known screen size */
38005b261ecSmrg
381f7df2e56Smrg    int numOutputs;
382f7df2e56Smrg    RROutputPtr *outputs;
383f7df2e56Smrg    RROutputPtr primaryOutput;
38405b261ecSmrg
385f7df2e56Smrg    int numCrtcs;
386f7df2e56Smrg    RRCrtcPtr *crtcs;
38705b261ecSmrg
38805b261ecSmrg    /* Last known pointer position */
389f7df2e56Smrg    RRCrtcPtr pointerCrtc;
39005b261ecSmrg
39105b261ecSmrg#ifdef RANDR_10_INTERFACE
39205b261ecSmrg    /*
39305b261ecSmrg     * Configuration information
39405b261ecSmrg     */
395f7df2e56Smrg    Rotation rotations;
396f7df2e56Smrg    CARD16 reqWidth, reqHeight;
397f7df2e56Smrg
398f7df2e56Smrg    int nSizes;
399f7df2e56Smrg    RRScreenSizePtr pSizes;
400f7df2e56Smrg
401f7df2e56Smrg    Rotation rotation;
402f7df2e56Smrg    int rate;
403f7df2e56Smrg    int size;
40405b261ecSmrg#endif
405f7df2e56Smrg    Bool discontiguous;
406f7df2e56Smrg
407f7df2e56Smrg    RRProviderPtr provider;
408f7df2e56Smrg
409f7df2e56Smrg    RRProviderDestroyProcPtr rrProviderDestroy;
410f7df2e56Smrg
411f7df2e56Smrg    int numMonitors;
412f7df2e56Smrg    RRMonitorPtr *monitors;
413f7df2e56Smrg
4147e31ba66Smrg    struct xorg_list leases;
41505b261ecSmrg} rrScrPrivRec, *rrScrPrivPtr;
41605b261ecSmrg
4176747b715Smrgextern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
418f7df2e56Smrg
4196747b715Smrg#define rrPrivKey (&rrPrivKeyRec)
42005b261ecSmrg
4214642e01fSmrg#define rrGetScrPriv(pScr)  ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey))
42205b261ecSmrg#define rrScrPriv(pScr)	rrScrPrivPtr    pScrPriv = rrGetScrPriv(pScr)
4234642e01fSmrg#define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, p)
42405b261ecSmrg
42505b261ecSmrg/*
42605b261ecSmrg * each window has a list of clients requesting
42705b261ecSmrg * RRNotify events.  Each client has a resource
42805b261ecSmrg * for each window it selects RRNotify input for,
42905b261ecSmrg * this resource is used to delete the RRNotifyRec
43005b261ecSmrg * entry from the per-window queue.
43105b261ecSmrg */
43205b261ecSmrg
43305b261ecSmrgtypedef struct _RREvent *RREventPtr;
43405b261ecSmrg
43505b261ecSmrgtypedef struct _RREvent {
436f7df2e56Smrg    RREventPtr next;
437f7df2e56Smrg    ClientPtr client;
438f7df2e56Smrg    WindowPtr window;
439f7df2e56Smrg    XID clientResource;
440f7df2e56Smrg    int mask;
44105b261ecSmrg} RREventRec;
44205b261ecSmrg
44305b261ecSmrgtypedef struct _RRTimes {
444f7df2e56Smrg    TimeStamp setTime;
445f7df2e56Smrg    TimeStamp configTime;
44605b261ecSmrg} RRTimesRec, *RRTimesPtr;
44705b261ecSmrg
44805b261ecSmrgtypedef struct _RRClient {
449f7df2e56Smrg    int major_version;
450f7df2e56Smrg    int minor_version;
45105b261ecSmrg/*  RRTimesRec	times[0]; */
45205b261ecSmrg} RRClientRec, *RRClientPtr;
45305b261ecSmrg
454f7df2e56Smrgextern RESTYPE RRClientType, RREventType;     /* resource types for event masks */
455f7df2e56Smrgextern DevPrivateKeyRec RRClientPrivateKeyRec;
456f7df2e56Smrg
4576747b715Smrg#define RRClientPrivateKey (&RRClientPrivateKeyRec)
4587e31ba66Smrgextern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType, RRLeaseType;
4596747b715Smrg
4606747b715Smrg#define VERIFY_RR_OUTPUT(id, ptr, a)\
4616747b715Smrg    {\
462f7df2e56Smrg	int rc = dixLookupResourceByType((void **)&(ptr), id,\
4636747b715Smrg	                                 RROutputType, client, a);\
4646747b715Smrg	if (rc != Success) {\
4656747b715Smrg	    client->errorValue = id;\
4666747b715Smrg	    return rc;\
4676747b715Smrg	}\
4686747b715Smrg    }
4696747b715Smrg
4706747b715Smrg#define VERIFY_RR_CRTC(id, ptr, a)\
4716747b715Smrg    {\
472f7df2e56Smrg	int rc = dixLookupResourceByType((void **)&(ptr), id,\
4736747b715Smrg	                                 RRCrtcType, client, a);\
4746747b715Smrg	if (rc != Success) {\
4756747b715Smrg	    client->errorValue = id;\
4766747b715Smrg	    return rc;\
4776747b715Smrg	}\
4786747b715Smrg    }
4796747b715Smrg
4806747b715Smrg#define VERIFY_RR_MODE(id, ptr, a)\
4816747b715Smrg    {\
482f7df2e56Smrg	int rc = dixLookupResourceByType((void **)&(ptr), id,\
4836747b715Smrg	                                 RRModeType, client, a);\
4846747b715Smrg	if (rc != Success) {\
4856747b715Smrg	    client->errorValue = id;\
4866747b715Smrg	    return rc;\
4876747b715Smrg	}\
4886747b715Smrg    }
48905b261ecSmrg
490f7df2e56Smrg#define VERIFY_RR_PROVIDER(id, ptr, a)\
491f7df2e56Smrg    {\
492f7df2e56Smrg        int rc = dixLookupResourceByType((void **)&(ptr), id,\
493f7df2e56Smrg                                         RRProviderType, client, a);\
494f7df2e56Smrg        if (rc != Success) {\
495f7df2e56Smrg            client->errorValue = id;\
496f7df2e56Smrg            return rc;\
497f7df2e56Smrg        }\
498f7df2e56Smrg    }
499f7df2e56Smrg
5007e31ba66Smrg#define VERIFY_RR_LEASE(id, ptr, a)\
5017e31ba66Smrg    {\
5027e31ba66Smrg        int rc = dixLookupResourceByType((void **)&(ptr), id,\
5037e31ba66Smrg                                         RRLeaseType, client, a);\
5047e31ba66Smrg        if (rc != Success) {\
5057e31ba66Smrg            client->errorValue = id;\
5067e31ba66Smrg            return rc;\
5077e31ba66Smrg        }\
5087e31ba66Smrg    }
5097e31ba66Smrg
5104642e01fSmrg#define GetRRClient(pClient)    ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey))
51105b261ecSmrg#define rrClientPriv(pClient)	RRClientPtr pRRClient = GetRRClient(pClient)
51205b261ecSmrg
51305b261ecSmrg#ifdef RANDR_12_INTERFACE
51405b261ecSmrg/*
51505b261ecSmrg * Set the range of sizes for the screen
51605b261ecSmrg */
5176747b715Smrgextern _X_EXPORT void
518f7df2e56Smrg
519f7df2e56SmrgRRScreenSetSizeRange(ScreenPtr pScreen,
520f7df2e56Smrg                     CARD16 minWidth,
521f7df2e56Smrg                     CARD16 minHeight, CARD16 maxWidth, CARD16 maxHeight);
52205b261ecSmrg#endif
52305b261ecSmrg
52405b261ecSmrg/* rrscreen.c */
52505b261ecSmrg/*
52605b261ecSmrg * Notify the extension that the screen size has been changed.
52705b261ecSmrg * The driver is responsible for calling this whenever it has changed
52805b261ecSmrg * the size of the screen
52905b261ecSmrg */
5306747b715Smrgextern _X_EXPORT void
531f7df2e56Smrg RRScreenSizeNotify(ScreenPtr pScreen);
53205b261ecSmrg
53305b261ecSmrg/*
53405b261ecSmrg * Request that the screen be resized
53505b261ecSmrg */
5366747b715Smrgextern _X_EXPORT Bool
537f7df2e56Smrg
538f7df2e56SmrgRRScreenSizeSet(ScreenPtr pScreen,
539f7df2e56Smrg                CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
54005b261ecSmrg
54105b261ecSmrg/*
54205b261ecSmrg * Send ConfigureNotify event to root window when 'something' happens
54305b261ecSmrg */
5446747b715Smrgextern _X_EXPORT void
545f7df2e56Smrg RRSendConfigNotify(ScreenPtr pScreen);
546f7df2e56Smrg
54705b261ecSmrg/*
54805b261ecSmrg * screen dispatch
54905b261ecSmrg */
5506747b715Smrgextern _X_EXPORT int
551f7df2e56Smrg ProcRRGetScreenSizeRange(ClientPtr client);
55205b261ecSmrg
5536747b715Smrgextern _X_EXPORT int
554f7df2e56Smrg ProcRRSetScreenSize(ClientPtr client);
55505b261ecSmrg
5566747b715Smrgextern _X_EXPORT int
557f7df2e56Smrg ProcRRGetScreenResources(ClientPtr client);
55805b261ecSmrg
5596747b715Smrgextern _X_EXPORT int
560f7df2e56Smrg ProcRRGetScreenResourcesCurrent(ClientPtr client);
5614642e01fSmrg
5626747b715Smrgextern _X_EXPORT int
563f7df2e56Smrg ProcRRSetScreenConfig(ClientPtr client);
56405b261ecSmrg
5656747b715Smrgextern _X_EXPORT int
566f7df2e56Smrg ProcRRGetScreenInfo(ClientPtr client);
56705b261ecSmrg
56805b261ecSmrg/*
56905b261ecSmrg * Deliver a ScreenNotify event
57005b261ecSmrg */
5716747b715Smrgextern _X_EXPORT void
572f7df2e56Smrg RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
573f7df2e56Smrg
574f7df2e56Smrgextern _X_EXPORT void
575f7df2e56Smrg RRResourcesChanged(ScreenPtr pScreen);
576f7df2e56Smrg
57705b261ecSmrg/* randr.c */
578f7df2e56Smrg/* set a screen change on the primary screen */
579f7df2e56Smrgextern _X_EXPORT void
580f7df2e56SmrgRRSetChanged(ScreenPtr pScreen);
581f7df2e56Smrg
58205b261ecSmrg/*
58305b261ecSmrg * Send all pending events
58405b261ecSmrg */
5856747b715Smrgextern _X_EXPORT void
586f7df2e56Smrg RRTellChanged(ScreenPtr pScreen);
58705b261ecSmrg
588051b6151Schristosextern _X_EXPORT void
589051b6151SchristosRRSetChanged (ScreenPtr pScreen);
590051b6151Schristos
59105b261ecSmrg/*
59205b261ecSmrg * Poll the driver for changed information
59305b261ecSmrg */
5946747b715Smrgextern _X_EXPORT Bool
595f7df2e56Smrg RRGetInfo(ScreenPtr pScreen, Bool force_query);
59605b261ecSmrg
597f7df2e56Smrgextern _X_EXPORT Bool RRInit(void);
59805b261ecSmrg
5996747b715Smrgextern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
60005b261ecSmrg
601f7df2e56Smrgextern _X_EXPORT RROutputPtr RRFirstOutput(ScreenPtr pScreen);
60205b261ecSmrg
603b3a28be8Smrgextern _X_EXPORT RRCrtcPtr RRFirstEnabledCrtc(ScreenPtr pScreen);
604b3a28be8Smrg
6057e31ba66Smrgextern _X_EXPORT Bool RROutputSetNonDesktop(RROutputPtr output, Bool non_desktop);
6067e31ba66Smrg
6076747b715Smrgextern _X_EXPORT CARD16
608f7df2e56Smrg RRVerticalRefresh(xRRModeInfo * mode);
60905b261ecSmrg
610f7df2e56Smrg#ifdef RANDR_10_INTERFACE
61105b261ecSmrg/*
61205b261ecSmrg * This is the old interface, deprecated but left
61305b261ecSmrg * around for compatibility
61405b261ecSmrg */
61505b261ecSmrg
61605b261ecSmrg/*
61705b261ecSmrg * Then, register the specific size with the screen
61805b261ecSmrg */
61905b261ecSmrg
6206747b715Smrgextern _X_EXPORT RRScreenSizePtr
621f7df2e56SmrgRRRegisterSize(ScreenPtr pScreen,
622f7df2e56Smrg               short width, short height, short mmWidth, short mmHeight);
62305b261ecSmrg
6246747b715Smrgextern _X_EXPORT Bool
625f7df2e56Smrg RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate);
62605b261ecSmrg
62705b261ecSmrg/*
62805b261ecSmrg * Finally, set the current configuration of the screen
62905b261ecSmrg */
63005b261ecSmrg
6316747b715Smrgextern _X_EXPORT void
63205b261ecSmrg
633f7df2e56SmrgRRSetCurrentConfig(ScreenPtr pScreen,
634f7df2e56Smrg                   Rotation rotation, int rate, RRScreenSizePtr pSize);
63505b261ecSmrg
636f7df2e56Smrgextern _X_EXPORT Rotation RRGetRotation(ScreenPtr pScreen);
637f7df2e56Smrg
638f7df2e56Smrg#endif
63905b261ecSmrg
64005b261ecSmrg/* rrcrtc.c */
64105b261ecSmrg
64205b261ecSmrg/*
64305b261ecSmrg * Notify the CRTC of some change; layoutChanged indicates that
64405b261ecSmrg * some position or size element changed
64505b261ecSmrg */
6466747b715Smrgextern _X_EXPORT void
647f7df2e56Smrg RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged);
64805b261ecSmrg
64905b261ecSmrg/*
65005b261ecSmrg * Create a CRTC
65105b261ecSmrg */
652f7df2e56Smrgextern _X_EXPORT RRCrtcPtr RRCrtcCreate(ScreenPtr pScreen, void *devPrivate);
65305b261ecSmrg
654d44ca368Smrg/*
6555a112b11Smrg * Tests if findCrtc belongs to pScreen or secondary screens
656d44ca368Smrg */
657d44ca368Smrgextern _X_EXPORT Bool RRCrtcExists(ScreenPtr pScreen, RRCrtcPtr findCrtc);
658d44ca368Smrg
65905b261ecSmrg/*
66005b261ecSmrg * Set the allowed rotations on a CRTC
66105b261ecSmrg */
6626747b715Smrgextern _X_EXPORT void
663f7df2e56Smrg RRCrtcSetRotations(RRCrtcPtr crtc, Rotation rotations);
66405b261ecSmrg
6654642e01fSmrg/*
6664642e01fSmrg * Set whether transforms are allowed on a CRTC
6674642e01fSmrg */
6686747b715Smrgextern _X_EXPORT void
669f7df2e56Smrg RRCrtcSetTransformSupport(RRCrtcPtr crtc, Bool transforms);
6704642e01fSmrg
67105b261ecSmrg/*
67205b261ecSmrg * Notify the extension that the Crtc has been reconfigured,
67305b261ecSmrg * the driver calls this whenever it has updated the mode
67405b261ecSmrg */
6756747b715Smrgextern _X_EXPORT Bool
676f7df2e56Smrg
677f7df2e56SmrgRRCrtcNotify(RRCrtcPtr crtc,
678f7df2e56Smrg             RRModePtr mode,
679f7df2e56Smrg             int x,
680f7df2e56Smrg             int y,
681f7df2e56Smrg             Rotation rotation,
682f7df2e56Smrg             RRTransformPtr transform, int numOutputs, RROutputPtr * outputs);
68305b261ecSmrg
6846747b715Smrgextern _X_EXPORT void
685f7df2e56Smrg RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
686f7df2e56Smrg
68705b261ecSmrg/*
68805b261ecSmrg * Request that the Crtc be reconfigured
68905b261ecSmrg */
6906747b715Smrgextern _X_EXPORT Bool
691f7df2e56Smrg
692f7df2e56SmrgRRCrtcSet(RRCrtcPtr crtc,
693f7df2e56Smrg          RRModePtr mode,
694f7df2e56Smrg          int x,
695f7df2e56Smrg          int y, Rotation rotation, int numOutput, RROutputPtr * outputs);
69605b261ecSmrg
69705b261ecSmrg/*
69805b261ecSmrg * Request that the Crtc gamma be changed
69905b261ecSmrg */
70005b261ecSmrg
7016747b715Smrgextern _X_EXPORT Bool
702f7df2e56Smrg RRCrtcGammaSet(RRCrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue);
70305b261ecSmrg
7046747b715Smrg/*
7056747b715Smrg * Request current gamma back from the DDX (if possible).
7066747b715Smrg * This includes gamma size.
7076747b715Smrg */
708f7df2e56Smrg
7096747b715Smrgextern _X_EXPORT Bool
710f7df2e56Smrg RRCrtcGammaGet(RRCrtcPtr crtc);
7116747b715Smrg
71205b261ecSmrg/*
71305b261ecSmrg * Notify the extension that the Crtc gamma has been changed
71405b261ecSmrg * The driver calls this whenever it has changed the gamma values
71505b261ecSmrg * in the RRCrtcRec
71605b261ecSmrg */
71705b261ecSmrg
7186747b715Smrgextern _X_EXPORT Bool
719f7df2e56Smrg RRCrtcGammaNotify(RRCrtcPtr crtc);
72005b261ecSmrg
72105b261ecSmrg/*
72205b261ecSmrg * Set the size of the gamma table at server startup time
72305b261ecSmrg */
72405b261ecSmrg
7256747b715Smrgextern _X_EXPORT Bool
726f7df2e56Smrg RRCrtcGammaSetSize(RRCrtcPtr crtc, int size);
72705b261ecSmrg
72805b261ecSmrg/*
72905b261ecSmrg * Return the area of the frame buffer scanned out by the crtc,
73005b261ecSmrg * taking into account the current mode and rotation
73105b261ecSmrg */
73205b261ecSmrg
7336747b715Smrgextern _X_EXPORT void
734f7df2e56Smrg RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
73505b261ecSmrg
7364642e01fSmrg/*
7374642e01fSmrg * Return crtc transform
7384642e01fSmrg */
739f7df2e56Smrgextern _X_EXPORT RRTransformPtr RRCrtcGetTransform(RRCrtcPtr crtc);
7404642e01fSmrg
7414642e01fSmrg/*
7424642e01fSmrg * Check whether the pending and current transforms are the same
7434642e01fSmrg */
7446747b715Smrgextern _X_EXPORT Bool
745f7df2e56Smrg RRCrtcPendingTransform(RRCrtcPtr crtc);
7464642e01fSmrg
74705b261ecSmrg/*
74805b261ecSmrg * Destroy a Crtc at shutdown
74905b261ecSmrg */
7506747b715Smrgextern _X_EXPORT void
751f7df2e56Smrg RRCrtcDestroy(RRCrtcPtr crtc);
7524642e01fSmrg
7534642e01fSmrg/*
7544642e01fSmrg * Set the pending CRTC transformation
7554642e01fSmrg */
7564642e01fSmrg
7576747b715Smrgextern _X_EXPORT int
758f7df2e56Smrg
759f7df2e56SmrgRRCrtcTransformSet(RRCrtcPtr crtc,
760f7df2e56Smrg                   PictTransformPtr transform,
761f7df2e56Smrg                   struct pict_f_transform *f_transform,
762f7df2e56Smrg                   struct pict_f_transform *f_inverse,
763f7df2e56Smrg                   char *filter, int filter_len, xFixed * params, int nparams);
7644642e01fSmrg
76505b261ecSmrg/*
76605b261ecSmrg * Initialize crtc type
76705b261ecSmrg */
7686747b715Smrgextern _X_EXPORT Bool
769f7df2e56Smrg RRCrtcInit(void);
77005b261ecSmrg
7716747b715Smrg/*
7726747b715Smrg * Initialize crtc type error value
7736747b715Smrg */
7746747b715Smrgextern _X_EXPORT void
775f7df2e56Smrg RRCrtcInitErrorValue(void);
776f7df2e56Smrg
777f7df2e56Smrg/*
778f7df2e56Smrg * Detach and free a scanout pixmap
779f7df2e56Smrg */
780f7df2e56Smrgextern _X_EXPORT void
781f7df2e56Smrg RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc);
782f7df2e56Smrg
783f7df2e56Smrgextern _X_EXPORT Bool
784f7df2e56Smrg RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable);
7856747b715Smrg
7867e31ba66Smrg/*
7877e31ba66Smrg * Return if the screen has any scanout_pixmap's attached
7887e31ba66Smrg */
7897e31ba66Smrgextern _X_EXPORT Bool
7907e31ba66Smrg RRHasScanoutPixmap(ScreenPtr pScreen);
7917e31ba66Smrg
79205b261ecSmrg/*
79305b261ecSmrg * Crtc dispatch
79405b261ecSmrg */
79505b261ecSmrg
7966747b715Smrgextern _X_EXPORT int
797f7df2e56Smrg ProcRRGetCrtcInfo(ClientPtr client);
79805b261ecSmrg
7996747b715Smrgextern _X_EXPORT int
800f7df2e56Smrg ProcRRSetCrtcConfig(ClientPtr client);
80105b261ecSmrg
8026747b715Smrgextern _X_EXPORT int
803f7df2e56Smrg ProcRRGetCrtcGammaSize(ClientPtr client);
80405b261ecSmrg
8056747b715Smrgextern _X_EXPORT int
806f7df2e56Smrg ProcRRGetCrtcGamma(ClientPtr client);
80705b261ecSmrg
8086747b715Smrgextern _X_EXPORT int
809f7df2e56Smrg ProcRRSetCrtcGamma(ClientPtr client);
81005b261ecSmrg
8116747b715Smrgextern _X_EXPORT int
812f7df2e56Smrg ProcRRSetCrtcTransform(ClientPtr client);
8134642e01fSmrg
8146747b715Smrgextern _X_EXPORT int
815f7df2e56Smrg ProcRRGetCrtcTransform(ClientPtr client);
8164642e01fSmrg
8174642e01fSmrgint
818f7df2e56Smrg ProcRRGetPanning(ClientPtr client);
8194642e01fSmrg
8204642e01fSmrgint
821f7df2e56Smrg ProcRRSetPanning(ClientPtr client);
822f7df2e56Smrg
823f7df2e56Smrgvoid
824f7df2e56Smrg RRConstrainCursorHarder(DeviceIntPtr, ScreenPtr, int, int *, int *);
8254642e01fSmrg
82605b261ecSmrg/* rrdispatch.c */
8276747b715Smrgextern _X_EXPORT Bool
828f7df2e56Smrg RRClientKnowsRates(ClientPtr pClient);
82905b261ecSmrg
8307e31ba66Smrg/* rrlease.c */
8317e31ba66Smrgvoid
8327e31ba66SmrgRRDeliverLeaseEvent(ClientPtr client, WindowPtr window);
8337e31ba66Smrg
8347e31ba66Smrgextern _X_EXPORT void
8357e31ba66SmrgRRLeaseTerminated(RRLeasePtr lease);
8367e31ba66Smrg
8377e31ba66Smrgextern _X_EXPORT void
8387e31ba66SmrgRRLeaseFree(RRLeasePtr lease);
8397e31ba66Smrg
8407e31ba66Smrgextern _X_EXPORT Bool
8417e31ba66SmrgRRCrtcIsLeased(RRCrtcPtr crtc);
8427e31ba66Smrg
8437e31ba66Smrgextern _X_EXPORT Bool
8447e31ba66SmrgRROutputIsLeased(RROutputPtr output);
8457e31ba66Smrg
8467e31ba66Smrgvoid
8477e31ba66SmrgRRTerminateLease(RRLeasePtr lease);
8487e31ba66Smrg
8497e31ba66SmrgBool
8507e31ba66SmrgRRLeaseInit(void);
8517e31ba66Smrg
85205b261ecSmrg/* rrmode.c */
85305b261ecSmrg/*
85405b261ecSmrg * Find, and if necessary, create a mode
85505b261ecSmrg */
85605b261ecSmrg
857f7df2e56Smrgextern _X_EXPORT RRModePtr RRModeGet(xRRModeInfo * modeInfo, const char *name);
85805b261ecSmrg
85905b261ecSmrg/*
86005b261ecSmrg * Destroy a mode.
86105b261ecSmrg */
86205b261ecSmrg
8636747b715Smrgextern _X_EXPORT void
864f7df2e56Smrg RRModeDestroy(RRModePtr mode);
86505b261ecSmrg
86605b261ecSmrg/*
86705b261ecSmrg * Return a list of modes that are valid for some output in pScreen
86805b261ecSmrg */
869f7df2e56Smrgextern _X_EXPORT RRModePtr *RRModesForScreen(ScreenPtr pScreen, int *num_ret);
870f7df2e56Smrg
87105b261ecSmrg/*
87205b261ecSmrg * Initialize mode type
87305b261ecSmrg */
8746747b715Smrgextern _X_EXPORT Bool
875f7df2e56Smrg RRModeInit(void);
8766747b715Smrg
8776747b715Smrg/*
8786747b715Smrg * Initialize mode type error value
8796747b715Smrg */
8806747b715Smrgextern _X_EXPORT void
881f7df2e56Smrg RRModeInitErrorValue(void);
882f7df2e56Smrg
8836747b715Smrgextern _X_EXPORT int
884f7df2e56Smrg ProcRRCreateMode(ClientPtr client);
88505b261ecSmrg
8866747b715Smrgextern _X_EXPORT int
887f7df2e56Smrg ProcRRDestroyMode(ClientPtr client);
88805b261ecSmrg
8896747b715Smrgextern _X_EXPORT int
890f7df2e56Smrg ProcRRAddOutputMode(ClientPtr client);
89105b261ecSmrg
8926747b715Smrgextern _X_EXPORT int
893f7df2e56Smrg ProcRRDeleteOutputMode(ClientPtr client);
89405b261ecSmrg
89505b261ecSmrg/* rroutput.c */
89605b261ecSmrg
89705b261ecSmrg/*
89805b261ecSmrg * Notify the output of some change. configChanged indicates whether
89905b261ecSmrg * any external configuration (mode list, clones, connected status)
90005b261ecSmrg * has changed, or whether the change was strictly internal
90105b261ecSmrg * (which crtc is in use)
90205b261ecSmrg */
9036747b715Smrgextern _X_EXPORT void
904f7df2e56Smrg RROutputChanged(RROutputPtr output, Bool configChanged);
90505b261ecSmrg
90605b261ecSmrg/*
90705b261ecSmrg * Create an output
90805b261ecSmrg */
90905b261ecSmrg
9106747b715Smrgextern _X_EXPORT RROutputPtr
911f7df2e56SmrgRROutputCreate(ScreenPtr pScreen,
912f7df2e56Smrg               const char *name, int nameLength, void *devPrivate);
91305b261ecSmrg
91405b261ecSmrg/*
91505b261ecSmrg * Notify extension that output parameters have been changed
91605b261ecSmrg */
9176747b715Smrgextern _X_EXPORT Bool
918f7df2e56Smrg RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones);
91905b261ecSmrg
9206747b715Smrgextern _X_EXPORT Bool
921f7df2e56Smrg
922f7df2e56SmrgRROutputSetModes(RROutputPtr output,
923f7df2e56Smrg                 RRModePtr * modes, int numModes, int numPreferred);
92405b261ecSmrg
9256747b715Smrgextern _X_EXPORT int
926f7df2e56Smrg RROutputAddUserMode(RROutputPtr output, RRModePtr mode);
92705b261ecSmrg
9286747b715Smrgextern _X_EXPORT int
929f7df2e56Smrg RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode);
93005b261ecSmrg
9316747b715Smrgextern _X_EXPORT Bool
932f7df2e56Smrg RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs);
93305b261ecSmrg
9346747b715Smrgextern _X_EXPORT Bool
935f7df2e56Smrg RROutputSetConnection(RROutputPtr output, CARD8 connection);
93605b261ecSmrg
9376747b715Smrgextern _X_EXPORT Bool
938f7df2e56Smrg RROutputSetSubpixelOrder(RROutputPtr output, int subpixelOrder);
93905b261ecSmrg
9406747b715Smrgextern _X_EXPORT Bool
941f7df2e56Smrg RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight);
94205b261ecSmrg
9436747b715Smrgextern _X_EXPORT void
944f7df2e56Smrg RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
94505b261ecSmrg
9466747b715Smrgextern _X_EXPORT void
947f7df2e56Smrg RROutputDestroy(RROutputPtr output);
94805b261ecSmrg
9496747b715Smrgextern _X_EXPORT int
950f7df2e56Smrg ProcRRGetOutputInfo(ClientPtr client);
95105b261ecSmrg
9526747b715Smrgextern _X_EXPORT int
953f7df2e56Smrg ProcRRSetOutputPrimary(ClientPtr client);
9544642e01fSmrg
9556747b715Smrgextern _X_EXPORT int
956f7df2e56Smrg ProcRRGetOutputPrimary(ClientPtr client);
9574642e01fSmrg
95805b261ecSmrg/*
95905b261ecSmrg * Initialize output type
96005b261ecSmrg */
9616747b715Smrgextern _X_EXPORT Bool
962f7df2e56Smrg RROutputInit(void);
9636747b715Smrg
9646747b715Smrg/*
9656747b715Smrg * Initialize output type error value
9666747b715Smrg */
9676747b715Smrgextern _X_EXPORT void
968f7df2e56Smrg RROutputInitErrorValue(void);
969f7df2e56Smrg
97005b261ecSmrg/* rrpointer.c */
9716747b715Smrgextern _X_EXPORT void
972f7df2e56Smrg RRPointerMoved(ScreenPtr pScreen, int x, int y);
97305b261ecSmrg
9746747b715Smrgextern _X_EXPORT void
975f7df2e56Smrg RRPointerScreenConfigured(ScreenPtr pScreen);
97605b261ecSmrg
97705b261ecSmrg/* rrproperty.c */
97805b261ecSmrg
9796747b715Smrgextern _X_EXPORT void
980f7df2e56Smrg RRDeleteAllOutputProperties(RROutputPtr output);
98105b261ecSmrg
9826747b715Smrgextern _X_EXPORT RRPropertyValuePtr
983f7df2e56SmrgRRGetOutputProperty(RROutputPtr output, Atom property, Bool pending);
98405b261ecSmrg
9856747b715Smrgextern _X_EXPORT RRPropertyPtr
986f7df2e56SmrgRRQueryOutputProperty(RROutputPtr output, Atom property);
987f7df2e56Smrg
9886747b715Smrgextern _X_EXPORT void
989f7df2e56Smrg RRDeleteOutputProperty(RROutputPtr output, Atom property);
99005b261ecSmrg
9916747b715Smrgextern _X_EXPORT Bool
992f7df2e56Smrg RRPostPendingProperties(RROutputPtr output);
993f7df2e56Smrg
9946747b715Smrgextern _X_EXPORT int
995f7df2e56Smrg
996f7df2e56SmrgRRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
997f7df2e56Smrg                       int format, int mode, unsigned long len,
9987e31ba66Smrg                       const void *value, Bool sendevent, Bool pending);
99905b261ecSmrg
10006747b715Smrgextern _X_EXPORT int
1001f7df2e56Smrg
1002f7df2e56SmrgRRConfigureOutputProperty(RROutputPtr output, Atom property,
1003f7df2e56Smrg                          Bool pending, Bool range, Bool immutable,
10047e31ba66Smrg                          int num_values, const INT32 *values);
10056747b715Smrgextern _X_EXPORT int
1006f7df2e56Smrg ProcRRChangeOutputProperty(ClientPtr client);
100705b261ecSmrg
10086747b715Smrgextern _X_EXPORT int
1009f7df2e56Smrg ProcRRGetOutputProperty(ClientPtr client);
101005b261ecSmrg
10116747b715Smrgextern _X_EXPORT int
1012f7df2e56Smrg ProcRRListOutputProperties(ClientPtr client);
101305b261ecSmrg
10146747b715Smrgextern _X_EXPORT int
1015f7df2e56Smrg ProcRRQueryOutputProperty(ClientPtr client);
101605b261ecSmrg
10176747b715Smrgextern _X_EXPORT int
1018f7df2e56Smrg ProcRRConfigureOutputProperty(ClientPtr client);
101905b261ecSmrg
10206747b715Smrgextern _X_EXPORT int
1021f7df2e56Smrg ProcRRDeleteOutputProperty(ClientPtr client);
1022f7df2e56Smrg
1023f7df2e56Smrg/* rrprovider.c */
10247e31ba66Smrg#define PRIME_SYNC_PROP         "PRIME Synchronization"
1025f7df2e56Smrgextern _X_EXPORT void
1026f7df2e56SmrgRRProviderInitErrorValue(void);
102705b261ecSmrg
1028f7df2e56Smrgextern _X_EXPORT int
1029f7df2e56SmrgProcRRGetProviders(ClientPtr client);
1030f7df2e56Smrg
1031f7df2e56Smrgextern _X_EXPORT int
1032f7df2e56SmrgProcRRGetProviderInfo(ClientPtr client);
1033f7df2e56Smrg
1034f7df2e56Smrgextern _X_EXPORT int
1035f7df2e56SmrgProcRRSetProviderOutputSource(ClientPtr client);
1036f7df2e56Smrg
1037f7df2e56Smrgextern _X_EXPORT int
1038f7df2e56SmrgProcRRSetProviderOffloadSink(ClientPtr client);
1039f7df2e56Smrg
1040f7df2e56Smrgextern _X_EXPORT Bool
1041f7df2e56SmrgRRProviderInit(void);
1042f7df2e56Smrg
1043f7df2e56Smrgextern _X_EXPORT RRProviderPtr
1044f7df2e56SmrgRRProviderCreate(ScreenPtr pScreen, const char *name,
1045f7df2e56Smrg                 int nameLength);
1046f7df2e56Smrg
1047f7df2e56Smrgextern _X_EXPORT void
1048f7df2e56SmrgRRProviderDestroy (RRProviderPtr provider);
1049f7df2e56Smrg
1050f7df2e56Smrgextern _X_EXPORT void
1051f7df2e56SmrgRRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities);
1052f7df2e56Smrg
1053f7df2e56Smrgextern _X_EXPORT Bool
1054f7df2e56SmrgRRProviderLookup(XID id, RRProviderPtr *provider_p);
1055f7df2e56Smrg
1056f7df2e56Smrgextern _X_EXPORT void
1057f7df2e56SmrgRRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider);
1058f7df2e56Smrg
10595a112b11Smrgextern _X_EXPORT void
10605a112b11SmrgRRProviderAutoConfigGpuScreen(ScreenPtr pScreen, ScreenPtr primaryScreen);
10615a112b11Smrg
1062f7df2e56Smrg/* rrproviderproperty.c */
1063f7df2e56Smrg
1064f7df2e56Smrgextern _X_EXPORT void
1065f7df2e56Smrg RRDeleteAllProviderProperties(RRProviderPtr provider);
1066f7df2e56Smrg
1067f7df2e56Smrgextern _X_EXPORT RRPropertyValuePtr
1068f7df2e56Smrg RRGetProviderProperty(RRProviderPtr provider, Atom property, Bool pending);
1069f7df2e56Smrg
1070f7df2e56Smrgextern _X_EXPORT RRPropertyPtr
1071f7df2e56Smrg RRQueryProviderProperty(RRProviderPtr provider, Atom property);
1072f7df2e56Smrg
1073f7df2e56Smrgextern _X_EXPORT void
1074f7df2e56Smrg RRDeleteProviderProperty(RRProviderPtr provider, Atom property);
1075f7df2e56Smrg
1076f7df2e56Smrgextern _X_EXPORT int
1077f7df2e56SmrgRRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
1078f7df2e56Smrg                       int format, int mode, unsigned long len,
1079f7df2e56Smrg                       void *value, Bool sendevent, Bool pending);
1080f7df2e56Smrg
1081f7df2e56Smrgextern _X_EXPORT int
1082f7df2e56Smrg RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
1083f7df2e56Smrg                             Bool pending, Bool range, Bool immutable,
1084f7df2e56Smrg                             int num_values, INT32 *values);
1085f7df2e56Smrg
1086f7df2e56Smrgextern _X_EXPORT Bool
1087f7df2e56Smrg RRPostProviderPendingProperties(RRProviderPtr provider);
1088f7df2e56Smrg
1089f7df2e56Smrgextern _X_EXPORT int
1090f7df2e56Smrg ProcRRGetProviderProperty(ClientPtr client);
1091f7df2e56Smrg
1092f7df2e56Smrgextern _X_EXPORT int
1093f7df2e56Smrg ProcRRListProviderProperties(ClientPtr client);
1094f7df2e56Smrg
1095f7df2e56Smrgextern _X_EXPORT int
1096f7df2e56Smrg ProcRRQueryProviderProperty(ClientPtr client);
1097f7df2e56Smrg
1098f7df2e56Smrgextern _X_EXPORT int
1099f7df2e56SmrgProcRRConfigureProviderProperty(ClientPtr client);
1100f7df2e56Smrg
1101f7df2e56Smrgextern _X_EXPORT int
1102f7df2e56SmrgProcRRChangeProviderProperty(ClientPtr client);
1103f7df2e56Smrg
1104f7df2e56Smrgextern _X_EXPORT int
1105f7df2e56Smrg ProcRRDeleteProviderProperty(ClientPtr client);
110605b261ecSmrg/* rrxinerama.c */
11076747b715Smrg#ifdef XINERAMA
11086747b715Smrgextern _X_EXPORT void
1109f7df2e56Smrg RRXineramaExtensionInit(void);
11106747b715Smrg#endif
111105b261ecSmrg
1112f7df2e56Smrgvoid
1113f7df2e56SmrgRRMonitorInit(ScreenPtr screen);
1114f7df2e56Smrg
1115f7df2e56SmrgBool
1116f7df2e56SmrgRRMonitorMakeList(ScreenPtr screen, Bool get_active, RRMonitorPtr *monitors_ret, int *nmon_ret);
1117f7df2e56Smrg
1118f7df2e56Smrgint
1119f7df2e56SmrgRRMonitorCountList(ScreenPtr screen);
1120f7df2e56Smrg
1121f7df2e56Smrgvoid
1122f7df2e56SmrgRRMonitorFreeList(RRMonitorPtr monitors, int nmon);
1123f7df2e56Smrg
1124f7df2e56Smrgvoid
1125f7df2e56SmrgRRMonitorClose(ScreenPtr screen);
1126f7df2e56Smrg
1127f7df2e56SmrgRRMonitorPtr
1128f7df2e56SmrgRRMonitorAlloc(int noutput);
1129f7df2e56Smrg
1130f7df2e56Smrgint
1131f7df2e56SmrgRRMonitorAdd(ClientPtr client, ScreenPtr screen, RRMonitorPtr monitor);
1132f7df2e56Smrg
1133f7df2e56Smrgvoid
1134f7df2e56SmrgRRMonitorFree(RRMonitorPtr monitor);
1135f7df2e56Smrg
1136f7df2e56Smrgint
1137f7df2e56SmrgProcRRGetMonitors(ClientPtr client);
1138f7df2e56Smrg
1139f7df2e56Smrgint
1140f7df2e56SmrgProcRRSetMonitor(ClientPtr client);
1141f7df2e56Smrg
1142f7df2e56Smrgint
1143f7df2e56SmrgProcRRDeleteMonitor(ClientPtr client);
1144f7df2e56Smrg
11457e31ba66Smrgint
11467e31ba66SmrgProcRRCreateLease(ClientPtr client);
11477e31ba66Smrg
11487e31ba66Smrgint
11497e31ba66SmrgProcRRFreeLease(ClientPtr client);
11507e31ba66Smrg
1151f7df2e56Smrg#endif                          /* _RANDRSTR_H_ */
115205b261ecSmrg
115305b261ecSmrg/*
1154f7df2e56Smrg
115505b261ecSmrgrandr extension implementation structure
115605b261ecSmrg
115705b261ecSmrgQuery state:
115805b261ecSmrg    ProcRRGetScreenInfo/ProcRRGetScreenResources
115905b261ecSmrg	RRGetInfo
1160f7df2e56Smrg
116105b261ecSmrg	    • Request configuration from driver, either 1.0 or 1.2 style
116205b261ecSmrg	    • These functions only record state changes, all
116305b261ecSmrg	      other actions are pended until RRTellChanged is called
1164f7df2e56Smrg
116505b261ecSmrg	    ->rrGetInfo
116605b261ecSmrg	    1.0:
116705b261ecSmrg		RRRegisterSize
116805b261ecSmrg		RRRegisterRate
116905b261ecSmrg		RRSetCurrentConfig
117005b261ecSmrg	    1.2:
117105b261ecSmrg		RRScreenSetSizeRange
117205b261ecSmrg		RROutputSetCrtcs
117305b261ecSmrg		RRModeGet
117405b261ecSmrg		RROutputSetModes
117505b261ecSmrg		RROutputSetConnection
117605b261ecSmrg		RROutputSetSubpixelOrder
117705b261ecSmrg		RROutputSetClones
117805b261ecSmrg		RRCrtcNotify
1179f7df2e56Smrg
118005b261ecSmrg	• Must delay scanning configuration until after ->rrGetInfo returns
118105b261ecSmrg	  because some drivers will call SetCurrentConfig in the middle
118205b261ecSmrg	  of the ->rrGetInfo operation.
1183f7df2e56Smrg
118405b261ecSmrg	1.0:
118505b261ecSmrg
118605b261ecSmrg	    • Scan old configuration, mirror to new structures
1187f7df2e56Smrg
118805b261ecSmrg	    RRScanOldConfig
118905b261ecSmrg		RRCrtcCreate
119005b261ecSmrg		RROutputCreate
119105b261ecSmrg		RROutputSetCrtcs
119205b261ecSmrg		RROutputSetConnection
119305b261ecSmrg		RROutputSetSubpixelOrder
119405b261ecSmrg		RROldModeAdd	• This adds modes one-at-a-time
119505b261ecSmrg		    RRModeGet
119605b261ecSmrg		RRCrtcNotify
1197f7df2e56Smrg
119805b261ecSmrg	• send events, reset pointer if necessary
1199f7df2e56Smrg
120005b261ecSmrg	RRTellChanged
120105b261ecSmrg	    WalkTree (sending events)
1202f7df2e56Smrg
120305b261ecSmrg	    • when layout has changed:
120405b261ecSmrg		RRPointerScreenConfigured
120505b261ecSmrg		RRSendConfigNotify
1206f7df2e56Smrg
120705b261ecSmrgAsynchronous state setting (1.2 only)
120805b261ecSmrg    When setting state asynchronously, the driver invokes the
120905b261ecSmrg    ->rrGetInfo function and then calls RRTellChanged to flush
121005b261ecSmrg    the changes to the clients and reset pointer if necessary
121105b261ecSmrg
121205b261ecSmrgSet state
121305b261ecSmrg
121405b261ecSmrg    ProcRRSetScreenConfig
121505b261ecSmrg	RRCrtcSet
121605b261ecSmrg	    1.2:
121705b261ecSmrg		->rrCrtcSet
121805b261ecSmrg		    RRCrtcNotify
121905b261ecSmrg	    1.0:
122005b261ecSmrg		->rrSetConfig
122105b261ecSmrg		RRCrtcNotify
122205b261ecSmrg	    RRTellChanged
122305b261ecSmrg */
1224