1/*
2 * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License").  You may not use this file except in compliance with the
9 * License.  Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22
23#ifndef _IOKIT_IOGRAPHICSTYPES_H
24#define _IOKIT_IOGRAPHICSTYPES_H
25
26
27#include <IOKit/IOTypes.h>
28#include <IOKit/IOKitKeys.h>
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34#define IOGRAPHICSTYPES_REV     40
35
36typedef SInt32  IOIndex;
37typedef UInt32  IOSelect;
38typedef UInt32  IOFixed1616;
39typedef UInt32  IODisplayVendorID;
40typedef UInt32  IODisplayProductID;
41
42typedef SInt32  IODisplayModeID;
43enum {
44    // This is the ID given to a programmable timing used at boot time
45    kIODisplayModeIDBootProgrammable = (IODisplayModeID)0xFFFFFFFB,
46    // Lowest (unsigned) DisplayModeID reserved by Apple
47    kIODisplayModeIDReservedBase     = (IODisplayModeID)0x80000000
48};
49
50enum {
51    kIOMaxPixelBits     = 64
52};
53typedef char IOPixelEncoding[ kIOMaxPixelBits ];
54
55// Common Apple pixel formats
56
57#define IO1BitIndexedPixels     "P"
58#define IO2BitIndexedPixels     "PP"
59#define IO4BitIndexedPixels     "PPPP"
60#define IO8BitIndexedPixels     "PPPPPPPP"
61#define IO16BitDirectPixels     "-RRRRRGGGGGBBBBB"
62#define IO32BitDirectPixels     "--------RRRRRRRRGGGGGGGGBBBBBBBB"
63
64#define kIO30BitDirectPixels    "--RRRRRRRRRRGGGGGGGGGGBBBBBBBBBB"
65#define kIO64BitDirectPixels    "-16R16G16B16"
66
67#define kIO16BitFloatPixels     "-16FR16FG16FB16"
68#define kIO32BitFloatPixels     "-32FR32FG32FB32"
69
70// other possible pixel formats
71
72#define IOYUV422Pixels          "Y4U2V2"
73#define IO8BitOverlayPixels     "O8"
74// page flipping
75#define IOPagedPixels           "Page1"
76
77#define IO_SampleTypeAlpha      'A'
78#define IO_SampleTypeSkip       '-'
79
80// Info about a pixel format
81enum {
82    kIOCLUTPixels                   = 0,
83    kIOFixedCLUTPixels              = 1,
84    kIORGBDirectPixels              = 2,
85    kIOMonoDirectPixels             = 3,
86    kIOMonoInverseDirectPixels      = 4,
87    kIORGBSignedDirectPixels        = 5,
88    kIORGBSignedFloatingPointPixels = 6
89};
90
91/*!
92 * @struct IOPixelInformation
93 * @abstract A structure defining the format of a framebuffer.
94 * @discussion This structure is used by IOFramebuffer to define the format of the pixels.
95 * @field bytesPerRow The number of bytes per row.
96 * @field bytesPerPlane Not used.
97 * @field bitsPerPixel The number of bits per pixel, including unused bits and alpha.
98 * @field pixelType One of kIOCLUTPixels (indexed pixels with changeable CLUT), kIORGBDirectPixels (direct pixels).
99 * @field componentCount One for indexed pixels, three for direct pixel formats.
100 * @field bitsPerComponent Number of bits per component in each pixel.
101 * @field componentMasks Mask of the bits valid for each component of the pixel - in R, G, B order for direct pixels.
102 * @field pixelFormat String description of the pixel format - IO32BitDirectPixels, IO16BitDirectPixels etc.
103 * @field flags None defined - set to zero.
104 * @field activeWidth Number of pixels visible per row.
105 * @field activeHeight Number of visible pixel rows.
106 * @field reserved Set to zero.
107 */
108
109struct IOPixelInformation {
110    UInt32                      bytesPerRow;
111    UInt32                      bytesPerPlane;
112    UInt32                      bitsPerPixel;
113    UInt32                      pixelType;
114    UInt32                      componentCount;
115    UInt32                      bitsPerComponent;
116    UInt32                      componentMasks[ 8 * 2 ];
117    IOPixelEncoding             pixelFormat;
118    UInt32                      flags;
119    UInt32                      activeWidth;
120    UInt32                      activeHeight;
121    UInt32                      reserved[ 2 ];
122};
123typedef struct IOPixelInformation IOPixelInformation;
124
125// ID for industry standard display timings
126typedef UInt32  IOAppleTimingID;
127
128/*!
129 * @struct IODisplayModeInformation
130 * @abstract A structure defining the format of a framebuffer.
131 * @discussion This structure is used by IOFramebuffer to define the format of the pixels.
132 * @field nominalWidth Number of pixels visible per row.
133 * @field nominalHeight Number of visible pixel rows.
134 * @field refreshRate Refresh rate in fixed point 16.16.
135 * @field maxDepthIndex Highest depth index available in this display mode.
136 * @field flags Flags for the mode, including: <br>
137 *   kDisplayModeInterlacedFlag mode is interlaced. <br>
138 *   kDisplayModeSimulscanFlag mode is available on multiple display connections. <br>
139 *   kDisplayModeNotPresetFlag mode is not a factory preset for the display (geometry may need correction). <br>
140 *   kDisplayModeStretchedFlag mode is stretched/distorted to match the display aspect ratio. <br>
141 * @field imageWidth Physical width of active image if known, in millimeters, otherwise zero. <br>
142 * @field imageHeight Physical height of active image if known, in millimeters, otherwise zero. <br>
143 * @field reserved Set to zero.
144 */
145
146struct IODisplayModeInformation {
147    UInt32                      nominalWidth;
148    UInt32                      nominalHeight;
149    IOFixed1616                 refreshRate;
150    IOIndex                     maxDepthIndex;
151    UInt32                      flags;
152    UInt16						imageWidth;
153    UInt16						imageHeight;
154    UInt32                      reserved[ 3 ];
155};
156typedef struct IODisplayModeInformation IODisplayModeInformation;
157
158// flags
159enum {
160    kDisplayModeSafetyFlags             = 0x00000007,
161
162    kDisplayModeAlwaysShowFlag          = 0x00000008,
163    kDisplayModeNeverShowFlag           = 0x00000080,
164    kDisplayModeNotResizeFlag           = 0x00000010,
165    kDisplayModeRequiresPanFlag         = 0x00000020,
166
167    kDisplayModeInterlacedFlag          = 0x00000040,
168
169    kDisplayModeSimulscanFlag           = 0x00000100,
170    kDisplayModeBuiltInFlag             = 0x00000400,
171    kDisplayModeNotPresetFlag           = 0x00000200,
172    kDisplayModeStretchedFlag           = 0x00000800,
173    kDisplayModeNotGraphicsQualityFlag  = 0x00001000,
174    kDisplayModeValidateAgainstDisplay  = 0x00002000,
175    kDisplayModeTelevisionFlag          = 0x00100000,
176    kDisplayModeValidForMirroringFlag   = 0x00200000,
177    kDisplayModeAcceleratorBackedFlag   = 0x00400000,
178    kDisplayModeValidForHiResFlag       = 0x00800000,
179    kDisplayModeValidForAirPlayFlag     = 0x01000000,
180    kDisplayModeNativeFlag              = 0x02000000
181};
182enum {
183    kDisplayModeValidFlag               = 0x00000001,
184    kDisplayModeSafeFlag                = 0x00000002,
185    kDisplayModeDefaultFlag             = 0x00000004
186};
187
188#ifndef KERNEL
189// Framebuffer info - obsolete
190
191struct IOFramebufferInformation {
192    IOPhysicalAddress           baseAddress;
193    UInt32                      activeWidth;
194    UInt32                      activeHeight;
195    IOByteCount                 bytesPerRow;
196    IOByteCount                 bytesPerPlane;
197    UInt32                      bitsPerPixel;
198    UInt32                      pixelType;
199    UInt32                      flags;
200    UInt32                      reserved[ 4 ];
201};
202typedef struct IOFramebufferInformation IOFramebufferInformation;
203#endif
204
205// flags
206enum {
207    kFramebufferSupportsCopybackCache   = 0x00010000,
208    kFramebufferSupportsWritethruCache  = 0x00020000,
209    kFramebufferSupportsGammaCorrection = 0x00040000,
210    kFramebufferDisableAltivecAccess    = 0x00080000
211};
212
213// Aperture is an index into supported pixel formats for a mode & depth
214typedef IOIndex IOPixelAperture;
215enum {
216    kIOFBSystemAperture = 0
217};
218
219//// CLUTs
220
221typedef UInt16 IOColorComponent;
222
223/*!
224 * @struct IOColorEntry
225 * @abstract A structure defining one entry of a color lookup table.
226 * @discussion This structure is used by IOFramebuffer to define an entry of a color lookup table.
227 * @field index Number of pixels visible per row.
228 * @field red Value of red component 0-65535.
229 * @field green Value of green component 0-65535.
230 * @field blue Value of blue component 0-65535.
231 */
232
233struct IOColorEntry {
234    UInt16                      index;
235    IOColorComponent            red;
236    IOColorComponent            green;
237    IOColorComponent            blue;
238};
239typedef struct IOColorEntry IOColorEntry;
240
241// options (masks)
242enum {
243    kSetCLUTByValue             = 0x00000001,           // else at index
244    kSetCLUTImmediately         = 0x00000002,           // else at VBL
245    kSetCLUTWithLuminance       = 0x00000004            // else RGB
246};
247
248//// Controller attributes
249
250enum {
251    kIOPowerStateAttribute              = 'pwrs',
252    kIOPowerAttribute                   = 'powr',
253    kIODriverPowerAttribute             = 'dpow',
254    kIOHardwareCursorAttribute          = 'crsr',
255
256    kIOMirrorAttribute                  = 'mirr',
257    kIOMirrorDefaultAttribute           = 'mrdf',
258
259    kIOCapturedAttribute                = 'capd',
260
261    kIOCursorControlAttribute           = 'crsc',
262
263    kIOSystemPowerAttribute             = 'spwr',
264    kIOVRAMSaveAttribute                = 'vrsv',
265    kIODeferCLUTSetAttribute            = 'vclt',
266
267    kIOClamshellStateAttribute          = 'clam',
268
269	kIOFBDisplayPortTrainingAttribute   = 'dpta',
270};
271
272// values for kIOMirrorAttribute
273enum {
274    kIOMirrorIsPrimary                  = 0x80000000,
275    kIOMirrorHWClipped                  = 0x40000000,
276    kIOMirrorIsMirrored                 = 0x20000000
277};
278
279// values for kIOMirrorDefaultAttribute
280enum {
281    kIOMirrorDefault                    = 0x00000001,
282    kIOMirrorForced                     = 0x00000002
283};
284
285//// Display mode timing information
286
287struct IODetailedTimingInformationV1 {
288    // from EDID defn
289    UInt32                      pixelClock;             // Hertz
290    UInt32                      horizontalActive;       // pixels
291    UInt32                      horizontalBlanking;     // pixels
292    UInt32                      horizontalBorder;       // pixels
293    UInt32                      horizontalSyncOffset;   // pixels
294    UInt32                      horizontalSyncWidth;    // pixels
295    UInt32                      verticalActive;         // lines
296    UInt32                      verticalBlanking;       // lines
297    UInt32                      verticalBorder;         // lines
298    UInt32                      verticalSyncOffset;     // lines
299    UInt32                      verticalSyncWidth;      // lines
300};
301typedef struct IODetailedTimingInformationV1 IODetailedTimingInformationV1;
302
303/*!
304 * @struct IODetailedTimingInformationV2
305 * @abstract A structure defining the detailed timing information of a display mode.
306 * @discussion This structure is used by IOFramebuffer to define detailed timing information for a display mode. The VESA EDID document has more information.
307 * @field __reservedA Set to zero.
308 * @field horizontalScaledInset If the mode is scaled, sets the number of active pixels to remove the left and right edges in order to display an underscanned image.
309 * @field verticalScaledInset If the mode is scaled, sets the number of active lines to remove the top and bottom edges in order to display an underscanned image.
310 * @field scalerFlags If the mode is scaled,
311 *    kIOScaleStretchToFit may be set to allow stretching.
312 *    kIOScaleRotateFlags is mask which may have the value given by kIOScaleRotate90, kIOScaleRotate180, kIOScaleRotate270 to display a rotated framebuffer.
313 * @field horizontalScaled If the mode is scaled, sets the size of the image before scaling or rotation.
314 * @field verticalScaled If the mode is scaled, sets the size of the image before scaling or rotation.
315 * @field signalConfig
316 *    kIOAnalogSetupExpected set if display expects a blank-to-black setup or pedestal.  See VESA signal standards. <br>
317 *    kIOInterlacedCEATiming set for a CEA style interlaced timing:<br>
318 *      Field 1 vertical blanking = half specified vertical blanking lines. <br>
319 *      Field 2 vertical blanking = (half vertical blanking lines) + 1 line. <br>
320 *      Field 1 vertical offset = half specified vertical sync offset. <br>
321 *      Field 2 vertical offset = (half specified vertical sync offset) + 0.5 lines. <br>
322 * @field signalLevels One of:<br>
323 *   kIOAnalogSignalLevel_0700_0300 0.700 - 0.300 V p-p.<br>
324 *   kIOAnalogSignalLevel_0714_0286 0.714 - 0.286 V p-p.<br>
325 *   kIOAnalogSignalLevel_1000_0400 1.000 - 0.400 V p-p.<br>
326 *   kIOAnalogSignalLevel_0700_0000 0.700 - 0.000 V p-p.<br>
327 * @field pixelClock Pixel clock frequency in Hz.
328 * @field minPixelClock Minimum pixel clock frequency in Hz, with error.
329 * @field maxPixelClock Maximum pixel clock frequency in Hz, with error.
330 * @field horizontalActive Pixel clocks per line.
331 * @field horizontalBlanking Blanking clocks per line.
332 * @field horizontalSyncOffset First clock of horizontal sync.
333 * @field horizontalSyncPulseWidth Width of horizontal sync.
334 * @field verticalActive Number of lines per frame.
335 * @field verticalBlanking Blanking lines per frame.
336 * @field verticalSyncOffset First line of vertical sync.
337 * @field verticalSyncPulseWidth Height of vertical sync.
338 * @field horizontalBorderLeft Number of pixels in left horizontal border.
339 * @field horizontalBorderRight Number of pixels in right horizontal border.
340 * @field verticalBorderTop Number of lines in top vertical border.
341 * @field verticalBorderBottom Number of lines in bottom vertical border.
342 * @field horizontalSyncConfig kIOSyncPositivePolarity for positive polarity horizontal sync (0 for negative).
343 * @field horizontalSyncLevel Zero.
344 * @field verticalSyncConfig kIOSyncPositivePolarity for positive polarity vertical sync (0 for negative).
345 * @field verticalSyncLevel Zero.
346 * @field numLinks number of links to be used by a dual link timing, if zero, assume one link.
347 * @field __reservedB Reserved set to zero.
348 */
349
350struct IODetailedTimingInformationV2 {
351
352    UInt32      __reservedA[3];                 // Init to 0
353    UInt32      horizontalScaledInset;          // pixels
354    UInt32      verticalScaledInset;            // lines
355
356    UInt32      scalerFlags;
357    UInt32      horizontalScaled;
358    UInt32      verticalScaled;
359
360    UInt32      signalConfig;
361    UInt32      signalLevels;
362
363    UInt64      pixelClock;                     // Hz
364
365    UInt64      minPixelClock;                  // Hz - With error what is slowest actual clock
366    UInt64      maxPixelClock;                  // Hz - With error what is fasted actual clock
367
368    UInt32      horizontalActive;               // pixels
369    UInt32      horizontalBlanking;             // pixels
370    UInt32      horizontalSyncOffset;           // pixels
371    UInt32      horizontalSyncPulseWidth;       // pixels
372
373    UInt32      verticalActive;                 // lines
374    UInt32      verticalBlanking;               // lines
375    UInt32      verticalSyncOffset;             // lines
376    UInt32      verticalSyncPulseWidth;         // lines
377
378    UInt32      horizontalBorderLeft;           // pixels
379    UInt32      horizontalBorderRight;          // pixels
380    UInt32      verticalBorderTop;              // lines
381    UInt32      verticalBorderBottom;           // lines
382
383    UInt32      horizontalSyncConfig;
384    UInt32      horizontalSyncLevel;            // Future use (init to 0)
385    UInt32      verticalSyncConfig;
386    UInt32      verticalSyncLevel;              // Future use (init to 0)
387    UInt32      numLinks;
388
389    UInt32      __reservedB[7];                 // Init to 0
390};
391typedef struct IODetailedTimingInformationV2 IODetailedTimingInformationV2;
392typedef struct IODetailedTimingInformationV2 IODetailedTimingInformation;
393
394struct IOTimingInformation {
395    IOAppleTimingID             appleTimingID;  // kIOTimingIDXXX const
396    UInt32                      flags;
397    union {
398      IODetailedTimingInformationV1     v1;
399      IODetailedTimingInformationV2     v2;
400    }                           detailedInfo;
401};
402typedef struct IOTimingInformation IOTimingInformation;
403
404enum {
405    // IOTimingInformation flags
406    kIODetailedTimingValid      = 0x80000000,
407    kIOScalingInfoValid         = 0x40000000
408};
409
410enum {
411    // scalerFlags
412    kIOScaleStretchToFit        = 0x00000001,
413
414    kIOScaleRotateFlags         = 0x000000f0,
415
416    kIOScaleSwapAxes            = 0x00000010,
417    kIOScaleInvertX             = 0x00000020,
418    kIOScaleInvertY             = 0x00000040,
419
420    kIOScaleRotate0             = 0x00000000,
421    kIOScaleRotate90            = kIOScaleSwapAxes | kIOScaleInvertX,
422    kIOScaleRotate180           = kIOScaleInvertX  | kIOScaleInvertY,
423    kIOScaleRotate270           = kIOScaleSwapAxes | kIOScaleInvertY
424};
425
426
427#pragma pack(push, 4)
428struct IOFBDisplayModeDescription {
429    IODisplayModeInformation    info;
430    IOTimingInformation         timingInfo;
431};
432typedef struct IOFBDisplayModeDescription IOFBDisplayModeDescription;
433#pragma pack(pop)
434
435/*!
436 * @struct IODisplayTimingRange
437 * @abstract A structure defining the limits and attributes of a display or framebuffer.
438 * @discussion This structure is used to define the limits for modes programmed as detailed timings by the OS. The VESA EDID is useful background information for many of these fields. A data property with this structure under the key kIOFBTimingRangeKey in a framebuffer will allow the OS to program detailed timings that fall within its range.
439 * @field __reservedA Set to zero.
440 * @field version Set to zero.
441 * @field __reservedB Set to zero.
442 * @field minPixelClock minimum pixel clock frequency in range, in Hz.
443 * @field minPixelClock maximum pixel clock frequency in range, in Hz.
444 * @field maxPixelError largest variation between specified and actual pixel clock frequency, in Hz.
445 * @field supportedSyncFlags mask of supported sync attributes. The following are defined:<br>
446 *    kIORangeSupportsSeparateSyncs - digital separate syncs.<br>
447 *    kIORangeSupportsSyncOnGreen - sync on green.<br>
448 *    kIORangeSupportsCompositeSync - composite sync.<br>
449 *    kIORangeSupportsVSyncSerration - vertical sync has serration and equalization pulses.<br>
450 * @field supportedSignalLevels mask of possible signal levels. The following are defined:<br>
451 *    kIORangeSupportsSignal_0700_0300 0.700 - 0.300 V p-p.<br>
452 *    kIORangeSupportsSignal_0714_0286 0.714 - 0.286 V p-p.<br>
453 *    kIORangeSupportsSignal_1000_0400 1.000 - 0.400 V p-p.<br>
454 *    kIORangeSupportsSignal_0700_0000 0.700 - 0.000 V p-p.<br>
455 * @field supportedSignalConfigs mask of possible signal configurations. The following are defined:<br>
456 *    kIORangeSupportsInterlacedCEATiming Supports CEA style interlaced timing:<br>
457 *      Field 1 vertical blanking = specified vertical blanking lines. <br>
458 *      Field 2 vertical blanking = vertical blanking lines + 1 line. <br>
459 *      Field 1 vertical offset = specified vertical sync offset. <br>
460 *      Field 2 vertical offset = specified vertical sync offset + 0.5 lines. <br>
461 *    kIORangeSupportsInterlacedCEATimingWithConfirm Supports CEA style interlaced timing, but require a confirm.
462 * @field minFrameRate minimum frame rate (vertical refresh frequency) in range, in Hz.
463 * @field maxFrameRate maximum frame rate (vertical refresh frequency) in range, in Hz.
464 * @field minLineRate minimum line rate (horizontal refresh frequency) in range, in Hz.
465 * @field maxLineRate maximum line rate (horizontal refresh frequency) in range, in Hz.
466 * @field maxHorizontalTotal maximum clocks in horizontal line (active + blanking).
467 * @field maxVerticalTotal maximum lines in vertical frame (active + blanking).
468 * @field __reservedD Set to zero.
469 * @field charSizeHorizontalActive horizontalActive must be a multiple of charSizeHorizontalActive.
470 * @field charSizeHorizontalBlanking horizontalBlanking must be a multiple of charSizeHorizontalBlanking.
471 * @field charSizeHorizontalSyncOffset horizontalSyncOffset must be a multiple of charSizeHorizontalSyncOffset.
472 * @field charSizeHorizontalSyncPulse horizontalSyncPulse must be a multiple of charSizeHorizontalSyncPulse.
473 * @field charSizeVerticalActive verticalActive must be a multiple of charSizeVerticalActive.
474 * @field charSizeVerticalBlanking verticalBlanking must be a multiple of charSizeVerticalBlanking.
475 * @field charSizeVerticalSyncOffset verticalSyncOffset must be a multiple of charSizeVerticalSyncOffset.
476 * @field charSizeVerticalSyncPulse verticalSyncPulse must be a multiple of charSizeVerticalSyncPulse.
477 * @field charSizeHorizontalBorderLeft horizontalBorderLeft must be a multiple of charSizeHorizontalBorderLeft.
478 * @field charSizeHorizontalBorderRight horizontalBorderRight must be a multiple of charSizeHorizontalBorderRight.
479 * @field charSizeVerticalBorderTop verticalBorderTop must be a multiple of charSizeVerticalBorderTop.
480 * @field charSizeVerticalBorderBottom verticalBorderBottom must be a multiple of charSizeVerticalBorderBottom.
481 * @field charSizeHorizontalTotal (horizontalActive + horizontalBlanking) must be a multiple of charSizeHorizontalTotal.
482 * @field charSizeVerticalTotal (verticalActive + verticalBlanking) must be a multiple of charSizeVerticalTotal.
483 * @field __reservedE Set to zero.
484 * @field minHorizontalActiveClocks minimum value of horizontalActive.
485 * @field maxHorizontalActiveClocks maximum value of horizontalActive.
486 * @field minHorizontalBlankingClocks minimum value of horizontalBlanking.
487 * @field maxHorizontalBlankingClocks maximum value of horizontalBlanking.
488 * @field minHorizontalSyncOffsetClocks minimum value of horizontalSyncOffset.
489 * @field maxHorizontalSyncOffsetClocks maximum value of horizontalSyncOffset.
490 * @field minHorizontalPulseWidthClocks minimum value of horizontalPulseWidth.
491 * @field maxHorizontalPulseWidthClocks maximum value of horizontalPulseWidth.
492 * @field minVerticalActiveClocks minimum value of verticalActive.
493 * @field maxVerticalActiveClocks maximum value of verticalActive.
494 * @field minVerticalBlankingClocks minimum value of verticalBlanking.
495 * @field maxVerticalBlankingClocks maximum value of verticalBlanking.
496 * @field minVerticalSyncOffsetClocks minimum value of verticalSyncOffset.
497 * @field maxVerticalSyncOffsetClocks maximum value of verticalSyncOffset.
498 * @field minVerticalPulseWidthClocks minimum value of verticalPulseWidth.
499 * @field maxVerticalPulseWidthClocks maximum value of verticalPulseWidth.
500 * @field minHorizontalBorderLeft minimum value of horizontalBorderLeft.
501 * @field maxHorizontalBorderLeft maximum value of horizontalBorderLeft.
502 * @field minHorizontalBorderRight minimum value of horizontalBorderRight.
503 * @field maxHorizontalBorderRight maximum value of horizontalBorderRight.
504 * @field minVerticalBorderTop minimum value of verticalBorderTop.
505 * @field maxVerticalBorderTop maximum value of verticalBorderTop.
506 * @field minVerticalBorderBottom minimum value of verticalBorderBottom.
507 * @field maxVerticalBorderBottom maximum value of verticalBorderBottom.
508 * @field maxNumLinks number of links supported, if zero, 1 link is assumed.
509 * @field minLink0PixelClock minimum pixel clock for link 0 (kHz).
510 * @field maxLink0PixelClock maximum pixel clock for link 0 (kHz).
511 * @field minLink1PixelClock minimum pixel clock for link 1 (kHz).
512 * @field maxLink1PixelClock maximum pixel clock for link 1 (kHz).
513 * @field __reservedF Set to zero.
514 */
515
516struct IODisplayTimingRange
517{
518    UInt32      __reservedA[2];                 // Init to 0
519    UInt32      version;                        // Init to 0
520    UInt32      __reservedB[5];                 // Init to 0
521
522    UInt64      minPixelClock;                  // Min dot clock in Hz
523    UInt64      maxPixelClock;                  // Max dot clock in Hz
524
525    UInt32      maxPixelError;                  // Max dot clock error
526    UInt32      supportedSyncFlags;
527    UInt32      supportedSignalLevels;
528    UInt32      supportedSignalConfigs;
529
530    UInt32      minFrameRate;                   // Hz
531    UInt32      maxFrameRate;                   // Hz
532    UInt32      minLineRate;                    // Hz
533    UInt32      maxLineRate;                    // Hz
534
535    UInt32      maxHorizontalTotal;             // Clocks - Maximum total (active + blanking)
536    UInt32      maxVerticalTotal;               // Clocks - Maximum total (active + blanking)
537    UInt32      __reservedD[2];                 // Init to 0
538
539    UInt8       charSizeHorizontalActive;
540    UInt8       charSizeHorizontalBlanking;
541    UInt8       charSizeHorizontalSyncOffset;
542    UInt8       charSizeHorizontalSyncPulse;
543
544    UInt8       charSizeVerticalActive;
545    UInt8       charSizeVerticalBlanking;
546    UInt8       charSizeVerticalSyncOffset;
547    UInt8       charSizeVerticalSyncPulse;
548
549    UInt8       charSizeHorizontalBorderLeft;
550    UInt8       charSizeHorizontalBorderRight;
551    UInt8       charSizeVerticalBorderTop;
552    UInt8       charSizeVerticalBorderBottom;
553
554    UInt8       charSizeHorizontalTotal;                // Character size for active + blanking
555    UInt8       charSizeVerticalTotal;                  // Character size for active + blanking
556    UInt16      __reservedE;                            // Reserved (Init to 0)
557
558    UInt32      minHorizontalActiveClocks;
559    UInt32      maxHorizontalActiveClocks;
560    UInt32      minHorizontalBlankingClocks;
561    UInt32      maxHorizontalBlankingClocks;
562
563    UInt32      minHorizontalSyncOffsetClocks;
564    UInt32      maxHorizontalSyncOffsetClocks;
565    UInt32      minHorizontalPulseWidthClocks;
566    UInt32      maxHorizontalPulseWidthClocks;
567
568    UInt32      minVerticalActiveClocks;
569    UInt32      maxVerticalActiveClocks;
570    UInt32      minVerticalBlankingClocks;
571    UInt32      maxVerticalBlankingClocks;
572
573    UInt32      minVerticalSyncOffsetClocks;
574    UInt32      maxVerticalSyncOffsetClocks;
575    UInt32      minVerticalPulseWidthClocks;
576    UInt32      maxVerticalPulseWidthClocks;
577
578    UInt32      minHorizontalBorderLeft;
579    UInt32      maxHorizontalBorderLeft;
580    UInt32      minHorizontalBorderRight;
581    UInt32      maxHorizontalBorderRight;
582
583    UInt32      minVerticalBorderTop;
584    UInt32      maxVerticalBorderTop;
585    UInt32      minVerticalBorderBottom;
586    UInt32      maxVerticalBorderBottom;
587    UInt32      maxNumLinks;                       // number of links, if zero, assume link 1
588    UInt32      minLink0PixelClock;                // min pixel clock for link 0 (kHz)
589    UInt32      maxLink0PixelClock;                // max pixel clock for link 0 (kHz)
590    UInt32      minLink1PixelClock;                // min pixel clock for link 1 (kHz)
591    UInt32      maxLink1PixelClock;                // max pixel clock for link 1 (kHz)
592
593    UInt32      __reservedF[3];                 // Init to 0
594};
595typedef struct IODisplayTimingRange  IODisplayTimingRange;
596
597enum {
598    // supportedSignalLevels
599    kIORangeSupportsSignal_0700_0300    = 0x00000001,
600    kIORangeSupportsSignal_0714_0286    = 0x00000002,
601    kIORangeSupportsSignal_1000_0400    = 0x00000004,
602    kIORangeSupportsSignal_0700_0000    = 0x00000008
603};
604enum {
605    // supportedSyncFlags
606    kIORangeSupportsSeparateSyncs        = 0x00000001,
607    kIORangeSupportsSyncOnGreen          = 0x00000002,
608    kIORangeSupportsCompositeSync        = 0x00000004,
609    kIORangeSupportsVSyncSerration       = 0x00000008
610};
611enum {
612    // supportedSignalConfigs
613    kIORangeSupportsInterlacedCEATiming            = 0x00000004,
614    kIORangeSupportsInterlacedCEATimingWithConfirm = 0x00000008
615};
616
617enum {
618    // signalConfig
619    kIODigitalSignal          = 0x00000001,
620    kIOAnalogSetupExpected    = 0x00000002,
621    kIOInterlacedCEATiming    = 0x00000004,
622    kIONTSCTiming             = 0x00000008,
623    kIOPALTiming              = 0x00000010
624};
625
626enum {
627    // signalLevels for analog
628    kIOAnalogSignalLevel_0700_0300 = 0,
629    kIOAnalogSignalLevel_0714_0286 = 1,
630    kIOAnalogSignalLevel_1000_0400 = 2,
631    kIOAnalogSignalLevel_0700_0000 = 3
632};
633
634enum {
635    // horizontalSyncConfig and verticalSyncConfig
636    kIOSyncPositivePolarity     = 0x00000001
637};
638
639/*!
640 * @struct IODisplayScalerInformation
641 * @abstract A structure defining the scaling capabilities of a framebuffer.
642 * @discussion This structure is used to define the limits for modes programmed as detailed timings by the OS. A data property with this structure under the key kIOFBScalerInfoKey in a framebuffer will allow the OS to program detailed timings that are scaled to a displays native resolution.
643 * @field __reservedA Set to zero.
644 * @field version Set to zero.
645 * @field __reservedB Set to zero.
646 * @field scalerFeatures Mask of scaling features. The following are defined:<br>
647 *   kIOScaleStretchOnly If set the framebuffer can only provide stretched scaling with non-square pixels, without borders.<br>
648 *   kIOScaleCanUpSamplePixels If set framebuffer can scale up from a smaller number of source pixels to a larger native timing (eg. 640x480 pixels on a 1600x1200 timing).<br>
649 *   kIOScaleCanDownSamplePixels If set framebuffer can scale down from a larger number of source pixels to a smaller native timing (eg. 1600x1200 pixels on a 640x480 timing).<br>
650 *   kIOScaleCanScaleInterlaced If set framebuffer can scale an interlaced detailed timing.<br>
651 *   kIOScaleCanSupportInset If set framebuffer can support scaled modes with non-zero horizontalScaledInset, verticalScaledInset fields.<br>
652 *   kIOScaleCanRotate If set framebuffer can support some of the flags in the kIOScaleRotateFlags mask.<br>
653 *   kIOScaleCanBorderInsetOnly If set framebuffer can support scaled modes with non-zero horizontalScaledInset, verticalScaledInset fields, but requires the active pixels to be equal in size to the inset area, ie. can do insets with a border versus scaling an image.<br>
654 * @field maxHorizontalPixels Maximum number of horizontal source pixels (horizontalScaled).<br>
655 * @field maxVerticalPixels Maximum number of vertical source pixels (verticalScaled).<br>
656 * @field __reservedC Set to zero.
657 */
658
659struct IODisplayScalerInformation {
660    UInt32              __reservedA[1];         // Init to 0
661    UInt32              version;                // Init to 0
662    UInt32              __reservedB[2];         // Init to 0
663
664    IOOptionBits        scalerFeatures;
665    UInt32              maxHorizontalPixels;
666    UInt32              maxVerticalPixels;
667    UInt32              __reservedC[5];         // Init to 0
668};
669typedef struct IODisplayScalerInformation IODisplayScalerInformation;
670
671enum {
672    /* scalerFeatures */
673    kIOScaleStretchOnly           = 0x00000001,
674    kIOScaleCanUpSamplePixels     = 0x00000002,
675    kIOScaleCanDownSamplePixels   = 0x00000004,
676    kIOScaleCanScaleInterlaced    = 0x00000008,
677    kIOScaleCanSupportInset       = 0x00000010,
678    kIOScaleCanRotate             = 0x00000020,
679    kIOScaleCanBorderInsetOnly    = 0x00000040
680};
681
682//// Connections
683
684enum {
685    kOrConnections                      = 0xffffffe,
686    kAndConnections                     = 0xffffffd
687};
688
689enum {
690    kConnectionFlags                    = 'flgs',
691    kConnectionSyncEnable               = 'sync',
692    kConnectionSyncFlags                = 'sycf',
693    kConnectionSupportsAppleSense       = 'asns',
694    kConnectionSupportsLLDDCSense       = 'lddc',
695    kConnectionSupportsHLDDCSense       = 'hddc',
696    kConnectionEnable                   = 'enab',
697    kConnectionCheckEnable              = 'cena',
698    kConnectionProbe                    = 'prob',
699    kConnectionChanged                  = 'chng',
700    kConnectionPower                    = 'powr',
701    kConnectionPostWake                 = 'pwak',
702    kConnectionDisplayParameterCount    = 'pcnt',
703    kConnectionDisplayParameters        = 'parm',
704    kConnectionOverscan                 = 'oscn',
705    kConnectionVideoBest                = 'vbst',
706
707    kConnectionRedGammaScale            = 'rgsc',
708    kConnectionGreenGammaScale          = 'ggsc',
709    kConnectionBlueGammaScale           = 'bgsc',
710    kConnectionGammaScale               = 'gsc ',
711    kConnectionFlushParameters          = 'flus',
712
713    kConnectionHandleDisplayPortEvent   = 'dpir',
714
715    kConnectionPanelTimingDisable       = 'pnlt',
716
717    kConnectionColorMode                = 'cyuv',
718    kConnectionColorModesSupported      = 'colr',
719    kConnectionColorDepthsSupported     = ' bpc',
720
721    kConnectionControllerDepthsSupported = '\0grd',
722    kConnectionControllerColorDepth      = '\0dpd',
723    kConnectionControllerDitherControl   = '\0gdc',
724
725    kConnectionDisplayFlags              = 'dflg',
726
727    kConnectionEnableAudio               = 'aud ',
728    kConnectionAudioStreaming            = 'auds',
729};
730
731// kConnectionFlags values
732enum {
733    kIOConnectionBuiltIn                = 0x00000800,
734    kIOConnectionStereoSync             = 0x00008000
735};
736
737// kConnectionSyncControl values
738enum {
739    kIOHSyncDisable                     = 0x00000001,
740    kIOVSyncDisable                     = 0x00000002,
741    kIOCSyncDisable                     = 0x00000004,
742    kIONoSeparateSyncControl            = 0x00000040,
743    kIOTriStateSyncs                    = 0x00000080,
744    kIOSyncOnBlue                       = 0x00000008,
745    kIOSyncOnGreen                      = 0x00000010,
746    kIOSyncOnRed                        = 0x00000020
747};
748
749// kConnectionHandleDisplayPortEvent values
750enum {
751    kIODPEventStart                             = 1,
752    kIODPEventIdle                              = 2,
753
754    kIODPEventForceRetrain                      = 3,
755
756    kIODPEventRemoteControlCommandPending       = 256,
757    kIODPEventAutomatedTestRequest              = 257,
758    kIODPEventContentProtection                 = 258,
759    kIODPEventMCCS                              = 259,
760    kIODPEventSinkSpecific                      = 260
761};
762
763#define kIODisplayAttributesKey         "IODisplayAttributes"
764
765#define kIODisplaySupportsUnderscanKey  "IODisplaySupportsUnderscan"
766#define kIODisplaySupportsBasicAudioKey "IODisplaySupportsBasicAudio"
767#define kIODisplaySupportsYCbCr444Key   "IODisplaySupportsYCbCr444"
768#define kIODisplaySupportsYCbCr422Key   "IODisplaySupportsYCbCr422"
769#define kIODisplaySelectedColorModeKey  "cmod"
770
771enum
772{
773    kIODisplayColorMode         = kConnectionColorMode,
774};
775
776#if 0
777enum
778{
779    // kConnectionColorMode attribute
780    kIODisplayColorModeReserved   = 0x00000000,
781    kIODisplayColorModeRGB        = 0x00000001,
782    kIODisplayColorModeYCbCr422   = 0x00000010,
783    kIODisplayColorModeYCbCr444   = 0x00000100,
784    kIODisplayColorModeRGBLimited = 0x00001000,
785    kIODisplayColorModeAuto       = 0x10000000,
786};
787#endif
788
789enum
790{
791    // kConnectionColorDepthsSupported attribute
792    kIODisplayRGBColorComponentBitsUnknown       = 0x00000000,
793    kIODisplayRGBColorComponentBits6             = 0x00000001,
794    kIODisplayRGBColorComponentBits8             = 0x00000002,
795    kIODisplayRGBColorComponentBits10            = 0x00000004,
796    kIODisplayRGBColorComponentBits12            = 0x00000008,
797    kIODisplayRGBColorComponentBits14            = 0x00000010,
798    kIODisplayRGBColorComponentBits16            = 0x00000020,
799
800    kIODisplayYCbCr444ColorComponentBitsUnknown  = 0x00000000,
801    kIODisplayYCbCr444ColorComponentBits6        = 0x00000100,
802    kIODisplayYCbCr444ColorComponentBits8        = 0x00000200,
803    kIODisplayYCbCr444ColorComponentBits10       = 0x00000400,
804    kIODisplayYCbCr444ColorComponentBits12       = 0x00000800,
805    kIODisplayYCbCr444ColorComponentBits14       = 0x00001000,
806    kIODisplayYCbCr444ColorComponentBits16       = 0x00002000,
807
808    kIODisplayYCbCr422ColorComponentBitsUnknown  = 0x00000000,
809    kIODisplayYCbCr422ColorComponentBits6        = 0x00010000,
810    kIODisplayYCbCr422ColorComponentBits8        = 0x00020000,
811    kIODisplayYCbCr422ColorComponentBits10       = 0x00040000,
812    kIODisplayYCbCr422ColorComponentBits12       = 0x00080000,
813    kIODisplayYCbCr422ColorComponentBits14       = 0x00100000,
814    kIODisplayYCbCr422ColorComponentBits16       = 0x00200000,
815};
816
817enum
818{
819    // kConnectionDitherControl attribute
820    kIODisplayDitherDisable          = 0x00000000,
821    kIODisplayDitherSpatial          = 0x00000001,
822    kIODisplayDitherTemporal         = 0x00000002,
823    kIODisplayDitherFrameRateControl = 0x00000004,
824    kIODisplayDitherDefault          = 0x00000080,
825    kIODisplayDitherAll              = 0x000000FF,
826    kIODisplayDitherRGBShift         = 0,
827    kIODisplayDitherYCbCr444Shift    = 8,
828    kIODisplayDitherYCbCr422Shift    = 16,
829};
830
831enum
832{
833    // kConnectionDisplayFlags attribute
834    kIODisplayNeedsCEAUnderscan      = 0x00000001,
835};
836
837enum
838{
839	kIODisplayPowerStateOff       =	0,
840	kIODisplayPowerStateMinUsable =	1,
841	kIODisplayPowerStateOn        = 2,
842};
843
844#define IO_DISPLAY_CAN_FILL             0x00000040
845#define IO_DISPLAY_CAN_BLIT             0x00000020
846
847#define IO_24BPP_TRANSFER_TABLE_SIZE    256
848#define IO_15BPP_TRANSFER_TABLE_SIZE    256
849#define IO_8BPP_TRANSFER_TABLE_SIZE     256
850#define IO_12BPP_TRANSFER_TABLE_SIZE    256
851#define IO_2BPP_TRANSFER_TABLE_SIZE     256
852
853#define STDFB_BM256_TO_BM38_MAP_SIZE    256
854#define STDFB_BM38_TO_BM256_MAP_SIZE    256
855#define STDFB_BM38_TO_256_WITH_LOGICAL_SIZE     \
856        (STDFB_BM38_TO_BM256_MAP_SIZE + (256/sizeof(int)))
857
858#define STDFB_4BPS_TO_5BPS_MAP_SIZE     16
859#define STDFB_5BPS_TO_4BPS_MAP_SIZE     32
860
861enum {
862    // connection types for IOServiceOpen
863    kIOFBServerConnectType              = 0,
864    kIOFBSharedConnectType              = 1
865};
866
867enum {
868    // options for IOServiceRequestProbe()
869    kIOFBUserRequestProbe               = 0x00000001
870};
871
872struct IOGPoint {
873    SInt16      x;
874    SInt16      y;
875};
876typedef struct IOGPoint IOGPoint;
877
878struct IOGSize {
879    SInt16      width;
880    SInt16      height;
881};
882typedef struct IOGSize IOGSize;
883
884struct IOGBounds {
885    SInt16      minx;
886    SInt16      maxx;
887    SInt16      miny;
888    SInt16      maxy;
889};
890typedef struct IOGBounds IOGBounds;
891
892#ifndef kIODescriptionKey
893
894#if !defined(__Point__) && !defined(BINTREE_H) && !defined(__MACTYPES__)
895#define __Point__
896typedef IOGPoint Point;
897#endif
898
899#if !defined(__Bounds__) && !defined(BINTREE_H) && !defined(__MACTYPES__)
900#define __Bounds__
901typedef IOGBounds Bounds;
902#endif
903
904#endif /* !kIODescriptionKey */
905
906// cursor description
907
908enum {
909   kTransparentEncoding         = 0,
910   kInvertingEncoding
911};
912
913enum {
914   kTransparentEncodingShift    = (kTransparentEncoding << 1),
915   kTransparentEncodedPixel     = (0x01 << kTransparentEncodingShift),
916
917   kInvertingEncodingShift      = (kInvertingEncoding << 1),
918   kInvertingEncodedPixel       = (0x01 << kInvertingEncodingShift)
919};
920
921enum {
922   kHardwareCursorDescriptorMajorVersion        = 0x0001,
923   kHardwareCursorDescriptorMinorVersion        = 0x0000
924};
925
926/*!
927 * @struct IOHardwareCursorDescriptor
928 * @abstract A structure defining the format of a hardware cursor.
929 * @discussion This structure is used by IOFramebuffer to define the format of a hardware cursor.
930 * @field majorVersion Set to kHardwareCursorDescriptorMajorVersion.
931 * @field minorVersion Set to kHardwareCursorDescriptorMinorVersion.
932 * @field height Maximum size of the cursor.
933 * @field width Maximum size of the cursor.
934 * @field bitDepth Number bits per pixel, or a QD/QT pixel type, for example kIO8IndexedPixelFormat, kIO32ARGBPixelFormat.
935 * @field maskBitDepth Unused.
936 * @field numColors Number of colors for indexed pixel types.
937 * @field colorEncodings An array pointer specifying the pixel values corresponding to the indices into the color table, for indexed pixel types.
938 * @field flags None defined, set to zero.
939 * @field supportedSpecialEncodings Mask of supported special pixel values, eg. kTransparentEncodedPixel, kInvertingEncodedPixel.
940 * @field specialEncodings Array of pixel values for each supported special encoding.
941 */
942
943struct IOHardwareCursorDescriptor {
944   UInt16               majorVersion;
945   UInt16               minorVersion;
946   UInt32               height;
947   UInt32               width;
948   UInt32               bitDepth;                       // bits per pixel, or a QD/QT pixel type
949   UInt32               maskBitDepth;                   // unused
950   UInt32               numColors;                      // number of colors in the colorMap. ie.
951   UInt32 *             colorEncodings;
952   UInt32               flags;
953   UInt32               supportedSpecialEncodings;
954   UInt32               specialEncodings[16];
955};
956typedef struct IOHardwareCursorDescriptor IOHardwareCursorDescriptor;
957
958enum {
959   kHardwareCursorInfoMajorVersion              = 0x0001,
960   kHardwareCursorInfoMinorVersion              = 0x0000
961};
962
963/*!
964 * @struct IOHardwareCursorInfo
965 * @abstract A structure defining the converted data of a hardware cursor.
966 * @discussion This structure is used by IOFramebuffer to return the data of a hardware cursor by convertCursorImage() after conversion based on the IOHardwareCursorDescriptor passed to that routine.
967 * @field majorVersion Set to kHardwareCursorInfoMajorVersion.
968 * @field minorVersion Set to kHardwareCursorInfoMinorVersion.
969 * @field cursorHeight The actual size of the cursor is returned.
970 * @field cursorWidth The actual size of the cursor is returned.
971 * @field colorMap Pointer to array of IOColorEntry structures, with the number of elements set by the numColors field of the IOHardwareCursorDescriptor. Zero should be passed for direct pixel formats.
972 * @field hardwareCursorData Buffer to receive the converted cursor data.
973 * @field cursorHotSpotX Cursor's hotspot.
974 * @field cursorHotSpotY Cursor's hotspot.
975 * @field reserved Reserved, set to zero.
976 */
977
978struct IOHardwareCursorInfo {
979   UInt16               majorVersion;
980   UInt16               minorVersion;
981   UInt32               cursorHeight;
982   UInt32               cursorWidth;
983   // nil or big enough for hardware's max colors
984   IOColorEntry *       colorMap;
985   UInt8 *              hardwareCursorData;
986   UInt16               cursorHotSpotX;
987   UInt16               cursorHotSpotY;
988   UInt32               reserved[5];
989};
990typedef struct IOHardwareCursorInfo IOHardwareCursorInfo;
991
992// interrupt types
993
994enum {
995    kIOFBVBLInterruptType               = 'vbl ',
996    kIOFBHBLInterruptType               = 'hbl ',
997    kIOFBFrameInterruptType             = 'fram',
998    // Demand to check configuration (Hardware unchanged)
999    kIOFBConnectInterruptType           = 'dci ',
1000    // Demand to rebuild (Hardware has reinitialized on dependent change)
1001    kIOFBChangedInterruptType           = 'chng',
1002    // Demand to remove framebuffer (Hardware not available on dependent change -- but must not buserror)
1003    kIOFBOfflineInterruptType           = 'remv',
1004    // Notice that hardware is available (after being removed)
1005    kIOFBOnlineInterruptType            = 'add ',
1006    // DisplayPort short pulse
1007    kIOFBDisplayPortInterruptType           = 'dpir',
1008    // DisplayPort link event
1009    kIOFBDisplayPortLinkChangeInterruptType = 'dplk',
1010    // MCCS
1011    kIOFBMCCSInterruptType                  = 'mccs',
1012    // early vram notification
1013    kIOFBWakeInterruptType                  = 'vwak'
1014};
1015
1016// IOAppleTimingID's
1017enum {
1018    kIOTimingIDInvalid               = 0,       /*  Not a standard timing */
1019    kIOTimingIDApple_FixedRateLCD    = 42,      /*  Lump all fixed-rate LCDs into one category.*/
1020    kIOTimingIDApple_512x384_60hz    = 130,     /*  512x384  (60 Hz) Rubik timing. */
1021    kIOTimingIDApple_560x384_60hz    = 135,     /*  560x384  (60 Hz) Rubik-560 timing. */
1022    kIOTimingIDApple_640x480_67hz    = 140,     /*  640x480  (67 Hz) HR timing. */
1023    kIOTimingIDApple_640x400_67hz    = 145,     /*  640x400  (67 Hz) HR-400 timing. */
1024    kIOTimingIDVESA_640x480_60hz     = 150,     /*  640x480  (60 Hz) VGA timing. */
1025    kIOTimingIDVESA_640x480_72hz     = 152,     /*  640x480  (72 Hz) VGA timing. */
1026    kIOTimingIDVESA_640x480_75hz     = 154,     /*  640x480  (75 Hz) VGA timing. */
1027    kIOTimingIDVESA_640x480_85hz     = 158,     /*  640x480  (85 Hz) VGA timing. */
1028    kIOTimingIDGTF_640x480_120hz     = 159,     /*  640x480  (120 Hz) VESA Generalized Timing Formula */
1029    kIOTimingIDApple_640x870_75hz    = 160,     /*  640x870  (75 Hz) FPD timing.*/
1030    kIOTimingIDApple_640x818_75hz    = 165,     /*  640x818  (75 Hz) FPD-818 timing.*/
1031    kIOTimingIDApple_832x624_75hz    = 170,     /*  832x624  (75 Hz) GoldFish timing.*/
1032    kIOTimingIDVESA_800x600_56hz     = 180,     /*  800x600  (56 Hz) SVGA timing. */
1033    kIOTimingIDVESA_800x600_60hz     = 182,     /*  800x600  (60 Hz) SVGA timing. */
1034    kIOTimingIDVESA_800x600_72hz     = 184,     /*  800x600  (72 Hz) SVGA timing. */
1035    kIOTimingIDVESA_800x600_75hz     = 186,     /*  800x600  (75 Hz) SVGA timing. */
1036    kIOTimingIDVESA_800x600_85hz     = 188,     /*  800x600  (85 Hz) SVGA timing. */
1037    kIOTimingIDVESA_1024x768_60hz    = 190,     /* 1024x768  (60 Hz) VESA 1K-60Hz timing. */
1038    kIOTimingIDVESA_1024x768_70hz    = 200,     /* 1024x768  (70 Hz) VESA 1K-70Hz timing. */
1039    kIOTimingIDVESA_1024x768_75hz    = 204,     /* 1024x768  (75 Hz) VESA 1K-75Hz timing (very similar to kIOTimingIDApple_1024x768_75hz). */
1040    kIOTimingIDVESA_1024x768_85hz    = 208,     /* 1024x768  (85 Hz) VESA timing. */
1041    kIOTimingIDApple_1024x768_75hz   = 210,     /* 1024x768  (75 Hz) Apple 19" RGB. */
1042    kIOTimingIDVESA_1152x864_75hz    = 215,     /* 1152x864  (75 Hz) VESA timing. */
1043    kIOTimingIDApple_1152x870_75hz   = 220,     /* 1152x870  (75 Hz) Apple 21" RGB. */
1044    kIOTimingIDAppleNTSC_ST          = 230,     /*  512x384  (60 Hz, interlaced, non-convolved). */
1045    kIOTimingIDAppleNTSC_FF          = 232,     /*  640x480  (60 Hz, interlaced, non-convolved). */
1046    kIOTimingIDAppleNTSC_STconv      = 234,     /*  512x384  (60 Hz, interlaced, convolved). */
1047    kIOTimingIDAppleNTSC_FFconv      = 236,     /*  640x480  (60 Hz, interlaced, convolved). */
1048    kIOTimingIDApplePAL_ST           = 238,     /*  640x480  (50 Hz, interlaced, non-convolved). */
1049    kIOTimingIDApplePAL_FF           = 240,     /*  768x576  (50 Hz, interlaced, non-convolved). */
1050    kIOTimingIDApplePAL_STconv       = 242,     /*  640x480  (50 Hz, interlaced, convolved). */
1051    kIOTimingIDApplePAL_FFconv       = 244,     /*  768x576  (50 Hz, interlaced, convolved). */
1052    kIOTimingIDVESA_1280x960_75hz    = 250,     /* 1280x960  (75 Hz) */
1053    kIOTimingIDVESA_1280x960_60hz    = 252,     /* 1280x960  (60 Hz) */
1054    kIOTimingIDVESA_1280x960_85hz    = 254,     /* 1280x960  (85 Hz) */
1055    kIOTimingIDVESA_1280x1024_60hz   = 260,     /* 1280x1024 (60 Hz) */
1056    kIOTimingIDVESA_1280x1024_75hz   = 262,     /* 1280x1024 (75 Hz) */
1057    kIOTimingIDVESA_1280x1024_85hz   = 268,     /* 1280x1024 (85 Hz) */
1058    kIOTimingIDVESA_1600x1200_60hz   = 280,     /* 1600x1200 (60 Hz) VESA timing. */
1059    kIOTimingIDVESA_1600x1200_65hz   = 282,     /* 1600x1200 (65 Hz) VESA timing. */
1060    kIOTimingIDVESA_1600x1200_70hz   = 284,     /* 1600x1200 (70 Hz) VESA timing. */
1061    kIOTimingIDVESA_1600x1200_75hz   = 286,     /* 1600x1200 (75 Hz) VESA timing (pixel clock is 189.2 Mhz dot clock). */
1062    kIOTimingIDVESA_1600x1200_80hz   = 288,     /* 1600x1200 (80 Hz) VESA timing (pixel clock is 216>? Mhz dot clock) - proposed only. */
1063    kIOTimingIDVESA_1600x1200_85hz   = 289,     /* 1600x1200 (85 Hz) VESA timing (pixel clock is 229.5 Mhz dot clock). */
1064    kIOTimingIDVESA_1792x1344_60hz   = 296,     /* 1792x1344 (60 Hz) VESA timing (204.75 Mhz dot clock). */
1065    kIOTimingIDVESA_1792x1344_75hz   = 298,     /* 1792x1344 (75 Hz) VESA timing (261.75 Mhz dot clock). */
1066    kIOTimingIDVESA_1856x1392_60hz   = 300,     /* 1856x1392 (60 Hz) VESA timing (218.25 Mhz dot clock). */
1067    kIOTimingIDVESA_1856x1392_75hz   = 302,     /* 1856x1392 (75 Hz) VESA timing (288 Mhz dot clock). */
1068    kIOTimingIDVESA_1920x1440_60hz   = 304,     /* 1920x1440 (60 Hz) VESA timing (234 Mhz dot clock). */
1069    kIOTimingIDVESA_1920x1440_75hz   = 306,     /* 1920x1440 (75 Hz) VESA timing (297 Mhz dot clock). */
1070    kIOTimingIDSMPTE240M_60hz        = 400,     /* 60Hz V, 33.75KHz H, interlaced timing, 16:9 aspect, typical resolution of 1920x1035. */
1071    kIOTimingIDFilmRate_48hz         = 410,     /* 48Hz V, 25.20KHz H, non-interlaced timing, typical resolution of 640x480. */
1072    kIOTimingIDSony_1600x1024_76hz   = 500,     /* 1600x1024 (76 Hz) Sony timing (pixel clock is 170.447 Mhz dot clock). */
1073    kIOTimingIDSony_1920x1080_60hz   = 510,     /* 1920x1080 (60 Hz) Sony timing (pixel clock is 159.84 Mhz dot clock). */
1074    kIOTimingIDSony_1920x1080_72hz   = 520,     /* 1920x1080 (72 Hz) Sony timing (pixel clock is 216.023 Mhz dot clock). */
1075    kIOTimingIDSony_1920x1200_76hz   = 540,     /* 1900x1200 (76 Hz) Sony timing (pixel clock is 243.20 Mhz dot clock). */
1076    kIOTimingIDApple_0x0_0hz_Offline = 550,     /* Indicates that this timing will take the display off-line and remove it from the system. */
1077    kIOTimingIDVESA_848x480_60hz     = 570,     /*  848x480 (60 Hz)  VESA timing. */
1078    kIOTimingIDVESA_1360x768_60hz    = 590      /* 1360x768 (60 Hz)  VESA timing. */
1079};
1080
1081// framebuffer property keys
1082
1083#define kIOFramebufferInfoKey           "IOFramebufferInformation"
1084
1085#define kIOFBWidthKey                   "IOFBWidth"
1086#define kIOFBHeightKey                  "IOFBHeight"
1087#define kIOFBRefreshRateKey             "IOFBRefreshRate"
1088#define kIOFBFlagsKey                   "IOFBFlags"
1089#define kIOFBBytesPerRowKey             "IOFBBytesPerRow"
1090#define kIOFBBytesPerPlaneKey           "IOFBBytesPerPlane"
1091#define kIOFBBitsPerPixelKey            "IOFBBitsPerPixel"
1092#define kIOFBComponentCountKey          "IOFBComponentCount"
1093#define kIOFBBitsPerComponentKey        "IOFBBitsPerComponent"
1094
1095#define kIOFBDetailedTimingsKey         "IOFBDetailedTimings"
1096#define kIOFBTimingRangeKey             "IOFBTimingRange"
1097#define kIOFBScalerInfoKey              "IOFBScalerInfo"
1098#define kIOFBCursorInfoKey              "IOFBCursorInfo"
1099#define kIOFBHDMIDongleROMKey           "IOFBHDMIDongleROM"
1100
1101#define kIOFBHostAccessFlagsKey         "IOFBHostAccessFlags"
1102
1103#define kIOFBMemorySizeKey              "IOFBMemorySize"
1104
1105#define kIOFBNeedsRefreshKey            "IOFBNeedsRefresh"
1106
1107#define kIOFBProbeOptionsKey            "IOFBProbeOptions"
1108
1109#define kIOFBGammaWidthKey              "IOFBGammaWidth"
1110#define kIOFBGammaCountKey              "IOFBGammaCount"
1111#define kIOFBCLUTDeferKey               "IOFBCLUTDefer"
1112
1113#define kIOFBDisplayPortConfigurationDataKey    "dpcd-registers"
1114
1115// exists on the hibernate progress display device
1116#ifndef kIOHibernatePreviewActiveKey
1117#define kIOHibernatePreviewActiveKey    "IOHibernatePreviewActive"
1118// values for kIOHibernatePreviewActiveKey set by driver
1119enum {
1120    kIOHibernatePreviewActive  = 0x00000001,
1121    kIOHibernatePreviewUpdates = 0x00000002
1122};
1123#endif
1124
1125#define kIOHibernateEFIGfxStatusKey    "IOHibernateEFIGfxStatus"
1126
1127// CFNumber/CFData
1128#define kIOFBAVSignalTypeKey            "av-signal-type"
1129enum {
1130    kIOFBAVSignalTypeUnknown = 0x00000000,
1131    kIOFBAVSignalTypeVGA     = 0x00000001,
1132    kIOFBAVSignalTypeDVI     = 0x00000002,
1133    kIOFBAVSignalTypeHDMI    = 0x00000008,
1134    kIOFBAVSignalTypeDP      = 0x00000010,
1135};
1136
1137// kIOFBDisplayPortTrainingAttribute data
1138
1139struct IOFBDPLinkConfig
1140{
1141    uint16_t version;		 // 8 bit high (major); 8 bit low (minor)
1142    uint8_t  bitRate;		 // same encoding as the spec
1143    uint8_t  __reservedA[1]; // reserved set to zero
1144	uint16_t t1Time;		 // minimum duration of the t1 pattern (microseconds)
1145	uint16_t t2Time;		 // minimum duration of the t2 pattern
1146	uint16_t t3Time;		 // minimum duration of the t3 pattern
1147	uint8_t  idlePatterns;   // minimum number of idle patterns
1148	uint8_t  laneCount;		 // number of lanes in the link
1149	uint8_t  voltage;
1150	uint8_t  preEmphasis;
1151	uint8_t  downspread;
1152	uint8_t  scrambler;
1153	uint8_t  maxBitRate;	 // same encoding as the bitRate field
1154	uint8_t  maxLaneCount;	 // an integer
1155	uint8_t  maxDownspread;	 // 0 = Off. 1 = 0.5
1156	uint8_t  __reservedB[9];	// reserved set to zero - fix align and provide 8 bytes of padding.
1157};
1158typedef struct IOFBDPLinkConfig IOFBDPLinkConfig;
1159
1160enum
1161{
1162    kIOFBBitRateRBR		= 0x06,		// 1.62 Gbps per lane
1163    kIOFBBitRateHBR		= 0x0A,		// 2.70 Gbps per lane
1164    kIOFBBitRateHBR2	= 0x14,		// 5.40 Gbps per lane
1165};
1166
1167enum {
1168    kIOFBLinkVoltageLevel0	= 0x00,
1169    kIOFBLinkVoltageLevel1	= 0x01,
1170    kIOFBLinkVoltageLevel2	= 0x02,
1171    kIOFBLinkVoltageLevel3	= 0x03
1172};
1173
1174enum
1175{
1176    kIOFBLinkPreEmphasisLevel0 = 0x00,
1177    kIOFBLinkPreEmphasisLevel1 = 0x01,
1178    kIOFBLinkPreEmphasisLevel2 = 0x02,
1179    kIOFBLinkPreEmphasisLevel3 = 0x03
1180};
1181
1182enum
1183{
1184    kIOFBLinkDownspreadNone  = 0x0,
1185    kIOFBLinkDownspreadMax   = 0x1
1186};
1187
1188enum
1189{
1190    kIOFBLinkScramblerNormal    = 0x0, // for external displays
1191    kIOFBLinkScramblerAlternate = 0x1  // used for eDP
1192};
1193
1194// diagnostic keys
1195
1196#define kIOFBConfigKey                  "IOFBConfig"
1197#define kIOFBModesKey                   "IOFBModes"
1198#define kIOFBModeIDKey                  "ID"
1199#define kIOFBModeDMKey                  "DM"
1200#define kIOFBModeTMKey                  "TM"
1201#define kIOFBModeAIDKey                 "AID"
1202#define kIOFBModeDFKey                  "DF"
1203#define kIOFBModePIKey                  "PI"
1204
1205// display property keys
1206
1207#define kIODisplayEDIDKey               "IODisplayEDID"
1208#define kIODisplayEDIDOriginalKey       "IODisplayEDIDOriginal"
1209#define kIODisplayLocationKey           "IODisplayLocation"             // CFString
1210#define kIODisplayConnectFlagsKey       "IODisplayConnectFlags"         // CFNumber
1211#define kIODisplayHasBacklightKey       "IODisplayHasBacklight"         // CFBoolean
1212#define kIODisplayIsDigitalKey          "IODisplayIsDigital"            // CFBoolean
1213#define kDisplayBundleKey               "DisplayBundle"
1214
1215#define kAppleDisplayTypeKey            "AppleDisplayType"
1216#define kAppleSenseKey                  "AppleSense"
1217
1218#define kIODisplayMCCSVersionKey                "IODisplayMCCSVersion"
1219#define kIODisplayTechnologyTypeKey             "IODisplayTechnologyType"
1220#define kIODisplayUsageTimeKey                  "IODisplayUsageTime"
1221#define kIODisplayFirmwareLevelKey              "IODisplayFirmwareLevel"
1222
1223enum {
1224    kDisplayVendorIDUnknown     = 'unkn',
1225    kDisplayProductIDGeneric    = 0x717
1226};
1227
1228#define kDisplayVendorID                "DisplayVendorID"        // CFNumber
1229#define kDisplayProductID               "DisplayProductID"       // CFNumber
1230#define kDisplaySerialNumber            "DisplaySerialNumber"    // CFNumber
1231#define kDisplaySerialString            "DisplaySerialString"    // CFString
1232#define kDisplayWeekOfManufacture       "DisplayWeekManufacture" // CFNumber
1233#define kDisplayYearOfManufacture       "DisplayYearManufacture" // CFNumber
1234
1235// CFDictionary of language-locale keys, name values
1236// eg. "en"="Color LCD", "en-GB"="Colour LCD"
1237#define kDisplayProductName             "DisplayProductName"
1238
1239// all CFNumber or CFArray of CFNumber (floats)
1240#define kDisplayWhitePointX             "DisplayWhitePointX"
1241#define kDisplayWhitePointY             "DisplayWhitePointY"
1242#define kDisplayRedPointX               "DisplayRedPointX"
1243#define kDisplayRedPointY               "DisplayRedPointY"
1244#define kDisplayGreenPointX             "DisplayGreenPointX"
1245#define kDisplayGreenPointY             "DisplayGreenPointY"
1246#define kDisplayBluePointX              "DisplayBluePointX"
1247#define kDisplayBluePointY              "DisplayBluePointY"
1248#define kDisplayWhiteGamma              "DisplayWhiteGamma"
1249#define kDisplayRedGamma                "DisplayRedGamma"
1250#define kDisplayGreenGamma              "DisplayGreenGamma"
1251#define kDisplayBlueGamma               "DisplayBlueGamma"
1252
1253// Display gamma
1254#define kDisplayGammaChannels           "DisplayGammaChannels"    // CFNumber 1 or 3 channel count
1255#define kDisplayGammaEntryCount         "DisplayGammaEntryCount"  // CFNumber 1-based count of entries per channel
1256#define kDisplayGammaEntrySize          "DisplayGammaEntrySize"   // CFNumber size in bytes of each table entry
1257#define kDisplayGammaTable              "DisplayGammaTable"       // CFData
1258
1259// CFBoolean
1260#define kDisplayBrightnessAffectsGamma  "DisplayBrightnessAffectsGamma"
1261#define kDisplayViewAngleAffectsGamma   "DisplayViewAngleAffectsGamma"
1262
1263// CFData
1264#define kDisplayCSProfile               "DisplayCSProfile"
1265
1266// CFNumber
1267#define kDisplayHorizontalImageSize     "DisplayHorizontalImageSize"
1268#define kDisplayVerticalImageSize       "DisplayVerticalImageSize"
1269
1270// Pixel description
1271
1272// CFBoolean
1273#define kDisplayFixedPixelFormat        "DisplayFixedPixelFormat"
1274
1275enum {
1276    kDisplaySubPixelLayoutUndefined     = 0x00000000,
1277    kDisplaySubPixelLayoutRGB           = 0x00000001,
1278    kDisplaySubPixelLayoutBGR           = 0x00000002,
1279    kDisplaySubPixelLayoutQuadGBL       = 0x00000003,
1280    kDisplaySubPixelLayoutQuadGBR       = 0x00000004,
1281
1282    kDisplaySubPixelConfigurationUndefined    = 0x00000000,
1283    kDisplaySubPixelConfigurationDelta        = 0x00000001,
1284    kDisplaySubPixelConfigurationStripe       = 0x00000002,
1285    kDisplaySubPixelConfigurationStripeOffset = 0x00000003,
1286    kDisplaySubPixelConfigurationQuad         = 0x00000004,
1287
1288    kDisplaySubPixelShapeUndefined      = 0x00000000,
1289    kDisplaySubPixelShapeRound          = 0x00000001,
1290    kDisplaySubPixelShapeSquare         = 0x00000002,
1291    kDisplaySubPixelShapeRectangular    = 0x00000003,
1292    kDisplaySubPixelShapeOval           = 0x00000004,
1293    kDisplaySubPixelShapeElliptical     = 0x00000005
1294};
1295
1296// CFNumbers
1297#define kDisplaySubPixelLayout          "DisplaySubPixelLayout"
1298#define kDisplaySubPixelConfiguration   "DisplaySubPixelConfiguration"
1299#define kDisplaySubPixelShape           "DisplaySubPixelShape"
1300
1301#define kIODisplayOverrideMatchingKey   "IODisplayOverrideMatching"
1302
1303// Display parameters
1304
1305#define kIODisplayParametersKey         "IODisplayParameters"
1306#define kIODisplayGUIDKey               "IODisplayGUID"
1307
1308#define kIODisplayValueKey              "value"
1309#define kIODisplayMinValueKey           "min"
1310#define kIODisplayMaxValueKey           "max"
1311
1312#define kIODisplayBrightnessKey             "brightness"
1313#define kIODisplayLinearBrightnessKey       "linear-brightness"
1314#define kIODisplayUsableLinearBrightnessKey "usable-linear-brightness"
1315#define kIODisplayBrightnessFadeKey         "brightness-fade"
1316#define kIODisplayContrastKey               "contrast"
1317#define kIODisplayHorizontalPositionKey     "horizontal-position"
1318#define kIODisplayHorizontalSizeKey     	"horizontal-size"
1319#define kIODisplayVerticalPositionKey   	"vertical-position"
1320#define kIODisplayVerticalSizeKey           "vertical-size"
1321#define kIODisplayTrapezoidKey              "trapezoid"
1322#define kIODisplayPincushionKey             "pincushion"
1323#define kIODisplayParallelogramKey          "parallelogram"
1324#define kIODisplayRotationKey               "rotation"
1325#define kIODisplayTheatreModeKey            "theatre-mode"
1326#define kIODisplayTheatreModeWindowKey      "theatre-mode-window"
1327#define kIODisplayOverscanKey               "oscn"
1328#define kIODisplayVideoBestKey              "vbst"
1329
1330#define kIODisplaySpeakerVolumeKey              "speaker-volume"
1331#define kIODisplaySpeakerSelectKey              "speaker-select"
1332#define kIODisplayMicrophoneVolumeKey           "microphone-volume"
1333#define kIODisplayAmbientLightSensorKey         "ambient-light-sensor"
1334#define kIODisplayAudioMuteAndScreenBlankKey    "audio-mute-and-screen-blank"
1335#define kIODisplayAudioTrebleKey                "audio-treble"
1336#define kIODisplayAudioBassKey                  "audio-bass"
1337#define kIODisplayAudioBalanceLRKey             "audio-balance-LR"
1338#define kIODisplayAudioProcessorModeKey         "audio-processor-mode"
1339#define kIODisplayPowerModeKey                  "power-mode"
1340#define kIODisplayManufacturerSpecificKey       "manufacturer-specific"
1341
1342#define kIODisplayPowerStateKey       			"dsyp"
1343
1344#define kIODisplayControllerIDKey				"IODisplayControllerID"
1345#define kIODisplayCapabilityStringKey       	"IODisplayCapabilityString"
1346
1347#define kIODisplayRedGammaScaleKey      "rgsc"
1348#define kIODisplayGreenGammaScaleKey    "ggsc"
1349#define kIODisplayBlueGammaScaleKey     "bgsc"
1350#define kIODisplayGammaScaleKey         "gsc "
1351
1352#define kIODisplayParametersCommitKey   "commit"
1353#define kIODisplayParametersDefaultKey  "defaults"
1354#define kIODisplayParametersFlushKey    "flush"
1355
1356#ifdef __cplusplus
1357}
1358#endif
1359
1360#endif /* ! _IOKIT_IOGRAPHICSTYPES_H */
1361