randrstr.h 31.2 KB
Newer Older
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
1
/*
2
 * Copyright © 2000 Compaq Computer Corporation
Keith Packard's avatar
Keith Packard committed
3
4
 * Copyright © 2002 Hewlett-Packard Company
 * Copyright © 2006 Intel Corporation
Adam Jackson's avatar
Adam Jackson committed
5
 * Copyright © 2008 Red Hat, Inc.
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
6
7
8
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
Keith Packard's avatar
Keith Packard committed
9
10
11
12
13
14
15
 * the above copyright notice appear in all copies and that both that copyright
 * notice and this permission notice appear in supporting documentation, and
 * that the name of the copyright holders not be used in advertising or
 * publicity pertaining to distribution of the software without specific,
 * written prior permission.  The copyright holders make no representations
 * about the suitability of this software for any purpose.  It is provided "as
 * is" without express or implied warranty.
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
16
 *
Keith Packard's avatar
Keith Packard committed
17
 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
18
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
Keith Packard's avatar
Keith Packard committed
19
 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
20
21
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
Keith Packard's avatar
Keith Packard committed
22
23
24
25
26
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
 * OF THIS SOFTWARE.
 *
 * Author:  Jim Gettys, Hewlett-Packard Company, Inc.
 *	    Keith Packard, Intel Corporation
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
27
28
 */

29
30
31
32
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
#endif

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
33
34
35
#ifndef _RANDRSTR_H_
#define _RANDRSTR_H_

36
37
38
39
40
41
42
43
44
45
46
#include <X11/X.h>
#include <X11/Xproto.h>
#include "misc.h"
#include "os.h"
#include "dixstruct.h"
#include "resource.h"
#include "scrnintstr.h"
#include "windowstr.h"
#include "pixmapstr.h"
#include "extnsionst.h"
#include "servermd.h"
47
#include "rrtransform.h"
48
#include <X11/extensions/randr.h>
Keith Packard's avatar
Keith Packard committed
49
#include <X11/extensions/randrproto.h>
50
#include <X11/extensions/render.h>      /* we share subpixel order information */
51
52
#include "picturestr.h"
#include <X11/Xfuncproto.h>
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
53

54
/* required for ABI compatibility for now */
55
#define RANDR_10_INTERFACE 1
56
#define RANDR_12_INTERFACE 1
57
#define RANDR_13_INTERFACE 1    /* requires RANDR_12_INTERFACE */
58
#define RANDR_GET_CRTC_INTERFACE 1
59

60
#define RANDR_INTERFACE_VERSION 0x0104
61

62
63
64
typedef XID RRMode;
typedef XID RROutput;
typedef XID RRCrtc;
65
typedef XID RRProvider;
66
typedef XID RRLease;
67

68
extern int RREventBase, RRErrorBase;
69

70
71
extern int (*ProcRandrVector[RRNumberRequests]) (ClientPtr);
extern int (*SProcRandrVector[RRNumberRequests]) (ClientPtr);
72

73
74
75
76
77
/*
 * Modeline for a monitor. Name follows directly after this struct
 */

#define RRModeName(pMode) ((char *) (pMode + 1))
78
79
80
81
82
typedef struct _rrMode RRModeRec, *RRModePtr;
typedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr;
typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
typedef struct _rrOutput RROutputRec, *RROutputPtr;
83
typedef struct _rrProvider RRProviderRec, *RRProviderPtr;
84
typedef struct _rrMonitor RRMonitorRec, *RRMonitorPtr;
85
typedef struct _rrLease RRLeaseRec, *RRLeasePtr;
86
87

struct _rrMode {
88
89
90
91
    int refcnt;
    xRRModeInfo mode;
    char *name;
    ScreenPtr userScreen;
92
93
};

94
struct _rrPropertyValue {
95
96
97
    Atom type;                  /* ignored by server */
    short format;               /* format of data for swapping - 8,16,32 */
    long size;                  /* size of data in (format/8) bytes */
98
    void *data;                 /* private to client */
99
100
101
};

struct _rrProperty {
102
103
104
105
106
107
108
109
    RRPropertyPtr next;
    ATOM propertyName;
    Bool is_pending;
    Bool range;
    Bool immutable;
    int num_valid;
    INT32 *valid_values;
    RRPropertyValueRec current, pending;
110
111
};

