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 |
|
---|
192 | /**
|
---|
193 | * Load ARGB image
|
---|
194 | */
|
---|
195 | void
|
---|
196 | (*load_cursor_argb) (xf86CrtcPtr crtc, CARD32 *image);
|
---|
197 |
|
---|
198 | /**
|
---|
199 | * Clean up driver-specific bits of the crtc
|
---|
200 | */
|
---|
201 | void
|
---|
202 | (*destroy) (xf86CrtcPtr crtc);
|
---|
203 |
|
---|
204 | /**
|
---|
205 | * Less fine-grained mode setting entry point for kernel modesetting
|
---|
206 | */
|
---|
207 | Bool
|
---|
208 | (*set_mode_major) (xf86CrtcPtr crtc, DisplayModePtr mode,
|
---|
209 | Rotation rotation, int x, int y);
|
---|
210 |
|
---|
211 | /**
|
---|
212 | * Callback for panning. Doesn't change the mode.
|
---|
213 | * Added in ABI version 2
|
---|
214 | */
|
---|
215 | void
|
---|
216 | (*set_origin) (xf86CrtcPtr crtc, int x, int y);
|
---|
217 |
|
---|
218 | /**
|
---|
219 | */
|
---|
220 | Bool
|
---|
221 | (*set_scanout_pixmap)(xf86CrtcPtr crtc, PixmapPtr pixmap);
|
---|
222 |
|
---|
223 | } xf86CrtcFuncsRec, *xf86CrtcFuncsPtr;
|
---|
224 |
|
---|
225 | #define XF86_CRTC_VERSION 5
|
---|
226 |
|
---|
227 | struct _xf86Crtc {
|
---|
228 | /**
|
---|
229 | * ABI versioning
|
---|
230 | */
|
---|
231 | int version;
|
---|
232 |
|
---|
233 | /**
|
---|
234 | * Associated ScrnInfo
|
---|
235 | */
|
---|
236 | ScrnInfoPtr scrn;
|
---|
237 |
|
---|
238 | /**
|
---|
239 | * Desired state of this CRTC
|
---|
240 | *
|
---|
241 | * Set when this CRTC should be 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 | /* framebuffer_to_crtc was removed in ABI 2 */
|
---|
316 | struct pict_f_transform f_crtc_to_framebuffer; /* ABI 2 */
|
---|
317 | struct pict_f_transform f_framebuffer_to_crtc; /* ABI 2 */
|
---|
318 | PictFilterPtr filter; /* ABI 2 */
|
---|
319 | xFixed *params; /* ABI 2 */
|
---|
320 | int nparams; /* ABI 2 */
|
---|
321 | int filter_width; /* ABI 2 */
|
---|
322 | int filter_height; /* ABI 2 */
|
---|
323 | Bool transform_in_use;
|
---|
324 | RRTransformRec transform; /* ABI 2 */
|
---|
325 | Bool transformPresent; /* ABI 2 */
|
---|
326 | RRTransformRec desiredTransform; /* ABI 2 */
|
---|
327 | Bool desiredTransformPresent; /* ABI 2 */
|
---|
328 | /**
|
---|
329 | * Bounding box in screen space
|
---|
330 | */
|
---|
331 | BoxRec bounds;
|
---|
332 | /**
|
---|
333 | * Panning:
|
---|
334 | * TotalArea: total panning area, larger than CRTC's size
|
---|
335 | * TrackingArea: Area of the pointer for which the CRTC is panned
|
---|
336 | * border: Borders of the displayed CRTC area which induces panning if the pointer reaches them
|
---|
337 | * Added in ABI version 2
|
---|
338 | */
|
---|
339 | BoxRec panningTotalArea;
|
---|
340 | BoxRec panningTrackingArea;
|
---|
341 | INT16 panningBorder[4];
|
---|
342 |
|
---|
343 | /**
|
---|
344 | * Current gamma, especially useful after initial config.
|
---|
345 | * Added in ABI version 3
|
---|
346 | */
|
---|
347 | CARD16 *gamma_red;
|
---|
348 | CARD16 *gamma_green;
|
---|
349 | CARD16 *gamma_blue;
|
---|
350 | int gamma_size;
|
---|
351 |
|
---|
352 | /**
|
---|
353 | * Actual state of this CRTC
|
---|
354 | *
|
---|
355 | * Set to TRUE after modesetting, set to FALSE if no outputs are connected
|
---|
356 | * Added in ABI version 3
|
---|
357 | */
|
---|
358 | Bool active;
|
---|
359 | /**
|
---|
360 | * Clear the shadow
|
---|
361 | */
|
---|
362 | Bool shadowClear;
|
---|
363 |
|
---|
364 | /**
|
---|
365 | * Indicates that the driver is handling the transform, so the shadow
|
---|
366 | * surface should be disabled. The driver writes this field before calling
|
---|
367 | * xf86CrtcRotate to indicate that it is handling the transform (including
|
---|
368 | * rotation and reflection).
|
---|
369 | *
|
---|
370 | * Setting this flag also causes the server to stop adjusting the cursor
|
---|
371 | * image and position.
|
---|
372 | *
|
---|
373 | * Added in ABI version 4
|
---|
374 | */
|
---|
375 | Bool driverIsPerformingTransform;
|
---|
376 |
|
---|
377 | /* Added in ABI version 5
|
---|
378 | */
|
---|
379 | PixmapPtr current_scanout;
|
---|
380 | };
|
---|
381 |
|
---|
382 | typedef struct _xf86OutputFuncs {
|
---|
383 | /**
|
---|
384 | * Called to allow the output a chance to create properties after the
|
---|
385 | * RandR objects have been created.
|
---|
386 | */
|
---|
387 | void
|
---|
388 | (*create_resources) (xf86OutputPtr output);
|
---|
389 |
|
---|
390 | /**
|
---|
391 | * Turns the output on/off, or sets intermediate power levels if available.
|
---|
392 | *
|
---|
393 | * Unsupported intermediate modes drop to the lower power setting. If the
|
---|
394 | * mode is DPMSModeOff, the output must be disabled, as the DPLL may be
|
---|
395 | * disabled afterwards.
|
---|
396 | */
|
---|
397 | void
|
---|
398 | (*dpms) (xf86OutputPtr output, int mode);
|
---|
399 |
|
---|
400 | /**
|
---|
401 | * Saves the output's state for restoration on VT switch.
|
---|
402 | */
|
---|
403 | void
|
---|
404 | (*save) (xf86OutputPtr output);
|
---|
405 |
|
---|
406 | /**
|
---|
407 | * Restore's the output's state at VT switch.
|
---|
408 | */
|
---|
409 | void
|
---|
410 | (*restore) (xf86OutputPtr output);
|
---|
411 |
|
---|
412 | /**
|
---|
413 | * Callback for testing a video mode for a given output.
|
---|
414 | *
|
---|
415 | * This function should only check for cases where a mode can't be supported
|
---|
416 | * on the output specifically, and not represent generic CRTC limitations.
|
---|
417 | *
|
---|
418 | * \return MODE_OK if the mode is valid, or another MODE_* otherwise.
|
---|
419 | */
|
---|
420 | int
|
---|
421 | (*mode_valid) (xf86OutputPtr output, DisplayModePtr pMode);
|
---|
422 |
|
---|
423 | /**
|
---|
424 | * Callback to adjust the mode to be set in the CRTC.
|
---|
425 | *
|
---|
426 | * This allows an output to adjust the clock or even the entire set of
|
---|
427 | * timings, which is used for panels with fixed timings or for
|
---|
428 | * buses with clock limitations.
|
---|
429 | */
|
---|
430 | Bool
|
---|
431 | (*mode_fixup) (xf86OutputPtr output,
|
---|
432 | DisplayModePtr mode, DisplayModePtr adjusted_mode);
|
---|
433 |
|
---|
434 | /**
|
---|
435 | * Callback for preparing mode changes on an output
|
---|
436 | */
|
---|
437 | void
|
---|
438 | (*prepare) (xf86OutputPtr output);
|
---|
439 |
|
---|
440 | /**
|
---|
441 | * Callback for committing mode changes on an output
|
---|
442 | */
|
---|
443 | void
|
---|
444 | (*commit) (xf86OutputPtr output);
|
---|
445 |
|
---|
446 | /**
|
---|
447 | * Callback for setting up a video mode after fixups have been made.
|
---|
448 | *
|
---|
449 | * This is only called while the output is disabled. The dpms callback
|
---|
450 | * must be all that's necessary for the output, to turn the output on
|
---|
451 | * after this function is called.
|
---|
452 | */
|
---|
453 | void
|
---|
454 | (*mode_set) (xf86OutputPtr output,
|
---|
455 | DisplayModePtr mode, DisplayModePtr adjusted_mode);
|
---|
456 |
|
---|
457 | /**
|
---|
458 | * Probe for a connected output, and return detect_status.
|
---|
459 | */
|
---|
460 | xf86OutputStatus(*detect) (xf86OutputPtr output);
|
---|
461 |
|
---|
462 | /**
|
---|
463 | * Query the device for the modes it provides.
|
---|
464 | *
|
---|
465 | * This function may also update MonInfo, mm_width, and mm_height.
|
---|
466 | *
|
---|
467 | * \return singly-linked list of modes or NULL if no modes found.
|
---|
468 | */
|
---|
469 | DisplayModePtr(*get_modes) (xf86OutputPtr output);
|
---|
470 |
|
---|
471 | #ifdef RANDR_12_INTERFACE
|
---|
472 | /**
|
---|
473 | * Callback when an output's property has changed.
|
---|
474 | */
|
---|
475 | Bool
|
---|
476 | (*set_property) (xf86OutputPtr output,
|
---|
477 | Atom property, RRPropertyValuePtr value);
|
---|
478 | #endif
|
---|
479 | #ifdef RANDR_13_INTERFACE
|
---|
480 | /**
|
---|
481 | * Callback to get an updated property value
|
---|
482 | */
|
---|
483 | Bool
|
---|
484 | (*get_property) (xf86OutputPtr output, Atom property);
|
---|
485 | #endif
|
---|
486 | #ifdef RANDR_GET_CRTC_INTERFACE
|
---|
487 | /**
|
---|
488 | * Callback to get current CRTC for a given output
|
---|
489 | */
|
---|
490 | xf86CrtcPtr(*get_crtc) (xf86OutputPtr output);
|
---|
491 | #endif
|
---|
492 | /**
|
---|
493 | * Clean up driver-specific bits of the output
|
---|
494 | */
|
---|
495 | void
|
---|
496 | (*destroy) (xf86OutputPtr output);
|
---|
497 | } xf86OutputFuncsRec, *xf86OutputFuncsPtr;
|
---|
498 |
|
---|
499 | #define XF86_OUTPUT_VERSION 2
|
---|
500 |
|
---|
501 | struct _xf86Output {
|
---|
502 | /**
|
---|
503 | * ABI versioning
|
---|
504 | */
|
---|
505 | int version;
|
---|
506 |
|
---|
507 | /**
|
---|
508 | * Associated ScrnInfo
|
---|
509 | */
|
---|
510 | ScrnInfoPtr scrn;
|
---|
511 |
|
---|
512 | /**
|
---|
513 | * Currently connected crtc (if any)
|
---|
514 | *
|
---|
515 | * If this output is not in use, this field will be NULL.
|
---|
516 | */
|
---|
517 | xf86CrtcPtr crtc;
|
---|
518 |
|
---|
519 | /**
|
---|
520 | * Possible CRTCs for this output as a mask of crtc indices
|
---|
521 | */
|
---|
522 | CARD32 possible_crtcs;
|
---|
523 |
|
---|
524 | /**
|
---|
525 | * Possible outputs to share the same CRTC as a mask of output indices
|
---|
526 | */
|
---|
527 | CARD32 possible_clones;
|
---|
528 |
|
---|
529 | /**
|
---|
530 | * Whether this output can support interlaced modes
|
---|
531 | */
|
---|
532 | Bool interlaceAllowed;
|
---|
533 |
|
---|
534 | /**
|
---|
535 | * Whether this output can support double scan modes
|
---|
536 | */
|
---|
537 | Bool doubleScanAllowed;
|
---|
538 |
|
---|
539 | /**
|
---|
540 | * List of available modes on this output.
|
---|
541 | *
|
---|
542 | * This should be the list from get_modes(), plus perhaps additional
|
---|
543 | * compatible modes added later.
|
---|
544 | */
|
---|
545 | DisplayModePtr probed_modes;
|
---|
546 |
|
---|
547 | /**
|
---|
548 | * Options parsed from the related monitor section
|
---|
549 | */
|
---|
550 | OptionInfoPtr options;
|
---|
551 |
|
---|
552 | /**
|
---|
553 | * Configured monitor section
|
---|
554 | */
|
---|
555 | XF86ConfMonitorPtr conf_monitor;
|
---|
556 |
|
---|
557 | /**
|
---|
558 | * Desired initial position
|
---|
559 | */
|
---|
560 | int initial_x, initial_y;
|
---|
561 |
|
---|
562 | /**
|
---|
563 | * Desired initial rotation
|
---|
564 | */
|
---|
565 | Rotation initial_rotation;
|
---|
566 |
|
---|
567 | /**
|
---|
568 | * Current connection status
|
---|
569 | *
|
---|
570 | * This indicates whether a monitor is known to be connected
|
---|
571 | * to this output or not, or whether there is no way to tell
|
---|
572 | */
|
---|
573 | xf86OutputStatus status;
|
---|
574 |
|
---|
575 | /** EDID monitor information */
|
---|
576 | xf86MonPtr MonInfo;
|
---|
577 |
|
---|
578 | /** subpixel order */
|
---|
579 | int subpixel_order;
|
---|
580 |
|
---|
581 | /** Physical size of the currently attached output device. */
|
---|
582 | int mm_width, mm_height;
|
---|
583 |
|
---|
584 | /** Output name */
|
---|
585 | char *name;
|
---|
586 |
|
---|
587 | /** output-specific functions */
|
---|
588 | const xf86OutputFuncsRec *funcs;
|
---|
589 |
|
---|
590 | /** driver private information */
|
---|
591 | void *driver_private;
|
---|
592 |
|
---|
593 | /** Whether to use the old per-screen Monitor config section */
|
---|
594 | Bool use_screen_monitor;
|
---|
595 |
|
---|
596 | #ifdef RANDR_12_INTERFACE
|
---|
597 | /**
|
---|
598 | * RandR 1.2 output structure.
|
---|
599 | *
|
---|
600 | * When RandR 1.2 is available, this points at the associated
|
---|
601 | * RandR output structure and is created when this output is created
|
---|
602 | */
|
---|
603 | RROutputPtr randr_output;
|
---|
604 | #else
|
---|
605 | void *randr_output;
|
---|
606 | #endif
|
---|
607 | /**
|
---|
608 | * Desired initial panning
|
---|
609 | * Added in ABI version 2
|
---|
610 | */
|
---|
611 | BoxRec initialTotalArea;
|
---|
612 | BoxRec initialTrackingArea;
|
---|
613 | INT16 initialBorder[4];
|
---|
614 | };
|
---|
615 |
|
---|
616 | typedef struct _xf86ProviderFuncs {
|
---|
617 | /**
|
---|
618 | * Called to allow the provider a chance to create properties after the
|
---|
619 | * RandR objects have been created.
|
---|
620 | */
|
---|
621 | void
|
---|
622 | (*create_resources) (ScrnInfoPtr scrn);
|
---|
623 |
|
---|
624 | /**
|
---|
625 | * Callback when an provider's property has changed.
|
---|
626 | */
|
---|
627 | Bool
|
---|
628 | (*set_property) (ScrnInfoPtr scrn,
|
---|
629 | Atom property, RRPropertyValuePtr value);
|
---|
630 |
|
---|
631 | /**
|
---|
632 | * Callback to get an updated property value
|
---|
633 | */
|
---|
634 | Bool
|
---|
635 | (*get_property) (ScrnInfoPtr provider, Atom property);
|
---|
636 |
|
---|
637 | } xf86ProviderFuncsRec, *xf86ProviderFuncsPtr;
|
---|
638 |
|
---|
639 | typedef struct _xf86CrtcConfigFuncs {
|
---|
640 | /**
|
---|
641 | * Requests that the driver resize the screen.
|
---|
642 | *
|
---|
643 | * The driver is responsible for updating scrn->virtualX and scrn->virtualY.
|
---|
644 | * If the requested size cannot be set, the driver should leave those values
|
---|
645 | * alone and return FALSE.
|
---|
646 | *
|
---|
647 | * A naive driver that cannot reallocate the screen may simply change
|
---|
648 | * virtual[XY]. A more advanced driver will want to also change the
|
---|
649 | * devPrivate.ptr and devKind of the screen pixmap, update any offscreen
|
---|
650 | * pixmaps it may have moved, and change pScrn->displayWidth.
|
---|
651 | */
|
---|
652 | Bool
|
---|
653 | (*resize) (ScrnInfoPtr scrn, int width, int height);
|
---|
654 | } xf86CrtcConfigFuncsRec, *xf86CrtcConfigFuncsPtr;
|
---|
655 |
|
---|
656 | typedef void (*xf86_crtc_notify_proc_ptr) (ScreenPtr pScreen);
|
---|
657 |
|
---|
658 | typedef struct _xf86CrtcConfig {
|
---|
659 | int num_output;
|
---|
660 | xf86OutputPtr *output;
|
---|
661 | /**
|
---|
662 | * compat_output is used whenever we deal
|
---|
663 | * with legacy code that only understands a single
|
---|
664 | * output. pScrn->modes will be loaded from this output,
|
---|
665 | * adjust frame will whack this output, etc.
|
---|
666 | */
|
---|
667 | int compat_output;
|
---|
668 |
|
---|
669 | int num_crtc;
|
---|
670 | xf86CrtcPtr *crtc;
|
---|
671 |
|
---|
672 | int minWidth, minHeight;
|
---|
673 | int maxWidth, maxHeight;
|
---|
674 |
|
---|
675 | /* For crtc-based rotation */
|
---|
676 | DamagePtr rotation_damage;
|
---|
677 | Bool rotation_damage_registered;
|
---|
678 |
|
---|
679 | /* DGA */
|
---|
680 | unsigned int dga_flags;
|
---|
681 | unsigned long dga_address;
|
---|
682 | DGAModePtr dga_modes;
|
---|
683 | int dga_nmode;
|
---|
684 | int dga_width, dga_height, dga_stride;
|
---|
685 | DisplayModePtr dga_save_mode;
|
---|
686 |
|
---|
687 | const xf86CrtcConfigFuncsRec *funcs;
|
---|
688 |
|
---|
689 | CreateScreenResourcesProcPtr CreateScreenResources;
|
---|
690 |
|
---|
691 | CloseScreenProcPtr CloseScreen;
|
---|
692 |
|
---|
693 | /* Cursor information */
|
---|
694 | xf86CursorInfoPtr cursor_info;
|
---|
695 | CursorPtr cursor;
|
---|
696 | CARD8 *cursor_image;
|
---|
697 | Bool cursor_on;
|
---|
698 | CARD32 cursor_fg, cursor_bg;
|
---|
699 |
|
---|
700 | /**
|
---|
701 | * Options parsed from the related device section
|
---|
702 | */
|
---|
703 | OptionInfoPtr options;
|
---|
704 |
|
---|
705 | Bool debug_modes;
|
---|
706 |
|
---|
707 | /* wrap screen BlockHandler for rotation */
|
---|
708 | ScreenBlockHandlerProcPtr BlockHandler;
|
---|
709 |
|
---|
710 | /* callback when crtc configuration changes */
|
---|
711 | xf86_crtc_notify_proc_ptr xf86_crtc_notify;
|
---|
712 |
|
---|
713 | char *name;
|
---|
714 | const xf86ProviderFuncsRec *provider_funcs;
|
---|
715 | #ifdef RANDR_12_INTERFACE
|
---|
716 | RRProviderPtr randr_provider;
|
---|
717 | #else
|
---|
718 | void *randr_provider;
|
---|
719 | #endif
|
---|
720 | } xf86CrtcConfigRec, *xf86CrtcConfigPtr;
|
---|
721 |
|
---|
722 | extern _X_EXPORT int xf86CrtcConfigPrivateIndex;
|
---|
723 |
|
---|
724 | #define XF86_CRTC_CONFIG_PTR(p) ((xf86CrtcConfigPtr) ((p)->privates[xf86CrtcConfigPrivateIndex].ptr))
|
---|
725 |
|
---|
726 | static _X_INLINE xf86OutputPtr
|
---|
727 | xf86CompatOutput(ScrnInfoPtr pScrn)
|
---|
728 | {
|
---|
729 | xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
---|
730 |
|
---|
731 | return config->output[config->compat_output];
|
---|
732 | }
|
---|
733 |
|
---|
734 | static _X_INLINE xf86CrtcPtr
|
---|
735 | xf86CompatCrtc(ScrnInfoPtr pScrn)
|
---|
736 | {
|
---|
737 | xf86OutputPtr compat_output = xf86CompatOutput(pScrn);
|
---|
738 |
|
---|
739 | if (!compat_output)
|
---|
740 | return NULL;
|
---|
741 | return compat_output->crtc;
|
---|
742 | }
|
---|
743 |
|
---|
744 | static _X_INLINE RRCrtcPtr
|
---|
745 | xf86CompatRRCrtc(ScrnInfoPtr pScrn)
|
---|
746 | {
|
---|
747 | xf86CrtcPtr compat_crtc = xf86CompatCrtc(pScrn);
|
---|
748 |
|
---|
749 | if (!compat_crtc)
|
---|
750 | return NULL;
|
---|
751 | return compat_crtc->randr_crtc;
|
---|
752 | }
|
---|
753 |
|
---|
754 | /*
|
---|
755 | * Initialize xf86CrtcConfig structure
|
---|
756 | */
|
---|
757 |
|
---|
758 | extern _X_EXPORT void
|
---|
759 | xf86CrtcConfigInit(ScrnInfoPtr scrn, const xf86CrtcConfigFuncsRec * funcs);
|
---|
760 |
|
---|
761 | extern _X_EXPORT void
|
---|
762 |
|
---|
763 | xf86CrtcSetSizeRange(ScrnInfoPtr scrn,
|
---|
764 | int minWidth, int minHeight, int maxWidth, int maxHeight);
|
---|
765 |
|
---|
766 | /*
|
---|
767 | * Crtc functions
|
---|
768 | */
|
---|
769 | extern _X_EXPORT xf86CrtcPtr
|
---|
770 | xf86CrtcCreate(ScrnInfoPtr scrn, const xf86CrtcFuncsRec * funcs);
|
---|
771 |
|
---|
772 | extern _X_EXPORT void
|
---|
773 | xf86CrtcDestroy(xf86CrtcPtr crtc);
|
---|
774 |
|
---|
775 | /**
|
---|
776 | * Sets the given video mode on the given crtc
|
---|
777 | */
|
---|
778 |
|
---|
779 | extern _X_EXPORT Bool
|
---|
780 |
|
---|
781 | xf86CrtcSetModeTransform(xf86CrtcPtr crtc, DisplayModePtr mode,
|
---|
782 | Rotation rotation, RRTransformPtr transform, int x,
|
---|
783 | int y);
|
---|
784 |
|
---|
785 | extern _X_EXPORT Bool
|
---|
786 |
|
---|
787 | xf86CrtcSetMode(xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
---|
788 | int x, int y);
|
---|
789 |
|
---|
790 | extern _X_EXPORT void
|
---|
791 | xf86CrtcSetOrigin(xf86CrtcPtr crtc, int x, int y);
|
---|
792 |
|
---|
793 | /*
|
---|
794 | * Assign crtc rotation during mode set
|
---|
795 | */
|
---|
796 | extern _X_EXPORT Bool
|
---|
797 | xf86CrtcRotate(xf86CrtcPtr crtc);
|
---|
798 |
|
---|
799 | /*
|
---|
800 | * Clean up any rotation data, used when a crtc is turned off
|
---|
801 | * as well as when rotation is disabled.
|
---|
802 | */
|
---|
803 | extern _X_EXPORT void
|
---|
804 | xf86RotateDestroy(xf86CrtcPtr crtc);
|
---|
805 |
|
---|
806 | /*
|
---|
807 | * free shadow memory allocated for all crtcs
|
---|
808 | */
|
---|
809 | extern _X_EXPORT void
|
---|
810 | xf86RotateFreeShadow(ScrnInfoPtr pScrn);
|
---|
811 |
|
---|
812 | /*
|
---|
813 | * Clean up rotation during CloseScreen
|
---|
814 | */
|
---|
815 | extern _X_EXPORT void
|
---|
816 | xf86RotateCloseScreen(ScreenPtr pScreen);
|
---|
817 |
|
---|
818 | /**
|
---|
819 | * Return whether any output is assigned to the crtc
|
---|
820 | */
|
---|
821 | extern _X_EXPORT Bool
|
---|
822 | xf86CrtcInUse(xf86CrtcPtr crtc);
|
---|
823 |
|
---|
824 | /*
|
---|
825 | * Output functions
|
---|
826 | */
|
---|
827 | extern _X_EXPORT xf86OutputPtr
|
---|
828 | xf86OutputCreate(ScrnInfoPtr scrn,
|
---|
829 | const xf86OutputFuncsRec * funcs, const char *name);
|
---|
830 |
|
---|
831 | extern _X_EXPORT void
|
---|
832 | xf86OutputUseScreenMonitor(xf86OutputPtr output, Bool use_screen_monitor);
|
---|
833 |
|
---|
834 | extern _X_EXPORT Bool
|
---|
835 | xf86OutputRename(xf86OutputPtr output, const char *name);
|
---|
836 |
|
---|
837 | extern _X_EXPORT void
|
---|
838 | xf86OutputDestroy(xf86OutputPtr output);
|
---|
839 |
|
---|
840 | extern _X_EXPORT void
|
---|
841 | xf86ProbeOutputModes(ScrnInfoPtr pScrn, int maxX, int maxY);
|
---|
842 |
|
---|
843 | extern _X_EXPORT void
|
---|
844 | xf86SetScrnInfoModes(ScrnInfoPtr pScrn);
|
---|
845 |
|
---|
846 | #ifdef RANDR_13_INTERFACE
|
---|
847 | #define ScreenInitRetType int
|
---|
848 | #else
|
---|
849 | #define ScreenInitRetType Bool
|
---|
850 | #endif
|
---|
851 |
|
---|
852 | extern _X_EXPORT ScreenInitRetType xf86CrtcScreenInit(ScreenPtr pScreen);
|
---|
853 |
|
---|
854 | extern _X_EXPORT Bool
|
---|
855 | xf86InitialConfiguration(ScrnInfoPtr pScrn, Bool canGrow);
|
---|
856 |
|
---|
857 | extern _X_EXPORT void
|
---|
858 | xf86DPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags);
|
---|
859 |
|
---|
860 | extern _X_EXPORT Bool
|
---|
861 | xf86SaveScreen(ScreenPtr pScreen, int mode);
|
---|
862 |
|
---|
863 | extern _X_EXPORT void
|
---|
864 | xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
|
---|
865 |
|
---|
866 | extern _X_EXPORT DisplayModePtr
|
---|
867 | xf86OutputFindClosestMode(xf86OutputPtr output, DisplayModePtr desired);
|
---|
868 |
|
---|
869 | extern _X_EXPORT Bool
|
---|
870 |
|
---|
871 | xf86SetSingleMode(ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
|
---|
872 |
|
---|
873 | /**
|
---|
874 | * Set the EDID information for the specified output
|
---|
875 | */
|
---|
876 | extern _X_EXPORT void
|
---|
877 | xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon);
|
---|
878 |
|
---|
879 | /**
|
---|
880 | * Return the list of modes supported by the EDID information
|
---|
881 | * stored in 'output'
|
---|
882 | */
|
---|
883 | extern _X_EXPORT DisplayModePtr xf86OutputGetEDIDModes(xf86OutputPtr output);
|
---|
884 |
|
---|
885 | extern _X_EXPORT xf86MonPtr
|
---|
886 | xf86OutputGetEDID(xf86OutputPtr output, I2CBusPtr pDDCBus);
|
---|
887 |
|
---|
888 | /**
|
---|
889 | * Initialize dga for this screen
|
---|
890 | */
|
---|
891 |
|
---|
892 | #ifdef XFreeXDGA
|
---|
893 | extern _X_EXPORT Bool
|
---|
894 | xf86DiDGAInit(ScreenPtr pScreen, unsigned long dga_address);
|
---|
895 |
|
---|
896 | /* this is the real function, used only internally */
|
---|
897 | _X_INTERNAL Bool
|
---|
898 | _xf86_di_dga_init_internal(ScreenPtr pScreen);
|
---|
899 |
|
---|
900 | /**
|
---|
901 | * Re-initialize dga for this screen (as when the set of modes changes)
|
---|
902 | */
|
---|
903 |
|
---|
904 | extern _X_EXPORT Bool
|
---|
905 | xf86DiDGAReInit(ScreenPtr pScreen);
|
---|
906 | #endif
|
---|
907 |
|
---|
908 | /* This is the real function, used only internally */
|
---|
909 | _X_INTERNAL Bool
|
---|
910 | _xf86_di_dga_reinit_internal(ScreenPtr pScreen);
|
---|
911 |
|
---|
912 | /*
|
---|
913 | * Set the subpixel order reported for the screen using
|
---|
914 | * the information from the outputs
|
---|
915 | */
|
---|
916 |
|
---|
917 | extern _X_EXPORT void
|
---|
918 | xf86CrtcSetScreenSubpixelOrder(ScreenPtr pScreen);
|
---|
919 |
|
---|
920 | /*
|
---|
921 | * Get a standard string name for a connector type
|
---|
922 | */
|
---|
923 | extern _X_EXPORT const char *xf86ConnectorGetName(xf86ConnectorType connector);
|
---|
924 |
|
---|
925 | /*
|
---|
926 | * Using the desired mode information in each crtc, set
|
---|
927 | * modes (used in EnterVT functions, or at server startup)
|
---|
928 | */
|
---|
929 |
|
---|
930 | extern _X_EXPORT Bool
|
---|
931 | xf86SetDesiredModes(ScrnInfoPtr pScrn);
|
---|
932 |
|
---|
933 | /**
|
---|
934 | * Initialize the CRTC-based cursor code. CRTC function vectors must
|
---|
935 | * contain relevant cursor setting functions.
|
---|
936 | *
|
---|
937 | * Driver should call this from ScreenInit function
|
---|
938 | */
|
---|
939 | extern _X_EXPORT Bool
|
---|
940 | xf86_cursors_init(ScreenPtr screen, int max_width, int max_height, int flags);
|
---|
941 |
|
---|
942 | /**
|
---|
943 | * Called when anything on the screen is reconfigured.
|
---|
944 | *
|
---|
945 | * Reloads cursor images as needed, then adjusts cursor positions.
|
---|
946 | *
|
---|
947 | * Driver should call this from crtc commit function.
|
---|
948 | */
|
---|
949 | extern _X_EXPORT void
|
---|
950 | xf86_reload_cursors(ScreenPtr screen);
|
---|
951 |
|
---|
952 | /**
|
---|
953 | * Called from EnterVT to turn the cursors back on
|
---|
954 | */
|
---|
955 | extern _X_EXPORT void
|
---|
956 | xf86_show_cursors(ScrnInfoPtr scrn);
|
---|
957 |
|
---|
958 | /**
|
---|
959 | * Called by the driver to turn cursors off
|
---|
960 | */
|
---|
961 | extern _X_EXPORT void
|
---|
962 | xf86_hide_cursors(ScrnInfoPtr scrn);
|
---|
963 |
|
---|
964 | /**
|
---|
965 | * Clean up CRTC-based cursor code. Driver must call this at CloseScreen time.
|
---|
966 | */
|
---|
967 | extern _X_EXPORT void
|
---|
968 | xf86_cursors_fini(ScreenPtr screen);
|
---|
969 |
|
---|
970 | /**
|
---|
971 | * Transform the cursor's coordinates based on the crtc transform. Normally
|
---|
972 | * this is done by the server, but if crtc->driverIsPerformingTransform is TRUE,
|
---|
973 | * then the server does not transform the cursor position automatically.
|
---|
974 | */
|
---|
975 | extern _X_EXPORT void
|
---|
976 | xf86CrtcTransformCursorPos(xf86CrtcPtr crtc, int *x, int *y);
|
---|
977 |
|
---|
978 | #ifdef XV
|
---|
979 | /*
|
---|
980 | * For overlay video, compute the relevant CRTC and
|
---|
981 | * clip video to that.
|
---|
982 | * wraps xf86XVClipVideoHelper()
|
---|
983 | */
|
---|
984 |
|
---|
985 | extern _X_EXPORT Bool
|
---|
986 |
|
---|
987 | xf86_crtc_clip_video_helper(ScrnInfoPtr pScrn,
|
---|
988 | xf86CrtcPtr * crtc_ret,
|
---|
989 | xf86CrtcPtr desired_crtc,
|
---|
990 | BoxPtr dst,
|
---|
991 | INT32 *xa,
|
---|
992 | INT32 *xb,
|
---|
993 | INT32 *ya,
|
---|
994 | INT32 *yb,
|
---|
995 | RegionPtr reg, INT32 width, INT32 height);
|
---|
996 | #endif
|
---|
997 |
|
---|
998 | extern _X_EXPORT xf86_crtc_notify_proc_ptr
|
---|
999 | xf86_wrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr new);
|
---|
1000 |
|
---|
1001 | extern _X_EXPORT void
|
---|
1002 | xf86_unwrap_crtc_notify(ScreenPtr pScreen, xf86_crtc_notify_proc_ptr old);
|
---|
1003 |
|
---|
1004 | extern _X_EXPORT void
|
---|
1005 | xf86_crtc_notify(ScreenPtr pScreen);
|
---|
1006 |
|
---|
1007 | /**
|
---|
1008 | * Gamma
|
---|
1009 | */
|
---|
1010 |
|
---|
1011 | extern _X_EXPORT Bool
|
---|
1012 | xf86_crtc_supports_gamma(ScrnInfoPtr pScrn);
|
---|
1013 |
|
---|
1014 | extern _X_EXPORT void
|
---|
1015 | xf86ProviderSetup(ScrnInfoPtr scrn,
|
---|
1016 | const xf86ProviderFuncsRec * funcs, const char *name);
|
---|
1017 |
|
---|
1018 | extern _X_EXPORT void
|
---|
1019 | xf86DetachAllCrtc(ScrnInfoPtr scrn);
|
---|
1020 |
|
---|
1021 | #endif /* _XF86CRTC_H_ */
|
---|