]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/graphics/IOGraphicsTypes.h
xnu-123.5.tar.gz
[apple/xnu.git] / iokit / IOKit / graphics / IOGraphicsTypes.h
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 * Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
24 *
25 * HISTORY
26 *
27 */
28
29
30 #ifndef _IOKIT_IOGRAPHICSTYPES_H
31 #define _IOKIT_IOGRAPHICSTYPES_H
32
33
34 #include <IOKit/IOTypes.h>
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40
41 typedef SInt32 IOIndex;
42 typedef UInt32 IOSelect;
43 typedef UInt32 IOFixed1616;
44 typedef SInt32 IODisplayModeID;
45 typedef UInt32 IODisplayVendorID;
46 typedef UInt32 IODisplayProductID;
47
48 enum {
49 kIOMaxPixelBits = 64
50 };
51 typedef char IOPixelEncoding[ kIOMaxPixelBits ];
52
53 // Common Apple pixel formats
54
55 #define IO1BitIndexedPixels "P"
56 #define IO2BitIndexedPixels "PP"
57 #define IO4BitIndexedPixels "PPPP"
58 #define IO8BitIndexedPixels "PPPPPPPP"
59 #define IO16BitDirectPixels "-RRRRRGGGGGBBBBB"
60 #define IO32BitDirectPixels "--------RRRRRRRRGGGGGGGGBBBBBBBB"
61
62 // other possible pixel formats
63
64 #define IOYUV422Pixels "Y4U2V2"
65 #define IO8BitOverlayPixels "O8"
66 // page flipping
67 #define IOPagedPixels "Page1"
68
69 #define IO_SampleTypeAlpha 'A'
70 #define IO_SampleTypeSkip '-'
71
72 // Info about a pixel format
73 enum {
74 kIOCLUTPixels = 0,
75 kIOFixedCLUTPixels = 1,
76 kIORGBDirectPixels = 2,
77 kIOMonoDirectPixels = 3,
78 kIOMonoInverseDirectPixels = 4,
79 };
80
81 struct IOPixelInformation {
82 IOByteCount bytesPerRow;
83 IOByteCount bytesPerPlane;
84 UInt32 bitsPerPixel;
85 UInt32 pixelType;
86 UInt32 componentCount;
87 UInt32 bitsPerComponent;
88 UInt32 componentMasks[ 8 * 2 ];
89 IOPixelEncoding pixelFormat;
90 UInt32 flags;
91 UInt32 activeWidth;
92 UInt32 activeHeight;
93 UInt32 reserved[ 2 ];
94 };
95 typedef struct IOPixelInformation IOPixelInformation;
96
97 // Info about a display mode
98 typedef UInt32 IOAppleTimingID;
99
100 struct IODisplayModeInformation {
101 UInt32 nominalWidth;
102 UInt32 nominalHeight;
103 IOFixed1616 refreshRate;
104 IOIndex maxDepthIndex;
105 UInt32 flags;
106 UInt32 reserved[ 4 ];
107 };
108 typedef struct IODisplayModeInformation IODisplayModeInformation;
109
110 // flags
111 enum {
112 kDisplayModeSafetyFlags = 0x00000007,
113
114 kDisplayModeAlwaysShowFlag = 0x00000008,
115 kDisplayModeNeverShowFlag = 0x00000080,
116 kDisplayModeNotResizeFlag = 0x00000010,
117 kDisplayModeRequiresPanFlag = 0x00000020,
118
119 kDisplayModeInterlacedFlag = 0x00000040,
120
121 kDisplayModeSimulscanFlag = 0x00000100,
122 kDisplayModeBuiltInFlag = 0x00000400,
123 kDisplayModeNotPresetFlag = 0x00000200,
124 kDisplayModeStretchedFlag = 0x00000800
125 };
126 enum {
127 kDisplayModeValidFlag = 0x00000001,
128 kDisplayModeSafeFlag = 0x00000002,
129 kDisplayModeDefaultFlag = 0x00000004,
130 };
131
132 // Framebuffer info
133
134 struct IOFramebufferInformation {
135 IOPhysicalAddress baseAddress;
136 UInt32 activeWidth;
137 UInt32 activeHeight;
138 IOByteCount bytesPerRow;
139 IOByteCount bytesPerPlane;
140 UInt32 bitsPerPixel;
141 UInt32 pixelType;
142 UInt32 flags;
143 UInt32 reserved[ 4 ];
144 };
145 typedef struct IOFramebufferInformation IOFramebufferInformation;
146
147 // flags
148 enum {
149 kFramebufferSupportsCopybackCache = 0x00010000,
150 kFramebufferSupportsWritethruCache = 0x00020000,
151 kFramebufferSupportsGammaCorrection = 0x00040000,
152 kFramebufferDisableAltivecAccess = 0x00080000,
153 };
154
155 // Aperture is an index into supported pixel formats for a mode & depth
156 typedef IOIndex IOPixelAperture;
157 enum {
158 kIOFBSystemAperture = 0
159 };
160
161 //// CLUTs
162
163 typedef UInt16 IOColorComponent;
164
165 struct IOColorEntry {
166 UInt16 index;
167 IOColorComponent red;
168 IOColorComponent green;
169 IOColorComponent blue;
170 };
171 typedef struct IOColorEntry IOColorEntry;
172
173 // options (masks)
174 enum {
175 kSetCLUTByValue = 0x00000001, // else at index
176 kSetCLUTImmediately = 0x00000002, // else at VBL
177 kSetCLUTWithLuminance = 0x00000004 // else RGB
178 };
179
180 //// Controller attributes
181
182 enum {
183 kIOPowerAttribute = 'powr',
184 kIOHardwareCursorAttribute = 'crsr'
185 };
186
187 //// Display mode timing information
188
189 struct IODetailedTimingInformation {
190 // from EDID defn
191 UInt32 pixelClock; // Hertz
192 UInt32 horizontalActive; // pixels
193 UInt32 horizontalBlanking; // pixels
194 UInt32 horizontalBorder; // pixels
195 UInt32 horizontalSyncOffset; // pixels
196 UInt32 horizontalSyncWidth; // pixels
197 UInt32 verticalActive; // lines
198 UInt32 verticalBlanking; // lines
199 UInt32 verticalBorder; // lines
200 UInt32 verticalSyncOffset; // lines
201 UInt32 verticalSyncWidth; // lines
202 };
203 typedef struct IODetailedTimingInformation IODetailedTimingInformation;
204
205 struct IOTimingInformation {
206 IOAppleTimingID appleTimingID; // appleTimingXXX const
207 UInt32 flags;
208 IODetailedTimingInformation detailedInfo;
209 };
210 typedef struct IOTimingInformation IOTimingInformation;
211
212 enum {
213 // b0-7 from EDID flags
214 kIODetailedTimingValid = 0x80000000
215 };
216
217 //// Connections
218
219 enum {
220 kOrConnections = 0xffffffe,
221 kAndConnections = 0xffffffd
222 };
223
224 enum {
225 kConnectionEnable = 'enab',
226 kConnectionSyncEnable = 'sync',
227 kConnectionSyncFlags = 'sycf',
228 kConnectionSupportsAppleSense = 'asns',
229 kConnectionSupportsLLDDCSense = 'lddc',
230 kConnectionSupportsHLDDCSense = 'hddc'
231 };
232
233 // kConnectionSyncControl values
234 enum {
235 kIOHSyncDisable = 0x00000001,
236 kIOVSyncDisable = 0x00000002,
237 kIOCSyncDisable = 0x00000004,
238 kIONoSeparateSyncControl = 0x00000040,
239 kIOTriStateSyncs = 0x00000080,
240 kIOSyncOnBlue = 0x00000008,
241 kIOSyncOnGreen = 0x00000010,
242 kIOSyncOnRed = 0x00000020
243 };
244
245
246 #define IO_DISPLAY_CAN_FILL 0x00000040
247 #define IO_DISPLAY_CAN_BLIT 0x00000020
248
249 #define IO_24BPP_TRANSFER_TABLE_SIZE 256
250 #define IO_15BPP_TRANSFER_TABLE_SIZE 256
251 #define IO_8BPP_TRANSFER_TABLE_SIZE 256
252 #define IO_12BPP_TRANSFER_TABLE_SIZE 256
253 #define IO_2BPP_TRANSFER_TABLE_SIZE 256
254
255 #define STDFB_BM256_TO_BM38_MAP_SIZE 256
256 #define STDFB_BM38_TO_BM256_MAP_SIZE 256
257 #define STDFB_BM38_TO_256_WITH_LOGICAL_SIZE \
258 (STDFB_BM38_TO_BM256_MAP_SIZE + (256/sizeof(int)))
259
260 #define STDFB_4BPS_TO_5BPS_MAP_SIZE 16
261 #define STDFB_5BPS_TO_4BPS_MAP_SIZE 32
262
263 enum {
264 // connection types for IOServiceOpen
265 kIOFBServerConnectType = 0,
266 kIOFBSharedConnectType = 1,
267 kIOFBEngineControllerConnectType = 20,
268 kIOFBEngineConnectType = 21
269 };
270
271 struct IOGPoint {
272 SInt16 x;
273 SInt16 y;
274 };
275 typedef struct IOGPoint IOGPoint;
276
277 struct IOGSize {
278 SInt16 width;
279 SInt16 height;
280 };
281 typedef struct IOGSize IOGSize;
282
283 struct IOGBounds {
284 SInt16 minx;
285 SInt16 maxx;
286 SInt16 miny;
287 SInt16 maxy;
288 };
289 typedef struct IOGBounds IOGBounds;
290
291 #if !defined(__Point__) && !defined(BINTREE_H) && !defined(__MACTYPES__)
292 #define __Point__
293 typedef IOGPoint Point;
294 #endif
295
296 #if !defined(__Bounds__) && !defined(BINTREE_H) && !defined(__MACTYPES__)
297 #define __Bounds__
298 typedef IOGBounds Bounds;
299 #endif
300
301 // interrupt types
302
303 enum {
304 kIOFBVBLInterruptType = 'vbl ',
305 kIOFBHBLInterruptType = 'hbl ',
306 kIOFBFrameInterruptType = 'fram',
307 kIOFBConnectInterruptType = 'dci '
308 };
309
310 // property keys
311
312 #define kIOFramebufferInfoKey "IOFramebufferInformation"
313
314 #define kIOFBWidthKey "IOFBWidth"
315 #define kIOFBHeightKey "IOFBHeight"
316 #define kIOFBRefreshRateKey "IOFBRefreshRate"
317 #define kIOFBFlagsKey "IOFBFlags"
318 #define kIOFBBytesPerRowKey "IOFBBytesPerRow"
319 #define kIOFBBytesPerPlaneKey "IOFBBytesPerPlane"
320 #define kIOFBBitsPerPixelKey "IOFBBitsPerPixel"
321 #define kIOFBComponentCountKey "IOFBComponentCount"
322 #define kIOFBBitsPerComponentKey "IOFBBitsPerComponent"
323
324 #define kIOFBDetailedTimingsKey "IOFBDetailedTimings"
325 #define kIOFBTimingRangeKey "IOFBTimingRange"
326
327 #define kIOFBHostAccessFlagsKey "IOFBHostAccessFlags"
328
329 #define kIODisplayEDIDKey "IODisplayEDID"
330 #define kIODisplayLocationKey "IODisplayLocation"
331
332 enum {
333 kDisplayVendorIDUnknown = 'unkn',
334 kDisplayProductIDGeneric = 0x717
335 };
336
337 #define kDisplayVendorID "DisplayVendorID" // CFNumber
338 #define kDisplayProductID "DisplayProductID" // CFNumber
339 #define kDisplaySerialNumber "DisplaySerialNumber" // CFNumber
340 #define kDisplaySerialString "DisplaySerialString" // CFString
341 #define kDisplayWeekOfManufacture "DisplayWeekManufacture" // CFNumber
342 #define kDisplayYearOfManufacture "DisplayYearManufacture" // CFNumber
343
344 // CFDictionary of language-locale keys, name values
345 // eg. "en"="Color LCD", "en-GB"="Colour LCD"
346 #define kDisplayProductName "DisplayProductName"
347
348 // all CFNumber or CFArray of CFNumber (floats)
349 #define kDisplayWhitePointX "DisplayWhitePointX"
350 #define kDisplayWhitePointY "DisplayWhitePointY"
351 #define kDisplayRedPointX "DisplayRedPointX"
352 #define kDisplayRedPointY "DisplayRedPointY"
353 #define kDisplayGreenPointX "DisplayGreenPointX"
354 #define kDisplayGreenPointY "DisplayGreenPointY"
355 #define kDisplayBluePointX "DisplayBluePointX"
356 #define kDisplayBluePointY "DisplayBluePointY"
357 #define kDisplayWhiteGamma "DisplayWhiteGamma"
358 #define kDisplayRedGamma "DisplayRedGamma"
359 #define kDisplayGreenGamma "DisplayGreenGamma"
360 #define kDisplayBlueGamma "DisplayBlueGamma"
361
362 // CFData
363 #define kDisplayCSProfile "DisplayCSProfile"
364
365 // CFNumber
366 #define kDisplayHorizontalImageSize "DisplayHorizontalImageSize"
367 #define kDisplayVerticalImageSize "DisplayVerticalImageSize"
368
369 // Display parameters
370
371 #define kIODisplayParametersKey "IODisplayParameters"
372 #define kIODisplayGUIDKey "IODisplayGUID"
373
374 #define kIODisplayValueKey "value"
375 #define kIODisplayMinValueKey "min"
376 #define kIODisplayMaxValueKey "max"
377
378 #define kIODisplayBrightnessKey "brightness"
379 #define kIODisplayContrastKey "contrast"
380 #define kIODisplayHorizontalPositionKey "horizontal-position"
381 #define kIODisplayHorizontalSizeKey "horizontal-size"
382 #define kIODisplayVerticalPositionKey "vertical-position"
383 #define kIODisplayVerticalSizeKey "vertical-size"
384 #define kIODisplayTrapezoidKey "trapezoid"
385 #define kIODisplayPincushionKey "pincushion"
386 #define kIODisplayParallelogramKey "parallelogram"
387 #define kIODisplayRotationKey "rotation"
388 #define kIODisplayTheatreModeKey "theatre-mode"
389
390 #define kIODisplayParametersCommitKey "commit"
391 #define kIODisplayParametersDefaultKey "defaults"
392
393 #ifdef __cplusplus
394 }
395 #endif
396
397 #endif /* ! _IOKIT_IOGRAPHICSTYPES_H */