graphics_plat/guestvideodriver_api/inc/guestvideodriver.h
branchbug235_bringup_0
changeset 146 4d1fe4a7ce83
child 153 d8f29c307082
equal deleted inserted replaced
145:8f2c3e21aac9 146:4d1fe4a7ce83
       
     1 // Copyright (c) 2010 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 "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 // Header file for guest video driver
       
    15 
       
    16 #ifndef __GUESTVIDEODRIVER_H__
       
    17 #define __GUESTVIDEODRIVER_H__
       
    18 
       
    19 #include <e32cmn.h>
       
    20 #include <e32std.h>
       
    21 #include <babitflags.h>
       
    22 
       
    23 #include "guestvideodrivercommon.h"
       
    24 
       
    25 class RemoteFunctionCallData;
       
    26 
       
    27 //Local request buffering size
       
    28 const TInt KRequestBufferSize = 20000;
       
    29 
       
    30 /**
       
    31  * Guest video driver user API. One instance exists per process.
       
    32  */
       
    33 NONSHARABLE_CLASS(RGuestVideoDriver) : public RBusLogicalChannel
       
    34     {
       
    35 public:
       
    36 	// Default constructor
       
    37 	IMPORT_C RGuestVideoDriver();
       
    38 
       
    39 	// Destructor
       
    40 	IMPORT_C ~RGuestVideoDriver();
       
    41 
       
    42 	/**
       
    43 	 * Opens this driver handle. Calls RBusLogicalChannel::DoCreate.
       
    44 	 * 
       
    45 	 * @return System wide error code
       
    46 	 */
       
    47 	IMPORT_C TInt Open();
       
    48 
       
    49 	/**
       
    50 	 * Executes a command 
       
    51 	 * @param aRequestData Remote function call
       
    52 	 */
       
    53 	IMPORT_C void ExecuteCommand(RemoteFunctionCallData& aRequestData);
       
    54 
       
    55 	/**
       
    56 	 * Flushes any buffered commands.
       
    57 	 */
       
    58 	IMPORT_C void Flush();
       
    59 
       
    60 	IMPORT_C TInt MapToHWAddress( const TInt aChunkHandle, TUint32& aHWAddress );
       
    61 
       
    62 	IMPORT_C TInt EglGetSgHandles( const TUint64 aId, TUint64 *aSgHandles );
       
    63 
       
    64 	/**
       
    65      * Gets Base Address of Frame Buffer
       
    66      * @param aHWAddress	returned Base Address
       
    67      *
       
    68 	 * @note	A base address of 0 is invalid, and indicates a failure to
       
    69      *          obtain the base address.
       
    70 	 */
       
    71 	IMPORT_C TInt GetFrameBufferBaseAddress( TUint32& aHWAddress );
       
    72 
       
    73 
       
    74 private:
       
    75 	/*
       
    76 	 Buffer, or send if it needs a reply, a command to the virtual video hardware
       
    77 	 @param aRFC Remote function call to buffer
       
    78 	 @return ETrue if buffering succeeds, otherwise the aRFC needs to be executed directly
       
    79 	 */
       
    80 	TBool BufferCommand( RemoteFunctionCallData& aRFC );
       
    81 
       
    82 	// Sends buffered commands 
       
    83 	void SendBuffer();
       
    84 
       
    85 private:
       
    86 	TBool     iIsOpen;
       
    87 	RMutex    iThreadLock;
       
    88 	/**
       
    89 	 * Request buffer
       
    90 	 */
       
    91 	TUint32                   iProcessId;
       
    92 	TBuf8<KRequestBufferSize> iBuffer;
       
    93     };
       
    94 
       
    95 
       
    96 #endif // __GUESTVIDEODRIVER_H__