112
struct _rrCrtc {
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
    RRCrtc id;
    ScreenPtr pScreen;
    RRModePtr mode;
    int x, y;
    Rotation rotation;
    Rotation rotations;
    Bool changed;
    int numOutputs;
    RROutputPtr *outputs;
    int gammaSize;
    CARD16 *gammaRed;
    CARD16 *gammaBlue;
    CARD16 *gammaGreen;
    void *devPrivate;
    Bool transforms;
    RRTransformRec client_pending_transform;
    RRTransformRec client_current_transform;
    PictTransform transform;
131
132
    struct pict_f_transform f_transform;
    struct pict_f_transform f_inverse;
133
134

    PixmapPtr scanout_pixmap;
135
    PixmapPtr scanout_pixmap_back;
136
137
138
};

struct _rrOutput {
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
    RROutput id;
    ScreenPtr pScreen;
    char *name;
    int nameLength;
    CARD8 connection;
    CARD8 subpixelOrder;
    int mmWidth;
    int mmHeight;
    RRCrtcPtr crtc;
    int numCrtcs;
    RRCrtcPtr *crtcs;
    int numClones;
    RROutputPtr *clones;
    int numModes;
    int numPreferred;
    RRModePtr *modes;
    int numUserModes;
    RRModePtr *userModes;
    Bool changed;
158
    Bool nonDesktop;
159
160
161
    RRPropertyPtr properties;
    Bool pendingProperties;
    void *devPrivate;
162
163
};

164
165
166
167
168
169
170
171
struct _rrProvider {
    RRProvider id;
    ScreenPtr pScreen;
    uint32_t capabilities;
    char *name;
    int nameLength;
    RRPropertyPtr properties;
    Bool pendingProperties;
172
    Bool changed;
173
    struct _rrProvider *offload_sink;
Dave Airlie's avatar
Dave Airlie committed
174
    struct _rrProvider *output_source;
175
176
};

177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
typedef struct _rrMonitorGeometry {
    BoxRec box;
    CARD32 mmWidth;
    CARD32 mmHeight;
} RRMonitorGeometryRec, *RRMonitorGeometryPtr;

struct _rrMonitor {
    Atom name;
    ScreenPtr pScreen;
    int numOutputs;
    RROutput *outputs;
    Bool primary;
    Bool automatic;
    RRMonitorGeometryRec geometry;
};

193
194
195
196
197
198
199
200
201
202
203
204
205
206
typedef enum _rrLeaseState { RRLeaseCreating, RRLeaseRunning, RRLeaseTerminating } RRLeaseState;

struct _rrLease {
    struct xorg_list list;
    ScreenPtr screen;
    RRLease id;
    RRLeaseState state;
    void *devPrivate;
    int numCrtcs;
    RRCrtcPtr *crtcs;
    int numOutputs;
    RROutputPtr *outputs;
};

207
#if RANDR_12_INTERFACE
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
                                        CARD16 width,
                                        CARD16 height,
                                        CARD32 mmWidth, CARD32 mmHeight);

typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
                                  RRCrtcPtr crtc,
                                  RRModePtr mode,
                                  int x,
                                  int y,
                                  Rotation rotation,
                                  int numOutputs, RROutputPtr * outputs);

typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);

typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);

typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
                                            RROutputPtr output,
                                            Atom property,
                                            RRPropertyValuePtr value);

typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
                                             RROutputPtr output,
                                             RRModePtr mode);

typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, RRModePtr mode);
235

236
#endif
Keith Packard's avatar
Keith Packard committed
237

238
#if RANDR_13_INTERFACE
239
240
241
242
243
244
245
246
247
248
249
250
251
typedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen,
                                            RROutputPtr output, Atom property);
typedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn,
                                     RRCrtcPtr crtc,
                                     BoxPtr totalArea,
                                     BoxPtr trackingArea, INT16 *border);
typedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn,
                                     RRCrtcPtr crtc,
                                     BoxPtr totalArea,
                                     BoxPtr trackingArea, INT16 *border);

#endif                          /* RANDR_13_INTERFACE */

252
253
254
255
256
257
258
typedef Bool (*RRProviderGetPropertyProcPtr) (ScreenPtr pScreen,
                                            RRProviderPtr provider, Atom property);
