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_IOGRAPHICSTYPESPRIVATE_H
24#define _IOKIT_IOGRAPHICSTYPESPRIVATE_H
25
26#include <IOKit/graphics/IOGraphicsTypes.h>
27
28enum {
29    // This is the ID given to a programmable timing used at boot time
30    kIODisplayModeIDInvalid   = (IODisplayModeID) 0xFFFFFFFF,
31    kIODisplayModeIDCurrent   = (IODisplayModeID) 0x00000000,
32    kIODisplayModeIDAliasBase = (IODisplayModeID) 0x40000000
33};
34
35
36enum {
37    // options for IOServiceRequestProbe()
38    kIOFBForceReadEDID                  = 0x00000100,
39    kIOFBAVProbe                        = 0x00000200,
40    kIOFBSetTransform                   = 0x00000400,
41    kIOFBTransformShift                 = 16,
42    kIOFBScalerUnderscan                = 0x01000000,
43};
44
45enum {
46    // transforms
47    kIOFBRotateFlags                    = 0x0000000f,
48
49    kIOFBSwapAxes                       = 0x00000001,
50    kIOFBInvertX                        = 0x00000002,
51    kIOFBInvertY                        = 0x00000004,
52
53    kIOFBRotate0                        = 0x00000000,
54    kIOFBRotate90                       = kIOFBSwapAxes | kIOFBInvertX,
55    kIOFBRotate180                      = kIOFBInvertX  | kIOFBInvertY,
56    kIOFBRotate270                      = kIOFBSwapAxes | kIOFBInvertY
57};
58
59// private IOPixelInformation.flags
60enum {
61    kFramebufferAGPFastWriteAccess      = 0x00100000,
62    kFramebufferDeepMode                = 0x00200000
63};
64
65enum {
66    kIOFBHWCursorSupported              = 0x00000001,
67    kIOFBCursorPans                     = 0x00010000
68};
69
70enum {
71    // Controller attributes
72    kIOFBSpeedAttribute                 = ' dgs',
73    kIOFBWSStartAttribute               = 'wsup',
74    kIOFBProcessConnectChangeAttribute  = 'wsch',
75    kIOFBEndConnectChangeAttribute      = 'wsed',
76
77    kIOFBMatchedConnectChangeAttribute  = 'wsmc',
78
79    // Connection attributes
80    kConnectionInTVMode                 = 'tvmd',
81    kConnectionWSSB                     = 'wssb',
82
83    kConnectionRawBacklight             = 'bklt',
84    kConnectionBacklightSave            = 'bksv',
85
86    kConnectionVendorTag                = 'vtag'
87};
88
89enum {
90    // kConnectionInTVMode values
91    kConnectionNonTVMode                = 0,
92    kConnectionNTSCMode                 = 1,
93    kConnectionPALMode                  = 2
94};
95
96// values for kIOCapturedAttribute
97enum {
98    kIOCaptureDisableDisplayChange      = 0x00000001,
99    kIOCaptureDisableDisplayDimming     = 0x00000002
100};
101
102/*! @enum FramebufferConstants
103    @constant kIOFBVRAMMemory The memory type for IOConnectMapMemory() to get the VRAM memory. Use a memory type equal to the IOPixelAperture index to get a particular pixel aperture.
104*/
105enum {
106    kIOFBVRAMMemory             = 110
107};
108
109#define kIOFBGammaHeaderSizeKey         "IOFBGammaHeaderSize"
110
111#define kIONDRVFramebufferGenerationKey "IONDRVFramebufferGeneration"
112
113#define kIOFramebufferOpenGLIndexKey    "IOFramebufferOpenGLIndex"
114
115#define kIOFBCurrentPixelClockKey       "IOFBCurrentPixelClock"
116#define kIOFBCurrentPixelCountKey       "IOFBCurrentPixelCount"
117
118#define kIOFBTransformKey               "IOFBTransform"
119#define kIOFBRotatePrefsKey             "framebuffer-rotation"
120#define kIOFBStartupTimingPrefsKey      "startup-timing"
121
122#define kIOFBCapturedKey                "IOFBCaptured"
123
124#define kIOFBMirrorDisplayModeSafeKey   "IOFBMirrorDisplayModeSafe"
125
126#define kIOFBConnectInterruptDelayKey   "connect-interrupt-delay"
127
128#define kIOFBUIScaleKey					"IOFBUIScale"
129
130#define kIOGraphicsPrefsKey             "IOGraphicsPrefs"
131#define kIODisplayPrefKeyKey            "IODisplayPrefsKey"
132#define kIOGraphicsPrefsParametersKey   "IOGraphicsPrefsParameters"
133#define kIOGraphicsIgnoreParametersKey  "IOGraphicsIgnoreParameters"
134
135#define kIOGraphicsPrefsVersionKey      "version"
136enum
137{
138    kIOGraphicsPrefsCurrentVersion 	= 2
139};
140
141#define kIODisplayFastBootEDIDKey       "nv-edid"
142
143#define kIOFBBuiltInKey                 "built-in"
144#define kIOFBIntegratedKey              "IOFBIntegrated"
145
146#define kIOMultimediaConnectionIDKey            "IOMultimediaConnectionID"
147#define kIOMultimediaConnectionIDDefault        "hdmi-1"
148#define kIOMultimediaConnectionPropertiesKey    "IOMultimediaConnectionProperties"
149#define kIOCEAEDIDVersionKey                    "IOCEAEDIDVersion"
150#define kIOCEADataBlocksKey                     "IOCEADataBlocks"
151
152#define detailedTimingModeID            __reservedA[0]
153
154#ifndef kIORequestIdleKey
155#define kIORequestIdleKey               "IORequestIdle"
156#endif
157
158enum {
159    kIOAccelSpecificID          = 0x00000002
160};
161
162#ifndef kIOFBLowPowerAggressiveness
163#define kIOFBLowPowerAggressiveness     ((uint32_t) iokit_family_err(sub_iokit_graphics, 1))
164#endif
165
166#ifndef kIOFBCaptureAggressiveness
167#define kIOFBCaptureAggressiveness      ((uint32_t) iokit_family_err(sub_iokit_graphics, 2))
168#endif
169
170#ifndef kIODisplayDimAggressiveness
171#define kIODisplayDimAggressiveness     ((uint32_t) iokit_family_err(sub_iokit_graphics, 3))
172#endif
173
174#define kIOFBMessageConnectChange       iokit_family_err(sub_iokit_graphics, 100)
175#define kIOFBMessageEndConnectChange    iokit_family_err(sub_iokit_graphics, 105)
176
177#if 1
178enum
179{
180    // kConnectionColorMode attribute
181    kIODisplayColorModeReserved   = 0x00000000,
182    kIODisplayColorModeRGB        = 0x00000001,
183    kIODisplayColorModeYCbCr422   = 0x00000010,
184    kIODisplayColorModeYCbCr444   = 0x00000100,
185    kIODisplayColorModeRGBLimited = 0x00001000,
186    kIODisplayColorModeAuto       = 0x10000000,
187};
188#endif
189
190enum
191{
192    kUpstreamProtocolMsgWrite   = '\0auw',
193    kUpstreamProtocolMsgRead    = '\0aur',
194    kUpstreamProtocolConfig     = 'aupc',
195    kUpstreamProtocolHDCPStatus = 'auph',
196    kUpstreamProtocolHDCPConfigStatus = 'aupp',
197    kUpstreamProtocolMsgStatus  = 'aums',
198    kColorSpaceSelection        = 'cyuv'
199};
200
201enum
202{
203    // AppleUpstream status change (HDCP downstream status has changed)
204    kIOFBAUSInterruptType          = 'aus ',
205    // AppleUpstream Data ready  (AppleUpstreamUserClient message is ready for read)
206    kIOFBAUDInterruptType          = 'aud '
207};
208
209#define kIOFBDPDeviceIDKey          "dp-device-id"
210#define kIOFBDPDeviceTypeKey        "device-type"
211#define kIOFBDPDeviceTypeDongleKey  "branch-device"
212
213enum
214{
215    kDPRegisterLinkStatus      = 0x200,
216    kDPRegisterLinkStatusCount = 6,
217    kDPRegisterServiceIRQ      = 0x201,
218};
219
220enum
221{
222    kDPLinkStatusSinkCountMask = 0x3f,
223};
224
225enum
226{
227    kDPIRQRemoteControlCommandPending = 0x01,
228    kDPIRQAutomatedTestRequest        = 0x02,
229    kDPIRQContentProtection           = 0x04,
230    kDPIRQMCCS                        = 0x08,
231    kDPIRQSinkSpecific                = 0x40,
232};
233
234enum
235{
236    // values for graphic-options & kIOMirrorDefaultAttribute
237//  kIOMirrorDefault       = 0x00000001,
238//  kIOMirrorForced        = 0x00000002,
239    kIOGPlatformYCbCr      = 0x00000004,
240//  kIOMirrorHint          = 0x00010000,
241    kIOMirrorNoAutoHDMI    = 0x00000010,
242};
243
244// values for displayOnline options
245
246enum
247{
248	kIODisplayOptionBacklight  = 0x00000001,
249	kIODisplayOptionDimDisable = 0x00000002
250};
251
252// boot compress gamma types
253
254struct IOFBGammaPoint
255{
256	uint16_t in;
257	uint16_t out;
258};
259typedef struct IOFBGammaPoint IOFBGammaPoint;
260
261struct IOFBGamma
262{
263	uint16_t       pointCount;
264	IOFBGammaPoint points[0];
265};
266typedef struct IOFBGamma IOFBGamma;
267
268struct IOFBCompressedGamma
269{
270	IOFBGamma red;
271	IOFBGamma green;
272	IOFBGamma blue;
273};
274typedef struct IOFBCompressedGamma IOFBCompressedGamma;
275
276struct IOFBBootGamma
277{
278	uint32_t            vendor;
279	uint32_t            product;
280	uint32_t            serial;
281	uint16_t            length;
282	uint16_t            resvA;
283	uint32_t            resvB;
284	IOFBCompressedGamma gamma;
285};
286typedef struct IOFBBootGamma IOFBBootGamma;
287
288#define kIOFBBootGammaKey			"boot-gamma"
289#define kIOFBBootGammaRestoredKey	"boot-gamma-restored"
290
291// uint32_t OSData
292#define kIOScreenRestoreStateKey "IOScreenRestoreState"
293
294// values for kIOScreenRestoreStateKey
295enum
296{
297	kIOScreenRestoreStateNone   = 0x00000000,
298	kIOScreenRestoreStateNormal = 0x00000001,
299	kIOScreenRestoreStateDark   = 0x00000002,
300};
301
302#define DBG_IOG_NOTIFYSERVER	10
303#define DBG_IOG_VRAM_RESTORE	11
304
305#endif /* ! _IOKIT_IOGRAPHICSTYPESPRIVATE_H */
306
307