|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of the License "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // User side class definitions for GCE mode support. |
|
15 // This file contains declarations for the generic |
|
16 // screen display channel and APIs. |
|
17 // |
|
18 // |
|
19 |
|
20 /** |
|
21 @file dispchannel.h |
|
22 @publishedPartner |
|
23 @released |
|
24 */ |
|
25 |
|
26 #ifndef __DISPLAY_CHANNEL_H__ |
|
27 #define __DISPLAY_CHANNEL_H__ |
|
28 |
|
29 #include <e32cmn.h> |
|
30 #include <e32ver.h> |
|
31 #ifndef __KERNEL_MODE__ |
|
32 #include <e32std.h> |
|
33 #endif |
|
34 |
|
35 _LIT(KDisplayDriverName,"displaychannel"); |
|
36 |
|
37 // the defined versions to be used for macros, condititional complilation, etc. |
|
38 |
|
39 // The major version number. MUST be a number in the range 0 to 127 |
|
40 #define K_DISPLAY_CH_MAJOR_VERSION_NUMBER 1 |
|
41 // The minor version number. MUST be a number in the range 0 to 99 |
|
42 #define K_DISPLAY_CH_MINOR_VERSION_NUMBER 2 |
|
43 // The build number. MUST be a number in the range 0 to 32,767 |
|
44 #define K_DISPLAY_CH_BUILD_VERSION_NUMBER 1 |
|
45 |
|
46 // legacy set of version constants |
|
47 const TInt KDisplayChMajorVersionNumber = K_DISPLAY_CH_MAJOR_VERSION_NUMBER; |
|
48 const TInt KDisplayChMinorVersionNumber = K_DISPLAY_CH_MINOR_VERSION_NUMBER; |
|
49 const TInt KDisplayChBuildVersionNumber = K_DISPLAY_CH_BUILD_VERSION_NUMBER; |
|
50 |
|
51 // the base version supported across all implementation |
|
52 const TInt KDisplayChMajorVersionNumberAlwaysSupported = 1; |
|
53 const TInt KDisplayChMinorVersionNumberAlwaysSupported = 0; |
|
54 const TInt KDisplayChBuildVersionNumberAlwaysSupported = 1; |
|
55 |
|
56 |
|
57 /* |
|
58 Generic display driver interface |
|
59 */ |
|
60 class RDisplayChannel : public RBusLogicalChannel |
|
61 { |
|
62 public: |
|
63 |
|
64 typedef TInt TPixelFormat; |
|
65 typedef TUint TBufferId; |
|
66 typedef TUint TPostCount; |
|
67 |
|
68 enum TDisplayRotation |
|
69 /** Used to communicate available rotations as a bit field and used to set a |
|
70 particular rotation as a single value. Rotations are specified relative |
|
71 to the normal physical orientation of the device. |
|
72 */ |
|
73 { |
|
74 ERotationNormal = 1, |
|
75 ERotation90CW = 2, |
|
76 ERotation180 = 4, |
|
77 ERotation270CW = 8, |
|
78 // v 1.1 |
|
79 ERotationAll = 0xF |
|
80 }; |
|
81 |
|
82 // control messages |
|
83 enum TControl |
|
84 { |
|
85 // v 1.0 |
|
86 ECtrlGetCaps = 0, |
|
87 ECtrlIsSingleBuffered, |
|
88 ECtrlGetDisplayInfo, |
|
89 ECtrlOpen, |
|
90 ECtrlClose, |
|
91 ECtrlPostCompositionBuffer, |
|
92 ECtrlPostLegacyBuffer, |
|
93 ECtrlRegisterUserBuffer, |
|
94 ECtrlDeregisterUserBuffer, |
|
95 ECtrlPostCount, |
|
96 ECtrlSetRotation, |
|
97 ECtrlCurrentRotation, |
|
98 ECtrlGetCompositionBufferInfo, |
|
99 // intermediate version |
|
100 ECtrlVersion, |
|
101 // v 1.1 |
|
102 ECtrlNumberOfResolutions, |
|
103 ECtrlGetResolutions, |
|
104 ECtrlSetResolution, |
|
105 ECtrlGetResolution, |
|
106 ECtrlGetTwips, |
|
107 ECtrlNumberOfPixelFormats, |
|
108 ECtrlGetPixelFormats, |
|
109 ECtrlSetBufferFormat, |
|
110 ECtrlGetBufferFormat, |
|
111 ECtrlNextPlaneOffset, |
|
112 ECtrlNextLineOffset, |
|
113 // v 1.2 |
|
114 ECtrlNextPlaneOffsetExtended, |
|
115 ECtrlNextLineOffsetExtended |
|
116 }; |
|
117 |
|
118 // request messages |
|
119 enum TRequest |
|
120 { |
|
121 EReqGetCompositionBuffer = 0, |
|
122 EReqPostUserBuffer, |
|
123 EReqWaitForPost, |
|
124 // v 1.1 |
|
125 EReqWaitForDisplayConnect |
|
126 }; |
|
127 |
|
128 // corresponding cancel |
|
129 enum TCancel |
|
130 { |
|
131 ECtrlCancelGetCompositionBuffer = 0, |
|
132 ECtrlCancelPostUserBuffer, |
|
133 ECtrlCancelWaitForPost, |
|
134 // v 1.1 |
|
135 ECtrlCancelWaitForDisplayConnect |
|
136 |
|
137 }; |
|
138 |
|
139 enum TPanic |
|
140 { |
|
141 EWrongRequest, // wrong request number from the user side |
|
142 EReqAlreadyPending, // user asynchronous reques is already pending |
|
143 EDriverNotReady, // wrong operation mode |
|
144 // v 1.1 |
|
145 EInvalidResolution, // Negative resolution passed |
|
146 ENullArgument, // NULL argument passed |
|
147 }; |
|
148 |
|
149 public: //structures used |
|
150 |
|
151 // display channel configuration information per orientation |
|
152 class TOrientationSpecificInfo |
|
153 /** Used to communicate the display configuration for a particular orientation. |
|
154 */ |
|
155 { |
|
156 public: |
|
157 TUint iWidth; //the width of the display in pixels. |
|
158 TUint iHeight; // the height of the display in pixels. |
|
159 TInt iOffsetBetweenLines; |
|
160 TUint32 reserved_0; // reserved fields for future extension |
|
161 TUint32 reserved_1; |
|
162 TUint32 reserved_2; |
|
163 TUint32 reserved_3; |
|
164 TUint32 reserved_4; |
|
165 }; |
|
166 |
|
167 // display channel info |
|
168 class TDisplayInfo |
|
169 { |
|
170 public: |
|
171 enum { KMaxUserBuffers = 8 }; |
|
172 enum { KMaxRectangles = 4 }; |
|
173 TUint iBitsPerPixel; |
|
174 TUint iRefreshRateHz; |
|
175 TUint iAvailableRotations; |
|
176 TPixelFormat iPixelFormat; |
|
177 TOrientationSpecificInfo iNormal; // rotation of 0 or 180 degrees |
|
178 TOrientationSpecificInfo iFlipped; // rotation of 90 or 270 degrees |
|
179 TUint iNumCompositionBuffers; |
|
180 TUint32 reserved_0; // reserved fields for future extension |
|
181 TUint32 reserved_1; |
|
182 TUint32 reserved_2; |
|
183 TUint32 reserved_3; |
|
184 TUint32 reserved_4; |
|
185 }; |
|
186 |
|
187 /** Defines a resolution setting, a combination of a size in pixels and the |
|
188 rotations of that size that can be used. For consistency, the size is always |
|
189 given in terms of ERotationNormal, regardless of whether that rotation is |
|
190 supported or not. |
|
191 */ |
|
192 class TResolution |
|
193 { //Kernel mode makes use of agregate constructors |
|
194 public: |
|
195 #ifndef __KERNEL_MODE__ |
|
196 inline TResolution(TSize aPixelSize,TSize aTwipsSize, TUint32 aFlags = ERotationNormal); |
|
197 #endif |
|
198 |
|
199 public: |
|
200 /** The physical display size in pixels with no rotation (i.e. ERotationNormal). |
|
201 See RDisplayChannel::SetResolution(). |
|
202 */ |
|
203 TSize iPixelSize; |
|
204 /** The physical display size in twips with no rotation (i.e. ERotationNormal). |
|
205 See RDisplayChannel::SetResolution(). |
|
206 */ |
|
207 TSize iTwipsSize; |
|
208 /** A bitwise combination of RDisplayChannel::TDisplayRotation values. |
|
209 */ |
|
210 TUint32 iFlags; |
|
211 #ifndef __KERNEL_MODE__ |
|
212 private: |
|
213 #endif |
|
214 /** Reserved for extension and alignment. |
|
215 */ |
|
216 TUint32 reserved_0; |
|
217 }; |
|
218 |
|
219 /** |
|
220 Defines the format of a buffer to be posted using PostCompositionBuffer(), |
|
221 PostLegacyBuffer() or PostUserBuffer(). |
|
222 */ |
|
223 class TBufferFormat |
|
224 { //Kernel mode makes use of agregate constructors |
|
225 public: |
|
226 #ifndef __KERNEL_MODE__ |
|
227 inline TBufferFormat(TSize aSize, TPixelFormat aPixelFormat); |
|
228 #endif |
|
229 public: |
|
230 /** The pixel dimensions of the buffer. |
|
231 */ |
|
232 TSize iSize; |
|
233 /** The pixel format of the buffer. |
|
234 */ |
|
235 TPixelFormat iPixelFormat; |
|
236 #ifndef __KERNEL_MODE__ |
|
237 private: |
|
238 #endif |
|
239 /** Reserved for extension and alignment |
|
240 */ |
|
241 TUint32 reserved_0; |
|
242 }; |
|
243 |
|
244 struct TBufferFormatContext |
|
245 { |
|
246 #ifndef __KERNEL_MODE__ |
|
247 inline TBufferFormatContext(TResolution aResolution, TDisplayRotation aRotation, TInt aPlane); |
|
248 #endif |
|
249 /** The resolution to be used when the buffer format is processed |
|
250 */ |
|
251 TResolution iResolution; |
|
252 |
|
253 /** The rotation to be used when the buffer format is processed |
|
254 */ |
|
255 TDisplayRotation iRotation; |
|
256 |
|
257 /** The plane number, starting at zero |
|
258 */ |
|
259 TInt iPlane; |
|
260 }; |
|
261 |
|
262 inline static const TDesC& Name(); |
|
263 inline static TVersion VersionRequired(void); |
|
264 #ifndef __KERNEL_MODE__ |
|
265 // v1.0 methods |
|
266 inline TInt Open(TUint aScreen); |
|
267 inline void Close(void); |
|
268 inline TInt GetDisplayInfo(TDes8& aInfo); |
|
269 inline TDisplayRotation CurrentRotation(void); |
|
270 inline TInt GetCompositionBufferInfo(TUint aBufferIndex, RChunk& aChunk, TInt& aOffset); |
|
271 inline void GetCompositionBuffer(TUint& aBufferIndex, TRequestStatus& aStatus); |
|
272 inline void CancelGetCompositionBuffer(void); |
|
273 inline TInt PostCompositionBuffer(const TRegionFix<TDisplayInfo::KMaxRectangles>* aRegion, TPostCount& aCount ); |
|
274 inline TInt PostLegacyBuffer(const TRegionFix<TDisplayInfo::KMaxRectangles>* aRegion, TPostCount& aCount); |
|
275 inline TInt RegisterUserBuffer(TBufferId& aBufferId, const RChunk& aChunk, TInt aOffset); |
|
276 inline void PostUserBuffer(TBufferId aBufferId, TRequestStatus& aStatus, const TRegionFix<TDisplayInfo::KMaxRectangles>* aRegion, TPostCount& aCount ); |
|
277 inline void CancelPostUserBuffer(void); |
|
278 inline TInt DeregisterUserBuffer(TBufferId aBufferId); |
|
279 inline void WaitForPost(TPostCount aTPostCount, TRequestStatus& aStatus); |
|
280 inline void CancelWaitForPost(void); |
|
281 inline TInt SetRotation(TDisplayRotation aRotation, TBool& aDisplayConfigChanged); |
|
282 // added to v1.0 |
|
283 inline TInt Version(TVersion& aVersion); |
|
284 // v1.1 methods |
|
285 inline void NotifyOnDisplayChange(TRequestStatus& aStatus); |
|
286 inline void NotifyOnDisplayChangeCancel(); |
|
287 inline TInt NumberOfResolutions(); |
|
288 inline TInt GetResolutions(TDes8& aResolutions, TInt& aCount); |
|
289 inline TInt SetResolution(const TSize& aRes); |
|
290 inline TInt GetResolution(TSize& aSize); |
|
291 inline TInt GetTwips(TSize& aTwips); |
|
292 inline TInt NumberOfPixelFormats(); |
|
293 inline TInt GetPixelFormats(TDes8& aFormatsBuf, TInt& aCount); |
|
294 inline TInt SetBufferFormat(const TBufferFormat& aBufferFormat); |
|
295 inline TInt GetBufferFormat(TBufferFormat& aBufferFormat); |
|
296 inline TInt NextPlaneOffset(const TBufferFormat& aBufferFormat, TInt aPlane); |
|
297 inline TInt NextLineOffset(const TBufferFormat& aBufferFormat, TInt aPlane); |
|
298 // v1.2 methods |
|
299 inline TInt NextPlaneOffset(const TBufferFormat& aBufferFormat, const TResolution& aResolution, TDisplayRotation aRotation, TInt aPlane); |
|
300 inline TInt NextLineOffset(const TBufferFormat& aBufferFormat, const TResolution& aResolution, TDisplayRotation aRotation, TInt aPlane); |
|
301 #endif |
|
302 }; |
|
303 |
|
304 #include <dispchannel.inl> |
|
305 |
|
306 #endif /* __DISPLAY_CHANNEL__ */ |
|
307 |
|
308 // EOF |