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