author | hgs |
Wed, 12 May 2010 10:34:10 +0100 | |
changeset 133 | 2a0ada0a1bf8 |
parent 31 | 56f325a607ea |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2007-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 |
// |
|
15 |
||
16 |
/** |
|
17 |
@file dispchannel.inl |
|
18 |
@publishedPartner |
|
19 |
@released |
|
20 |
*/ |
|
21 |
||
22 |
#ifndef __DISPCHANNEL_INL__ |
|
23 |
#define __DISPCHANNEL_INL__ |
|
24 |
||
25 |
#include <dispchannel.h> |
|
26 |
||
27 |
#ifndef __KERNEL_MODE__ |
|
28 |
||
29 |
/** Creates a connection to the DisplayChannel Driver logical device driver. |
|
30 |
This handle will need to be closed by calling Close() |
|
31 |
when the connection to the Display Driver is no longer required. |
|
32 |
||
33 |
@param aScreen Identifies the screen this object will control |
|
34 |
@return KErrNone if successful, otherwise one of the system-wide error codes. |
|
35 |
*/ |
|
36 |
inline TInt RDisplayChannel::Open(TUint aScreen) |
|
37 |
{ |
|
38 |
TVersion versionAlwaysSupported(KDisplayChMajorVersionNumberAlwaysSupported, |
|
39 |
KDisplayChMinorVersionNumberAlwaysSupported, |
|
40 |
KDisplayChBuildVersionNumberAlwaysSupported); |
|
41 |
||
42 |
TInt r = DoCreate(Name(), versionAlwaysSupported, aScreen, NULL, NULL); |
|
43 |
return r; |
|
44 |
} |
|
45 |
||
46 |
/** The connection is closed and the driver reverts back to legacy behaviour, |
|
47 |
i.e. Non-GCE mode where the legacy buffer is used as the screen output |
|
48 |
*/ |
|
49 |
inline void RDisplayChannel::Close(void) |
|
50 |
{ |
|
51 |
RBusLogicalChannel::Close(); |
|
52 |
} |
|
53 |
||
54 |
/** Get the static details of the display-owned composition buffer(s). |
|
55 |
These are used with the address returned by GetCompositionBuffer() |
|
56 |
to describe the current composition buffer. |
|
57 |
||
58 |
The normal and flipped size information reflects the maximum direct access display resolution, |
|
59 |
rather than the current resolution. The offset between lines remains constant, |
|
60 |
regardless of current buffer format. See NextLineOffset() for specific buffer |
|
61 |
format details. |
|
62 |
||
63 |
The available rotations indicates all the possible rotations, across all |
|
64 |
resolutions, even if not all are supported in all cases. |
|
65 |
||
66 |
@see SetResolution |
|
67 |
@see SetBufferFormat |
|
68 |
@see NextLineOffset |
|
69 |
||
70 |
@param aInfo The static details of the composition buffer(s). |
|
71 |
@return KErrNone if successful, otherwise one of the system-wide error codes. |
|
72 |
*/ |
|
73 |
inline TInt RDisplayChannel::GetDisplayInfo(TDes8& aInfo) |
|
74 |
{ |
|
75 |
return (DoControl(ECtrlGetDisplayInfo, &aInfo)); |
|
76 |
} |
|
77 |
||
78 |
/** Return the access details for a composition buffer, opening a new handle to the chunk containing |
|
79 |
the composition buffer. Note that because all returned information is static, this function will |
|
80 |
normally only be called called once for each composition buffer when the RDisplayChannel is opened. |
|
81 |
||
82 |
@param aBufferIndex The index of a composition buffer. |
|
83 |
@param aChunk A new open handle to chunk containing the composition buffer indexed by aBufferIndex. |
|
84 |
@param aChunkOffset The offset from the base address of aChunk to the composition buffer indexed by aBufferIndex. |
|
85 |
@return KErrNone if this command completed successfully, otherwise this is another of the system-wide error codes. |
|
86 |
*/ |
|
87 |
inline TInt RDisplayChannel::GetCompositionBufferInfo(TUint aBufferIndex, RChunk& aChunk, TInt& aOffset) |
|
88 |
{ |
|
89 |
TInt arg[2] = {0,0}; |
|
90 |
(DoControl(ECtrlGetCompositionBufferInfo, &aBufferIndex, &arg)); |
|
91 |
aChunk.SetHandle(arg[0]); |
|
92 |
aOffset = arg[1]; |
|
93 |
return KErrNone; |
|
94 |
} |
|
95 |
||
96 |
/** Request the driver to identify a driver-owned composition buffer for the user to render into. |
|
97 |
This may not be completed until the next display refresh if the system is implementing multi-buffering |
|
98 |
and there are no composition buffers available immediately. |
|
99 |
||
100 |
@param aBufferIndex On completion of aStatus, contains the buffer index of driver-owned buffer suitable |
|
101 |
for client rendering. The buffer access details can be retrieved by calling GetCompositionBufferInfo(). |
|
102 |
The remaining buffer attributes are described by GetDisplayInfo() |
|
103 |
@param aStatus On completion, contains the status of the request. This is KErrNone if |
|
104 |
the system is multi-buffered and an available buffer was returned. |
|
105 |
This is KErrNone is the system is single-buffered and the primary buffer was returned. |
|
106 |
Otherwise this is another of the system-wide error codes. |
|
107 |
*/ |
|
108 |
inline void RDisplayChannel::GetCompositionBuffer(TUint& aIndex, TRequestStatus& aStatus) |
|
109 |
{ |
|
110 |
DoRequest(EReqGetCompositionBuffer, aStatus, (TAny*)&aIndex); |
|
111 |
} |
|
112 |
||
113 |
/** Cancel the outstanding request to GetCompositionBuffer() |
|
114 |
*/ |
|
115 |
inline void RDisplayChannel::CancelGetCompositionBuffer(void) |
|
116 |
{ |
|
117 |
DoCancel(1<<ECtrlCancelGetCompositionBuffer); |
|
118 |
} |
|
119 |
||
120 |
/** Tells the driver to queue a request to show the composition buffer on screen at the next display refresh. |
|
121 |
||
122 |
@param aRegion The region changed by the client. The driver may choose to optimise posting using this |
|
123 |
information or it may ignore it. Up to KMaxRectangles rectangles can be specified. If null, the whole buffer is used. |
|
124 |
@param aPostCount This is an identifier returned by the driver for this Post request on exiting the method |
|
125 |
*/ |
|
126 |
inline TInt RDisplayChannel::PostCompositionBuffer(const TRegionFix<TDisplayInfo::KMaxRectangles>* aRegion, TPostCount& aCount) |
|
127 |
{ |
|
128 |
return (DoControl(ECtrlPostCompositionBuffer, (TAny*)aRegion, &aCount)); |
|
129 |
} |
|
130 |
||
131 |
/** Request the driver to show the legacy buffer on screen at the next display refresh. |
|
132 |
@param aPostCount This is an identifier returned by the driver for this Post request on exiting the method. |
|
133 |
@return KErrNone if the request was queued successfully, otherwise this is another of the system-wide error codes. |
|
134 |
*/ |
|
135 |
inline TInt RDisplayChannel::PostLegacyBuffer(const TRegionFix<TDisplayInfo::KMaxRectangles>* aRegion, TPostCount& aCount) |
|
136 |
{ |
|
137 |
return (DoControl(ECtrlPostLegacyBuffer, (TAny*)aRegion, &aCount)); |
|
138 |
} |
|
139 |
||
140 |
/** Register a user-provided buffer for use by the driver. This enables the user to subsequently post the buffer. |
|
141 |
The number of registered buffers will need to have a limit and this is set to KMaxUserBuffers. |
|
142 |
||
143 |
@param aBufferId Identifier to be used in the call to PostUserBuffer(). |
|
144 |
@param aChunk Chunk containing memory to be used by the driver. |
|
145 |
@param aOffset Byte offset of the buffer from the chunk base. |
|
146 |
@return KErrNone if the buffer has successfully registered. |
|
147 |
KErrTooBig if the number of registered buffers is at its limit when this call was made. |
|
148 |
Otherwise this is another of the system-wide error codes. |
|
149 |
*/ |
|
150 |
inline TInt RDisplayChannel::RegisterUserBuffer(TBufferId& aBufferId, const RChunk& aChunk, TInt aOffset) |
|
151 |
{ |
|
152 |
TInt arg[2] = {aChunk.Handle(), aOffset}; |
|
153 |
return (DoControl(ECtrlRegisterUserBuffer, arg, &aBufferId)); |
|
154 |
} |
|
155 |
||
156 |
/** Request the driver to show a buffer on screen at the next display refresh and notify the user when the buffer |
|
157 |
is no longer being displayed or has been dropped. Note that if two successive calls are made to PostUserBuffer() |
|
158 |
in between vertical sync pulses, the latest PostUserBuffer() call will supersede the previous call and will complete |
|
159 |
any outstanding request status object for that call with KErrCancel |
|
160 |
||
161 |
@param aBufferId Identifier representing a buffer. Generated by a previous call to RegisterUserBuffer(). |
|
162 |
@param aStatus On completion the submitted buffer is no longer in use by the display hardware, unless the same |
|
163 |
buffer is posted a second time before it has completed. aStatus contains the status of the request. This is KErrNone |
|
164 |
if the request was executed successfully. This is KErrCancel if this posting request was superseded by a more recent request. |
|
165 |
This is KErrArgument if aBufferId is not a registered buffer. Otherwise this is another of the system-wide error codes. |
|
166 |
@param aRegion The region changed by the client. The driver may choose to optimise posting using this information or it may ignore it. |
|
167 |
Up to KMaxRectangles rectangles can be specified. If null, the whole buffer is used. |
|
168 |
@param aPostCount This is an identifier returned by the driver for this Post request on exiting the method. |
|
169 |
*/ |
|
170 |
inline void RDisplayChannel::PostUserBuffer(TBufferId aBufferId, TRequestStatus& aStatus, const TRegionFix<TDisplayInfo::KMaxRectangles>* aRegion, TPostCount& aCount) |
|
171 |
{ |
|
172 |
TInt arg[2] = {aBufferId, reinterpret_cast<const TInt>(aRegion)}; |
|
173 |
DoRequest(EReqPostUserBuffer, aStatus, arg, &aCount); |
|
174 |
} |
|
175 |
||
176 |
/** Cancel the outstanding request to PostUserBuffer |
|
177 |
*/ |
|
178 |
inline void RDisplayChannel::CancelPostUserBuffer(void) |
|
179 |
{ |
|
180 |
DoCancel(1<<ECtrlCancelPostUserBuffer); |
|
181 |
} |
|
182 |
||
183 |
/** Deregister a previously registered buffer. |
|
184 |
||
185 |
@param aBufferId Identifier for a previously registered buffer, generated by a call to RegisterUserBuffer(). |
|
186 |
@return KErrNone if successful, KErrArgument if the token is not recognised, KErrInUse if the buffer is still in use, |
|
187 |
*/ |
|
188 |
inline TInt RDisplayChannel::DeregisterUserBuffer(TBufferId aBufferId) |
|
189 |
{ |
|
190 |
return (DoControl(ECtrlDeregisterUserBuffer, (TAny*)&aBufferId)); |
|
191 |
} |
|
192 |
||
193 |
/** This function allows the caller to be notified when a specified post either gets displayed or dropped. |
|
194 |
Completes when a specified post request either gets displayed or dropped. |
|
195 |
Used to determine timing information for when a particular frame was displayed. |
|
196 |
||
197 |
@param aPostCount An identifier representing a particular post request obtained from PostUserBuffer(). |
|
198 |
@param aStatus On completion, contains the status of the request. This is KErrNone if the post request was |
|
199 |
valid and was either displayed or dropped. If aPostCount is less than the current count then this will complete |
|
200 |
immediately with KErrNone. Otherwise this is another of the system-wide error codes. |
|
201 |
*/ |
|
202 |
inline void RDisplayChannel::WaitForPost(TPostCount aPostCount, TRequestStatus& aStatus) |
|
203 |
{ |
|
204 |
DoRequest(EReqWaitForPost, aStatus, &aPostCount); |
|
205 |
} |
|
206 |
||
207 |
/** Cancel the outstanding request to WaitForPost(). |
|
208 |
*/ |
|
209 |
inline void RDisplayChannel::CancelWaitForPost(void) |
|
210 |
{ |
|
211 |
DoCancel(1<<ECtrlCancelWaitForPost); |
|
212 |
} |
|
213 |
||
214 |
/** Ensures that the next post request will be displayed using the requested rotation. |
|
215 |
||
216 |
@param aRotation A specific rotation value. |
|
217 |
@param aDisplayConfigChanged Returns ETrue if the composition buffer is now using an alternative |
|
218 |
(either Normal or Flipped) orientation following this call. |
|
219 |
@return KErrNone if rotation can be achieved. KErrNotSupported if the requested rotation is not supported. |
|
220 |
Otherwise this is another of the system-wide error codes. |
|
221 |
*/ |
|
222 |
inline TInt RDisplayChannel::SetRotation(TDisplayRotation aRotation, TBool& aDisplayConfigChanged) |
|
223 |
{ |
|
224 |
aDisplayConfigChanged = EFalse; |
|
225 |
return (DoControl(ECtrlSetRotation, &aRotation, &aDisplayConfigChanged)); |
|
226 |
} |
|
227 |
||
228 |
/** Return the current rotation setting of the display. |
|
229 |
*/ |
|
230 |
inline RDisplayChannel::TDisplayRotation RDisplayChannel::CurrentRotation(void) |
|
231 |
{ |
|
232 |
TDisplayRotation rotation = ERotationNormal; |
|
233 |
DoControl(ECtrlCurrentRotation, &rotation); |
|
234 |
return rotation; |
|
235 |
} |
|
236 |
||
237 |
/** Asynchronous request for notification of when a display change occurs. |
|
238 |
The request is completed when the connectedness of the display changes, or when |
|
239 |
the set of available resolutions or pixel formats changes. |
|
240 |
||
241 |
If a failure occurs, it is passed back in the aStatus. |
|
242 |
||
243 |
@panic DISPCHAN KNotificationAlreadySet if a notification request is pending. |
|
244 |
@param aStatus Completed on display change, or cancellation. |
|
245 |
*/ |
|
246 |
inline void RDisplayChannel::NotifyOnDisplayChange(TRequestStatus& aStatus) |
|
247 |
{ |
|
248 |
DoRequest(EReqWaitForDisplayConnect, aStatus); |
|
249 |
} |
|
250 |
||
251 |
/** Cancels a pending request to notify on display change. |
|
252 |
||
253 |
If there is a pending notification request, the status value will be set to |
|
254 |
KErrCancelled and it will be completed. If there is no pending request for |
|
255 |
notification, the call will simply return. |
|
256 |
*/ |
|
257 |
inline void RDisplayChannel::NotifyOnDisplayChangeCancel() |
|
258 |
{ |
|
259 |
DoCancel(1<<ECtrlCancelWaitForDisplayConnect); |
|
260 |
} |
|
261 |
||
262 |
/** Returns the number of display resolutions currently available. |
|
263 |
||
264 |
This is the maximum number of resolutions that can currently be retrieved using |
|
265 |
GetResolutions() and set using a combination of SetResolution() and |
|
266 |
SetRotation(). |
|
267 |
When no display is connected, there shall be a single entry. |
|
268 |
||
269 |
@return The number of TResolution elements that can be retrieved using |
|
270 |
GetResolutions(). |
|
271 |
*/ |
|
272 |
inline TInt RDisplayChannel::NumberOfResolutions() |
|
273 |
{ |
|
274 |
return (DoControl(ECtrlNumberOfResolutions)); |
|
275 |
} |
|
276 |
||
277 |
/** Retrieves the resolutions that are currently available. |
|
278 |
||
279 |
If the given buffer is large enough to hold them all, the set of available |
|
280 |
resolutions shall be written to it as a contiguous sequence of TResolution |
|
281 |
elements. aCount shall be set to the number of TResolution elements written and |
|
282 |
the length of the buffer shall be set to the total number of bytes written. |
|
283 |
||
284 |
If a display can be disabled or become disconnected, the list shall include the |
|
285 |
size (0,0). If the display is connected but disabled, the list shall also |
|
286 |
include the other supported resolutions. If a display cannot be disconnected or |
|
287 |
disabled, the list shall not include (0,0). |
|
288 |
||
289 |
@return KErrNone on success, KErrOverflow if the buffer is not large enough, or |
|
290 |
KErrNotSupported if not supported by driver.. |
|
291 |
@param aResolutions Buffer to receive resolutions, as a contiguous sequence |
|
292 |
of TResolution elements. |
|
293 |
@param aCount The number of TResolution elements written to the buffer. |
|
294 |
*/ |
|
295 |
inline TInt RDisplayChannel::GetResolutions(TDes8& aResolutions, TInt& aCount) |
|
296 |
{ |
|
297 |
return (DoControl(ECtrlGetResolutions,&aResolutions,&aCount)); |
|
298 |
} |
|
299 |
||
300 |
/** Sets the display's new pixel resolution. |
|
301 |
||
302 |
The resolution shall be in terms of no rotation (ERotationNormal), but the |
|
303 |
actual display output will depend on the current Rotation() value. |
|
304 |
||
305 |
A successful call to this function may change any of the other attributes of |
|
306 |
the display channel. The change to the attributes happens immediately, but the |
|
307 |
change to the display output will only take place on the next buffer posting. |
|
308 |
||
309 |
It is recommended that the implementation tries to minimize changes to other |
|
310 |
attributes, if possible. For example, if the current rotation is set to |
|
311 |
ERotation90CW and the new resolution supports that rotation, it should remain |
|
312 |
as the current rotation. On the other hand, if the new resolution does not |
|
313 |
support that rotation, it must be changed to a supported one. |
|
314 |
||
315 |
If (0,0) is in the resolution list, passing a zero width and/or zero height |
|
316 |
resolution shall select it, and shall have the effect of disabling output. |
|
317 |
||
318 |
If either dimension of the given resolution is negative, KErrArgument shall be |
|
319 |
returned. If the parameter is valid, but not currently available, |
|
320 |
KErrNotSupported shall be returned. |
|
321 |
||
322 |
@see GetResolutions |
|
323 |
@capability WriteDeviceData Used to prevent arbitrary changes to the display |
|
324 |
resolution. |
|
325 |
@param aRes The new display resolution. |
|
326 |
@return KErrNone on success. KErrNotSupported, KErrOutOfMemory or KErrArgument |
|
327 |
on failure. |
|
328 |
*/ |
|
329 |
inline TInt RDisplayChannel::SetResolution(const TSize& aRes) |
|
330 |
{ |
|
331 |
return (DoControl(ECtrlSetResolution,const_cast<TSize*>(&aRes))); |
|
332 |
} |
|
333 |
||
334 |
/** Returns the current resolution. |
|
335 |
||
336 |
This is always in terms of the ERotationNormal rotation regardless of current |
|
337 |
and supported rotations. When the display is disconnected or disabled, this |
|
338 |
returns (0,0). |
|
339 |
||
340 |
If the current rotation is ERotation90CW or ERotation270CW, the width and |
|
341 |
height values must be swapped by the caller to get the apparent width and |
|
342 |
height. |
|
343 |
||
344 |
@param aSize Receives the current resolution. |
|
345 |
@return KErrNone on success, KErrNotSupported if not supported by driver. |
|
346 |
*/ |
|
347 |
inline TInt RDisplayChannel::GetResolution(TSize& aSize) |
|
348 |
{ |
|
349 |
return (DoControl(ECtrlGetResolution,&aSize)); |
|
350 |
} |
|
351 |
||
352 |
inline TInt RDisplayChannel::GetTwips(TSize& aTwips) |
|
353 |
{ |
|
354 |
return (DoControl(ECtrlGetTwips,&aTwips)); |
|
355 |
} |
|
356 |
||
357 |
/** Returns the number of different buffer pixel formats that can be retrieved |
|
358 |
using GetPixelFormats(). |
|
359 |
||
360 |
@return The number of pixel formats supported. |
|
361 |
*/ |
|
362 |
inline TInt RDisplayChannel::NumberOfPixelFormats() |
|
363 |
{ |
|
364 |
return (DoControl(ECtrlNumberOfPixelFormats)); |
|
365 |
} |
|
366 |
||
367 |
/** Retrieves the buffer pixel formats that are supported. |
|
368 |
||
369 |
If aFormatsBuf is large enough to hold them all, the set of available pixel |
|
370 |
formats shall be written to it as a contiguous sequence of TPixelFormat |
|
371 |
elements. aCount shall be set to the number of TPixelFormat elements written |
|
372 |
and the length of the buffer shall be set to the total number of bytes written. |
|
373 |
||
374 |
Not all pixel formats may be valid in all circumstances. |
|
375 |
||
376 |
@see SetBufferFormat |
|
377 |
||
378 |
@param aFormatsBuf Buffer to receive pixel formats, as a contiguous sequence |
|
379 |
of TUid elements. |
|
380 |
@param aCount Receives the number of TUid elements written to the buffer. |
|
381 |
@return KErrNone on success, KErrOverflow if the buffer is too small to hold |
|
382 |
all the elements, or KErrNotSupported if not supported by driver. |
|
383 |
*/ |
|
384 |
inline TInt RDisplayChannel::GetPixelFormats(TDes8& aFormatsBuf, TInt& aCount) |
|
385 |
{ |
|
386 |
return (DoControl(ECtrlGetPixelFormats,&aFormatsBuf,&aCount)); |
|
387 |
} |
|
388 |
||
389 |
/** Sets the buffer format to be used when the next buffer is posted. |
|
390 |
||
391 |
The width and height used in the buffer format correspond to the current |
|
392 |
rotation in effect. The size in the buffer format must be at least as big as |
|
393 |
the buffer mapping size, or the function shall fail with KErrNotSupported. |
|
394 |
||
395 |
@see SetBufferMapping |
|
396 |
@see PostCompositionBuffer |
|
397 |
@see PostLegacyBuffer |
|
398 |
@see PostUserBuffer |
|
399 |
||
400 |
@capability WriteDeviceData Used to prevent arbitrary changes to the buffer |
|
401 |
format. |
|
402 |
@param aBufferFormat The buffer format to be used. |
|
403 |
@return KErrNone on success, KErrArgument if the buffer format is not valid, |
|
404 |
KErrNotSupported if the format is valid but not supported, or KErrOutOfMemory |
|
405 |
on memory allocation failure. |
|
406 |
*/ |
|
407 |
inline TInt RDisplayChannel::SetBufferFormat(const TBufferFormat& aBufferFormat) |
|
408 |
{ |
|
409 |
return (DoControl(ECtrlSetBufferFormat,const_cast<TBufferFormat*>(&aBufferFormat))); |
|
410 |
||
411 |
} |
|
412 |
||
413 |
/** Retrieves the buffer format that will be used on the next buffer posting. |
|
414 |
||
415 |
Initially, this will match the information returned by GetDisplayInfo() for the |
|
416 |
current rotation. |
|
417 |
When a new resolution, rotation or mapping is chosen, the buffer format may |
|
418 |
change. |
|
419 |
||
420 |
@param aBufferFormat Receives the buffer format. |
|
421 |
@return KErrNone on success, KErrNotSupported if not supported by driver. |
|
422 |
*/ |
|
423 |
inline TInt RDisplayChannel::GetBufferFormat(TBufferFormat& aBufferFormat) |
|
424 |
{ |
|
425 |
return (DoControl(ECtrlGetBufferFormat,&aBufferFormat)); |
|
426 |
} |
|
427 |
||
428 |
/** Returns the offset in bytes from the start of a plane to the next one, for the |
|
429 |
given buffer format. |
|
430 |
||
431 |
This allows for additional bytes at the end of a plane before the start of the |
|
432 |
next one, to allow for alignment, for example. |
|
433 |
||
434 |
For packed pixel formats and interleaved planes in semi-planar formats, the |
|
435 |
return value is zero. |
|
436 |
||
437 |
The current display channel resolution and the rotation is used in computing the |
|
438 |
next plane offset. |
|
439 |
||
440 |
@param aBufferFormat A buffer width, in pixels. |
|
441 |
@param aPlane The plane number, starting at zero, for planar formats. |
|
442 |
@return The next plane offset, in bytes, or zero if the parameters are invalid, |
|
443 |
not recognised or not supported. |
|
444 |
*/ |
|
445 |
inline TInt RDisplayChannel::NextPlaneOffset(const TBufferFormat& aBufferFormat, TInt aPlane) |
|
446 |
{ |
|
447 |
return (DoControl(ECtrlNextPlaneOffset,const_cast<TBufferFormat*>(&aBufferFormat),&aPlane)); |
|
448 |
} |
|
449 |
||
450 |
/** Returns the offset in bytes between pixels in adjacent lines, for the given |
|
451 |
plane if relevant. |
|
452 |
||
453 |
The value returned may allow for additional bytes at the end of each line, for |
|
454 |
the purposes of alignment, for example. This is also known as the "stride" of |
|
455 |
the line. |
|
456 |
||
457 |
For packed pixel formats, aPlane is ignored. The offset returned shall be at |
|
458 |
least the width in pixels multiplied by the bytes per pixel. |
|
459 |
||
460 |
The current display channel resolution and the rotation is used in computing the |
|
461 |
next line offset. |
|
462 |
||
463 |
For planar and semi-planar formats, aPlane dictates which offset is returned. |
|
464 |
It must be at least the width in pixels multiplied by the (possibly fractional) |
|
465 |
number of bytes per pixel for the plane. |
|
466 |
||
467 |
@param aBufferFormat The buffer format. |
|
468 |
@param aPlane The plane number, starting at zero. |
|
469 |
@return The stride for a given combination of width in pixels and pixel format, |
|
470 |
or zero if the parameters are invalid, not recognised or not supported. |
|
471 |
*/ |
|
472 |
inline TInt RDisplayChannel::NextLineOffset(const TBufferFormat& aBufferFormat, TInt aPlane) |
|
473 |
{ |
|
474 |
return (DoControl(ECtrlNextLineOffset,const_cast<TBufferFormat*>(&aBufferFormat),&aPlane)); |
|
475 |
} |
|
476 |
||
477 |
/** Returns the offset in bytes from the start of a plane to the next one, for the |
|
478 |
given parameters. |
|
479 |
||
480 |
This allows for additional bytes at the end of a plane before the start of the |
|
481 |
next one, to allow for alignment, for example. |
|
482 |
||
483 |
For packed pixel formats and interleaved planes in semi-planar formats, the |
|
484 |
return value is zero. |
|
485 |
||
486 |
For planar and semi-planar formats, aPlane dictates which offset is returned. |
|
487 |
It must be at least the width in pixels multiplied by the (possibly fractional) |
|
488 |
number of bytes per pixel for the plane. |
|
489 |
||
490 |
@param aBufferFormat The buffer format. |
|
491 |
@param aResolution The resolution to be taken in consideration |
|
492 |
@param aRotation The rotation to be taken in consideration |
|
493 |
@param aPlane The plane number, starting at zero. |
|
494 |
@return The stride for a given combination of width in pixels and pixel format, |
|
495 |
or zero if the parameters are invalid, not recognised or not supported. |
|
496 |
*/ |
|
497 |
inline TInt RDisplayChannel::NextPlaneOffset(const TBufferFormat& aBufferFormat, const TResolution& aResolution, TDisplayRotation aRotation, TInt aPlane) |
|
498 |
{ |
|
499 |
TBufferFormatContext context(aResolution, aRotation, aPlane); |
|
500 |
return (DoControl(ECtrlNextPlaneOffsetExtended, const_cast<TBufferFormat*>(&aBufferFormat), &context)); |
|
501 |
} |
|
502 |
||
503 |
/** Returns the offset in bytes between pixels in adjacent lines, for the given |
|
504 |
plane if relevant. |
|
505 |
||
506 |
The value returned may allow for additional bytes at the end of each line, for |
|
507 |
the purposes of alignment, for example. This is also known as the "stride" of |
|
508 |
the line. |
|
509 |
||
510 |
For packed pixel formats, aPlane is ignored. The offset returned shall be at |
|
511 |
least the width in pixels multiplied by the bytes per pixel. |
|
512 |
||
513 |
For planar and semi-planar formats, aPlane dictates which offset is returned. |
|
514 |
It must be at least the width in pixels multiplied by the (possibly fractional) |
|
515 |
number of bytes per pixel for the plane. |
|
516 |
||
517 |
@param aBufferFormat The buffer format. |
|
518 |
@param aResolution The resolution to be taken in consideration |
|
519 |
@param aRotation The rotation to be taken in consideration |
|
520 |
@param aPlane The plane number, starting at zero. |
|
521 |
@return The stride for a given combination of width in pixels and pixel format, |
|
522 |
or zero if the parameters are invalid, not recognised or not supported. |
|
523 |
*/ |
|
524 |
inline TInt RDisplayChannel::NextLineOffset(const TBufferFormat& aBufferFormat, const TResolution& aResolution, TDisplayRotation aRotation, TInt aPlane) |
|
525 |
{ |
|
526 |
TBufferFormatContext context(aResolution, aRotation, aPlane); |
|
527 |
return (DoControl(ECtrlNextLineOffsetExtended, const_cast<TBufferFormat*>(&aBufferFormat), &context)); |
|
528 |
} |
|
529 |
||
530 |
/** Returns the current version of the driver. |
|
531 |
*/ |
|
532 |
inline TInt RDisplayChannel::Version(TVersion& aVersion) |
|
533 |
{ |
|
534 |
return (DoControl(ECtrlVersion, &aVersion)); |
|
535 |
} |
|
536 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
537 |
#ifdef _DEBUG |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
538 |
/** Debug only function to allocate a shared chunk user buffer for testing. |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
539 |
*/ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
540 |
inline TInt RDisplayChannel::CreateUserBuffer(TBufferFormat& aBufferFormat, RChunk& aChunk) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
541 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
542 |
return (aChunk.SetReturnedHandle(DoControl(ECtrlCreateUserBuffer, &aBufferFormat))); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
543 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
544 |
#endif // _DEBUG |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
545 |
|
0 | 546 |
/** Constructs a resolution setting. |
547 |
||
548 |
@param aSize The resolution size in pixels, in ERotationNormal rotation. |
|
549 |
@param aRotations A bitwise combination of one or more TDisplayRotation |
|
550 |
values. |
|
551 |
*/ |
|
552 |
inline RDisplayChannel::TResolution::TResolution(TSize aPixelSize, TSize aTwipsSize, TUint32 aFlags): |
|
553 |
iPixelSize(aPixelSize),iTwipsSize(aTwipsSize),iFlags(aFlags),reserved_0(0) |
|
554 |
{ } |
|
555 |
||
556 |
/** Constructs a buffer format. |
|
557 |
||
558 |
@param aSize The size in pixels. |
|
559 |
@param aPixelFormat The pixel format. |
|
560 |
*/ |
|
561 |
inline RDisplayChannel::TBufferFormat::TBufferFormat(TSize aSize, TPixelFormat aPixelFormat): |
|
562 |
iSize(aSize),iPixelFormat(aPixelFormat),reserved_0(0) |
|
563 |
{ |
|
564 |
} |
|
565 |
||
566 |
||
567 |
/** Constructs a buffer context. |
|
568 |
||
569 |
@param aResolution The display resolution. |
|
570 |
@param aRotation The display rotation. |
|
571 |
@param aPlane |
|
572 |
*/ |
|
573 |
inline RDisplayChannel::TBufferFormatContext::TBufferFormatContext(TResolution aResolution, TDisplayRotation aRotation, TInt aPlane): |
|
574 |
iResolution(aResolution), iRotation(aRotation), iPlane(aPlane) |
|
575 |
{ |
|
576 |
} |
|
577 |
||
578 |
||
579 |
#endif |
|
580 |
||
581 |
/** |
|
582 |
*/ |
|
583 |
inline const TDesC& RDisplayChannel::Name() |
|
584 |
{ |
|
585 |
return (KDisplayDriverName); |
|
586 |
} |
|
587 |
||
588 |
/** |
|
589 |
*/ |
|
590 |
inline TVersion RDisplayChannel::VersionRequired(void) |
|
591 |
{ |
|
592 |
return TVersion(KDisplayChMajorVersionNumber, |
|
593 |
KDisplayChMinorVersionNumber, |
|
594 |
KDisplayChBuildVersionNumber); |
|
595 |
} |
|
596 |
||
597 |
#endif // __DISPCHANNEL_INL__ |