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