1 | /*
|
---|
2 | * Copyright © 2006 Keith Packard
|
---|
3 | * Copyright © 2011 Aaron Plattner
|
---|
4 | *
|
---|
5 | * Permission to use, copy, modify, distribute, and sell this software and its
|
---|
6 | * documentation for any purpose is hereby granted without fee, provided that
|
---|
7 | * the above copyright notice appear in all copies and that both that copyright
|
---|
8 | * notice and this permission notice appear in supporting documentation, and
|
---|
9 | * that the name of the copyright holders not be used in advertising or
|
---|
10 | * publicity pertaining to distribution of the software without specific,
|
---|
11 | * written prior permission. The copyright holders make no representations
|
---|
12 | * about the suitability of this software for any purpose. It is provided "as
|
---|
13 | * is" without express or implied warranty.
|
---|
14 | *
|
---|
15 | * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
---|
16 | * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
---|
17 | * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
---|
18 | * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
---|
19 | * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
---|
20 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
---|
21 | * OF THIS SOFTWARE.
|
---|
22 | */
|
---|
23 | #ifndef _XF86CRTC_H_
|
---|
24 | #define _XF86CRTC_H_
|
---|
25 |
|
---|
26 | #include <edid.h>
|
---|
27 | #include "randrstr.h"
|
---|
28 | #if XF86_MODES_RENAME
|
---|
29 | #include "xf86Rename.h"
|
---|
30 | #endif
|
---|
31 | #include "xf86Modes.h"
|
---|
32 | #include "xf86Cursor.h"
|
---|
33 | #include "xf86i2c.h"
|
---|
34 | #include "damage.h"
|
---|
35 | #include "picturestr.h"
|
---|
36 |
|
---|
37 | /* Compat definitions for older X Servers. */
|
---|
38 | #ifndef M_T_PREFERRED
|
---|
39 | #define M_T_PREFERRED 0x08
|
---|
40 | #endif
|
---|
41 | #ifndef M_T_DRIVER
|
---|
42 | #define M_T_DRIVER 0x40
|
---|
43 | #endif
|
---|
44 | #ifndef M_T_USERPREF
|
---|
45 | #define M_T_USERPREF 0x80
|
---|
46 | #endif
|
---|
47 | #ifndef HARDWARE_CURSOR_ARGB
|
---|
48 | #define HARDWARE_CURSOR_ARGB 0x00004000
|
---|
49 | #endif
|
---|
50 |
|
---|
51 | typedef struct _xf86Crtc xf86CrtcRec, *xf86CrtcPtr;
|
---|
52 | typedef struct _xf86Output xf86OutputRec, *xf86OutputPtr;
|
---|
53 |
|
---|
54 | /* define a standard for connector types */
|
---|
55 | typedef enum _xf86ConnectorType {
|
---|
56 | XF86ConnectorNone,
|
---|
57 | XF86ConnectorVGA,
|
---|
58 | XF86ConnectorDVI_I,
|
---|
59 | XF86ConnectorDVI_D,
|
---|
60 | XF86ConnectorDVI_A,
|
---|
61 | XF86ConnectorComposite,
|
---|
62 | XF86ConnectorSvideo,
|
---|
63 | XF86ConnectorComponent,
|
---|
64 | XF86ConnectorLFP,
|
---|
65 | XF86ConnectorProprietary,
|
---|
66 | XF86ConnectorHDMI,
|
---|
67 | XF86ConnectorDisplayPort,
|
---|
68 | } xf86ConnectorType;
|
---|
69 |
|
---|
70 | typedef enum _xf86OutputStatus {
|
---|
71 | XF86OutputStatusConnected,
|
---|
72 | XF86OutputStatusDisconnected,
|
---|
73 | XF86OutputStatusUnknown
|
---|
74 | } xf86OutputStatus;
|
---|
75 |
|
---|
76 | typedef struct _xf86CrtcFuncs {
|
---|
77 | /**
|
---|
78 | * Turns the crtc on/off, or sets intermediate power levels if available.
|
---|
79 | *
|
---|
80 | * Unsupported intermediate modes drop to the lower power setting. If the
|
---|
81 | * mode is DPMSModeOff, the crtc must be disabled sufficiently for it to
|
---|
82 | * be safe to call mode_set.
|
---|
83 | */
|
---|
84 | void
|
---|
85 | (*dpms)(xf86CrtcPtr crtc,
|
---|
86 | int mode);
|
---|
87 |
|
---|
88 | /**
|
---|
89 | * Saves the crtc's state for restoration on VT switch.
|
---|
90 | */
|
---|
91 | void
|
---|
92 | (*save)(xf86CrtcPtr crtc);
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Restore's the crtc's state at VT switch.
|
---|
96 | */
|
---|
97 | void
|
---|
98 | (*restore)(xf86CrtcPtr crtc);
|
---|
99 |
|
---|
100 | /**
|
---|
101 | * Lock CRTC prior to mode setting, mostly for DRI.
|
---|
102 | * Returns whether unlock is needed
|
---|
103 | */
|
---|
104 | Bool
|
---|
105 | (*lock) (xf86CrtcPtr crtc);
|
---|
106 |
|
---|
107 | /**
|
---|
108 | * Unlock CRTC after mode setting, mostly for DRI
|
---|
109 | */
|
---|
110 | void
|
---|
111 | (*unlock) (xf86CrtcPtr crtc);
|
---|
112 |
|
---|
113 | /**
|
---|
114 | * Callback to adjust the mode to be set in the CRTC.
|
---|
115 | *
|
---|
116 | * This allows a CRTC to adjust the clock or even the entire set of
|
---|
117 | * timings, which is used for panels with fixed timings or for
|
---|
118 | * buses with clock limitations.
|
---|
119 | */
|
---|
120 | Bool
|
---|
121 | (*mode_fixup)(xf86CrtcPtr crtc,
|
---|
122 | DisplayModePtr mode,
|
---|
123 | DisplayModePtr adjusted_mode);
|
---|
124 |
|
---|
125 | /**
|
---|
126 | * Prepare CRTC for an upcoming mode set.
|
---|
127 | */
|
---|
128 | void
|
---|
129 | (*prepare)(xf86CrtcPtr crtc);
|
---|
130 |
|
---|
131 | /**
|
---|
132 | * Callback for setting up a video mode after fixups have been made.
|
---|
133 | */
|
---|
134 | void
|
---|
135 | (*mode_set)(xf86CrtcPtr crtc,
|
---|
136 | DisplayModePtr mode,
|
---|
137 | DisplayModePtr adjusted_mode,
|
---|
138 | int x, int y);
|
---|
139 |
|
---|
140 | /**
|
---|
141 | * Commit mode changes to a CRTC
|
---|
142 | */
|
---|
143 | void
|
---|
144 | (*commit)(xf86CrtcPtr crtc);
|
---|
145 |
|
---|
146 | /* Set the color ramps for the CRTC to the given values. */
|
---|
147 | void
|
---|
148 | (*gamma_set)(xf86CrtcPtr crtc, CARD16 *red, CARD16 *green, CARD16 *blue,
|
---|
149 | int size);
|
---|
150 |
|
---|
151 | /**
|
---|
152 | * Allocate the shadow area, delay the pixmap creation until needed
|
---|
153 | */
|
---|
154 | void *
|
---|
155 | (*shadow_allocate) (xf86CrtcPtr crtc, int width, int height);
|
---|
156 |
|
---|
157 | /**
|
---|
158 | * Create shadow pixmap for rotation support
|
---|
159 | */
|
---|
160 | PixmapPtr
|
---|
161 | (*shadow_create) (xf86CrtcPtr crtc, void *data, int width, int height);
|
---|
162 |
|
---|
163 | /**
|
---|
164 | * Destroy shadow pixmap
|
---|
165 | */
|
---|
166 | void
|
---|
167 | (*shadow_destroy) (xf86CrtcPtr crtc, PixmapPtr pPixmap, void *data);
|
---|
168 |
|
---|
169 | /**
|
---|
170 | * Set cursor colors
|
---|
171 | */
|
---|
172 | void
|
---|
173 | (*set_cursor_colors) (xf86CrtcPtr crtc, int bg, int fg);
|
---|
174 |
|
---|
175 | /**
|
---|
176 | * Set cursor position
|
---|
177 | */
|
---|
178 | void
|
---|
179 | (*set_cursor_position) (xf86CrtcPtr crtc, int x, int y);
|
---|
180 |
|
---|
181 | /**
|
---|
182 | * Show cursor
|
---|
183 | */
|
---|
184 | void
|
---|
185 | (*show_cursor) (xf86CrtcPtr crtc);
|
---|
186 |
|
---|
187 | /**
|
---|
188 | * Hide cursor
|
---|
189 | */
|
---|
190 | void
|
---|
191 | (*hide_cursor) (xf86CrtcPtr crtc);
|
---|
192 |
|
---|
193 | /**
|
---|
194 | * Load monochrome image
|
---|
195 | */
|
---|
196 | void
|
---|
197 | (*load_cursor_image) (xf86CrtcPtr crtc, CARD8 *image);
|
---|
198 |
|
---|
199 | /**
|
---|
200 | * Load ARGB image
|
---|
201 | */
|
---|
202 | void
|
---|
203 | (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
|
---|
204 |
|
---|
205 | /**
|
---|
206 | * Clean up driver-specific bits of the crtc
|
---|
207 | */
|
---|
208 | void
|
---|
209 | (*destroy) (xf86CrtcPtr crtc);
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * Less fine-grained mode setting entry point for kernel modesetting
|
---|
213 | */
|
---|
214 | Bool
|
---|
215 | (*set_mode_major)(xf86CrtcPtr crtc, DisplayModePtr mode,
|
---|
216 | Rotation rotation, int x, int y);
|
---|
217 |
|
---|
218 | /**
|
---|
219 | * Callback for panning. Doesn't change the mode.
|
---|
220 | * Added in ABI version 2
|
---|
221 | */
|
---|
222 | void
|
---|
223 | (*set_origin)(xf86CrtcPtr crtc, int x, int y);
|
---|
224 |
|
---|
225 | } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
|
---|
226 |
|
---|
227 | #define XF86_CRTC_VERSION 4
|
---|
228 |
|
---|
229 | struct _xf86Crtc {
|
---|
230 | /**
|
---|
231 | * ABI versioning
|
---|
232 | */
|
---|
233 | int version;
|
---|
234 |
|
---|
235 | /**
|
---|
236 | * Associated ScrnInfo
|
---|
237 | */
|
---|
238 | ScrnInfoPtr scrn;
|
---|
239 |
|
---|
240 | /**
|
---|
241 | * Desired state of this CRTC
|
---|
242 | *
|
---|
243 | * Set when this CRTC should be driving one or more outputs
|
---|
244 | */
|
---|
245 | Bool enabled;
|
---|
246 |
|
---|
247 | /**
|
---|
248 | * Active mode
|
---|
249 | *
|
---|
250 | * This reflects the mode as set in the CRTC currently
|
---|
251 | * It will be cleared when the VT is not active or
|
---|
252 | * during server startup
|
---|
253 | */
|
---|
254 | DisplayModeRec mode;
|
---|
255 | Rotation rotation;
|
---|
256 | PixmapPtr rotatedPixmap;
|
---|
257 | void *rotatedData;
|
---|
258 |
|
---|
259 | /**
|
---|
260 | * Position on screen
|
---|
261 | *
|
---|
262 | * Locates this CRTC within the frame buffer
|
---|
263 | */
|
---|
264 | int x, y;
|
---|
265 |
|
---|
266 | /**
|
---|
267 | * Desired mode
|
---|
268 | *
|
---|
269 | * This is set to the requested mode, independent of
|
---|
270 | * whether the VT is active. In particular, it receives
|
---|
271 | * the startup configured mode and saves the active mode
|
---|
272 | * on VT switch.
|
---|
273 | */
|
---|
274 | DisplayModeRec desiredMode;
|
---|
275 | Rotation desiredRotation;
|
---|
276 | int desiredX, desiredY;
|
---|
277 |
|
---|
278 | /** crtc-specific functions */
|
---|
279 | const xf86CrtcFuncsRec *funcs;
|
---|
280 |
|
---|
281 | /**
|
---|
282 | * Driver private
|
---|
283 | *
|
---|
284 | * Holds driver-private information
|
---|
285 | */
|
---|
286 | void *driver_private;
|
---|
287 |
|
---|
288 | #ifdef RANDR_12_INTERFACE
|
---|
289 | /**
|
---|
290 | * RandR crtc
|
---|
291 | *
|
---|
292 | * When RandR 1.2 is available, this
|
---|
293 | * points at the associated crtc object
|
---|
294 | */
|
---|
295 | RRCrtcPtr randr_crtc;
|
---|
296 | #else
|
---|
297 | void *randr_crtc;
|
---|
298 | #endif
|
---|
299 |
|
---|
300 | /**
|
---|
301 | * Current cursor is ARGB
|
---|
302 | */
|
---|
303 | Bool cursor_argb;
|
---|
304 | /**
|
---|
305 | * Track whether cursor is within CRTC range
|
---|
306 | */
|
---|
307 | Bool cursor_in_range;
|
---|
308 | /**
|
---|
309 | * Track state of cursor associated with this CRTC
|
---|
310 | */
|
---|
311 | Bool cursor_shown;
|
---|
312 |
|
---|
313 | /**
|
---|
314 | * Current transformation matrix
|
---|
315 | */
|
---|
316 | PictTransform crtc_to_framebuffer;
|
---|
317 | /* framebuffer_to_crtc was removed in ABI 2 */
|
---|
318 | struct pict_f_transform f_crtc_to_framebuffer; /* ABI 2 */
|
---|
319 | struct pict_f_transform f_framebuffer_to_crtc; /* ABI 2 */
|
---|
320 | PictFilterPtr filter; /* ABI 2 */
|
---|
321 | xFixed *params; /* ABI 2 */
|
---|
322 | int nparams; /* ABI 2 */
|
---|
323 | int filter_width; /* ABI 2 */
|
---|
324 | int filter_height; /* ABI 2 */
|
---|
325 | Bool transform_in_use;
|
---|
326 | RRTransformRec transform; /* ABI 2 */
|
---|
327 | Bool transformPresent; /* ABI 2 */
|
---|
328 | RRTransformRec desiredTransform; /* ABI 2 */
|
---|
329 | Bool desiredTransformPresent; /* ABI 2 */
|
---|
330 | /**
|
---|
331 | * Bounding box in screen space
|
---|
332 | */
|
---|
333 | BoxRec bounds;
|
---|
334 | /**
|
---|
335 | * Panning:
|
---|
336 | * TotalArea: total panning area, larger than CRTC's size
|
---|
337 | * TrackingArea: Area of the pointer for which the CRTC is panned
|
---|
338 | * border: Borders of the displayed CRTC area which induces panning if the pointer reaches them
|
---|
339 | * Added in ABI version 2
|
---|
340 | */
|
---|
341 | BoxRec panningTotalArea;
|
---|
342 | BoxRec panningTrackingArea;
|
---|
343 | INT16 panningBorder[4];
|
---|
344 |
|
---|
345 | /**
|
---|
346 | * Current gamma, especially useful after initial config.
|
---|
347 | * Added in ABI version 3
|
---|
348 | */
|
---|
349 | CARD16 *gamma_red;
|
---|
350 | CARD16 *gamma_green;
|
---|
351 | CARD16 *gamma_blue;
|
---|
352 | int gamma_size;
|
---|
353 |
|
---|
354 | /**
|
---|
355 | * Actual state of this CRTC
|
---|
356 | *
|
---|
357 | * Set to TRUE after modesetting, set to FALSE if no outputs are connected
|
---|
358 | * Added in ABI version 3
|
---|
359 | */
|
---|
360 | Bool active;
|
---|
361 | /**
|
---|
362 | * Clear the shadow
|
---|
363 | */
|
---|
364 | Bool shadowClear;
|
---|
365 |
|
---|
366 | /**
|
---|
367 | * Indicates that the driver is handling the transform, so the shadow
|
---|
368 | * surface should be disabled. The driver writes this field before calling
|
---|
369 | * xf86CrtcRotate to indicate that it is handling the transform (including
|
---|
370 | * rotation and reflection).
|
---|
371 | *
|
---|
372 | * Setting this flag also causes the server to stop adjusting the cursor
|
---|
373 | * image and position.
|
---|
374 | *
|
---|
375 | * Added in ABI version 4
|
---|
376 | */
|
---|
377 | Bool driverIsPerformingTransform;
|
---|
378 | };
|
---|
379 |
|
---|
380 | typedef struct _xf86OutputFuncs {
|
---|
381 | /**
|
---|
382 | * Called to allow the output a chance to create properties after the
|
---|
383 | * RandR objects have been created.
|
---|
384 | */
|
---|
385 | void
|
---|
386 | (*create_resources)(xf86OutputPtr output);
|
---|
387 |
|
---|
388 | /**
|
---|
389 | * Turns the output on/off, or sets intermediate power levels if available.
|
---|
390 | *
|
---|
391 | * Unsupported intermediate modes drop to the lower power setting. If the
|
---|
392 | * mode is DPMSModeOff, the output must be disabled, as the DPLL may be
|
---|
393 | * disabled afterwards.
|
---|
394 | */
|
---|
395 | void
|
---|
396 | (*dpms)(xf86OutputPtr output,
|
---|
397 | int mode);
|
---|
398 |
|
---|
399 | /**
|
---|
400 | * Saves the output's state for restoration on VT switch.
|
---|
401 | */
|
---|
402 | void
|
---|
403 | (*save)(xf86OutputPtr output);
|
---|
404 |
|
---|
405 | /**
|
---|
406 | * Restore's the output's state at VT switch.
|
---|
407 | */
|
---|
408 | void
|
---|
409 | (*restore)(xf86OutputPtr output);
|
---|
410 |
|
---|
411 | /**
|
---|
412 | * Callback for testing a video mode for a given output.
|
---|
413 | *
|
---|
414 | * This function should only check for cases where a mode can't be supported
|
---|
415 | * on the output specifically, and not represent generic CRTC limitations.
|
---|
416 | *
|
---|
417 | * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
|
---|
418 | */
|
---|
419 | int
|
---|
420 | (*mode_valid)(xf86OutputPtr output,
|
---|
421 | DisplayModePtr pMode);
|
---|
422 |
|
---|
423 | /**
|
---|
424 | * Callback to adjust the mode to be set in the CRTC.
|
---|
425 | *
|
---|
426 | * This allows an output to adjust the clock or even the entire set of
|
---|
427 | * timings, which is used for panels with fixed timings or for
|
---|
428 | * buses with clock limitations.
|
---|
429 | */
|
---|
430 | Bool
|
---|
431 | (*mode_fixup)(xf86OutputPtr output,
|
---|
432 | DisplayModePtr mode,
|
---|
433 | DisplayModePtr adjusted_mode);
|
---|
434 |
|
---|
435 | /**
|
---|
436 | * Callback for preparing mode changes on an output
|
---|
437 | */
|
---|
438 | void
|
---|
439 | (*prepare)(xf86OutputPtr output);
|
---|
440 |
|
---|
441 | /**
|
---|
442 | * Callback for committing mode changes on an output
|
---|
443 | */
|
---|
444 | void
|
---|
445 | (*commit)(xf86OutputPtr output);
|
---|
446 |
|
---|
447 | /**
|
---|
448 | * Callback for setting up a video mode after fixups have been made.
|
---|
449 | *
|
---|
450 | * This is only called while the output is disabled. The dpms callback
|
---|
451 | * must be all that's necessary for the output, to turn the output on
|
---|
452 | * after this function is called.
|
---|
453 | */
|
---|
454 | void
|
---|
455 | (*mode_set)(xf86OutputPtr output,
|
---|
456 | DisplayModePtr mode,
|
---|
457 | DisplayModePtr adjusted_mode);
|
---|
458 |
|
---|
459 | /**
|
---|
460 | * Probe for a connected output, and return detect_status.
|
---|
461 | */
|
---|
462 | xf86OutputStatus
|
---|
463 | (*detect)(xf86OutputPtr output);
|
---|
464 |
|
---|
465 | /**
|
---|
466 | * Query the device for the modes it provides.
|
---|
467 | *
|
---|
468 | * This function may also update MonInfo, mm_width, and mm_height.
|
---|
469 | *
|
---|
470 | * \return singly-linked list of modes or NULL if no modes found.
|
---|
471 | */
|
---|
472 | DisplayModePtr
|
---|
473 | (*get_modes)(xf86OutputPtr output);
|
---|
474 |
|
---|
475 | #ifdef RANDR_12_INTERFACE
|
---|
476 | /**
|
---|
477 | * Callback when an output's property has changed.
|
---|
478 | */
|
---|
479 | Bool
|
---|
480 | (*set_property)(xf86OutputPtr output,
|
---|
481 | Atom property,
|
---|
482 | RRPropertyValuePtr value);
|
---|
483 | #endif
|
---|
484 | #ifdef RANDR_13_INTERFACE
|
---|
485 | /**
|
---|
486 | * Callback to get an updated property value
|
---|
487 | */
|
---|
488 | Bool
|
---|
489 | (*get_property)(xf86OutputPtr output,
|
---|
490 | Atom property);
|
---|
491 | #endif
|
---|
492 | #ifdef RANDR_GET_CRTC_INTERFACE
|
---|
493 | /**
|
---|
494 | * Callback to get current CRTC for a given output
|
---|
495 | */
|
---|
496 | xf86CrtcPtr
|
---|
497 | (*get_crtc)(xf86OutputPtr output);
|
---|
498 | #endif
|
---|
499 | /**
|
---|
500 | * Clean up driver-specific bits of the output
|
---|
501 | */
|
---|
502 | void
|
---|
503 | (*destroy) (xf86OutputPtr output);
|
---|
504 | } xf86OutputFuncsRec, *xf86OutputFuncsPtr;
|
---|
505 |
|
---|
506 |
|
---|
507 | #define XF86_OUTPUT_VERSION 2
|
---|
508 |
|
---|
509 | struct _xf86Output {
|
---|
510 | /**
|
---|
511 | * ABI versioning
|
---|
512 | */
|
---|
513 | int version;
|
---|
514 |
|
---|
515 | /**
|
---|
516 | * Associated ScrnInfo
|
---|
517 | */
|
---|
518 | ScrnInfoPtr scrn;
|
---|
519 |
|
---|
520 | /**
|
---|
521 | * Currently connected crtc (if any)
|
---|
522 | *
|
---|
523 | * If this output is not in use, this field will be NULL.
|
---|
524 | */
|
---|
525 | xf86CrtcPtr crtc;
|
---|
526 |
|
---|
527 | /**
|
---|
528 | * Possible CRTCs for this output as a mask of crtc indices
|
---|
529 | */
|
---|
530 | CARD32 possible_crtcs;
|
---|
531 |
|
---|
532 | /**
|
---|
533 | * Possible outputs to share the same CRTC as a mask of output indices
|
---|
534 | */
|
---|
535 | CARD32 possible_clones;
|
---|
536 |
|
---|
537 | /**
|
---|
538 | * Whether this output can support interlaced modes
|
---|
539 | */
|
---|
540 | Bool interlaceAllowed;
|
---|
541 |
|
---|
542 | /**
|
---|
543 | * Whether this output can support double scan modes
|
---|
544 | */
|
---|
545 | Bool doubleScanAllowed;
|
---|
546 |
|
---|
547 | /**
|
---|
548 | * List of available modes on this output.
|
---|
549 | *
|
---|
550 | * This should be the list from get_modes(), plus perhaps additional
|
---|
551 | * compatible modes added later.
|
---|
552 | */
|
---|
553 | DisplayModePtr probed_modes;
|
---|
554 |
|
---|
555 | /**
|
---|
556 | * Options parsed from the related monitor section
|
---|
557 | */
|
---|
558 | OptionInfoPtr options;
|
---|
559 |
|
---|
560 | /**
|
---|
561 | * Configured monitor section
|
---|
562 | */
|
---|
563 | XF86ConfMonitorPtr conf_monitor;
|
---|
564 |
|
---|
565 | /**
|
---|
566 | * Desired initial position
|
---|
567 | */
|
---|
568 | int initial_x, initial_y;
|
---|
569 |
|
---|
570 | /**
|
---|
571 | * Desired initial rotation
|
---|
572 | */
|
---|
573 | Rotation initial_rotation;
|
---|
574 |
|
---|
575 | /**
|
---|
576 | * Current connection status
|
---|
577 | *
|
---|
578 | * This indicates whether a monitor is known to be connected
|
---|
579 | * to this output or not, or whether there is no way to tell
|
---|
580 | */
|
---|
581 | xf86OutputStatus status;
|
---|
582 |
|
---|
583 | /** EDID monitor information */
|
---|
584 | xf86MonPtr MonInfo;
|
---|
585 |
|
---|
586 | /** subpixel order */
|
---|
587 | int subpixel_order;
|
---|
588 |
|
---|
589 | /** Physical size of the currently attached output device. */
|
---|
590 | int mm_width, mm_height;
|
---|
591 |
|
---|
592 | /** Output name */
|
---|
593 | char *name;
|
---|
594 |
|
---|
595 | /** output-specific functions */
|
---|
596 | const xf86OutputFuncsRec *funcs;
|
---|
597 |
|
---|
598 | /** driver private information */
|
---|
599 | void *driver_private;
|
---|
600 |
|
---|
601 | /** Whether to use the old per-screen Monitor config section */
|
---|
602 | Bool use_screen_monitor;
|
---|
603 |
|
---|
604 | #ifdef RANDR_12_INTERFACE
|
---|
605 | /**
|
---|
606 | * RandR 1.2 output structure.
|
---|
607 | *
|
---|
608 | * When RandR 1.2 is available, this points at the associated
|
---|
609 | * RandR output structure and is created when this output is created
|
---|
610 | */
|
---|
611 | RROutputPtr randr_output;
|
---|
612 | #else
|
---|
613 | void *randr_output;
|
---|
614 | #endif
|
---|
615 | /**
|
---|
616 | * Desired initial panning
|
---|
617 | * Added in ABI version 2
|
---|
618 | */
|
---|
619 | BoxRec initialTotalArea;
|
---|
620 | BoxRec initialTrackingArea;
|
---|
621 | INT16 initialBorder[4];
|
---|
622 | };
|
---|
623 |
|
---|
624 | typedef struct _xf86CrtcConfigFuncs {
|
---|
625 | /**
|
---|
626 | * Requests that the driver resize the screen.
|
---|
627 | *
|
---|
628 | * The driver is responsible for updating scrn->virtualX and scrn->virtualY.
|
---|
629 | * If the requested size cannot be set, the driver should leave those values
|
---|
630 | * alone and return FALSE.
|
---|
631 | *
|
---|
632 | * A naive driver that cannot reallocate the screen may simply change
|
---|
633 | * virtual[XY]. A more advanced driver will want to also change the
|
---|
634 | * devPrivate.ptr and devKind of the screen pixmap, update any offscreen
|
---|
635 | * pixmaps it may have moved, and change pScrn->displayWidth.
|
---|
636 | */
|
---|
637 | Bool
|
---|
638 | (*resize)(ScrnInfoPtr scrn,
|
---|
639 | int width,
|
---|
640 | int height);
|
---|
641 | } xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
|
---|
642 |
|
---|
643 | typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen);
|
---|
644 |
|
---|
645 | typedef struct _xf86CrtcConfig {
|
---|
646 | int num_output;
|
---|
647 | xf86OutputPtr *output;
|
---|
648 | /**
|
---|
649 | * compat_output is used whenever we deal
|
---|
650 | * with legacy code that only understands a single
|
---|
651 | * output. pScrn->modes will be loaded from this output,
|
---|
652 | * adjust frame will whack this output, etc.
|
---|
653 | */
|
---|
654 | int compat_output;
|
---|
655 |
|
---|
656 | int num_crtc;
|
---|
657 | xf86CrtcPtr *crtc;
|
---|
658 |
|
---|
659 | int minWidth, minHeight;
|
---|
660 | int maxWidth, maxHeight;
|
---|
661 |
|
---|
662 | /* For crtc-based rotation */
|
---|
663 | DamagePtr rotation_damage;
|
---|
664 | Bool rotation_damage_registered;
|
---|
665 |
|
---|
666 | /* DGA */
|
---|
667 | unsigned int dga_flags;
|
---|
668 | unsigned long dga_address;
|
---|
669 | DGAModePtr dga_modes;
|
---|
670 | int dga_nmode;
|
---|
671 | int dga_width, dga_height, dga_stride;
|
---|
672 | DisplayModePtr dga_save_mode;
|
---|
673 |
|
---|
674 | const xf86CrtcConfigFuncsRec *funcs;
|
---|
675 |
|
---|
676 | CreateScreenResourcesProcPtr CreateScreenResources;
|
---|
677 |
|
---|
678 | CloseScreenProcPtr CloseScreen;
|
---|
679 |
|
---|
680 | /* Cursor information */
|
---|
681 | xf86CursorInfoPtr cursor_info;
|
---|
682 | CursorPtr cursor;
|
---|
683 | CARD8 *cursor_image;
|
---|
684 | Bool cursor_on;
|
---|
685 | CARD32 cursor_fg, cursor_bg;
|
---|
686 |
|
---|
687 | /**
|
---|
688 | * Options parsed from the related device section
|
---|
689 | */
|
---|
690 | OptionInfoPtr options;
|
---|
691 |
|
---|
692 | Bool debug_modes;
|
---|
693 |
|
---|
694 | /* wrap screen BlockHandler for rotation */
|
---|
695 | ScreenBlockHandlerProcPtr BlockHandler;
|
---|
696 |
|
---|
697 | /* callback when crtc configuration changes */
|
---|
698 | xf86_crtc_notify_proc_ptr xf86_crtc_notify;
|
---|
699 |
|
---|
700 | } xf86CrtcConfigRec, *xf86CrtcConfigPtr;
|
---|
701 |
|
---|
702 | extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
|
---|
703 |
|
---|
704 | #define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
|
---|
705 |
|
---|
706 | static _X_INLINE xf86OutputPtr
|
---|
707 | xf86CompatOutput(ScrnInfoPtr pScrn)
|
---|
708 | {
|
---|
709 | xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
---|
710 | return config->output[config->compat_output];
|
---|
711 | }
|
---|
712 |
|
---|
713 | static _X_INLINE xf86CrtcPtr
|
---|
714 | xf86CompatCrtc(ScrnInfoPtr pScrn)
|
---|
715 | {
|
---|
716 | xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
|
---|
717 | if (!compat_output)
|
---|
718 | return NULL;
|
---|
719 | return compat_output->crtc;
|
---|
720 | }
|
---|
721 |
|
---|
722 | static _X_INLINE RRCrtcPtr
|
---|
723 | xf86CompatRRCrtc(ScrnInfoPtr pScrn)
|
---|
724 | {
|
---|
725 | xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
|
---|
726 | if (!compat_crtc)
|
---|
727 | return NULL;
|
---|
728 | return compat_crtc->randr_crtc;
|
---|
729 | }
|
---|
730 |
|
---|
731 |
|
---|
732 | /*
|
---|
733 | * Initialize xf86CrtcConfig structure
|
---|
734 | */
|
---|
735 |
|
---|
736 | extern _X_EXPORT void
|
---|
737 | xf86CrtcConfigInit (ScrnInfoPtr scrn,
|
---|
738 | const xf86CrtcConfigFuncsRec *funcs);
|
---|
739 |
|
---|
740 | extern _X_EXPORT void
|
---|
741 | xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
|
---|
742 | int minWidth, int minHeight,
|
---|
743 | int maxWidth, int maxHeight);
|
---|
744 |
|
---|
745 | /*
|
---|
746 | * Crtc functions
|
---|
747 | */
|
---|
748 | extern _X_EXPORT xf86CrtcPtr
|
---|
749 | xf86CrtcCreate (ScrnInfoPtr scrn,
|
---|
750 | const xf86CrtcFuncsRec *funcs);
|
---|
751 |
|
---|
752 | extern _X_EXPORT void
|
---|
753 | xf86CrtcDestroy (xf86CrtcPtr crtc);
|
---|
754 |
|
---|
755 |
|
---|
756 | /**
|
---|
757 | * Sets the given video mode on the given crtc
|
---|
758 | */
|
---|
759 |
|
---|
760 | extern _X_EXPORT Bool
|
---|
761 | xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
---|
762 | RRTransformPtr transform, int x, int y);
|
---|
763 |
|
---|
764 | extern _X_EXPORT Bool
|
---|
765 | xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
---|
766 | int x, int y);
|
---|
767 |
|
---|
768 | extern _X_EXPORT void
|
---|
769 | xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y);
|
---|
770 |
|
---|
771 | /*
|
---|
772 | * Assign crtc rotation during mode set
|
---|
773 | */
|
---|
774 | extern _X_EXPORT Bool
|
---|
775 | xf86CrtcRotate (xf86CrtcPtr crtc);
|
---|
776 |
|
---|
777 | /*
|
---|
778 | * Clean up any rotation data, used when a crtc is turned off
|
---|
779 | * as well as when rotation is disabled.
|
---|
780 | */
|
---|
781 | extern _X_EXPORT void
|
---|
782 | xf86RotateDestroy (xf86CrtcPtr crtc);
|
---|
783 |
|
---|
784 | /*
|
---|
785 | * free shadow memory allocated for all crtcs
|
---|
786 | */
|
---|
787 | extern _X_EXPORT void
|
---|
788 | xf86RotateFreeShadow(ScrnInfoPtr pScrn);
|
---|
789 |
|
---|
790 | /*
|
---|
791 | * Clean up rotation during CloseScreen
|
---|
792 | */
|
---|
793 | extern _X_EXPORT void
|
---|
794 | xf86RotateCloseScreen (ScreenPtr pScreen);
|
---|
795 |
|
---|
796 | /**
|
---|
797 | * Return whether any output is assigned to the crtc
|
---|
798 | */
|
---|
799 | extern _X_EXPORT Bool
|
---|
800 | xf86CrtcInUse (xf86CrtcPtr crtc);
|
---|
801 |
|
---|
802 | /*
|
---|
803 | * Output functions
|
---|
804 | */
|
---|
805 | extern _X_EXPORT xf86OutputPtr
|
---|
806 | xf86OutputCreate (ScrnInfoPtr scrn,
|
---|
807 | const xf86OutputFuncsRec *funcs,
|
---|
808 | const char *name);
|
---|
809 |
|
---|
810 | extern _X_EXPORT void
|
---|
811 | xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
|
---|
812 |
|
---|
813 | extern _X_EXPORT Bool
|
---|
814 | xf86OutputRename (xf86OutputPtr output, const char *name);
|
---|
815 |
|
---|
816 | extern _X_EXPORT void
|
---|
817 | xf86OutputDestroy (xf86OutputPtr output);
|
---|
818 |
|
---|
819 | extern _X_EXPORT void
|
---|
820 | xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
|
---|
821 |
|
---|
822 | extern _X_EXPORT void
|
---|
823 | xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
|
---|
824 |
|
---|
825 | #ifdef RANDR_13_INTERFACE
|
---|
826 | # define ScreenInitRetType int
|
---|
827 | #else
|
---|
828 | # define ScreenInitRetType Bool
|
---|
829 | #endif
|
---|
830 |
|
---|
831 | extern _X_EXPORT ScreenInitRetType
|
---|
832 | xf86CrtcScreenInit (ScreenPtr pScreen);
|
---|
833 |
|
---|
834 | extern _X_EXPORT Bool
|
---|
835 | xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
|
---|
836 |
|
---|
837 | extern _X_EXPORT void
|
---|
838 | xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
|
---|
839 |
|
---|
840 | extern _X_EXPORT Bool
|
---|
841 | xf86SaveScreen(ScreenPtr pScreen, int mode);
|
---|
842 |
|
---|
843 | extern _X_EXPORT void
|
---|
844 | xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
|
---|
845 |
|
---|
846 | extern _X_EXPORT DisplayModePtr
|
---|
847 | xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired);
|
---|
848 |
|
---|
849 | extern _X_EXPORT Bool
|
---|
850 | xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
|
---|
851 |
|
---|
852 | /**
|
---|
853 | * Set the EDID information for the specified output
|
---|
854 | */
|
---|
855 | extern _X_EXPORT void
|
---|
856 | xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
|
---|
857 |
|
---|
858 | /**
|
---|
859 | * Return the list of modes supported by the EDID information
|
---|
860 | * stored in 'output'
|
---|
861 | */
|
---|
862 | extern _X_EXPORT DisplayModePtr
|
---|
863 | xf86OutputGetEDIDModes (xf86OutputPtr output);
|
---|
864 |
|
---|
865 | extern _X_EXPORT xf86MonPtr
|
---|
866 | xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
|
---|
867 |
|
---|
868 | /**
|
---|
869 | * Initialize dga for this screen
|
---|
870 | */
|
---|
871 |
|
---|
872 | #ifdef XFreeXDGA
|
---|
873 | extern _X_EXPORT Bool
|
---|
874 | xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
|
---|
875 |
|
---|
876 | /* this is the real function, used only internally */
|
---|
877 | _X_INTERNAL Bool
|
---|
878 | _xf86_di_dga_init_internal (ScreenPtr pScreen);
|
---|
879 |
|
---|
880 | /**
|
---|
881 | * Re-initialize dga for this screen (as when the set of modes changes)
|
---|
882 | */
|
---|
883 |
|
---|
884 | extern _X_EXPORT Bool
|
---|
885 | xf86DiDGAReInit (ScreenPtr pScreen);
|
---|
886 | #endif
|
---|
887 |
|
---|
888 | /* This is the real function, used only internally */
|
---|
889 | _X_INTERNAL Bool
|
---|
890 | _xf86_di_dga_reinit_internal (ScreenPtr pScreen);
|
---|
891 |
|
---|
892 | /*
|
---|
893 | * Set the subpixel order reported for the screen using
|
---|
894 | * the information from the outputs
|
---|
895 | */
|
---|
896 |
|
---|
897 | extern _X_EXPORT void
|
---|
898 | xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
|
---|
899 |
|
---|
900 | /*
|
---|
901 | * Get a standard string name for a connector type
|
---|
902 | */
|
---|
903 | extern _X_EXPORT const char *
|
---|
904 | xf86ConnectorGetName(xf86ConnectorType connector);
|
---|
905 |
|
---|
906 | /*
|
---|
907 | * Using the desired mode information in each crtc, set
|
---|
908 | * modes (used in EnterVT functions, or at server startup)
|
---|
909 | */
|
---|
910 |
|
---|
911 | extern _X_EXPORT Bool
|
---|
912 | xf86SetDesiredModes (ScrnInfoPtr pScrn);
|
---|
913 |
|
---|
914 | /**
|
---|
915 | * Initialize the CRTC-based cursor code. CRTC function vectors must
|
---|
916 | * contain relevant cursor setting functions.
|
---|
917 | *
|
---|
918 | * Driver should call this from ScreenInit function
|
---|
919 | */
|
---|
920 | extern _X_EXPORT Bool
|
---|
921 | xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
|
---|
922 |
|
---|
923 | /**
|
---|
924 | * Called when anything on the screen is reconfigured.
|
---|
925 | *
|
---|
926 | * Reloads cursor images as needed, then adjusts cursor positions.
|
---|
927 | *
|
---|
928 | * Driver should call this from crtc commit function.
|
---|
929 | */
|
---|
930 | extern _X_EXPORT void
|
---|
931 | xf86_reload_cursors (ScreenPtr screen);
|
---|
932 |
|
---|
933 | /**
|
---|
934 | * Called from EnterVT to turn the cursors back on
|
---|
935 | */
|
---|
936 | extern _X_EXPORT void
|
---|
937 | xf86_show_cursors (ScrnInfoPtr scrn);
|
---|
938 |
|
---|
939 | /**
|
---|
940 | * Called by the driver to turn cursors off
|
---|
941 | */
|
---|
942 | extern _X_EXPORT void
|
---|
943 | xf86_hide_cursors (ScrnInfoPtr scrn);
|
---|
944 |
|
---|
945 | /**
|
---|
946 | * Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
|
---|
947 | */
|
---|
948 | extern _X_EXPORT void
|
---|
949 | xf86_cursors_fini (ScreenPtr screen);
|
---|
950 |
|
---|
951 | /**
|
---|
952 | * Transform the cursor's coordinates based on the crtc transform. Normally
|
---|
953 | * this is done by the server, but if crtc->driverIsPerformingTransform is TRUE,
|
---|
954 | * then the server does not transform the cursor position automatically.
|
---|
955 | */
|
---|
956 | extern _X_EXPORT void
|
---|
957 | xf86CrtcTransformCursorPos (xf86CrtcPtr crtc, int *x, int *y);
|
---|
958 |
|
---|
959 | #ifdef XV
|
---|
960 | /*
|
---|
961 | * For overlay video, compute the relevant CRTC and
|
---|
962 | * clip video to that.
|
---|
963 | * wraps xf86XVClipVideoHelper()
|
---|
964 | */
|
---|
965 |
|
---|
966 | extern _X_EXPORT Bool
|
---|
967 | xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
|
---|
968 | xf86CrtcPtr *crtc_ret,
|
---|
969 | xf86CrtcPtr desired_crtc,
|
---|
970 | BoxPtr dst,
|
---|
971 | INT32 *xa,
|
---|
972 | INT32 *xb,
|
---|
973 | INT32 *ya,
|
---|
974 | INT32 *yb,
|
---|
975 | RegionPtr reg,
|
---|
976 | INT32 width,
|
---|
977 | INT32 height);
|
---|
978 | #endif
|
---|
979 |
|
---|
980 | extern _X_EXPORT xf86_crtc_notify_proc_ptr
|
---|
981 | xf86_wrap_crtc_notify (ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new);
|
---|
982 |
|
---|
983 | extern _X_EXPORT void
|
---|
984 | xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old);
|
---|
985 |
|
---|
986 | extern _X_EXPORT void
|
---|
987 | xf86_crtc_notify(ScreenPtr pScreen);
|
---|
988 |
|
---|
989 | /**
|
---|
990 | * Gamma
|
---|
991 | */
|
---|
992 |
|
---|
993 | extern _X_EXPORT Bool
|
---|
994 | xf86_crtc_supports_gamma(ScrnInfoPtr pScrn);
|
---|
995 |
|
---|
996 | #endif /* _XF86CRTC_H_ */
|
---|