typedef Bool (*RRProviderSetPropertyProcPtr) (ScreenPtr pScreen,
                                              RRProviderPtr provider,
                                              Atom property,
                                              RRPropertyValuePtr value);

259
typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation * rotations);
260
typedef Bool (*RRCloseScreenProcPtr) (ScreenPtr pscreen);
Keith Packard's avatar
Keith Packard committed
261

Dave Airlie's avatar
Dave Airlie committed
262
263
264
265
typedef Bool (*RRProviderSetOutputSourceProcPtr)(ScreenPtr pScreen,
                                          RRProviderPtr provider,
                                          RRProviderPtr output_source);

266
267
268
269
270
typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen,
                                         RRProviderPtr provider,
                                         RRProviderPtr offload_sink);


Dave Airlie's avatar
Dave Airlie committed
271
272
273
typedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen,
                                         RRProviderPtr provider);

274
275
276
277
278
279
280
281
282
/* Additions for 1.6 */

typedef int (*RRCreateLeaseProcPtr)(ScreenPtr screen,
                                    RRLeasePtr lease,
                                    int *fd);

typedef void (*RRTerminateLeaseProcPtr)(ScreenPtr screen,
                                        RRLeasePtr lease);

283
/* These are for 1.0 compatibility */
284

285
typedef struct _rrRefresh {
286
287
    CARD16 rate;
    RRModePtr mode;
288
} RRScreenRate, *RRScreenRatePtr;
289
290

typedef struct _rrScreenSize {
291
292
293
294
    int id;
    short width, height;
    short mmWidth, mmHeight;
    int nRates;
295
296
297
    RRScreenRatePtr pRates;
} RRScreenSize, *RRScreenSizePtr;

298
#ifdef RANDR_10_INTERFACE
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
299

300
301
302
typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
                                    Rotation rotation,
                                    int rate, RRScreenSizePtr pSize);
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
303

Keith Packard's avatar
Keith Packard committed
304
305
#endif

306
307
typedef Bool (*RRCrtcSetScanoutPixmapProcPtr)(RRCrtcPtr crtc, PixmapPtr pixmap);

308
typedef Bool (*RRStartFlippingPixmapTrackingProcPtr)(RRCrtcPtr, DrawablePtr,
309
310
311
312
313
314
315
316
317
318
319
320
                                                     PixmapPtr, PixmapPtr,
                                                     int x, int y,
                                                     int dst_x, int dst_y,
                                                     Rotation rotation);

typedef Bool (*RREnableSharedPixmapFlippingProcPtr)(RRCrtcPtr,
                                                    PixmapPtr front,
                                                    PixmapPtr back);

