Imported Upstream version 1.15.1
[deb_xorg-server.git] / randr / randrstr.h
1 /*
2 * Copyright © 2000 Compaq Computer Corporation
3 * Copyright © 2002 Hewlett-Packard Company
4 * Copyright © 2006 Intel Corporation
5 * Copyright © 2008 Red Hat, Inc.
6 *
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that copyright
10 * notice and this permission notice appear in supporting documentation, and
11 * that the name of the copyright holders not be used in advertising or
12 * publicity pertaining to distribution of the software without specific,
13 * written prior permission. The copyright holders make no representations
14 * about the suitability of this software for any purpose. It is provided "as
15 * is" without express or implied warranty.
16 *
17 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23 * OF THIS SOFTWARE.
24 *
25 * Author: Jim Gettys, Hewlett-Packard Company, Inc.
26 * Keith Packard, Intel Corporation
27 */
28
29 #ifdef HAVE_DIX_CONFIG_H
30 #include <dix-config.h>
31 #endif
32
33 #ifndef _RANDRSTR_H_
34 #define _RANDRSTR_H_
35
36 #include <X11/X.h>
37 #include <X11/Xproto.h>
38 #include "misc.h"
39 #include "os.h"
40 #include "dixstruct.h"
41 #include "resource.h"
42 #include "scrnintstr.h"
43 #include "windowstr.h"
44 #include "pixmapstr.h"
45 #include "extnsionst.h"
46 #include "servermd.h"
47 #include "rrtransform.h"
48 #include <X11/extensions/randr.h>
49 #include <X11/extensions/randrproto.h>
50 #include <X11/extensions/render.h> /* we share subpixel order information */
51 #include "picturestr.h"
52 #include <X11/Xfuncproto.h>
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 typedef XID RRMode;
63 typedef XID RROutput;
64 typedef XID RRCrtc;
65 typedef XID RRProvider;
66
67 extern _X_EXPORT int RREventBase, RRErrorBase;
68
69 extern _X_EXPORT int (*ProcRandrVector[RRNumberRequests]) (ClientPtr);
70 extern _X_EXPORT int (*SProcRandrVector[RRNumberRequests]) (ClientPtr);
71
72 /*
73 * Modeline for a monitor. Name follows directly after this struct
74 */
75
76 #define RRModeName(pMode) ((char *) (pMode + 1))
77 typedef struct _rrMode RRModeRec, *RRModePtr;
78 typedef struct _rrPropertyValue RRPropertyValueRec, *RRPropertyValuePtr;
79 typedef struct _rrProperty RRPropertyRec, *RRPropertyPtr;
80 typedef struct _rrCrtc RRCrtcRec, *RRCrtcPtr;
81 typedef struct _rrOutput RROutputRec, *RROutputPtr;
82 typedef struct _rrProvider RRProviderRec, *RRProviderPtr;
83
84 struct _rrMode {
85 int refcnt;
86 xRRModeInfo mode;
87 char *name;
88 ScreenPtr userScreen;
89 };
90
91 struct _rrPropertyValue {
92 Atom type; /* ignored by server */
93 short format; /* format of data for swapping - 8,16,32 */
94 long size; /* size of data in (format/8) bytes */
95 pointer data; /* private to client */
96 };
97
98 struct _rrProperty {
99 RRPropertyPtr next;
100 ATOM propertyName;
101 Bool is_pending;
102 Bool range;
103 Bool immutable;
104 int num_valid;
105 INT32 *valid_values;
106 RRPropertyValueRec current, pending;
107 };
108
109 struct _rrCrtc {
110 RRCrtc id;
111 ScreenPtr pScreen;
112 RRModePtr mode;
113 int x, y;
114 Rotation rotation;
115 Rotation rotations;
116 Bool changed;
117 int numOutputs;
118 RROutputPtr *outputs;
119 int gammaSize;
120 CARD16 *gammaRed;
121 CARD16 *gammaBlue;
122 CARD16 *gammaGreen;
123 void *devPrivate;
124 Bool transforms;
125 RRTransformRec client_pending_transform;
126 RRTransformRec client_current_transform;
127 PictTransform transform;
128 struct pict_f_transform f_transform;
129 struct pict_f_transform f_inverse;
130
131 PixmapPtr scanout_pixmap;
132 };
133
134 struct _rrOutput {
135 RROutput id;
136 ScreenPtr pScreen;
137 char *name;
138 int nameLength;
139 CARD8 connection;
140 CARD8 subpixelOrder;
141 int mmWidth;
142 int mmHeight;
143 RRCrtcPtr crtc;
144 int numCrtcs;
145 RRCrtcPtr *crtcs;
146 int numClones;
147 RROutputPtr *clones;
148 int numModes;
149 int numPreferred;
150 RRModePtr *modes;
151 int numUserModes;
152 RRModePtr *userModes;
153 Bool changed;
154 RRPropertyPtr properties;
155 Bool pendingProperties;
156 void *devPrivate;
157 };
158
159 struct _rrProvider {
160 RRProvider id;
161 ScreenPtr pScreen;
162 uint32_t capabilities;
163 char *name;
164 int nameLength;
165 RRPropertyPtr properties;
166 Bool pendingProperties;
167 Bool changed;
168 struct _rrProvider *offload_sink;
169 struct _rrProvider *output_source;
170 };
171
172 #if RANDR_12_INTERFACE
173 typedef Bool (*RRScreenSetSizeProcPtr) (ScreenPtr pScreen,
174 CARD16 width,
175 CARD16 height,
176 CARD32 mmWidth, CARD32 mmHeight);
177
178 typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen,
179 RRCrtcPtr crtc,
180 RRModePtr mode,
181 int x,
182 int y,
183 Rotation rotation,
184 int numOutputs, RROutputPtr * outputs);
185
186 typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
187
188 typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc);
189
190 typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen,
191 RROutputPtr output,
192 Atom property,
193 RRPropertyValuePtr value);
194
195 typedef Bool (*RROutputValidateModeProcPtr) (ScreenPtr pScreen,
196 RROutputPtr output,
197 RRModePtr mode);
198
199 typedef void (*RRModeDestroyProcPtr) (ScreenPtr pScreen, RRModePtr mode);
200
201 #endif
202
203 #if RANDR_13_INTERFACE
204 typedef Bool (*RROutputGetPropertyProcPtr) (ScreenPtr pScreen,
205 RROutputPtr output, Atom property);
206 typedef Bool (*RRGetPanningProcPtr) (ScreenPtr pScrn,
207 RRCrtcPtr crtc,
208 BoxPtr totalArea,
209 BoxPtr trackingArea, INT16 *border);
210 typedef Bool (*RRSetPanningProcPtr) (ScreenPtr pScrn,
211 RRCrtcPtr crtc,
212 BoxPtr totalArea,
213 BoxPtr trackingArea, INT16 *border);
214
215 #endif /* RANDR_13_INTERFACE */
216
217 typedef Bool (*RRProviderGetPropertyProcPtr) (ScreenPtr pScreen,
218 RRProviderPtr provider, Atom property);
219 typedef Bool (*RRProviderSetPropertyProcPtr) (ScreenPtr pScreen,
220 RRProviderPtr provider,
221 Atom property,
222 RRPropertyValuePtr value);
223
224 typedef Bool (*RRGetInfoProcPtr) (ScreenPtr pScreen, Rotation * rotations);
225 typedef Bool (*RRCloseScreenProcPtr) (ScreenPtr pscreen);
226
227 typedef Bool (*RRProviderSetOutputSourceProcPtr)(ScreenPtr pScreen,
228 RRProviderPtr provider,
229 RRProviderPtr output_source);
230
231 typedef Bool (*RRProviderSetOffloadSinkProcPtr)(ScreenPtr pScreen,
232 RRProviderPtr provider,
233 RRProviderPtr offload_sink);
234
235
236 typedef void (*RRProviderDestroyProcPtr)(ScreenPtr pScreen,
237 RRProviderPtr provider);
238
239 /* These are for 1.0 compatibility */
240
241 typedef struct _rrRefresh {
242 CARD16 rate;
243 RRModePtr mode;
244 } RRScreenRate, *RRScreenRatePtr;
245
246 typedef struct _rrScreenSize {
247 int id;
248 short width, height;
249 short mmWidth, mmHeight;
250 int nRates;
251 RRScreenRatePtr pRates;
252 } RRScreenSize, *RRScreenSizePtr;
253
254 #ifdef RANDR_10_INTERFACE
255
256 typedef Bool (*RRSetConfigProcPtr) (ScreenPtr pScreen,
257 Rotation rotation,
258 int rate, RRScreenSizePtr pSize);
259
260 #endif
261
262 typedef Bool (*RRCrtcSetScanoutPixmapProcPtr)(RRCrtcPtr crtc, PixmapPtr pixmap);
263
264 typedef struct _rrScrPriv {
265 /*
266 * 'public' part of the structure; DDXen fill this in
267 * as they initialize
268 */
269 #if RANDR_10_INTERFACE
270 RRSetConfigProcPtr rrSetConfig;
271 #endif
272 RRGetInfoProcPtr rrGetInfo;
273 #if RANDR_12_INTERFACE
274 RRScreenSetSizeProcPtr rrScreenSetSize;
275 RRCrtcSetProcPtr rrCrtcSet;
276 RRCrtcSetGammaProcPtr rrCrtcSetGamma;
277 RRCrtcGetGammaProcPtr rrCrtcGetGamma;
278 RROutputSetPropertyProcPtr rrOutputSetProperty;
279 RROutputValidateModeProcPtr rrOutputValidateMode;
280 RRModeDestroyProcPtr rrModeDestroy;
281 #endif
282 #if RANDR_13_INTERFACE
283 RROutputGetPropertyProcPtr rrOutputGetProperty;
284 RRGetPanningProcPtr rrGetPanning;
285 RRSetPanningProcPtr rrSetPanning;
286 #endif
287 /* TODO #if RANDR_15_INTERFACE */
288 RRCrtcSetScanoutPixmapProcPtr rrCrtcSetScanoutPixmap;
289
290 RRProviderSetOutputSourceProcPtr rrProviderSetOutputSource;
291 RRProviderSetOffloadSinkProcPtr rrProviderSetOffloadSink;
292 RRProviderGetPropertyProcPtr rrProviderGetProperty;
293 RRProviderSetPropertyProcPtr rrProviderSetProperty;
294 /*
295 * Private part of the structure; not considered part of the ABI
296 */
297 TimeStamp lastSetTime; /* last changed by client */
298 TimeStamp lastConfigTime; /* possible configs changed */
299 RRCloseScreenProcPtr CloseScreen;
300
301 Bool changed; /* some config changed */
302 Bool configChanged; /* configuration changed */
303 Bool layoutChanged; /* screen layout changed */
304 Bool resourcesChanged; /* screen resources change */
305
306 CARD16 minWidth, minHeight;
307 CARD16 maxWidth, maxHeight;
308 CARD16 width, height; /* last known screen size */
309 CARD16 mmWidth, mmHeight; /* last known screen size */
310
311 int numOutputs;
312 RROutputPtr *outputs;
313 RROutputPtr primaryOutput;
314
315 int numCrtcs;
316 RRCrtcPtr *crtcs;
317
318 /* Last known pointer position */
319 RRCrtcPtr pointerCrtc;
320
321 #ifdef RANDR_10_INTERFACE
322 /*
323 * Configuration information
324 */
325 Rotation rotations;
326 CARD16 reqWidth, reqHeight;
327
328 int nSizes;
329 RRScreenSizePtr pSizes;
330
331 Rotation rotation;
332 int rate;
333 int size;
334 #endif
335 Bool discontiguous;
336
337 RRProviderPtr provider;
338
339 RRProviderDestroyProcPtr rrProviderDestroy;
340
341 } rrScrPrivRec, *rrScrPrivPtr;
342
343 extern _X_EXPORT DevPrivateKeyRec rrPrivKeyRec;
344
345 #define rrPrivKey (&rrPrivKeyRec)
346
347 #define rrGetScrPriv(pScr) ((rrScrPrivPtr)dixLookupPrivate(&(pScr)->devPrivates, rrPrivKey))
348 #define rrScrPriv(pScr) rrScrPrivPtr pScrPriv = rrGetScrPriv(pScr)
349 #define SetRRScreen(s,p) dixSetPrivate(&(s)->devPrivates, rrPrivKey, p)
350
351 /*
352 * each window has a list of clients requesting
353 * RRNotify events. Each client has a resource
354 * for each window it selects RRNotify input for,
355 * this resource is used to delete the RRNotifyRec
356 * entry from the per-window queue.
357 */
358
359 typedef struct _RREvent *RREventPtr;
360
361 typedef struct _RREvent {
362 RREventPtr next;
363 ClientPtr client;
364 WindowPtr window;
365 XID clientResource;
366 int mask;
367 } RREventRec;
368
369 typedef struct _RRTimes {
370 TimeStamp setTime;
371 TimeStamp configTime;
372 } RRTimesRec, *RRTimesPtr;
373
374 typedef struct _RRClient {
375 int major_version;
376 int minor_version;
377 /* RRTimesRec times[0]; */
378 } RRClientRec, *RRClientPtr;
379
380 extern _X_EXPORT RESTYPE RRClientType, RREventType; /* resource types for event masks */
381 extern _X_EXPORT DevPrivateKeyRec RRClientPrivateKeyRec;
382
383 #define RRClientPrivateKey (&RRClientPrivateKeyRec)
384 extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType, RRProviderType;
385
386 #define VERIFY_RR_OUTPUT(id, ptr, a)\
387 {\
388 int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
389 RROutputType, client, a);\
390 if (rc != Success) {\
391 client->errorValue = id;\
392 return rc;\
393 }\
394 }
395
396 #define VERIFY_RR_CRTC(id, ptr, a)\
397 {\
398 int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
399 RRCrtcType, client, a);\
400 if (rc != Success) {\
401 client->errorValue = id;\
402 return rc;\
403 }\
404 }
405
406 #define VERIFY_RR_MODE(id, ptr, a)\
407 {\
408 int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
409 RRModeType, client, a);\
410 if (rc != Success) {\
411 client->errorValue = id;\
412 return rc;\
413 }\
414 }
415
416 #define VERIFY_RR_PROVIDER(id, ptr, a)\
417 {\
418 int rc = dixLookupResourceByType((pointer *)&(ptr), id,\
419 RRProviderType, client, a);\
420 if (rc != Success) {\
421 client->errorValue = id;\
422 return rc;\
423 }\
424 }
425
426 #define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey))
427 #define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient)
428
429 #ifdef RANDR_12_INTERFACE
430 /*
431 * Set the range of sizes for the screen
432 */
433 extern _X_EXPORT void
434
435 RRScreenSetSizeRange(ScreenPtr pScreen,
436 CARD16 minWidth,
437 CARD16 minHeight, CARD16 maxWidth, CARD16 maxHeight);
438 #endif
439
440 /* rrscreen.c */
441 /*
442 * Notify the extension that the screen size has been changed.
443 * The driver is responsible for calling this whenever it has changed
444 * the size of the screen
445 */
446 extern _X_EXPORT void
447 RRScreenSizeNotify(ScreenPtr pScreen);
448
449 /*
450 * Request that the screen be resized
451 */
452 extern _X_EXPORT Bool
453
454 RRScreenSizeSet(ScreenPtr pScreen,
455 CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight);
456
457 /*
458 * Send ConfigureNotify event to root window when 'something' happens
459 */
460 extern _X_EXPORT void
461 RRSendConfigNotify(ScreenPtr pScreen);
462
463 /*
464 * screen dispatch
465 */
466 extern _X_EXPORT int
467 ProcRRGetScreenSizeRange(ClientPtr client);
468
469 extern _X_EXPORT int
470 ProcRRSetScreenSize(ClientPtr client);
471
472 extern _X_EXPORT int
473 ProcRRGetScreenResources(ClientPtr client);
474
475 extern _X_EXPORT int
476 ProcRRGetScreenResourcesCurrent(ClientPtr client);
477
478 extern _X_EXPORT int
479 ProcRRSetScreenConfig(ClientPtr client);
480
481 extern _X_EXPORT int
482 ProcRRGetScreenInfo(ClientPtr client);
483
484 /*
485 * Deliver a ScreenNotify event
486 */
487 extern _X_EXPORT void
488 RRDeliverScreenEvent(ClientPtr client, WindowPtr pWin, ScreenPtr pScreen);
489
490 extern _X_EXPORT void
491 RRResourcesChanged(ScreenPtr pScreen);
492
493 /* randr.c */
494 /* set a screen change on the primary screen */
495 extern _X_EXPORT void
496 RRSetChanged(ScreenPtr pScreen);
497
498 /*
499 * Send all pending events
500 */
501 extern _X_EXPORT void
502 RRTellChanged(ScreenPtr pScreen);
503
504 /*
505 * Poll the driver for changed information
506 */
507 extern _X_EXPORT Bool
508 RRGetInfo(ScreenPtr pScreen, Bool force_query);
509
510 extern _X_EXPORT Bool RRInit(void);
511
512 extern _X_EXPORT Bool RRScreenInit(ScreenPtr pScreen);
513
514 extern _X_EXPORT RROutputPtr RRFirstOutput(ScreenPtr pScreen);
515
516 extern _X_EXPORT CARD16
517 RRVerticalRefresh(xRRModeInfo * mode);
518
519 #ifdef RANDR_10_INTERFACE
520 /*
521 * This is the old interface, deprecated but left
522 * around for compatibility
523 */
524
525 /*
526 * Then, register the specific size with the screen
527 */
528
529 extern _X_EXPORT RRScreenSizePtr
530 RRRegisterSize(ScreenPtr pScreen,
531 short width, short height, short mmWidth, short mmHeight);
532
533 extern _X_EXPORT Bool
534 RRRegisterRate(ScreenPtr pScreen, RRScreenSizePtr pSize, int rate);
535
536 /*
537 * Finally, set the current configuration of the screen
538 */
539
540 extern _X_EXPORT void
541
542 RRSetCurrentConfig(ScreenPtr pScreen,
543 Rotation rotation, int rate, RRScreenSizePtr pSize);
544
545 extern _X_EXPORT Rotation RRGetRotation(ScreenPtr pScreen);
546
547 #endif
548
549 /* rrcrtc.c */
550
551 /*
552 * Notify the CRTC of some change; layoutChanged indicates that
553 * some position or size element changed
554 */
555 extern _X_EXPORT void
556 RRCrtcChanged(RRCrtcPtr crtc, Bool layoutChanged);
557
558 /*
559 * Create a CRTC
560 */
561 extern _X_EXPORT RRCrtcPtr RRCrtcCreate(ScreenPtr pScreen, void *devPrivate);
562
563 /*
564 * Set the allowed rotations on a CRTC
565 */
566 extern _X_EXPORT void
567 RRCrtcSetRotations(RRCrtcPtr crtc, Rotation rotations);
568
569 /*
570 * Set whether transforms are allowed on a CRTC
571 */
572 extern _X_EXPORT void
573 RRCrtcSetTransformSupport(RRCrtcPtr crtc, Bool transforms);
574
575 /*
576 * Notify the extension that the Crtc has been reconfigured,
577 * the driver calls this whenever it has updated the mode
578 */
579 extern _X_EXPORT Bool
580
581 RRCrtcNotify(RRCrtcPtr crtc,
582 RRModePtr mode,
583 int x,
584 int y,
585 Rotation rotation,
586 RRTransformPtr transform, int numOutputs, RROutputPtr * outputs);
587
588 extern _X_EXPORT void
589 RRDeliverCrtcEvent(ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc);
590
591 /*
592 * Request that the Crtc be reconfigured
593 */
594 extern _X_EXPORT Bool
595
596 RRCrtcSet(RRCrtcPtr crtc,
597 RRModePtr mode,
598 int x,
599 int y, Rotation rotation, int numOutput, RROutputPtr * outputs);
600
601 /*
602 * Request that the Crtc gamma be changed
603 */
604
605 extern _X_EXPORT Bool
606 RRCrtcGammaSet(RRCrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue);
607
608 /*
609 * Request current gamma back from the DDX (if possible).
610 * This includes gamma size.
611 */
612
613 extern _X_EXPORT Bool
614 RRCrtcGammaGet(RRCrtcPtr crtc);
615
616 /*
617 * Notify the extension that the Crtc gamma has been changed
618 * The driver calls this whenever it has changed the gamma values
619 * in the RRCrtcRec
620 */
621
622 extern _X_EXPORT Bool
623 RRCrtcGammaNotify(RRCrtcPtr crtc);
624
625 /*
626 * Set the size of the gamma table at server startup time
627 */
628
629 extern _X_EXPORT Bool
630 RRCrtcGammaSetSize(RRCrtcPtr crtc, int size);
631
632 /*
633 * Return the area of the frame buffer scanned out by the crtc,
634 * taking into account the current mode and rotation
635 */
636
637 extern _X_EXPORT void
638 RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
639
640 /*
641 * Return crtc transform
642 */
643 extern _X_EXPORT RRTransformPtr RRCrtcGetTransform(RRCrtcPtr crtc);
644
645 /*
646 * Check whether the pending and current transforms are the same
647 */
648 extern _X_EXPORT Bool
649 RRCrtcPendingTransform(RRCrtcPtr crtc);
650
651 /*
652 * Destroy a Crtc at shutdown
653 */
654 extern _X_EXPORT void
655 RRCrtcDestroy(RRCrtcPtr crtc);
656
657 /*
658 * Set the pending CRTC transformation
659 */
660
661 extern _X_EXPORT int
662
663 RRCrtcTransformSet(RRCrtcPtr crtc,
664 PictTransformPtr transform,
665 struct pict_f_transform *f_transform,
666 struct pict_f_transform *f_inverse,
667 char *filter, int filter_len, xFixed * params, int nparams);
668
669 /*
670 * Initialize crtc type
671 */
672 extern _X_EXPORT Bool
673 RRCrtcInit(void);
674
675 /*
676 * Initialize crtc type error value
677 */
678 extern _X_EXPORT void
679 RRCrtcInitErrorValue(void);
680
681 /*
682 * Detach and free a scanout pixmap
683 */
684 extern _X_EXPORT void
685 RRCrtcDetachScanoutPixmap(RRCrtcPtr crtc);
686
687 extern _X_EXPORT Bool
688 RRReplaceScanoutPixmap(DrawablePtr pDrawable, PixmapPtr pPixmap, Bool enable);
689
690 /*
691 * Crtc dispatch
692 */
693
694 extern _X_EXPORT int
695 ProcRRGetCrtcInfo(ClientPtr client);
696
697 extern _X_EXPORT int
698 ProcRRSetCrtcConfig(ClientPtr client);
699
700 extern _X_EXPORT int
701 ProcRRGetCrtcGammaSize(ClientPtr client);
702
703 extern _X_EXPORT int
704 ProcRRGetCrtcGamma(ClientPtr client);
705
706 extern _X_EXPORT int
707 ProcRRSetCrtcGamma(ClientPtr client);
708
709 extern _X_EXPORT int
710 ProcRRSetCrtcTransform(ClientPtr client);
711
712 extern _X_EXPORT int
713 ProcRRGetCrtcTransform(ClientPtr client);
714
715 int
716 ProcRRGetPanning(ClientPtr client);
717
718 int
719 ProcRRSetPanning(ClientPtr client);
720
721 void
722 RRConstrainCursorHarder(DeviceIntPtr, ScreenPtr, int, int *, int *);
723
724 /* rrdispatch.c */
725 extern _X_EXPORT Bool
726 RRClientKnowsRates(ClientPtr pClient);
727
728 /* rrmode.c */
729 /*
730 * Find, and if necessary, create a mode
731 */
732
733 extern _X_EXPORT RRModePtr RRModeGet(xRRModeInfo * modeInfo, const char *name);
734
735 /*
736 * Destroy a mode.
737 */
738
739 extern _X_EXPORT void
740 RRModeDestroy(RRModePtr mode);
741
742 /*
743 * Return a list of modes that are valid for some output in pScreen
744 */
745 extern _X_EXPORT RRModePtr *RRModesForScreen(ScreenPtr pScreen, int *num_ret);
746
747 /*
748 * Initialize mode type
749 */
750 extern _X_EXPORT Bool
751 RRModeInit(void);
752
753 /*
754 * Initialize mode type error value
755 */
756 extern _X_EXPORT void
757 RRModeInitErrorValue(void);
758
759 extern _X_EXPORT int
760 ProcRRCreateMode(ClientPtr client);
761
762 extern _X_EXPORT int
763 ProcRRDestroyMode(ClientPtr client);
764
765 extern _X_EXPORT int
766 ProcRRAddOutputMode(ClientPtr client);
767
768 extern _X_EXPORT int
769 ProcRRDeleteOutputMode(ClientPtr client);
770
771 /* rroutput.c */
772
773 /*
774 * Notify the output of some change. configChanged indicates whether
775 * any external configuration (mode list, clones, connected status)
776 * has changed, or whether the change was strictly internal
777 * (which crtc is in use)
778 */
779 extern _X_EXPORT void
780 RROutputChanged(RROutputPtr output, Bool configChanged);
781
782 /*
783 * Create an output
784 */
785
786 extern _X_EXPORT RROutputPtr
787 RROutputCreate(ScreenPtr pScreen,
788 const char *name, int nameLength, void *devPrivate);
789
790 /*
791 * Notify extension that output parameters have been changed
792 */
793 extern _X_EXPORT Bool
794 RROutputSetClones(RROutputPtr output, RROutputPtr * clones, int numClones);
795
796 extern _X_EXPORT Bool
797
798 RROutputSetModes(RROutputPtr output,
799 RRModePtr * modes, int numModes, int numPreferred);
800
801 extern _X_EXPORT int
802 RROutputAddUserMode(RROutputPtr output, RRModePtr mode);
803
804 extern _X_EXPORT int
805 RROutputDeleteUserMode(RROutputPtr output, RRModePtr mode);
806
807 extern _X_EXPORT Bool
808 RROutputSetCrtcs(RROutputPtr output, RRCrtcPtr * crtcs, int numCrtcs);
809
810 extern _X_EXPORT Bool
811 RROutputSetConnection(RROutputPtr output, CARD8 connection);
812
813 extern _X_EXPORT Bool
814 RROutputSetSubpixelOrder(RROutputPtr output, int subpixelOrder);
815
816 extern _X_EXPORT Bool
817 RROutputSetPhysicalSize(RROutputPtr output, int mmWidth, int mmHeight);
818
819 extern _X_EXPORT void
820 RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output);
821
822 extern _X_EXPORT void
823 RROutputDestroy(RROutputPtr output);
824
825 extern _X_EXPORT int
826 ProcRRGetOutputInfo(ClientPtr client);
827
828 extern _X_EXPORT int
829 ProcRRSetOutputPrimary(ClientPtr client);
830
831 extern _X_EXPORT int
832 ProcRRGetOutputPrimary(ClientPtr client);
833
834 /*
835 * Initialize output type
836 */
837 extern _X_EXPORT Bool
838 RROutputInit(void);
839
840 /*
841 * Initialize output type error value
842 */
843 extern _X_EXPORT void
844 RROutputInitErrorValue(void);
845
846 /* rrpointer.c */
847 extern _X_EXPORT void
848 RRPointerMoved(ScreenPtr pScreen, int x, int y);
849
850 extern _X_EXPORT void
851 RRPointerScreenConfigured(ScreenPtr pScreen);
852
853 /* rrproperty.c */
854
855 extern _X_EXPORT void
856 RRDeleteAllOutputProperties(RROutputPtr output);
857
858 extern _X_EXPORT RRPropertyValuePtr
859 RRGetOutputProperty(RROutputPtr output, Atom property, Bool pending);
860
861 extern _X_EXPORT RRPropertyPtr
862 RRQueryOutputProperty(RROutputPtr output, Atom property);
863
864 extern _X_EXPORT void
865 RRDeleteOutputProperty(RROutputPtr output, Atom property);
866
867 extern _X_EXPORT Bool
868 RRPostPendingProperties(RROutputPtr output);
869
870 extern _X_EXPORT int
871
872 RRChangeOutputProperty(RROutputPtr output, Atom property, Atom type,
873 int format, int mode, unsigned long len,
874 pointer value, Bool sendevent, Bool pending);
875
876 extern _X_EXPORT int
877
878 RRConfigureOutputProperty(RROutputPtr output, Atom property,
879 Bool pending, Bool range, Bool immutable,
880 int num_values, INT32 *values);
881 extern _X_EXPORT int
882 ProcRRChangeOutputProperty(ClientPtr client);
883
884 extern _X_EXPORT int
885 ProcRRGetOutputProperty(ClientPtr client);
886
887 extern _X_EXPORT int
888 ProcRRListOutputProperties(ClientPtr client);
889
890 extern _X_EXPORT int
891 ProcRRQueryOutputProperty(ClientPtr client);
892
893 extern _X_EXPORT int
894 ProcRRConfigureOutputProperty(ClientPtr client);
895
896 extern _X_EXPORT int
897 ProcRRDeleteOutputProperty(ClientPtr client);
898
899 /* rrprovider.c */
900 extern _X_EXPORT void
901 RRProviderInitErrorValue(void);
902
903 extern _X_EXPORT int
904 ProcRRGetProviders(ClientPtr client);
905
906 extern _X_EXPORT int
907 ProcRRGetProviderInfo(ClientPtr client);
908
909 extern _X_EXPORT int
910 ProcRRSetProviderOutputSource(ClientPtr client);
911
912 extern _X_EXPORT int
913 ProcRRSetProviderOffloadSink(ClientPtr client);
914
915 extern _X_EXPORT Bool
916 RRProviderInit(void);
917
918 extern _X_EXPORT RRProviderPtr
919 RRProviderCreate(ScreenPtr pScreen, const char *name,
920 int nameLength);
921
922 extern _X_EXPORT void
923 RRProviderDestroy (RRProviderPtr provider);
924
925 extern _X_EXPORT void
926 RRProviderSetCapabilities(RRProviderPtr provider, uint32_t capabilities);
927
928 extern _X_EXPORT Bool
929 RRProviderLookup(XID id, RRProviderPtr *provider_p);
930
931 extern _X_EXPORT void
932 RRDeliverProviderEvent(ClientPtr client, WindowPtr pWin, RRProviderPtr provider);
933
934 /* rrproviderproperty.c */
935
936 extern _X_EXPORT void
937 RRDeleteAllProviderProperties(RRProviderPtr provider);
938
939 extern _X_EXPORT RRPropertyValuePtr
940 RRGetProviderProperty(RRProviderPtr provider, Atom property, Bool pending);
941
942 extern _X_EXPORT RRPropertyPtr
943 RRQueryProviderProperty(RRProviderPtr provider, Atom property);
944
945 extern _X_EXPORT void
946 RRDeleteProviderProperty(RRProviderPtr provider, Atom property);
947
948 extern _X_EXPORT int
949 RRChangeProviderProperty(RRProviderPtr provider, Atom property, Atom type,
950 int format, int mode, unsigned long len,
951 pointer value, Bool sendevent, Bool pending);
952
953 extern _X_EXPORT int
954 RRConfigureProviderProperty(RRProviderPtr provider, Atom property,
955 Bool pending, Bool range, Bool immutable,
956 int num_values, INT32 *values);
957
958 extern _X_EXPORT Bool
959 RRPostProviderPendingProperties(RRProviderPtr provider);
960
961 extern _X_EXPORT int
962 ProcRRGetProviderProperty(ClientPtr client);
963
964 extern _X_EXPORT int
965 ProcRRListProviderProperties(ClientPtr client);
966
967 extern _X_EXPORT int
968 ProcRRQueryProviderProperty(ClientPtr client);
969
970 extern _X_EXPORT int
971 ProcRRConfigureProviderProperty(ClientPtr client);
972
973 extern _X_EXPORT int
974 ProcRRChangeProviderProperty(ClientPtr client);
975
976 extern _X_EXPORT int
977 ProcRRDeleteProviderProperty(ClientPtr client);
978 /* rrxinerama.c */
979 #ifdef XINERAMA
980 extern _X_EXPORT void
981 RRXineramaExtensionInit(void);
982 #endif
983
984 #endif /* _RANDRSTR_H_ */
985
986 /*
987
988 randr extension implementation structure
989
990 Query state:
991 ProcRRGetScreenInfo/ProcRRGetScreenResources
992 RRGetInfo
993
994 • Request configuration from driver, either 1.0 or 1.2 style
995 • These functions only record state changes, all
996 other actions are pended until RRTellChanged is called
997
998 ->rrGetInfo
999 1.0:
1000 RRRegisterSize
1001 RRRegisterRate
1002 RRSetCurrentConfig
1003 1.2:
1004 RRScreenSetSizeRange
1005 RROutputSetCrtcs
1006 RRModeGet
1007 RROutputSetModes
1008 RROutputSetConnection
1009 RROutputSetSubpixelOrder
1010 RROutputSetClones
1011 RRCrtcNotify
1012
1013 • Must delay scanning configuration until after ->rrGetInfo returns
1014 because some drivers will call SetCurrentConfig in the middle
1015 of the ->rrGetInfo operation.
1016
1017 1.0:
1018
1019 • Scan old configuration, mirror to new structures
1020
1021 RRScanOldConfig
1022 RRCrtcCreate
1023 RROutputCreate
1024 RROutputSetCrtcs
1025 RROutputSetConnection
1026 RROutputSetSubpixelOrder
1027 RROldModeAdd • This adds modes one-at-a-time
1028 RRModeGet
1029 RRCrtcNotify
1030
1031 • send events, reset pointer if necessary
1032
1033 RRTellChanged
1034 WalkTree (sending events)
1035
1036 • when layout has changed:
1037 RRPointerScreenConfigured
1038 RRSendConfigNotify
1039
1040 Asynchronous state setting (1.2 only)
1041 When setting state asynchronously, the driver invokes the
1042 ->rrGetInfo function and then calls RRTellChanged to flush
1043 the changes to the clients and reset pointer if necessary
1044
1045 Set state
1046
1047 ProcRRSetScreenConfig
1048 RRCrtcSet
1049 1.2:
1050 ->rrCrtcSet
1051 RRCrtcNotify
1052 1.0:
1053 ->rrSetConfig
1054 RRCrtcNotify
1055 RRTellChanged
1056 */