]> git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/graphics/IODisplay.h
xnu-124.13.tar.gz
[apple/xnu.git] / iokit / IOKit / graphics / IODisplay.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 Apple Computer, Inc.
24 *
25 *
26 * HISTORY
27 *
28 * sdouglas 22 Oct 97 - first checked in.
29 * sdouglas 23 Jul 98 - start IOKit
30 */
31
32 #ifndef _IOKIT_IODISPLAY_H
33 #define _IOKIT_IODISPLAY_H
34
35 #include <IOKit/IOService.h>
36 #include <IOKit/graphics/IOFramebuffer.h>
37
38 extern const OSSymbol * gIODisplayParametersKey;
39 extern const OSSymbol * gIODisplayGUIDKey;
40
41 extern const OSSymbol * gIODisplayValueKey;
42 extern const OSSymbol * gIODisplayMinValueKey;
43 extern const OSSymbol * gIODisplayMaxValueKey;
44
45 extern const OSSymbol * gIODisplayContrastKey;
46 extern const OSSymbol * gIODisplayBrightnessKey;
47 extern const OSSymbol * gIODisplayHorizontalPositionKey;
48 extern const OSSymbol * gIODisplayHorizontalSizeKey;
49 extern const OSSymbol * gIODisplayVerticalPositionKey;
50 extern const OSSymbol * gIODisplayVerticalSizeKey;
51 extern const OSSymbol * gIODisplayTrapezoidKey;
52 extern const OSSymbol * gIODisplayPincushionKey;
53 extern const OSSymbol * gIODisplayParallelogramKey;
54 extern const OSSymbol * gIODisplayRotationKey;
55
56 extern const OSSymbol * gIODisplayParametersCommitKey;
57 extern const OSSymbol * gIODisplayParametersDefaultKey;
58
59 enum {
60 kIODisplayMaxPowerStates = 4
61 };
62
63 struct DisplayPMVars // these are the private instance variables for power management
64 {
65 IOIndex connectIndex;
66 // control bytes we send to the framebuffer to control syncs
67 UInt32 syncControls[kIODisplayMaxPowerStates];
68 // mask bits that go with the control byte
69 UInt32 syncMask;
70 // current state of sync signals
71 UInt32 currentSyncs;
72 // highest state number normally, lowest usable state in emergency
73 unsigned long max_display_state;
74 bool displayIdle; // true if the display has had power lowered due to user inactivity
75 bool powerControllable; // false if no sync control available on video display
76 };
77
78 class IODisplayConnect : public IOService
79 {
80 OSDeclareDefaultStructors(IODisplayConnect)
81
82 private:
83 IOIndex connection;
84
85 public:
86 virtual bool initWithConnection( IOIndex connection );
87 virtual IOFramebuffer * getFramebuffer( void );
88 virtual IOIndex getConnection( void );
89 virtual IOReturn getAttributeForConnection( IOIndex, IOSelect, UInt32 * );
90 virtual IOReturn setAttributeForConnection( IOIndex, IOSelect, UInt32 );
91 virtual void joinPMtree ( IOService * driver );
92 };
93
94 class IODisplay : public IOService
95 {
96 OSDeclareAbstractStructors(IODisplay)
97
98 public:
99 static void initialize( void );
100
101 private:
102
103 // used to query the framebuffer controller
104 IODisplayConnect * connection;
105 protected:
106 // pointer to protected instance variables for power management
107 struct DisplayPMVars * displayPMVars;
108
109 /* Reserved for future expansion. */
110 int _IODisplay_reserved[2];
111
112 virtual void initForPM ( IOService * );
113
114 virtual IOReturn setProperties( OSObject * properties );
115
116 virtual IOReturn setAggressiveness ( unsigned long, unsigned long newLevel );
117 virtual IOReturn setPowerState ( unsigned long, IOService* );
118 virtual unsigned long maxCapabilityForDomainState ( IOPMPowerFlags );
119 virtual unsigned long initialPowerStateForDomainState ( IOPMPowerFlags );
120 virtual unsigned long powerStateForDomainState ( IOPMPowerFlags );
121
122 public:
123 virtual IOService * probe( IOService * provider,
124 SInt32 * score );
125
126 virtual bool start( IOService * provider );
127
128 virtual IODisplayConnect * getConnection( void );
129
130 virtual IOReturn getConnectFlagsForDisplayMode(
131 IODisplayModeID mode, UInt32 * flags ) = 0;
132
133 virtual IOReturn getGammaTableByIndex(
134 UInt32 * channelCount, UInt32 * dataCount,
135 UInt32 * dataWidth, void ** data );
136
137 virtual void dropOneLevel ( void );
138 virtual void makeDisplayUsable ( void );
139 IOReturn registerPowerDriver ( IOService*, IOPMPowerState*, unsigned long );
140 };
141
142 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
143
144 class AppleSenseDisplay : public IODisplay
145 {
146 OSDeclareDefaultStructors(AppleSenseDisplay)
147
148 public:
149 virtual IOService * probe( IOService * provider,
150 SInt32 * score );
151
152 virtual IOReturn getConnectFlagsForDisplayMode(
153 IODisplayModeID mode, UInt32 * flags );
154 };
155
156 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
157
158 class AppleNoSenseDisplay : public IODisplay
159 {
160 OSDeclareDefaultStructors(AppleNoSenseDisplay)
161
162 public:
163 virtual IOReturn getConnectFlagsForDisplayMode(
164 IODisplayModeID mode, UInt32 * flags );
165 };
166
167 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
168
169 #endif /* ! _IOKIT_IODISPLAY_H */
170