typedef void (*RRDisableSharedPixmapFlippingProcPtr)(RRCrtcPtr);


Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
321
typedef struct _rrScrPriv {
322
323
324
325
    /*
     * 'public' part of the structure; DDXen fill this in
     * as they initialize
     */
326
#if RANDR_10_INTERFACE
327
    RRSetConfigProcPtr rrSetConfig;
328
#endif
329
    RRGetInfoProcPtr rrGetInfo;
330
#if RANDR_12_INTERFACE
331
332
333
334
335
336
337
    RRScreenSetSizeProcPtr rrScreenSetSize;
    RRCrtcSetProcPtr rrCrtcSet;
    RRCrtcSetGammaProcPtr rrCrtcSetGamma;
    RRCrtcGetGammaProcPtr rrCrtcGetGamma;
    RROutputSetPropertyProcPtr rrOutputSetProperty;
    RROutputValidateModeProcPtr rrOutputValidateMode;
    RRModeDestroyProcPtr rrModeDestroy;
338
#endif
339
#if RANDR_13_INTERFACE
340
341
342
    RROutputGetPropertyProcPtr rrOutputGetProperty;
    RRGetPanningProcPtr rrGetPanning;
    RRSetPanningProcPtr rrSetPanning;
343
#endif
344
345
    /* TODO #if RANDR_15_INTERFACE */
    RRCrtcSetScanoutPixmapProcPtr rrCrtcSetScanoutPixmap;
346

347
348
349
350
    RRStartFlippingPixmapTrackingProcPtr rrStartFlippingPixmapTracking;
    RREnableSharedPixmapFlippingProcPtr rrEnableSharedPixmapFlipping;
    RRDisableSharedPixmapFlippingProcPtr rrDisableSharedPixmapFlipping;

Dave Airlie's avatar
Dave Airlie committed
351
    RRProviderSetOutputSourceProcPtr rrProviderSetOutputSource;
352
    RRProviderSetOffloadSinkProcPtr rrProviderSetOffloadSink;
353
354
    RRProviderGetPropertyProcPtr rrProviderGetProperty;
    RRProviderSetPropertyProcPtr rrProviderSetProperty;
355
356
357
358

    RRCreateLeaseProcPtr rrCreateLease;
    RRTerminateLeaseProcPtr rrTerminateLease;

359
360
361
    /*
     * Private part of the structure; not considered part of the ABI
     */
362
363
364
    TimeStamp lastSetTime;      /* last changed by client */
    TimeStamp lastConfigTime;   /* possible configs changed */
    RRCloseScreenProcPtr CloseScreen;
365

366
367
368
    Bool changed;               /* some config changed */
    Bool configChanged;         /* configuration changed */
    Bool layoutChanged;         /* screen layout changed */
369
    Bool resourcesChanged;      /* screen resources change */
370
    Bool leasesChanged;         /* leases change */
371

372
373
374
375
    CARD16 minWidth, minHeight;
    CARD16 maxWidth, maxHeight;
    CARD16 width, height;       /* last known screen size */
    CARD16 mmWidth, mmHeight;   /* last known screen size */
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
376

377
378
379
    int numOutputs;
    RROutputPtr *outputs;
    RROutputPtr primaryOutput;
380

381
382
    int numCrtcs;
    RRCrtcPtr *crtcs;
Keith Packard's avatar
Keith Packard committed
383

384
    /* Last known pointer position */
385
    RRCrtcPtr pointerCrtc;
386

387
#ifdef RANDR_10_INTERFACE
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
388
389
390
    /*
     * Configuration information
     */
391
392
393
394
395
396
397
398
399
    Rotation rotations;
    CARD16 reqWidth, reqHeight;

    int nSizes;
    RRScreenSizePtr pSizes;

    Rotation rotation;
    int rate;
    int size;
Keith Packard's avatar
Keith Packard committed
400
#endif
401
    Bool discontiguous;
402
403

    RRProviderPtr provider;
Dave Airlie's avatar
Dave Airlie committed
404
405
406

    RRProviderDestroyProcPtr rrProviderDestroy;

407
408
409
    int numMonitors;
    RRMonitorPtr *monitors;

410
    struct xorg_list leases;
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
411
412
} rrScrPrivRec, *rrScrPrivPtr;

413
extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
414

415
#define rrPrivKey (&rrPrivKeyRec)
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
416

417
#define rrGetScrPriv(pScr)  ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey))
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
418
#define rrScrPriv(pScr)	rrScrPrivPtr    pScrPriv = rrGetScrPriv(pScr)
419
#define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, p)
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
420

421
422
423
424
425
426
427
428
429
430
431
/*
 * each window has a list of clients requesting
 * RRNotify events.  Each client has a resource
 * for each window it selects RRNotify input for,
 * this resource is used to delete the RRNotifyRec
 * entry from the per-window queue.
 */

typedef struct _RREvent *RREventPtr;

typedef struct _RREvent {
432
433
434
435
436
    RREventPtr next;
    ClientPtr client;
    WindowPtr window;
    XID clientResource;
    int mask;
437
438
439
} RREventRec;

typedef struct _RRTimes {
440
441
    TimeStamp setTime;
    TimeStamp configTime;
442
443
444
} RRTimesRec, *RRTimesPtr;

typedef struct _RRClient {
445
446
    int major_version;
    int minor_version;
447
448
449
/*  RRTimesRec	times[0]; */
} RRClientRec, *RRClientPtr;

450
451
extern RESTYPE RRClientType, RREventType;     /* resource types for event masks */
extern DevPrivateKeyRec RRClientPrivateKeyRec;
452

453
#define RRClientPrivateKey (&RRClientPrivateKeyRec)
454
extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType, RRLeaseType;
455

