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 | */
|
---|
220 | void
|
---|
221 | (*set_origin)(xf86CrtcPtr crtc, int x, int y);
|
---|
222 |
|
---|
223 | } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
|
---|
224 |
|
---|
225 | #define XF86_CRTC_VERSION 2
|
---|
226 |
|
---|
227 | struct _xf86Crtc {
|
---|
228 | /**
|
---|
229 | * ABI versioning
|
---|
230 | */
|
---|
231 | int version;
|
---|
232 |
|
---|
233 | /**
|
---|
234 | * Associated ScrnInfo
|
---|
235 | */
|
---|
236 | ScrnInfoPtr scrn;
|
---|
237 |
|
---|
238 | /**
|
---|
239 | * Active state of this CRTC
|
---|
240 | *
|
---|
241 | * Set when this CRTC is driving one or more outputs
|
---|
242 | */
|
---|
243 | Bool enabled;
|
---|
244 |
|
---|
245 | /**
|
---|
246 | * Active mode
|
---|
247 | *
|
---|
248 | * This reflects the mode as set in the CRTC currently
|
---|
249 | * It will be cleared when the VT is not active or
|
---|
250 | * during server startup
|
---|
251 | */
|
---|
252 | DisplayModeRec mode;
|
---|
253 | Rotation rotation;
|
---|
254 | PixmapPtr rotatedPixmap;
|
---|
255 | void *rotatedData;
|
---|
256 |
|
---|
257 | /**
|
---|
258 | * Position on screen
|
---|
259 | *
|
---|
260 | * Locates this CRTC within the frame buffer
|
---|
261 | */
|
---|
262 | int x, y;
|
---|
263 |
|
---|
264 | /**
|
---|
265 | * Desired mode
|
---|
266 | *
|
---|
267 | * This is set to the requested mode, independent of
|
---|
268 | * whether the VT is active. In particular, it receives
|
---|
269 | * the startup configured mode and saves the active mode
|
---|
270 | * on VT switch.
|
---|
271 | */
|
---|
272 | DisplayModeRec desiredMode;
|
---|
273 | Rotation desiredRotation;
|
---|
274 | int desiredX, desiredY;
|
---|
275 |
|
---|
276 | /** crtc-specific functions */
|
---|
277 | const xf86CrtcFuncsRec *funcs;
|
---|
278 |
|
---|
279 | /**
|
---|
280 | * Driver private
|
---|
281 | *
|
---|
282 | * Holds driver-private information
|
---|
283 | */
|
---|
284 | void *driver_private;
|
---|
285 |
|
---|
286 | #ifdef RANDR_12_INTERFACE
|
---|
287 | /**
|
---|
288 | * RandR crtc
|
---|
289 | *
|
---|
290 | * When RandR 1.2 is available, this
|
---|
291 | * points at the associated crtc object
|
---|
292 | */
|
---|
293 | RRCrtcPtr randr_crtc;
|
---|
294 | #else
|
---|
295 | void *randr_crtc;
|
---|
296 | #endif
|
---|
297 |
|
---|
298 | /**
|
---|
299 | * Current cursor is ARGB
|
---|
300 | */
|
---|
301 | Bool cursor_argb;
|
---|
302 | /**
|
---|
303 | * Track whether cursor is within CRTC range
|
---|
304 | */
|
---|
305 | Bool cursor_in_range;
|
---|
306 | /**
|
---|
307 | * Track state of cursor associated with this CRTC
|
---|
308 | */
|
---|
309 | Bool cursor_shown;
|
---|
310 |
|
---|
311 | /**
|
---|
312 | * Current transformation matrix
|
---|
313 | */
|
---|
314 | PictTransform crtc_to_framebuffer;
|
---|
315 | struct pict_f_transform f_crtc_to_framebuffer;
|
---|
316 | struct pict_f_transform f_framebuffer_to_crtc;
|
---|
317 | PictFilterPtr filter;
|
---|
318 | xFixed *params;
|
---|
319 | int nparams;
|
---|
320 | int filter_width;
|
---|
321 | int filter_height;
|
---|
322 | Bool transform_in_use;
|
---|
323 | RRTransformRec transform;
|
---|
324 | Bool transformPresent;
|
---|
325 | RRTransformRec desiredTransform;
|
---|
326 | Bool desiredTransformPresent;
|
---|
327 | /**
|
---|
328 | * Bounding box in screen space
|
---|
329 | */
|
---|
330 | BoxRec bounds;
|
---|
331 | /**
|
---|
332 | * Panning:
|
---|
333 | * TotalArea: total panning area, larger than CRTC's size
|
---|
334 | * TrackingArea: Area of the pointer for which the CRTC is panned
|
---|
335 | * border: Borders of the displayed CRTC area which induces panning if the pointer reaches them
|
---|
336 | */
|
---|
337 | BoxRec panningTotalArea;
|
---|
338 | BoxRec panningTrackingArea;
|
---|
339 | INT16 panningBorder[4];
|
---|
340 | /**
|
---|
341 | * Clear the shadow
|
---|
342 | */
|
---|
343 | Bool shadowClear;
|
---|
344 | };
|
---|
345 |
|
---|
346 | typedef struct _xf86OutputFuncs {
|
---|
347 | /**
|
---|
348 | * Called to allow the output a chance to create properties after the
|
---|
349 | * RandR objects have been created.
|
---|
350 | */
|
---|
351 | void
|
---|
352 | (*create_resources)(xf86OutputPtr output);
|
---|
353 |
|
---|
354 | /**
|
---|
355 | * Turns the output on/off, or sets intermediate power levels if available.
|
---|
356 | *
|
---|
357 | * Unsupported intermediate modes drop to the lower power setting. If the
|
---|
358 | * mode is DPMSModeOff, the output must be disabled, as the DPLL may be
|
---|
359 | * disabled afterwards.
|
---|
360 | */
|
---|
361 | void
|
---|
362 | (*dpms)(xf86OutputPtr output,
|
---|
363 | int mode);
|
---|
364 |
|
---|
365 | /**
|
---|
366 | * Saves the output's state for restoration on VT switch.
|
---|
367 | */
|
---|
368 | void
|
---|
369 | (*save)(xf86OutputPtr output);
|
---|
370 |
|
---|
371 | /**
|
---|
372 | * Restore's the output's state at VT switch.
|
---|
373 | */
|
---|
374 | void
|
---|
375 | (*restore)(xf86OutputPtr output);
|
---|
376 |
|
---|
377 | /**
|
---|
378 | * Callback for testing a video mode for a given output.
|
---|
379 | *
|
---|
380 | * This function should only check for cases where a mode can't be supported
|
---|
381 | * on the output specifically, and not represent generic CRTC limitations.
|
---|
382 | *
|
---|
383 | * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
|
---|
384 | */
|
---|
385 | int
|
---|
386 | (*mode_valid)(xf86OutputPtr output,
|
---|
387 | DisplayModePtr pMode);
|
---|
388 |
|
---|
389 | /**
|
---|
390 | * Callback to adjust the mode to be set in the CRTC.
|
---|
391 | *
|
---|
392 | * This allows an output to adjust the clock or even the entire set of
|
---|
393 | * timings, which is used for panels with fixed timings or for
|
---|
394 | * buses with clock limitations.
|
---|
395 | */
|
---|
396 | Bool
|
---|
397 | (*mode_fixup)(xf86OutputPtr output,
|
---|
398 | DisplayModePtr mode,
|
---|
399 | DisplayModePtr adjusted_mode);
|
---|
400 |
|
---|
401 | /**
|
---|
402 | * Callback for preparing mode changes on an output
|
---|
403 | */
|
---|
404 | void
|
---|
405 | (*prepare)(xf86OutputPtr output);
|
---|
406 |
|
---|
407 | /**
|
---|
408 | * Callback for committing mode changes on an output
|
---|
409 | */
|
---|
410 | void
|
---|
411 | (*commit)(xf86OutputPtr output);
|
---|
412 |
|
---|
413 | /**
|
---|
414 | * Callback for setting up a video mode after fixups have been made.
|
---|
415 | *
|
---|
416 | * This is only called while the output is disabled. The dpms callback
|
---|
417 | * must be all that's necessary for the output, to turn the output on
|
---|
418 | * after this function is called.
|
---|
419 | */
|
---|
420 | void
|
---|
421 | (*mode_set)(xf86OutputPtr output,
|
---|
422 | DisplayModePtr mode,
|
---|
423 | DisplayModePtr adjusted_mode);
|
---|
424 |
|
---|
425 | /**
|
---|
426 | * Probe for a connected output, and return detect_status.
|
---|
427 | */
|
---|
428 | xf86OutputStatus
|
---|
429 | (*detect)(xf86OutputPtr output);
|
---|
430 |
|
---|
431 | /**
|
---|
432 | * Query the device for the modes it provides.
|
---|
433 | *
|
---|
434 | * This function may also update MonInfo, mm_width, and mm_height.
|
---|
435 | *
|
---|
436 | * \return singly-linked list of modes or NULL if no modes found.
|
---|
437 | */
|
---|
438 | DisplayModePtr
|
---|
439 | (*get_modes)(xf86OutputPtr output);
|
---|
440 |
|
---|
441 | #ifdef RANDR_12_INTERFACE
|
---|
442 | /**
|
---|
443 | * Callback when an output's property has changed.
|
---|
444 | */
|
---|
445 | Bool
|
---|
446 | (*set_property)(xf86OutputPtr output,
|
---|
447 | Atom property,
|
---|
448 | RRPropertyValuePtr value);
|
---|
449 | #endif
|
---|
450 | #ifdef RANDR_13_INTERFACE
|
---|
451 | /**
|
---|
452 | * Callback to get an updated property value
|
---|
453 | */
|
---|
454 | Bool
|
---|
455 | (*get_property)(xf86OutputPtr output,
|
---|
456 | Atom property);
|
---|
457 | #endif
|
---|
458 | #ifdef RANDR_GET_CRTC_INTERFACE
|
---|
459 | /**
|
---|
460 | * Callback to get current CRTC for a given output
|
---|
461 | */
|
---|
462 | xf86CrtcPtr
|
---|
463 | (*get_crtc)(xf86OutputPtr output);
|
---|
464 | #endif
|
---|
465 | /**
|
---|
466 | * Clean up driver-specific bits of the output
|
---|
467 | */
|
---|
468 | void
|
---|
469 | (*destroy) (xf86OutputPtr output);
|
---|
470 | } xf86OutputFuncsRec, *xf86OutputFuncsPtr;
|
---|
471 |
|
---|
472 |
|
---|
473 | #define XF86_OUTPUT_VERSION 2
|
---|
474 |
|
---|
475 | struct _xf86Output {
|
---|
476 | /**
|
---|
477 | * ABI versioning
|
---|
478 | */
|
---|
479 | int version;
|
---|
480 |
|
---|
481 | /**
|
---|
482 | * Associated ScrnInfo
|
---|
483 | */
|
---|
484 | ScrnInfoPtr scrn;
|
---|
485 |
|
---|
486 | /**
|
---|
487 | * Currently connected crtc (if any)
|
---|
488 | *
|
---|
489 | * If this output is not in use, this field will be NULL.
|
---|
490 | */
|
---|
491 | xf86CrtcPtr crtc;
|
---|
492 |
|
---|
493 | /**
|
---|
494 | * Possible CRTCs for this output as a mask of crtc indices
|
---|
495 | */
|
---|
496 | CARD32 possible_crtcs;
|
---|
497 |
|
---|
498 | /**
|
---|
499 | * Possible outputs to share the same CRTC as a mask of output indices
|
---|
500 | */
|
---|
501 | CARD32 possible_clones;
|
---|
502 |
|
---|
503 | /**
|
---|
504 | * Whether this output can support interlaced modes
|
---|
505 | */
|
---|
506 | Bool interlaceAllowed;
|
---|
507 |
|
---|
508 | /**
|
---|
509 | * Whether this output can support double scan modes
|
---|
510 | */
|
---|
511 | Bool doubleScanAllowed;
|
---|
512 |
|
---|
513 | /**
|
---|
514 | * List of available modes on this output.
|
---|
515 | *
|
---|
516 | * This should be the list from get_modes(), plus perhaps additional
|
---|
517 | * compatible modes added later.
|
---|
518 | */
|
---|
519 | DisplayModePtr probed_modes;
|
---|
520 |
|
---|
521 | /**
|
---|
522 | * Options parsed from the related monitor section
|
---|
523 | */
|
---|
524 | OptionInfoPtr options;
|
---|
525 |
|
---|
526 | /**
|
---|
527 | * Configured monitor section
|
---|
528 | */
|
---|
529 | XF86ConfMonitorPtr conf_monitor;
|
---|
530 |
|
---|
531 | /**
|
---|
532 | * Desired initial position
|
---|
533 | */
|
---|
534 | int initial_x, initial_y;
|
---|
535 |
|
---|
536 | /**
|
---|
537 | * Desired initial rotation
|
---|
538 | */
|
---|
539 | Rotation initial_rotation;
|
---|
540 |
|
---|
541 | /**
|
---|
542 | * Current connection status
|
---|
543 | *
|
---|
544 | * This indicates whether a monitor is known to be connected
|
---|
545 | * to this output or not, or whether there is no way to tell
|
---|
546 | */
|
---|
547 | xf86OutputStatus status;
|
---|
548 |
|
---|
549 | /** EDID monitor information */
|
---|
550 | xf86MonPtr MonInfo;
|
---|
551 |
|
---|
552 | /** subpixel order */
|
---|
553 | int subpixel_order;
|
---|
554 |
|
---|
555 | /** Physical size of the currently attached output device. */
|
---|
556 | int mm_width, mm_height;
|
---|
557 |
|
---|
558 | /** Output name */
|
---|
559 | char *name;
|
---|
560 |
|
---|
561 | /** output-specific functions */
|
---|
562 | const xf86OutputFuncsRec *funcs;
|
---|
563 |
|
---|
564 | /** driver private information */
|
---|
565 | void *driver_private;
|
---|
566 |
|
---|
567 | /** Whether to use the old per-screen Monitor config section */
|
---|
568 | Bool use_screen_monitor;
|
---|
569 |
|
---|
570 | #ifdef RANDR_12_INTERFACE
|
---|
571 | /**
|
---|
572 | * RandR 1.2 output structure.
|
---|
573 | *
|
---|
574 | * When RandR 1.2 is available, this points at the associated
|
---|
575 | * RandR output structure and is created when this output is created
|
---|
576 | */
|
---|
577 | RROutputPtr randr_output;
|
---|
578 | #else
|
---|
579 | void *randr_output;
|
---|
580 | #endif
|
---|
581 | /** Desired initial panning */
|
---|
582 | BoxRec initialTotalArea;
|
---|
583 | BoxRec initialTrackingArea;
|
---|
584 | INT16 initialBorder[4];
|
---|
585 | };
|
---|
586 |
|
---|
587 | typedef struct _xf86CrtcConfigFuncs {
|
---|
588 | /**
|
---|
589 | * Requests that the driver resize the screen.
|
---|
590 | *
|
---|
591 | * The driver is responsible for updating scrn->virtualX and scrn->virtualY.
|
---|
592 | * If the requested size cannot be set, the driver should leave those values
|
---|
593 | * alone and return FALSE.
|
---|
594 | *
|
---|
595 | * A naive driver that cannot reallocate the screen may simply change
|
---|
596 | * virtual[XY]. A more advanced driver will want to also change the
|
---|
597 | * devPrivate.ptr and devKind of the screen pixmap, update any offscreen
|
---|
598 | * pixmaps it may have moved, and change pScrn->displayWidth.
|
---|
599 | */
|
---|
600 | Bool
|
---|
601 | (*resize)(ScrnInfoPtr scrn,
|
---|
602 | int width,
|
---|
603 | int height);
|
---|
604 | } xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
|
---|
605 |
|
---|
606 | typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen);
|
---|
607 |
|
---|
608 | typedef struct _xf86CrtcConfig {
|
---|
609 | int num_output;
|
---|
610 | xf86OutputPtr *output;
|
---|
611 | /**
|
---|
612 | * compat_output is used whenever we deal
|
---|
613 | * with legacy code that only understands a single
|
---|
614 | * output. pScrn->modes will be loaded from this output,
|
---|
615 | * adjust frame will whack this output, etc.
|
---|
616 | */
|
---|
617 | int compat_output;
|
---|
618 |
|
---|
619 | int num_crtc;
|
---|
620 | xf86CrtcPtr *crtc;
|
---|
621 |
|
---|
622 | int minWidth, minHeight;
|
---|
623 | int maxWidth, maxHeight;
|
---|
624 |
|
---|
625 | /* For crtc-based rotation */
|
---|
626 | DamagePtr rotation_damage;
|
---|
627 | Bool rotation_damage_registered;
|
---|
628 |
|
---|
629 | /* DGA */
|
---|
630 | unsigned int dga_flags;
|
---|
631 | unsigned long dga_address;
|
---|
632 | DGAModePtr dga_modes;
|
---|
633 | int dga_nmode;
|
---|
634 | int dga_width, dga_height, dga_stride;
|
---|
635 | DisplayModePtr dga_save_mode;
|
---|
636 |
|
---|
637 | const xf86CrtcConfigFuncsRec *funcs;
|
---|
638 |
|
---|
639 | CreateScreenResourcesProcPtr CreateScreenResources;
|
---|
640 |
|
---|
641 | CloseScreenProcPtr CloseScreen;
|
---|
642 |
|
---|
643 | /* Cursor information */
|
---|
644 | xf86CursorInfoPtr cursor_info;
|
---|
645 | CursorPtr cursor;
|
---|
646 | CARD8 *cursor_image;
|
---|
647 | Bool cursor_on;
|
---|
648 | CARD32 cursor_fg, cursor_bg;
|
---|
649 |
|
---|
650 | /**
|
---|
651 | * Options parsed from the related device section
|
---|
652 | */
|
---|
653 | OptionInfoPtr options;
|
---|
654 |
|
---|
655 | Bool debug_modes;
|
---|
656 |
|
---|
657 | /* wrap screen BlockHandler for rotation */
|
---|
658 | ScreenBlockHandlerProcPtr BlockHandler;
|
---|
659 |
|
---|
660 | /* callback when crtc configuration changes */
|
---|
661 | xf86_crtc_notify_proc_ptr xf86_crtc_notify;
|
---|
662 |
|
---|
663 | } xf86CrtcConfigRec, *xf86CrtcConfigPtr;
|
---|
664 |
|
---|
665 | extern int xf86CrtcConfigPrivateIndex;
|
---|
666 |
|
---|
667 | #define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
|
---|
668 |
|
---|
669 | /*
|
---|
670 | * Initialize xf86CrtcConfig structure
|
---|
671 | */
|
---|
672 |
|
---|
673 | void
|
---|
674 | xf86CrtcConfigInit (ScrnInfoPtr scrn,
|
---|
675 | const xf86CrtcConfigFuncsRec *funcs);
|
---|
676 |
|
---|
677 | void
|
---|
678 | xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
|
---|
679 | int minWidth, int minHeight,
|
---|
680 | int maxWidth, int maxHeight);
|
---|
681 |
|
---|
682 | /*
|
---|
683 | * Crtc functions
|
---|
684 | */
|
---|
685 | xf86CrtcPtr
|
---|
686 | xf86CrtcCreate (ScrnInfoPtr scrn,
|
---|
687 | const xf86CrtcFuncsRec *funcs);
|
---|
688 |
|
---|
689 | void
|
---|
690 | xf86CrtcDestroy (xf86CrtcPtr crtc);
|
---|
691 |
|
---|
692 |
|
---|
693 | /**
|
---|
694 | * Sets the given video mode on the given crtc
|
---|
695 | */
|
---|
696 |
|
---|
697 | Bool
|
---|
698 | xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
---|
699 | RRTransformPtr transform, int x, int y);
|
---|
700 |
|
---|
701 | Bool
|
---|
702 | xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
---|
703 | int x, int y);
|
---|
704 |
|
---|
705 | void
|
---|
706 | xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y);
|
---|
707 |
|
---|
708 | /*
|
---|
709 | * Assign crtc rotation during mode set
|
---|
710 | */
|
---|
711 | Bool
|
---|
712 | xf86CrtcRotate (xf86CrtcPtr crtc);
|
---|
713 |
|
---|
714 | /*
|
---|
715 | * Clean up any rotation data, used when a crtc is turned off
|
---|
716 | * as well as when rotation is disabled.
|
---|
717 | */
|
---|
718 | void
|
---|
719 | xf86RotateDestroy (xf86CrtcPtr crtc);
|
---|
720 |
|
---|
721 | /*
|
---|
722 | * free shadow memory allocated for all crtcs
|
---|
723 | */
|
---|
724 | void
|
---|
725 | xf86RotateFreeShadow(ScrnInfoPtr pScrn);
|
---|
726 |
|
---|
727 | /*
|
---|
728 | * Clean up rotation during CloseScreen
|
---|
729 | */
|
---|
730 | void
|
---|
731 | xf86RotateCloseScreen (ScreenPtr pScreen);
|
---|
732 |
|
---|
733 | /**
|
---|
734 | * Return whether any output is assigned to the crtc
|
---|
735 | */
|
---|
736 | Bool
|
---|
737 | xf86CrtcInUse (xf86CrtcPtr crtc);
|
---|
738 |
|
---|
739 | /*
|
---|
740 | * Output functions
|
---|
741 | */
|
---|
742 | xf86OutputPtr
|
---|
743 | xf86OutputCreate (ScrnInfoPtr scrn,
|
---|
744 | const xf86OutputFuncsRec *funcs,
|
---|
745 | const char *name);
|
---|
746 |
|
---|
747 | void
|
---|
748 | xf86OutputUseScreenMonitor (xf86OutputPtr output, Bool use_screen_monitor);
|
---|
749 |
|
---|
750 | Bool
|
---|
751 | xf86OutputRename (xf86OutputPtr output, const char *name);
|
---|
752 |
|
---|
753 | void
|
---|
754 | xf86OutputDestroy (xf86OutputPtr output);
|
---|
755 |
|
---|
756 | void
|
---|
757 | xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
|
---|
758 |
|
---|
759 | void
|
---|
760 | xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
|
---|
761 |
|
---|
762 | #ifdef RANDR_13_INTERFACE
|
---|
763 | int
|
---|
764 | #else
|
---|
765 | Bool
|
---|
766 | #endif
|
---|
767 | xf86CrtcScreenInit (ScreenPtr pScreen);
|
---|
768 |
|
---|
769 | Bool
|
---|
770 | xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
|
---|
771 |
|
---|
772 | void
|
---|
773 | xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
|
---|
774 |
|
---|
775 | Bool
|
---|
776 | xf86SaveScreen(ScreenPtr pScreen, int mode);
|
---|
777 |
|
---|
778 | void
|
---|
779 | xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
|
---|
780 |
|
---|
781 | DisplayModePtr
|
---|
782 | xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired);
|
---|
783 |
|
---|
784 | Bool
|
---|
785 | xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
|
---|
786 |
|
---|
787 | /**
|
---|
788 | * Set the EDID information for the specified output
|
---|
789 | */
|
---|
790 | void
|
---|
791 | xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon);
|
---|
792 |
|
---|
793 | /**
|
---|
794 | * Return the list of modes supported by the EDID information
|
---|
795 | * stored in 'output'
|
---|
796 | */
|
---|
797 | DisplayModePtr
|
---|
798 | xf86OutputGetEDIDModes (xf86OutputPtr output);
|
---|
799 |
|
---|
800 | xf86MonPtr
|
---|
801 | xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus);
|
---|
802 |
|
---|
803 | /**
|
---|
804 | * Initialize dga for this screen
|
---|
805 | */
|
---|
806 |
|
---|
807 | Bool
|
---|
808 | xf86DiDGAInit (ScreenPtr pScreen, unsigned long dga_address);
|
---|
809 |
|
---|
810 | /**
|
---|
811 | * Re-initialize dga for this screen (as when the set of modes changes)
|
---|
812 | */
|
---|
813 |
|
---|
814 | Bool
|
---|
815 | xf86DiDGAReInit (ScreenPtr pScreen);
|
---|
816 |
|
---|
817 | /*
|
---|
818 | * Set the subpixel order reported for the screen using
|
---|
819 | * the information from the outputs
|
---|
820 | */
|
---|
821 |
|
---|
822 | void
|
---|
823 | xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
|
---|
824 |
|
---|
825 | /*
|
---|
826 | * Get a standard string name for a connector type
|
---|
827 | */
|
---|
828 | char *
|
---|
829 | xf86ConnectorGetName(xf86ConnectorType connector);
|
---|
830 |
|
---|
831 | /*
|
---|
832 | * Using the desired mode information in each crtc, set
|
---|
833 | * modes (used in EnterVT functions, or at server startup)
|
---|
834 | */
|
---|
835 |
|
---|
836 | Bool
|
---|
837 | xf86SetDesiredModes (ScrnInfoPtr pScrn);
|
---|
838 |
|
---|
839 | /**
|
---|
840 | * Initialize the CRTC-based cursor code. CRTC function vectors must
|
---|
841 | * contain relevant cursor setting functions.
|
---|
842 | *
|
---|
843 | * Driver should call this from ScreenInit function
|
---|
844 | */
|
---|
845 | Bool
|
---|
846 | xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags);
|
---|
847 |
|
---|
848 | /**
|
---|
849 | * Called when anything on the screen is reconfigured.
|
---|
850 | *
|
---|
851 | * Reloads cursor images as needed, then adjusts cursor positions.
|
---|
852 | *
|
---|
853 | * Driver should call this from crtc commit function.
|
---|
854 | */
|
---|
855 | void
|
---|
856 | xf86_reload_cursors (ScreenPtr screen);
|
---|
857 |
|
---|
858 | /**
|
---|
859 | * Called from EnterVT to turn the cursors back on
|
---|
860 | */
|
---|
861 | void
|
---|
862 | xf86_show_cursors (ScrnInfoPtr scrn);
|
---|
863 |
|
---|
864 | /**
|
---|
865 | * Called by the driver to turn cursors off
|
---|
866 | */
|
---|
867 | void
|
---|
868 | xf86_hide_cursors (ScrnInfoPtr scrn);
|
---|
869 |
|
---|
870 | /**
|
---|
871 | * Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
|
---|
872 | */
|
---|
873 | void
|
---|
874 | xf86_cursors_fini (ScreenPtr screen);
|
---|
875 |
|
---|
876 | /*
|
---|
877 | * For overlay video, compute the relevant CRTC and
|
---|
878 | * clip video to that.
|
---|
879 | * wraps xf86XVClipVideoHelper()
|
---|
880 | */
|
---|
881 |
|
---|
882 | Bool
|
---|
883 | xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
|
---|
884 | xf86CrtcPtr *crtc_ret,
|
---|
885 | xf86CrtcPtr desired_crtc,
|
---|
886 | BoxPtr dst,
|
---|
887 | INT32 *xa,
|
---|
888 | INT32 *xb,
|
---|
889 | INT32 *ya,
|
---|
890 | INT32 *yb,
|
---|
891 | RegionPtr reg,
|
---|
892 | INT32 width,
|
---|
893 | INT32 height);
|
---|
894 |
|
---|
895 | xf86_crtc_notify_proc_ptr
|
---|
896 | xf86_wrap_crtc_notify (ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new);
|
---|
897 |
|
---|
898 | void
|
---|
899 | xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old);
|
---|
900 |
|
---|
901 | void
|
---|
902 | xf86_crtc_notify(ScreenPtr pScreen);
|
---|
903 |
|
---|
904 | /**
|
---|
905 | * Panning
|
---|
906 | */
|
---|
907 | Bool
|
---|
908 | xf86_crtc_get_panning(ScrnInfoPtr pScrn,
|
---|
909 | BoxPtr totalArea,
|
---|
910 | BoxPtr TrackingArea,
|
---|
911 | INT16 *border);
|
---|
912 |
|
---|
913 | Bool
|
---|
914 | xf86_crtc_set_panning(ScrnInfoPtr pScrn,
|
---|
915 | BoxPtr totalArea,
|
---|
916 | BoxPtr TrackingArea,
|
---|
917 | INT16 *border);
|
---|
918 |
|
---|
919 | #endif /* _XF86CRTC_H_ */
|
---|