os/kernelhwsrv/kernel/eka/include/dispchannel.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/dispchannel.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,597 @@
     1.4 +// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file dispchannel.inl
    1.21 + @publishedPartner
    1.22 + @released
    1.23 +*/
    1.24 +
    1.25 +#ifndef __DISPCHANNEL_INL__
    1.26 +#define __DISPCHANNEL_INL__
    1.27 +
    1.28 +#include <dispchannel.h>
    1.29 +
    1.30 +#ifndef __KERNEL_MODE__
    1.31 +
    1.32 +/** Creates a connection to the DisplayChannel Driver logical device driver.
    1.33 +    This handle will need to be closed by calling Close()
    1.34 +    when the connection to the Display Driver is no longer required.
    1.35 +
    1.36 +    @param aScreen  Identifies the screen this object will control
    1.37 +    @return KErrNone if successful, otherwise one of the system-wide error codes.
    1.38 +*/
    1.39 +inline TInt RDisplayChannel::Open(TUint aScreen)
    1.40 +	{
    1.41 +	TVersion versionAlwaysSupported(KDisplayChMajorVersionNumberAlwaysSupported,
    1.42 +                                    KDisplayChMinorVersionNumberAlwaysSupported,
    1.43 +                                    KDisplayChBuildVersionNumberAlwaysSupported);
    1.44 +	
    1.45 +    TInt r = DoCreate(Name(), versionAlwaysSupported, aScreen, NULL, NULL);
    1.46 +	return r;
    1.47 +	}
    1.48 +
    1.49 +/** The connection is closed and the driver reverts back to legacy behaviour,
    1.50 +    i.e. Non-GCE mode where the legacy buffer is used as the screen output
    1.51 +*/
    1.52 +inline void RDisplayChannel::Close(void)
    1.53 +	{
    1.54 +  	RBusLogicalChannel::Close();
    1.55 +	}
    1.56 +
    1.57 +/** Get the static details of the display-owned composition buffer(s).
    1.58 +    These are used with the address returned by GetCompositionBuffer()
    1.59 +    to describe the current composition buffer.
    1.60 +
    1.61 +    The normal and flipped size information reflects the maximum direct access display resolution,
    1.62 +    rather than the current resolution. The offset between lines remains constant,
    1.63 +    regardless of current buffer format. See NextLineOffset() for specific buffer
    1.64 +    format details.
    1.65 +
    1.66 +    The available rotations indicates all the possible rotations, across all
    1.67 +    resolutions, even if not all are supported in all cases.
    1.68 +
    1.69 +    @see SetResolution
    1.70 +    @see SetBufferFormat
    1.71 +    @see NextLineOffset
    1.72 +
    1.73 +    @param aInfo The static details of the composition buffer(s).
    1.74 +    @return KErrNone if successful, otherwise one of the system-wide error codes.
    1.75 +*/
    1.76 +inline TInt	RDisplayChannel::GetDisplayInfo(TDes8& aInfo)
    1.77 +	{
    1.78 +	return (DoControl(ECtrlGetDisplayInfo, &aInfo));
    1.79 +    }
    1.80 +
    1.81 +/** Return the access details for a composition buffer, opening a new handle to the chunk containing
    1.82 +    the composition buffer.  Note that because all returned information is static, this function will
    1.83 +    normally only be called called once for each composition buffer when the RDisplayChannel is opened.
    1.84 +
    1.85 +    @param aBufferIndex  The index of a composition buffer.
    1.86 +    @param aChunk A new open handle to chunk containing the composition buffer indexed by aBufferIndex.
    1.87 +    @param aChunkOffset The offset from the base address of aChunk to the composition buffer indexed by aBufferIndex.
    1.88 +    @return KErrNone if this command completed successfully, otherwise this is another of the system-wide error codes.
    1.89 +*/
    1.90 +inline TInt RDisplayChannel::GetCompositionBufferInfo(TUint aBufferIndex, RChunk& aChunk, TInt& aOffset)
    1.91 +	{
    1.92 +	TInt arg[2] = {0,0};
    1.93 +	(DoControl(ECtrlGetCompositionBufferInfo, &aBufferIndex, &arg));
    1.94 +    aChunk.SetHandle(arg[0]);
    1.95 +    aOffset = arg[1];
    1.96 +	return KErrNone;
    1.97 +	}
    1.98 +
    1.99 +/** Request the driver to identify a driver-owned composition buffer for the user to render into.
   1.100 +    This may not be completed until the next display refresh if the system is implementing multi-buffering
   1.101 +    and there are no composition buffers available immediately.
   1.102 +
   1.103 +    @param  aBufferIndex On completion of aStatus, contains the buffer index of driver-owned buffer suitable
   1.104 +    for client rendering.  The buffer access details can be retrieved by calling GetCompositionBufferInfo().
   1.105 +    The remaining buffer attributes are described by GetDisplayInfo()
   1.106 +    @param aStatus On completion, contains the status of the request. This is KErrNone if 
   1.107 +    the system is multi-buffered and an available buffer was returned.  
   1.108 +    This is KErrNone is the system is single-buffered and the primary buffer was returned.  
   1.109 +    Otherwise this is another of the system-wide error codes.
   1.110 +*/
   1.111 +inline void	RDisplayChannel::GetCompositionBuffer(TUint& aIndex, TRequestStatus& aStatus)
   1.112 +	{
   1.113 +	DoRequest(EReqGetCompositionBuffer, aStatus, (TAny*)&aIndex);
   1.114 +	}
   1.115 +
   1.116 +/** Cancel the outstanding request to GetCompositionBuffer()
   1.117 +*/
   1.118 +inline void	RDisplayChannel::CancelGetCompositionBuffer(void)
   1.119 +	{
   1.120 +	DoCancel(1<<ECtrlCancelGetCompositionBuffer);
   1.121 +	}
   1.122 +
   1.123 +/** Tells the driver to queue a request to show the composition buffer on screen at the next display refresh.
   1.124 +
   1.125 +    @param aRegion The region changed by the client.  The driver may choose to optimise posting using this
   1.126 +    information or it may ignore it.  Up to KMaxRectangles rectangles can be specified.  If null, the whole buffer is used.
   1.127 +    @param aPostCount This is an identifier returned by the driver for this Post request on exiting the method
   1.128 +*/
   1.129 +inline TInt RDisplayChannel::PostCompositionBuffer(const TRegionFix<TDisplayInfo::KMaxRectangles>* aRegion, TPostCount& aCount)
   1.130 +	{
   1.131 +	return (DoControl(ECtrlPostCompositionBuffer, (TAny*)aRegion, &aCount));
   1.132 +	}
   1.133 +
   1.134 +/** Request the driver to show the legacy buffer on screen at the next display refresh.
   1.135 +    @param aPostCount This is an identifier returned by the driver for this Post request on exiting the method.
   1.136 +    @return KErrNone if the request was queued successfully, otherwise this is another of the system-wide error codes.
   1.137 +*/
   1.138 +inline TInt	RDisplayChannel::PostLegacyBuffer(const TRegionFix<TDisplayInfo::KMaxRectangles>* aRegion, TPostCount& aCount)
   1.139 +	{
   1.140 +	return (DoControl(ECtrlPostLegacyBuffer, (TAny*)aRegion, &aCount));
   1.141 +	}
   1.142 +
   1.143 +/** Register a user-provided buffer for use by the driver.  This enables the user to subsequently post the buffer. 
   1.144 +    The number of registered buffers will need to have a limit and this is set to KMaxUserBuffers.
   1.145 +
   1.146 +    @param aBufferId Identifier to be used in the call to PostUserBuffer().
   1.147 +    @param aChunk Chunk containing memory to be used by the driver.
   1.148 +    @param aOffset Byte offset of the buffer from the chunk base.
   1.149 +    @return KErrNone if the buffer has successfully registered.  
   1.150 +    KErrTooBig if the number of registered buffers is at its limit when this call was made.  
   1.151 +    Otherwise this is another of the system-wide error codes.
   1.152 +*/
   1.153 +inline TInt RDisplayChannel::RegisterUserBuffer(TBufferId& aBufferId, const RChunk& aChunk, TInt aOffset)
   1.154 +	{
   1.155 +	TInt arg[2] = {aChunk.Handle(), aOffset};
   1.156 +	return (DoControl(ECtrlRegisterUserBuffer, arg, &aBufferId));
   1.157 +	}
   1.158 +
   1.159 +/** Request the driver to show a buffer on screen at the next display refresh and notify the user when the buffer 
   1.160 +    is no longer being displayed or has been dropped. Note that if two successive calls are made to PostUserBuffer() 
   1.161 +    in between vertical sync pulses, the latest PostUserBuffer() call will supersede the previous call and will complete 
   1.162 +    any outstanding request status object for that call with KErrCancel
   1.163 +
   1.164 +    @param aBufferId Identifier representing a buffer.  Generated by a previous call to RegisterUserBuffer().
   1.165 +    @param aStatus On completion the submitted buffer is no longer in use by the display hardware, unless the same 
   1.166 +    buffer is posted a second time before it has completed. aStatus contains the status of the request. This is KErrNone 
   1.167 +    if the request was executed successfully.  This is KErrCancel if this posting request was superseded by a more recent request.  
   1.168 +    This is KErrArgument if aBufferId is not a registered buffer. Otherwise this is another of the system-wide error codes.
   1.169 +    @param aRegion The region changed by the client.  The driver may choose to optimise posting using this information or it may ignore it.  
   1.170 +    Up to KMaxRectangles rectangles can be specified.  If null, the whole buffer is used.
   1.171 +    @param aPostCount This is an identifier returned by the driver for this Post request on exiting the method.
   1.172 +*/
   1.173 +inline void RDisplayChannel::PostUserBuffer(TBufferId aBufferId, TRequestStatus& aStatus, const TRegionFix<TDisplayInfo::KMaxRectangles>* aRegion, TPostCount& aCount)
   1.174 +	{
   1.175 +	TInt arg[2] = {aBufferId, reinterpret_cast<const TInt>(aRegion)};
   1.176 +	DoRequest(EReqPostUserBuffer, aStatus, arg, &aCount);
   1.177 +	}
   1.178 +
   1.179 +/** Cancel the outstanding request to PostUserBuffer
   1.180 +*/
   1.181 +inline void RDisplayChannel::CancelPostUserBuffer(void)
   1.182 +	{
   1.183 +	DoCancel(1<<ECtrlCancelPostUserBuffer);
   1.184 +	}
   1.185 +
   1.186 +/** Deregister a previously registered buffer.
   1.187 +
   1.188 +    @param aBufferId Identifier for a previously registered buffer, generated by a call to RegisterUserBuffer().
   1.189 +    @return KErrNone if successful, KErrArgument if the token is not recognised, KErrInUse if the buffer is still in use,
   1.190 +*/
   1.191 +inline TInt RDisplayChannel::DeregisterUserBuffer(TBufferId aBufferId)
   1.192 +	{
   1.193 +	return (DoControl(ECtrlDeregisterUserBuffer, (TAny*)&aBufferId));
   1.194 +	}
   1.195 +
   1.196 +/** This function allows the caller to be notified when a specified post either gets displayed or dropped.
   1.197 +    Completes when a specified post request either gets displayed or dropped.  
   1.198 +    Used to determine timing information for when a particular frame was displayed.
   1.199 +
   1.200 +    @param aPostCount An identifier representing a particular post request obtained from PostUserBuffer().
   1.201 +    @param aStatus On completion, contains the status of the request. This is KErrNone if the post request was 
   1.202 +    valid and was either displayed or dropped.  If aPostCount is less than the current count then this will complete 
   1.203 +    immediately with KErrNone. Otherwise this is another of the system-wide error codes.
   1.204 +*/
   1.205 +inline void RDisplayChannel::WaitForPost(TPostCount aPostCount, TRequestStatus& aStatus)
   1.206 +	{
   1.207 +    DoRequest(EReqWaitForPost, aStatus, &aPostCount);
   1.208 +	}
   1.209 +
   1.210 +/** Cancel the outstanding request to WaitForPost().
   1.211 +*/
   1.212 +inline void RDisplayChannel::CancelWaitForPost(void)
   1.213 +	{
   1.214 +	DoCancel(1<<ECtrlCancelWaitForPost);
   1.215 +	}
   1.216 +
   1.217 +/** Ensures that the next post request will be displayed using the requested rotation.
   1.218 +
   1.219 +    @param aRotation A specific rotation value.
   1.220 +    @param aDisplayConfigChanged Returns ETrue if the composition buffer is now using an alternative 
   1.221 +    (either Normal or Flipped) orientation following this call.
   1.222 +    @return KErrNone if rotation can be achieved.  KErrNotSupported if the requested rotation is not supported. 
   1.223 +    Otherwise this is another of the system-wide error codes.
   1.224 +*/
   1.225 +inline TInt RDisplayChannel::SetRotation(TDisplayRotation aRotation, TBool& aDisplayConfigChanged)
   1.226 +	{
   1.227 +	aDisplayConfigChanged = EFalse;
   1.228 +	return (DoControl(ECtrlSetRotation, &aRotation, &aDisplayConfigChanged));
   1.229 +	}
   1.230 +
   1.231 +/** Return the current rotation setting of the display.
   1.232 +*/
   1.233 +inline RDisplayChannel::TDisplayRotation RDisplayChannel::CurrentRotation(void)
   1.234 +	{
   1.235 +    TDisplayRotation rotation = ERotationNormal;
   1.236 +    DoControl(ECtrlCurrentRotation, &rotation);
   1.237 +    return rotation;
   1.238 +	}
   1.239 +
   1.240 +/** Asynchronous request for notification of when a display change occurs.
   1.241 +    The request is completed when the connectedness of the display changes, or when
   1.242 +    the set of available resolutions or pixel formats changes.
   1.243 +    
   1.244 +    If a failure occurs, it is passed back in the aStatus.
   1.245 +
   1.246 +    @panic DISPCHAN KNotificationAlreadySet if a notification request is pending.
   1.247 +    @param aStatus    Completed on display change, or cancellation.
   1.248 +*/
   1.249 +inline void RDisplayChannel::NotifyOnDisplayChange(TRequestStatus& aStatus)
   1.250 +	{
   1.251 +	DoRequest(EReqWaitForDisplayConnect, aStatus);
   1.252 +	}
   1.253 +
   1.254 +/** Cancels a pending request to notify on display change.
   1.255 +
   1.256 +    If there is a pending notification request, the status value will be set to
   1.257 +    KErrCancelled and it will be completed. If there is no pending request for
   1.258 +    notification, the call will simply return.
   1.259 +*/
   1.260 +inline void RDisplayChannel::NotifyOnDisplayChangeCancel()
   1.261 +	{
   1.262 +	DoCancel(1<<ECtrlCancelWaitForDisplayConnect);
   1.263 +	}
   1.264 +
   1.265 +/** Returns the number of display resolutions currently available.
   1.266 +
   1.267 +    This is the maximum number of resolutions that can currently be retrieved using
   1.268 +    GetResolutions() and set using a combination of SetResolution() and
   1.269 +    SetRotation().
   1.270 +    When no display is connected, there shall be a single entry.
   1.271 +    
   1.272 +    @return The number of TResolution elements that can be retrieved using
   1.273 +    GetResolutions().
   1.274 +*/
   1.275 +inline TInt RDisplayChannel::NumberOfResolutions()  
   1.276 +	{
   1.277 +	return (DoControl(ECtrlNumberOfResolutions));
   1.278 +	}
   1.279 +
   1.280 +/** Retrieves the resolutions that are currently available.
   1.281 +
   1.282 +    If the given buffer is large enough to hold them all, the set of available
   1.283 +    resolutions shall be written to it as a contiguous sequence of TResolution
   1.284 +    elements. aCount shall be set to the number of TResolution elements written and
   1.285 +    the length of the buffer shall be set to the total number of bytes written.
   1.286 +
   1.287 +    If a display can be disabled or become disconnected, the list shall include the
   1.288 +    size (0,0). If the display is connected but disabled, the list shall also
   1.289 +    include the other supported resolutions. If a display cannot be disconnected or
   1.290 +    disabled, the list shall not include (0,0).
   1.291 +
   1.292 +    @return KErrNone on success, KErrOverflow if the buffer is not large enough, or
   1.293 +    KErrNotSupported if not supported by driver..
   1.294 +    @param aResolutions    Buffer to receive resolutions, as a contiguous sequence
   1.295 +    of TResolution elements.
   1.296 +    @param aCount    The number of TResolution elements written to the buffer.
   1.297 +*/
   1.298 +inline TInt RDisplayChannel::GetResolutions(TDes8& aResolutions, TInt& aCount)  
   1.299 +	{
   1.300 +	return (DoControl(ECtrlGetResolutions,&aResolutions,&aCount));
   1.301 +	}
   1.302 +
   1.303 +/** Sets the display's new pixel resolution.
   1.304 +
   1.305 +    The resolution shall be in terms of no rotation (ERotationNormal), but the
   1.306 +    actual display output will depend on the current Rotation() value.
   1.307 +
   1.308 +    A successful call to this function may change any of the other attributes of
   1.309 +    the display channel. The change to the attributes happens immediately, but the
   1.310 +    change to the display output will only take place on the next buffer posting.
   1.311 +
   1.312 +    It is recommended that the implementation tries to minimize changes to other
   1.313 +    attributes, if possible. For example, if the current rotation is set to
   1.314 +    ERotation90CW and the new resolution supports that rotation, it should remain
   1.315 +    as the current rotation. On the other hand, if the new resolution does not
   1.316 +    support that rotation, it must be changed to a supported one.
   1.317 +
   1.318 +    If (0,0) is in the resolution list, passing a zero width and/or zero height
   1.319 +    resolution shall select it, and shall have the effect of disabling output.
   1.320 +
   1.321 +    If either dimension of the given resolution is negative, KErrArgument shall be
   1.322 +    returned. If the parameter is valid, but not currently available,
   1.323 +    KErrNotSupported shall be returned.
   1.324 +
   1.325 +    @see GetResolutions
   1.326 +    @capability WriteDeviceData Used to prevent arbitrary changes to the display
   1.327 +    resolution.
   1.328 +    @param aRes    The new display resolution.
   1.329 +    @return KErrNone on success. KErrNotSupported, KErrOutOfMemory or KErrArgument
   1.330 +    on failure.
   1.331 +*/
   1.332 +inline TInt RDisplayChannel::SetResolution(const TSize& aRes)
   1.333 +	{
   1.334 +	return (DoControl(ECtrlSetResolution,const_cast<TSize*>(&aRes)));
   1.335 +	}
   1.336 +
   1.337 +/** Returns the current resolution.
   1.338 +
   1.339 +    This is always in terms of the ERotationNormal rotation regardless of current
   1.340 +    and supported rotations. When the display is disconnected or disabled, this
   1.341 +    returns (0,0).
   1.342 +
   1.343 +    If the current rotation is ERotation90CW or ERotation270CW, the width and
   1.344 +    height values must be swapped by the caller to get the apparent width and
   1.345 +    height.
   1.346 +
   1.347 +    @param aSize    Receives the current resolution.
   1.348 +    @return KErrNone on success, KErrNotSupported if not supported by driver.
   1.349 +*/
   1.350 +inline TInt RDisplayChannel::GetResolution(TSize& aSize)  
   1.351 +	{
   1.352 +	return (DoControl(ECtrlGetResolution,&aSize));
   1.353 +	}
   1.354 +
   1.355 +inline TInt RDisplayChannel::GetTwips(TSize& aTwips)
   1.356 +	{
   1.357 +	return (DoControl(ECtrlGetTwips,&aTwips));
   1.358 +	}
   1.359 +
   1.360 +/** Returns the number of different buffer pixel formats that can be retrieved
   1.361 +    using GetPixelFormats().
   1.362 +
   1.363 +    @return The number of pixel formats supported.
   1.364 +*/
   1.365 +inline TInt RDisplayChannel::NumberOfPixelFormats()  
   1.366 +	{
   1.367 +	return (DoControl(ECtrlNumberOfPixelFormats));
   1.368 +	}
   1.369 +
   1.370 +/** Retrieves the buffer pixel formats that are supported.
   1.371 +
   1.372 +    If aFormatsBuf is large enough to hold them all, the set of available pixel
   1.373 +    formats shall be written to it as a contiguous sequence of TPixelFormat
   1.374 +    elements. aCount shall be set to the number of TPixelFormat elements written
   1.375 +    and the length of the buffer shall be set to the total number of bytes written.
   1.376 +
   1.377 +    Not all pixel formats may be valid in all circumstances.
   1.378 +
   1.379 +    @see SetBufferFormat
   1.380 +
   1.381 +    @param aFormatsBuf    Buffer to receive pixel formats, as a contiguous sequence
   1.382 +    of TUid elements.
   1.383 +    @param aCount    Receives the number of TUid elements written to the buffer.
   1.384 +    @return KErrNone on success, KErrOverflow if the buffer is too small to hold
   1.385 +    all the elements, or KErrNotSupported if not supported by driver.
   1.386 +*/
   1.387 +inline TInt RDisplayChannel::GetPixelFormats(TDes8& aFormatsBuf, TInt& aCount)  
   1.388 +	{
   1.389 +	return (DoControl(ECtrlGetPixelFormats,&aFormatsBuf,&aCount));
   1.390 +	}
   1.391 +
   1.392 +/** Sets the buffer format to be used when the next buffer is posted.
   1.393 +
   1.394 +    The width and height used in the buffer format correspond to the current
   1.395 +    rotation in effect. The size in the buffer format must be at least as big as
   1.396 +    the buffer mapping size, or the function shall fail with KErrNotSupported.
   1.397 +
   1.398 +    @see SetBufferMapping
   1.399 +    @see PostCompositionBuffer
   1.400 +    @see PostLegacyBuffer
   1.401 +    @see PostUserBuffer
   1.402 +
   1.403 +    @capability WriteDeviceData Used to prevent arbitrary changes to the buffer
   1.404 +    format.
   1.405 +    @param aBufferFormat    The buffer format to be used.
   1.406 +    @return KErrNone on success, KErrArgument if the buffer format is not valid,
   1.407 +    KErrNotSupported if the format is valid but not supported, or KErrOutOfMemory
   1.408 +    on memory allocation failure.
   1.409 +*/
   1.410 +inline TInt RDisplayChannel::SetBufferFormat(const TBufferFormat& aBufferFormat)
   1.411 +	{
   1.412 +	return (DoControl(ECtrlSetBufferFormat,const_cast<TBufferFormat*>(&aBufferFormat)));
   1.413 +
   1.414 +	}
   1.415 +
   1.416 +/** Retrieves the buffer format that will be used on the next buffer posting.
   1.417 +
   1.418 +    Initially, this will match the information returned by GetDisplayInfo() for the
   1.419 +    current rotation.
   1.420 +    When a new resolution, rotation or mapping is chosen, the buffer format may
   1.421 +    change.
   1.422 +
   1.423 +    @param aBufferFormat    Receives the buffer format.
   1.424 +    @return KErrNone on success, KErrNotSupported if not supported by driver.
   1.425 +*/
   1.426 +inline TInt RDisplayChannel::GetBufferFormat(TBufferFormat& aBufferFormat)  
   1.427 +	{
   1.428 +	return (DoControl(ECtrlGetBufferFormat,&aBufferFormat));
   1.429 +	}
   1.430 +
   1.431 +/** Returns the offset in bytes from the start of a plane to the next one, for the
   1.432 +    given buffer format.
   1.433 +
   1.434 +    This allows for additional bytes at the end of a plane before the start of the
   1.435 +    next one, to allow for alignment, for example.
   1.436 +
   1.437 +    For packed pixel formats and interleaved planes in semi-planar formats, the
   1.438 +    return value is zero.
   1.439 +    
   1.440 +    The current display channel resolution and the rotation is used in computing the
   1.441 +    next plane offset.
   1.442 +
   1.443 +    @param aBufferFormat    A buffer width, in pixels.
   1.444 +    @param aPlane    The plane number, starting at zero, for planar formats.
   1.445 +    @return The next plane offset, in bytes, or zero if the parameters are invalid,
   1.446 +    not recognised or not supported.
   1.447 +*/
   1.448 +inline TInt RDisplayChannel::NextPlaneOffset(const TBufferFormat& aBufferFormat, TInt aPlane) 
   1.449 +	{
   1.450 +	return (DoControl(ECtrlNextPlaneOffset,const_cast<TBufferFormat*>(&aBufferFormat),&aPlane));
   1.451 +	}
   1.452 +
   1.453 +/** Returns the offset in bytes between pixels in adjacent lines, for the given
   1.454 +    plane if relevant.
   1.455 +
   1.456 +    The value returned may allow for additional bytes at the end of each line, for
   1.457 +    the purposes of alignment, for example. This is also known as the "stride" of
   1.458 +    the line.
   1.459 +
   1.460 +    For packed pixel formats, aPlane is ignored. The offset returned shall be at
   1.461 +    least the width in pixels multiplied by the bytes per pixel.
   1.462 +
   1.463 +    The current display channel resolution and the rotation is used in computing the
   1.464 +    next line offset.
   1.465 +    
   1.466 +    For planar and semi-planar formats, aPlane dictates which offset is returned.
   1.467 +    It must be at least the width in pixels multiplied by the (possibly fractional)
   1.468 +    number of bytes per pixel for the plane.
   1.469 +
   1.470 +    @param aBufferFormat    The buffer format.
   1.471 +    @param aPlane    The plane number, starting at zero.
   1.472 +    @return The stride for a given combination of width in pixels and pixel format,
   1.473 +    or zero if the parameters are invalid, not recognised or not supported.
   1.474 +*/
   1.475 +inline TInt RDisplayChannel::NextLineOffset(const TBufferFormat& aBufferFormat, TInt aPlane) 
   1.476 +	{
   1.477 +	return (DoControl(ECtrlNextLineOffset,const_cast<TBufferFormat*>(&aBufferFormat),&aPlane));
   1.478 +	}
   1.479 +
   1.480 +/** Returns the offset in bytes from the start of a plane to the next one, for the
   1.481 +    given parameters.
   1.482 +
   1.483 +    This allows for additional bytes at the end of a plane before the start of the
   1.484 +    next one, to allow for alignment, for example.
   1.485 +
   1.486 +    For packed pixel formats and interleaved planes in semi-planar formats, the
   1.487 +    return value is zero.
   1.488 +
   1.489 +    For planar and semi-planar formats, aPlane dictates which offset is returned.
   1.490 +    It must be at least the width in pixels multiplied by the (possibly fractional)
   1.491 +    number of bytes per pixel for the plane.
   1.492 +
   1.493 +    @param aBufferFormat    The buffer format.
   1.494 +    @param aResolution	The resolution to be taken in consideration
   1.495 +    @param aRotation    The rotation to be taken in consideration
   1.496 +    @param aPlane    The plane number, starting at zero.
   1.497 +    @return The stride for a given combination of width in pixels and pixel format,
   1.498 +    or zero if the parameters are invalid, not recognised or not supported.
   1.499 +*/
   1.500 +inline TInt RDisplayChannel::NextPlaneOffset(const TBufferFormat& aBufferFormat, const TResolution& aResolution, TDisplayRotation aRotation, TInt aPlane)
   1.501 +	{
   1.502 +	TBufferFormatContext context(aResolution, aRotation, aPlane);
   1.503 +	return (DoControl(ECtrlNextPlaneOffsetExtended, const_cast<TBufferFormat*>(&aBufferFormat), &context));
   1.504 +	}
   1.505 +
   1.506 +/** Returns the offset in bytes between pixels in adjacent lines, for the given
   1.507 +    plane if relevant.
   1.508 +
   1.509 +    The value returned may allow for additional bytes at the end of each line, for
   1.510 +    the purposes of alignment, for example. This is also known as the "stride" of
   1.511 +    the line.
   1.512 +
   1.513 +    For packed pixel formats, aPlane is ignored. The offset returned shall be at
   1.514 +    least the width in pixels multiplied by the bytes per pixel.
   1.515 +
   1.516 +    For planar and semi-planar formats, aPlane dictates which offset is returned.
   1.517 +    It must be at least the width in pixels multiplied by the (possibly fractional)
   1.518 +    number of bytes per pixel for the plane.
   1.519 +
   1.520 +    @param aBufferFormat    The buffer format.
   1.521 +    @param aResolution	The resolution to be taken in consideration
   1.522 +    @param aRotation    The rotation to be taken in consideration
   1.523 +    @param aPlane    The plane number, starting at zero.
   1.524 +    @return The stride for a given combination of width in pixels and pixel format,
   1.525 +    or zero if the parameters are invalid, not recognised or not supported.
   1.526 +*/
   1.527 +inline TInt RDisplayChannel::NextLineOffset(const TBufferFormat& aBufferFormat, const TResolution& aResolution, TDisplayRotation aRotation, TInt aPlane)
   1.528 +	{
   1.529 +	TBufferFormatContext context(aResolution, aRotation, aPlane);
   1.530 +	return (DoControl(ECtrlNextLineOffsetExtended, const_cast<TBufferFormat*>(&aBufferFormat), &context));
   1.531 +	}
   1.532 +
   1.533 +/** Returns the current version of the driver.
   1.534 +*/
   1.535 +inline TInt RDisplayChannel::Version(TVersion& aVersion) 
   1.536 +	{
   1.537 +	return (DoControl(ECtrlVersion, &aVersion));
   1.538 +	}
   1.539 +
   1.540 +#ifdef _DEBUG
   1.541 +/** Debug only function to allocate a shared chunk user buffer for testing.
   1.542 +*/
   1.543 +inline TInt RDisplayChannel::CreateUserBuffer(TBufferFormat& aBufferFormat, RChunk& aChunk)
   1.544 +	{
   1.545 +	return (aChunk.SetReturnedHandle(DoControl(ECtrlCreateUserBuffer, &aBufferFormat)));
   1.546 +	}
   1.547 +#endif // _DEBUG
   1.548 +
   1.549 +/** Constructs a resolution setting.
   1.550 +
   1.551 +    @param aSize    The resolution size in pixels, in ERotationNormal rotation.
   1.552 +    @param aRotations    A bitwise combination of one or more TDisplayRotation
   1.553 +    values.
   1.554 +*/
   1.555 +inline RDisplayChannel::TResolution::TResolution(TSize aPixelSize, TSize aTwipsSize, TUint32 aFlags):
   1.556 +	iPixelSize(aPixelSize),iTwipsSize(aTwipsSize),iFlags(aFlags),reserved_0(0)
   1.557 +	{	}
   1.558 +
   1.559 +/** Constructs a buffer format.
   1.560 +
   1.561 +    @param aSize    The size in pixels.
   1.562 +    @param aPixelFormat    The pixel format.
   1.563 +*/
   1.564 +inline RDisplayChannel::TBufferFormat::TBufferFormat(TSize aSize, TPixelFormat aPixelFormat):
   1.565 +	iSize(aSize),iPixelFormat(aPixelFormat),reserved_0(0)
   1.566 +	{
   1.567 +	}
   1.568 +
   1.569 +
   1.570 +/** Constructs a buffer context.
   1.571 +
   1.572 +    @param aResolution    The display resolution.
   1.573 +    @param aRotation    The display rotation.
   1.574 +    @param aPlane
   1.575 +*/
   1.576 +inline RDisplayChannel::TBufferFormatContext::TBufferFormatContext(TResolution aResolution, TDisplayRotation aRotation, TInt aPlane):
   1.577 +	iResolution(aResolution), iRotation(aRotation), iPlane(aPlane)
   1.578 +	{
   1.579 +	}
   1.580 +
   1.581 +
   1.582 +#endif
   1.583 +
   1.584 +/**
   1.585 +*/
   1.586 +inline const TDesC& RDisplayChannel::Name()
   1.587 +{
   1.588 + return (KDisplayDriverName);
   1.589 +}
   1.590 +
   1.591 +/**
   1.592 +*/
   1.593 +inline TVersion RDisplayChannel::VersionRequired(void)
   1.594 +{
   1.595 +	return TVersion(KDisplayChMajorVersionNumber,
   1.596 +				    KDisplayChMinorVersionNumber,
   1.597 +			        KDisplayChBuildVersionNumber);
   1.598 +}
   1.599 +
   1.600 +#endif // __DISPCHANNEL_INL__