456
457
#define VERIFY_RR_OUTPUT(id, ptr, a)\
    {\
458
	int rc = dixLookupResourceByType((void **)&(ptr), id,\
459
	                                 RROutputType, client, a);\
460
461
	if (rc != Success) {\
	    client->errorValue = id;\
462
	    return rc;\
463
	}\
464
465
466
467
    }

#define VERIFY_RR_CRTC(id, ptr, a)\
    {\
468
	int rc = dixLookupResourceByType((void **)&(ptr), id,\
469
	                                 RRCrtcType, client, a);\
470
471
	if (rc != Success) {\
	    client->errorValue = id;\
472
	    return rc;\
473
	}\
474
475
476
477
    }

#define VERIFY_RR_MODE(id, ptr, a)\
    {\
478
	int rc = dixLookupResourceByType((void **)&(ptr), id,\
479
	                                 RRModeType, client, a);\
480
481
	if (rc != Success) {\
	    client->errorValue = id;\
482
	    return rc;\
483
	}\
484
    }
485

486
487
#define VERIFY_RR_PROVIDER(id, ptr, a)\
    {\
488
        int rc = dixLookupResourceByType((void **)&(ptr), id,\
489
490
491
492
493
494
495
                                         RRProviderType, client, a);\
        if (rc != Success) {\
            client->errorValue = id;\
            return rc;\
        }\
    }

496
497
498
499
500
501
502
503
504
505
#define VERIFY_RR_LEASE(id, ptr, a)\
    {\
        int rc = dixLookupResourceByType((void **)&(ptr), id,\
                                         RRLeaseType, client, a);\
        if (rc != Success) {\
            client->errorValue = id;\
            return rc;\
        }\
    }

506
#define GetRRClient(pClient)    ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey))
507
508
#define rrClientPriv(pClient)	RRClientPtr pRRClient = GetRRClient(pClient)

509
#ifdef RANDR_12_INTERFACE
Keith Packard's avatar
Keith Packard committed
510
/*
511
512
 * Set the range of sizes for the screen
 */
513
extern _X_EXPORT void
514
515
516
517

RRScreenSetSizeRange(ScreenPtr pScreen,
                     CARD16 minWidth,
                     CARD16 minHeight, CARD16 maxWidth, CARD16 maxHeight);
518
#endif
519

520
/* rrscreen.c */
521
/*
522
523
524
 * Notify the extension that the screen size has been changed.
 * The driver is responsible for calling this whenever it has changed
 * the size of the screen
525
 */
526
extern _X_EXPORT void
527
 RRScreenSizeNotify(ScreenPtr pScreen);
Keith Packard's avatar
Keith Packard committed
528
529

/*
530
 * Request that the screen be resized
Keith Packard's avatar
Keith Packard committed
531
 */
532
extern _X_EXPORT Bool
533
534
535

RRScreenSizeSet(ScreenPtr pScreen,
                CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
536

537
538
539
/*
 * Send ConfigureNotify event to root window when 'something' happens
 */
540
extern _X_EXPORT void
541
542
 RRSendConfigNotify(ScreenPtr pScreen);

543
544
545
/*
 * screen dispatch
 */
546
extern _X_EXPORT int
547
 ProcRRGetScreenSizeRange(ClientPtr client);
548

549
extern _X_EXPORT int
550
 ProcRRSetScreenSize(ClientPtr client);
551

552
extern _X_EXPORT int
553
 ProcRRGetScreenResources(ClientPtr client);
554

555
extern _X_EXPORT int
556
 ProcRRGetScreenResourcesCurrent(ClientPtr client);
557

558
extern _X_EXPORT int
559
 ProcRRSetScreenConfig(ClientPtr client);
560

561
extern _X_EXPORT int
562
 ProcRRGetScreenInfo(ClientPtr client);
563

564
/*
565
 * Deliver a ScreenNotify event
566
 */
567
extern _X_EXPORT void
568
569
 RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);

570
571
572
extern _X_EXPORT void
 RRResourcesChanged(ScreenPtr pScreen);

573
/* randr.c */
574
575
576
577
/* set a screen change on the primary screen */
extern _X_EXPORT void
RRSetChanged(ScreenPtr pScreen);

578
579
580
/*
 * Send all pending events
 */
581
extern _X_EXPORT void
582
 RRTellChanged(ScreenPtr pScreen);
