]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/ndrvsupport/IONDRVFramebuffer.h
846c3eedca9c5f9e03a49b653b8d4bcbb182c727
[apple/xnu.git] / iokit / IOKit / ndrvsupport / IONDRVFramebuffer.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) 1997-1998 Apple Computer, Inc.
24 *
25 *
26 * HISTORY
27 *
28 * sdouglas 22 Oct 97 - first checked in.
29 * sdouglas 24 Jul 98 - start IOKit.
30 * sdouglas 15 Dec 98 - cpp.
31 *
32 */
33
34 #ifndef _IOKIT_IONDRVFRAMEBUFFER_H
35 #define _IOKIT_IONDRVFRAMEBUFFER_H
36
37 #include <IOKit/graphics/IOFramebuffer.h>
38 #include <IOKit/ndrvsupport/IOMacOSVideo.h>
39 #include <IOKit/ndrvsupport/IONDRVSupport.h>
40
41
42 #define kIONDRVDisableKey "AAPL,disable-ndrv"
43
44
45 class IONDRVFramebuffer : public IOFramebuffer
46 {
47 OSDeclareDefaultStructors(IONDRVFramebuffer)
48
49 protected:
50 /*! @struct ExpansionData
51 @discussion This structure will be used to expand the capablilties of this class in the future.
52 */
53 struct ExpansionData { };
54
55 /*! @var reserved
56 Reserved for future use. (Internal use only) */
57 ExpansionData * reserved;
58
59 protected:
60
61 IOService * nub;
62 class IONDRV * ndrv;
63
64 // current configuration
65 IODisplayModeID currentDisplayMode;
66 IOIndex currentDepth;
67 IOIndex currentPage;
68 bool directMode;
69
70 IOPhysicalAddress physicalFramebuffer;
71 IODeviceMemory * vramRange;
72
73 UInt8 startAt8;
74 UInt8 grayMode;
75 UInt8 lastGrayMode;
76 VDClutBehavior lastClutSetting;
77 UInt8 platformDeepSleep;
78
79 bool consoleDevice;
80 UInt32 powerState;
81 UInt32 ndrvState;
82 SInt32 ndrvEnter;
83 OSArray * detailedTimings;
84 UInt32 detailedTimingsSeed;
85 UInt32 * detailedTimingsCurrent;
86
87 IODeviceMemory * vramMemory;
88
89 VDResolutionInfoRec cachedVDResolution;
90
91 struct _VSLService * vslServices;
92
93 UInt32 accessFlags;
94
95 UInt32 __reserved[32];
96
97 private:
98 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 0);
99 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 1);
100 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 2);
101 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 3);
102 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 4);
103 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 5);
104 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 6);
105 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 7);
106 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 8);
107 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 9);
108 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 10);
109 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 11);
110 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 12);
111 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 13);
112 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 14);
113 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 15);
114 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 16);
115 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 17);
116 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 18);
117 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 19);
118 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 20);
119 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 21);
120 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 22);
121 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 23);
122 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 24);
123 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 25);
124 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 26);
125 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 27);
126 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 28);
127 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 29);
128 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 30);
129 OSMetaClassDeclareReservedUnused(IONDRVFramebuffer, 31);
130
131 private:
132
133 void initForPM ( void );
134 IOReturn setPowerState( unsigned long, IOService* );
135 unsigned long maxCapabilityForDomainState( IOPMPowerFlags );
136 unsigned long initialPowerStateForDomainState( IOPMPowerFlags );
137 unsigned long powerStateForDomainState( IOPMPowerFlags );
138
139 virtual IOReturn checkDriver( void );
140 virtual UInt32 iterateAllModes( IODisplayModeID * displayModeIDs );
141 virtual IOReturn getResInfoForMode( IODisplayModeID modeID,
142 IODisplayModeInformation * theInfo );
143 virtual IOReturn getResInfoForArbMode( IODisplayModeID modeID,
144 IODisplayModeInformation * theInfo );
145 virtual IOReturn validateDisplayMode(
146 IODisplayModeID mode, IOOptionBits flags,
147 VDDetailedTimingRec ** detailed );
148 virtual IOReturn setDetailedTiming(
149 IODisplayModeID mode, IOOptionBits options,
150 void * description, IOByteCount descripSize );
151 virtual void getCurrentConfiguration( void );
152 static const IOTVector * _undefinedSymbolHandler( void * self,
153 const char * libraryName, const char * symbolName );
154
155 public:
156 virtual IOReturn doControl( UInt32 code, void * params );
157 virtual IOReturn doStatus( UInt32 code, void * params );
158
159 public:
160
161 virtual IOService * probe( IOService * provider,
162 SInt32 * score );
163
164 virtual bool start( IOService * provider );
165
166 virtual void free( void );
167
168 virtual IOReturn setProperties( OSObject * properties );
169
170 virtual IOReturn enableController( void );
171
172 virtual IODeviceMemory * makeSubRange( IOPhysicalAddress start,
173 IOPhysicalLength length );
174 virtual IODeviceMemory * getApertureRange( IOPixelAperture aperture );
175 virtual IODeviceMemory * getVRAMRange( void );
176
177 virtual IODeviceMemory * findVRAM( void );
178
179 virtual bool isConsoleDevice( void );
180
181 virtual const IOTVector * undefinedSymbolHandler( const char * libraryName,
182 const char * symbolName );
183
184 virtual const char * getPixelFormats( void );
185
186 // Array of supported display modes
187 virtual IOItemCount getDisplayModeCount( void );
188 virtual IOReturn getDisplayModes( IODisplayModeID * allDisplayModes );
189
190 // Info about a display mode
191 virtual IOReturn getInformationForDisplayMode( IODisplayModeID displayMode,
192 IODisplayModeInformation * info );
193
194 // Mask of pixel formats available in mode and depth
195 virtual UInt64 getPixelFormatsForDisplayMode( IODisplayModeID displayMode,
196 IOIndex depth );
197
198 virtual IOReturn getPixelInformation(
199 IODisplayModeID displayMode, IOIndex depth,
200 IOPixelAperture aperture, IOPixelInformation * pixelInfo );
201
202 // Framebuffer info
203
204 // Current display mode and depth
205 virtual IOReturn getCurrentDisplayMode( IODisplayModeID * displayMode,
206 IOIndex * depth );
207
208 // Set display mode and depth
209 virtual IOReturn setDisplayMode( IODisplayModeID displayMode,
210 IOIndex depth );
211
212 // For pages
213 virtual IOReturn setApertureEnable( IOPixelAperture aperture,
214 IOOptionBits enable );
215
216 virtual IOReturn setStartupDisplayMode( IODisplayModeID displayMode,
217 IOIndex depth );
218 virtual IOReturn getStartupDisplayMode( IODisplayModeID * displayMode,
219 IOIndex * depth );
220
221 //// CLUTs
222
223 virtual IOReturn setCLUTWithEntries( IOColorEntry * colors, UInt32 index,
224 UInt32 numEntries, IOOptionBits options );
225
226 //// Gamma
227
228 virtual IOReturn setGammaTable( UInt32 channelCount, UInt32 dataCount,
229 UInt32 dataWidth, void * data );
230
231 //// Display mode timing information
232
233 virtual IOReturn getTimingInfoForDisplayMode( IODisplayModeID displayMode,
234 IOTimingInformation * info );
235
236 //// Detailed timing information
237
238 virtual IOReturn validateDetailedTiming(
239 void * description, IOByteCount descripSize );
240
241 virtual IOReturn setDetailedTimings( OSArray * array );
242
243 //// Controller attributes
244
245 virtual IOReturn getAttribute( IOSelect attribute, UInt32 * value );
246
247 //// Connections
248
249 virtual IOItemCount getConnectionCount( void );
250
251 virtual IOReturn getAttributeForConnection( IOIndex connectIndex,
252 IOSelect attribute, UInt32 * value );
253
254 virtual IOReturn setAttributeForConnection( IOIndex connectIndex,
255 IOSelect attribute, UInt32 info );
256
257 // Apple sensing
258
259 virtual IOReturn getAppleSense( IOIndex connectIndex,
260 UInt32 * senseType,
261 UInt32 * primary,
262 UInt32 * extended,
263 UInt32 * displayType );
264
265 virtual IOReturn connectFlags( IOIndex connectIndex,
266 IODisplayModeID displayMode, IOOptionBits * flags );
267
268 //// IOHighLevelDDCSense
269
270 virtual bool hasDDCConnect( IOIndex connectIndex );
271 virtual IOReturn getDDCBlock( IOIndex connectIndex, UInt32 blockNumber,
272 IOSelect blockType, IOOptionBits options,
273 UInt8 * data, IOByteCount * length );
274
275 //// Interrupts
276
277 virtual IOReturn registerForInterruptType( IOSelect interruptType,
278 IOFBInterruptProc proc, OSObject * target, void * ref,
279 void ** interruptRef );
280 virtual IOReturn unregisterInterrupt( void * interruptRef );
281 virtual IOReturn setInterruptState( void * interruptRef, UInt32 state );
282
283 //// HW Cursors
284
285 virtual IOReturn setCursorImage( void * cursorImage );
286 virtual IOReturn setCursorState( SInt32 x, SInt32 y, bool visible );
287
288 //// VSL calls
289
290 static OSStatus VSLNewInterruptService(
291 void * entryID,
292 UInt32 serviceType,
293 _VSLService ** serviceID );
294 static OSStatus VSLDisposeInterruptService( _VSLService * serviceID );
295 static OSStatus VSLDoInterruptService( _VSLService * serviceID );
296 static Boolean VSLPrepareCursorForHardwareCursor(
297 void * cursorRef,
298 IOHardwareCursorDescriptor * hwDesc,
299 IOHardwareCursorInfo * hwCursorInfo );
300 };
301
302 #endif /* ! _IOKIT_IONDRVFRAMEBUFFER_H */
303
304