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