583

584
585
586
/*
 * Poll the driver for changed information
 */
587
extern _X_EXPORT Bool
588
 RRGetInfo(ScreenPtr pScreen, Bool force_query);
589

590
extern _X_EXPORT Bool RRInit(void);
591

592
extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
593

594
extern _X_EXPORT RROutputPtr RRFirstOutput(ScreenPtr pScreen);
595

596
597
extern _X_EXPORT RRCrtcPtr RRFirstEnabledCrtc(ScreenPtr pScreen);

598
599
extern _X_EXPORT Bool RROutputSetNonDesktop(RROutputPtr output, Bool non_desktop);

600
extern _X_EXPORT CARD16
601
 RRVerticalRefresh(xRRModeInfo * mode);
602

603
#ifdef RANDR_10_INTERFACE
Keith Packard's avatar
Keith Packard committed
604
605
606
607
608
/*
 * This is the old interface, deprecated but left
 * around for compatibility
 */

Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
609
610
611
612
/*
 * Then, register the specific size with the screen
 */

613
extern _X_EXPORT RRScreenSizePtr
614
615
RRRegisterSize(ScreenPtr pScreen,
               short width, short height, short mmWidth, short mmHeight);
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
616

617
extern _X_EXPORT Bool
618
 RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate);
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
619
620
621
622
623

/*
 * Finally, set the current configuration of the screen
 */

624
extern _X_EXPORT void
Kaleb Keithley Keithley's avatar
Kaleb Keithley Keithley committed
625

626
627
628
629
RRSetCurrentConfig(ScreenPtr pScreen,
                   Rotation rotation, int rate, RRScreenSizePtr pSize);

extern _X_EXPORT Rotation RRGetRotation(ScreenPtr pScreen);
630

631
#endif
632
633

/* rrcrtc.c */
634
635
636
637
638

/*
 * Notify the CRTC of some change; layoutChanged indicates that
 * some position or size element changed
 */
639
extern _X_EXPORT void
640
 RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged);
641

642
643
644
/*
 * Create a CRTC
 */
645
extern _X_EXPORT RRCrtcPtr RRCrtcCreate(ScreenPtr pScreen, void *devPrivate);
646

647
648
649
650
651
/*
 * Tests if findCrtc belongs to pScreen or secondary screens
 */
extern _X_EXPORT Bool RRCrtcExists(ScreenPtr pScreen, RRCrtcPtr findCrtc);

652
/*
653
 * Set the allowed rotations on a CRTC
654
 */
655
extern _X_EXPORT void
656
 RRCrtcSetRotations(RRCrtcPtr crtc, Rotation rotations);
657

658
659
660
/*
 * Set whether transforms are allowed on a CRTC
 */
661
extern _X_EXPORT void
662
 RRCrtcSetTransformSupport(RRCrtcPtr crtc, Bool transforms);
663

664
665
666
667
/*
 * Notify the extension that the Crtc has been reconfigured,
 * the driver calls this whenever it has updated the mode
 */
668
extern _X_EXPORT Bool
669
670
671
672
673
674
675

RRCrtcNotify(RRCrtcPtr crtc,
             RRModePtr mode,
             int x,
             int y,
             Rotation rotation,
             RRTransformPtr transform, int numOutputs, RROutputPtr * outputs);
676

677
extern _X_EXPORT void
678
679
 RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);

680
681
682
/*
 * Request that the Crtc be reconfigured
 */
683
extern _X_EXPORT Bool
684
685
686
687
688

RRCrtcSet(RRCrtcPtr crtc,
          RRModePtr mode,
          int x,
          int y, Rotation rotation, int numOutput, RROutputPtr * outputs);
689

690
691
692
693
/*
 * Request that the Crtc gamma be changed
 */

694
extern _X_EXPORT Bool
695
 RRCrtcGammaSet(RRCrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue);
696

697
698
699
700
/*
 * Request current gamma back from the DDX (if possible).
 * This includes gamma size.
 */
701

702
extern _X_EXPORT Bool
703
 RRCrtcGammaGet(RRCrtcPtr crtc);
704

705
706
707
708
709
710
/*
 * Notify the extension that the Crtc gamma has been changed
 * The driver calls this whenever it has changed the gamma values
 * in the RRCrtcRec
 */

