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