711
extern _X_EXPORT Bool
712
 RRCrtcGammaNotify(RRCrtcPtr crtc);
713
714
715
716
717

/*
 * Set the size of the gamma table at server startup time
 */

718
extern _X_EXPORT Bool
719
 RRCrtcGammaSetSize(RRCrtcPtr crtc, int size);
720

721
722
723
724
725
/*
 * Return the area of the frame buffer scanned out by the crtc,
 * taking into account the current mode and rotation
 */

726
extern _X_EXPORT void
727
 RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
728

729
730
731
/*
 * Return crtc transform
 */
732
extern _X_EXPORT RRTransformPtr RRCrtcGetTransform(RRCrtcPtr crtc);
733

734
735
736
/*
 * Check whether the pending and current transforms are the same
 */
737
extern _X_EXPORT Bool
738
 RRCrtcPendingTransform(RRCrtcPtr crtc);
739

740
741
742
/*
 * Destroy a Crtc at shutdown
 */
743
extern _X_EXPORT void
744
 RRCrtcDestroy(RRCrtcPtr crtc);
745
746
747
748
749

/*
 * Set the pending CRTC transformation
 */

750
extern _X_EXPORT int
751
752
753
754
755
756

RRCrtcTransformSet(RRCrtcPtr crtc,
                   PictTransformPtr transform,
                   struct pict_f_transform *f_transform,
                   struct pict_f_transform *f_inverse,
                   char *filter, int filter_len, xFixed * params, int nparams);
757

758
759
760
/*
 * Initialize crtc type
 */
761
extern _X_EXPORT Bool
762
 RRCrtcInit(void);
763

764
765
766
767
/*
 * Initialize crtc type error value
 */
extern _X_EXPORT void
768
 RRCrtcInitErrorValue(void);
769

770
771
772
773
774
775
/*
 * Detach and free a scanout pixmap
 */
extern _X_EXPORT void
 RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc);

776
777
778
extern _X_EXPORT Bool
 RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable);

779
780
781
782
783
784
/*
 * Return if the screen has any scanout_pixmap's attached
 */
extern _X_EXPORT Bool
 RRHasScanoutPixmap(ScreenPtr pScreen);

785
786
787
788
/*
 * Crtc dispatch
 */

789
extern _X_EXPORT int
790
 ProcRRGetCrtcInfo(ClientPtr client);
791

792
extern _X_EXPORT int
793
 ProcRRSetCrtcConfig(ClientPtr client);
794

795
extern _X_EXPORT int
796
 ProcRRGetCrtcGammaSize(ClientPtr client);
797

798
extern _X_EXPORT int
799
 ProcRRGetCrtcGamma(ClientPtr client);
800

801
extern _X_EXPORT int
802
 ProcRRSetCrtcGamma(ClientPtr client);
803

804
extern _X_EXPORT int
805
 ProcRRSetCrtcTransform(ClientPtr client);
806

807
extern _X_EXPORT int
808
 ProcRRGetCrtcTransform(ClientPtr client);
809

810
int
811
 ProcRRGetPanning(ClientPtr client);
812
813

int
814
 ProcRRSetPanning(ClientPtr client);
815

816
void
817
 RRConstrainCursorHarder(DeviceIntPtr, ScreenPtr, int, int *, int *);
818

819
/* rrdispatch.c */
820
extern _X_EXPORT Bool
821
 RRClientKnowsRates(ClientPtr pClient);
822

823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
/* rrlease.c */
void
RRDeliverLeaseEvent(ClientPtr client, WindowPtr window);

extern _X_EXPORT void
RRLeaseTerminated(RRLeasePtr lease);

extern _X_EXPORT void
RRLeaseFree(RRLeasePtr lease);

extern _X_EXPORT Bool
RRCrtcIsLeased(RRCrtcPtr crtc);

extern _X_EXPORT Bool
RROutputIsLeased(RROutputPtr output);

839
840
841
void
RRTerminateLease(RRLeasePtr lease);

842
843
844
Bool
RRLeaseInit(void);

845
846
847
848
849
/* rrmode.c */
/*
 * Find, and if necessary, create a mode
 */

850
extern _X_EXPORT RRModePtr RRModeGet(xRRModeInfo * modeInfo, const char *name);
851
852
853
854
855

/*
 * Destroy a mode.
 */

856
extern _X_EXPORT void
857
 RRModeDestroy(RRModePtr mode);
858

859
860
861
/*
 * Return a list of modes that are valid for some output in pScreen
 */
862
863
extern _X_EXPORT RRModePtr *RRModesForScreen(ScreenPtr pScreen, int *num_ret);

864
865
866
/*
 * Initialize mode type
 */
867
extern _X_EXPORT Bool
868
 RRModeInit(void);
869
870
871
872
873

/*
 * Initialize mode type error value
 */
extern _X_EXPORT void
874
875
 RRModeInitErrorValue(void);

876
extern _X_EXPORT int
877
 ProcRRCreateMode(ClientPtr client);
878

879
extern _X_EXPORT int
880
 ProcRRDestroyMode(ClientPtr client);
881

882
extern _X_EXPORT int
883
 ProcRRAddOutputMode(ClientPtr client);
884

885
extern _X_EXPORT int
886
 ProcRRDeleteOutputMode(ClientPtr client);
887

888
/* rroutput.c */
889
890

/*
891
892
893
894
 * Notify the output of some change. configChanged indicates whether
 * any external configuration (mode list, clones, connected status)
 * has changed, or whether the change was strictly internal
 * (which crtc is in use)
895
 */
896
extern _X_EXPORT void
897
 RROutputChanged(RROutputPtr output, Bool configChanged);
898

899
900
901
902
/*
 * Create an output
 */

903
extern _X_EXPORT RROutputPtr
904
905
RROutputCreate(ScreenPtr pScreen,
               const char *name, int nameLength, void *devPrivate);
906
907
908
909

/*
 * Notify extension that output parameters have been changed
 */
910
extern _X_EXPORT Bool
911
 RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones);
912

913
extern _X_EXPORT Bool
914
915
916

RROutputSetModes(RROutputPtr output,
                 RRModePtr * modes, int numModes, int numPreferred);
917

918
extern _X_EXPORT int
919
 RROutputAddUserMode(RROutputPtr output, RRModePtr mode);
920

921
extern _X_EXPORT int
922
 RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode);
923

924
extern _X_EXPORT Bool
925
 RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs);
926

927
extern _X_EXPORT Bool
928
 RROutputSetConnection(RROutputPtr output, CARD8 connection);
929

930
extern _X_EXPORT Bool
931
 RROutputSetSubpixelOrder(RROutputPtr output, int subpixelOrder);
932

933
extern _X_EXPORT Bool
934
 RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight);
935

936
extern _X_EXPORT void
937
 RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
938

939
extern _X_EXPORT void
940
 RROutputDestroy(RROutputPtr output);
941

942
extern _X_EXPORT int
943
 ProcRRGetOutputInfo(ClientPtr client);
944

945
extern _X_EXPORT int
946
 ProcRRSetOutputPrimary(ClientPtr client);
Adam Jackson's avatar
Adam Jackson committed
947

948
extern _X_EXPORT int
949
 ProcRRGetOutputPrimary(ClientPtr client);
Adam Jackson's avatar
Adam Jackson committed
950

951
952
953
/*
 * Initialize output type
 */
954
extern _X_EXPORT Bool
955
 RROutputInit(void);
956
957
958
959
960

/*
 * Initialize output type error value
 */
extern _X_EXPORT void
961
962
 RROutputInitErrorValue(void);

963
/* rrpointer.c */
964
extern _X_EXPORT void
965
 RRPointerMoved(ScreenPtr pScreen, int x, int y);
966

967
extern _X_EXPORT void
968
 RRPointerScreenConfigured(ScreenPtr pScreen);
969

970
971
/* rrproperty.c */

972
extern _X_EXPORT void
973
 RRDeleteAllOutputProperties(RROutputPtr output);
974

975
extern _X_EXPORT RRPropertyValuePtr
976
RRGetOutputProperty(RROutputPtr output, Atom property, Bool pending);
977

978
extern _X_EXPORT RRPropertyPtr
979
980
RRQueryOutputProperty(RROutputPtr output, Atom property);

981
extern _X_EXPORT void
982
 RRDeleteOutputProperty(RROutputPtr output, Atom property);
983

984
extern _X_EXPORT Bool