Bootstrap the guestvideodriver and sghwserialiser. Some stuff is still commented out. Compiles with graphics package at changeset 8d47cca9cc11 bug235_bringup_0
authorFaisal Memon <faisal.memon@nokia.com>
Fri, 20 Aug 2010 18:02:40 +0100
branchbug235_bringup_0
changeset 1 d8d95053303a
parent 0 013716db5021
child 2 e8ccf068ac7f
Bootstrap the guestvideodriver and sghwserialiser. Some stuff is still commented out. Compiles with graphics package at changeset 8d47cca9cc11
guestrendering/guestvideodriver/api/group/bld.inf
guestrendering/guestvideodriver/api/group/guestvideodriver.mmp
guestrendering/guestvideodriver/api/src/guestvideodriver.cpp
guestrendering/guestvideodriver/group/bld.inf
guestrendering/guestvideodriver/ldd/group/bld.inf
guestrendering/guestvideodriver/ldd/group/reqhandlerextension.mmp
guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp
guestrendering/guestvideodriver/ldd/src/devicereqhandler.cpp
guestrendering/guestvideodriver/ldd/src/reqhandlerextension.cpp
guestrendering/guestvideodriver/ldd/src/virtualvideohwchannel.cpp
guestrendering/guestvideodriver/ldd/src/virtualvideohwdevice.cpp
guestrendering/guestvideodriver/ldd/src/virtualvideohwinterface.cpp
guestrendering/guestvideodriver/rom/guestvideodriver.iby
guestrendering/vghwserialiser/eabi/vghwserialiseru.def
guestrendering/vghwserialiser/group/bld.inf
guestrendering/vghwserialiser/group/vghwserialiser.mmp
guestrendering/vghwserialiser/inc/driverrfc.h
guestrendering/vghwserialiser/inc/driverrfc.inl
guestrendering/vghwserialiser/inc/eglrfc.h
guestrendering/vghwserialiser/inc/eglrfc.inl
guestrendering/vghwserialiser/inc/opengles11rfc.h
guestrendering/vghwserialiser/inc/opengles11rfc.inl
guestrendering/vghwserialiser/inc/openvgrfc.h
guestrendering/vghwserialiser/inc/openvgrfc.inl
guestrendering/vghwserialiser/inc/remotefunctioncall.h
guestrendering/vghwserialiser/inc/requestbuffer.h
guestrendering/vghwserialiser/inc/serialisedapiuids.h
guestrendering/vghwserialiser/inc/serializedfunctioncall.h
guestrendering/vghwserialiser/inc/serializerplatform.h
guestrendering/vghwserialiser/src/driverrfc.cpp
guestrendering/vghwserialiser/src/eglrfc.cpp
guestrendering/vghwserialiser/src/opengles11rfc.cpp
guestrendering/vghwserialiser/src/openvgrfc.cpp
guestrendering/vghwserialiser/src/remotefunctioncall.cpp
guestrendering/vghwserialiser/src/serializedfunctioncall.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/api/group/bld.inf	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,21 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Build file for guest video driver 
+/
+
+PRJ_PLATFORMS
+ARMV5
+
+PRJ_MMPFILES
+guestvideodriver.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/api/group/guestvideodriver.mmp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,45 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Project file for Guest Video Driver Implementation
+
+#include <platform_paths.hrh>
+
+TARGET          guestvideohwapi.dll
+TARGETTYPE      dll
+UID             0x1000008D 0x20026A2F
+NOEXPORTLIBRARY
+LINKAS          guestvideohwapi.dll
+
+DEFFILE         /epoc32/include/def/eabi/guestvideohwapi.def
+VENDORID        VID_DEFAULT
+CAPABILITY      CAP_GENERAL_DLL
+
+SOURCEPATH      ../src
+
+SOURCE          guestvideodriver.cpp
+
+USERINCLUDE     ../../../serialiser/inc
+
+USERINCLUDE     ../inc
+USERINCLUDE	../../../vghwserialiser/inc
+
+// Default system include paths for middleware layer modules
+OS_LAYER_SYSTEMINCLUDE
+OS_LAYER_ESTLIB_SYSTEMINCLUDE
+//SYSTEMINCLUDE   /epoc32/include/internal
+
+LIBRARY         euser.lib
+LIBRARY         vghwserialiser.lib
+
+LANG            SC
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/api/src/guestvideodriver.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,254 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Guest Video Driver Implementation
+
+#include <e32cmn.h>
+#include <e32des8.h> 
+#include <e32std.h> 
+#include <e32debug.h> 
+
+#include <graphics/guestvideodriver.h>
+#include <graphics/guestvideodriverprotocol.h>
+#include <graphics/guestvideodriverinterfaceconstants.h>
+
+#include "remotefunctioncall.h"
+#include "serializedfunctioncall.h"
+
+// tracing
+#ifdef _DEBUG
+#include <e32debug.h>
+    #define UTIL_TRACE(fmt, args...) RDebug::Printf(fmt, ##args)
+	#define DRVRPANIC_ASSERT(condition, panic) if (!(condition)) { DriverPanic(panic, #condition, __LINE__); }
+	#define DRVRPANIC_ASSERT_DEBUG(condition, panic) if (!(condition)) { DriverPanic(panic, #condition, __LINE__); }
+#else
+    #define UTIL_TRACE(fmt, args...)
+	#define DRVRPANIC_ASSERT(condition, panic) if (!(condition)) { DriverPanic(panic, NULL, __LINE__); }
+	#define DRVRPANIC_ASSERT_DEBUG(condition, panic)
+#endif
+
+//Max supported request size
+const TUint32 KMaxRequestSize( VVI_PARAMETERS_INPUT_MEMORY_SIZE );
+
+typedef enum
+	{
+	EDriverPanicSendBufferFailed=1,
+	EDriverPanicInvalidOperationType,
+	EDriverPanicOperationDataTooBig,
+	EDriverPanicDriverAlreadyOpen,
+	EDriverPanicCreateDriverChannelFailed,
+	EDriverPanicCreateThreadLockFailed,
+	EDriverPanicSendBufferFnDoesNotHaveThreadLock,
+	EDriverPanicBufferCommandFnDoesNotHaveThreadLock,
+	EDriverPanicDriverNotOpenForExecuteCommandFn,
+	EDriverPanicRequestStatusErrorInExecuteCommandFn, // 10
+	EDriverPanicBufferWriteFailed,
+	} TDriverPanic;
+
+_LIT(KDriverPanicCategory, "Guest VidDrv");
+
+void DriverPanic(TDriverPanic aPanicCode, char* aCondition, TInt aLine)
+	{
+	UTIL_TRACE("Guest Video Driver Panic %d for failed Assert (%s), at guestvideodriver.cpp:%d", aPanicCode, aCondition, aLine);
+		
+	User::Panic(KDriverPanicCategory, aPanicCode);
+	}
+
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// RGuestVideoDriver::RGuestVideoDriver
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RGuestVideoDriver::RGuestVideoDriver() : iIsOpen(EFalse), iProcessId(0)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// RGuestVideoDriver::Open
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RGuestVideoDriver::Open()
+    {
+	UTIL_TRACE("RGuestVideoDriver::Open start iProcessId=0x%x, iIsOpen=%d", iProcessId, iIsOpen);
+	DRVRPANIC_ASSERT(iIsOpen == EFalse, EDriverPanicDriverAlreadyOpen);
+	iProcessId = RProcess().Id();
+	TInt error = iThreadLock.CreateLocal(EOwnerProcess);
+	DRVRPANIC_ASSERT_DEBUG( error == KErrNone, EDriverPanicCreateThreadLockFailed);
+	if (!error)
+		{
+		error = DoCreate(
+			GuestVideoDriver::KDeviceName,
+			TVersion( GuestVideoDriver::KMajorVer,
+					  GuestVideoDriver::KMinorVer,
+					  GuestVideoDriver::KBuildVer ),
+			KNullUnit,
+			NULL,
+			NULL);
+		DRVRPANIC_ASSERT_DEBUG( error == KErrNone, EDriverPanicCreateDriverChannelFailed);
+		if (!error)
+			{
+			iIsOpen = ETrue;
+			}
+		}
+	UTIL_TRACE("RGuestVideoDriver::Open end iProcessId=0x%x, error=%d", iProcessId, error);
+	return error;
+	}
+
+// -----------------------------------------------------------------------------
+// RGuestVideoDriver::~RGuestVideoDriver
+// -----------------------------------------------------------------------------
+//
+EXPORT_C RGuestVideoDriver::~RGuestVideoDriver()
+    {
+	UTIL_TRACE("RGuestVideoDriver::~RGuestVideoDriver iProcessId=0x%x", iProcessId);
+	iThreadLock.Close();
+    }
+
+// -----------------------------------------------------------------------------
+// RGuestVideoDriver::ExecuteCommand
+// Syncrhonous version with local buffering
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void RGuestVideoDriver::ExecuteCommand(RemoteFunctionCallData& aRequestData)
+	{
+	DRVRPANIC_ASSERT(iIsOpen, EDriverPanicDriverNotOpenForExecuteCommandFn);
+	DRVRPANIC_ASSERT( (RemoteFunctionCallData::EOpRequestWithReply == aRequestData.Header().iOpType) ||
+			(RemoteFunctionCallData::EOpRequest == aRequestData.Header().iOpType),
+			EDriverPanicInvalidOperationType);
+
+	//Set thread and process id
+	aRequestData.SetThreadInformation(iProcessId, RThread().Id());
+	TBool sendNow = (RemoteFunctionCallData::EOpRequest != aRequestData.Header().iOpType); 
+	if (!sendNow)
+		{
+		iThreadLock.Wait();
+		while (!BufferCommand(aRequestData))
+			{
+			// Flush any queued commands & retry
+			if (iBuffer.Length())
+				{
+				SendBuffer();
+				}
+			else
+				{ // Too big for buffer
+				sendNow = ETrue;
+				break;
+				}
+			}
+		iThreadLock.Signal();
+		}
+
+	if (sendNow)
+		{
+		// Maintain order of operations by flushing queue
+		iThreadLock.Wait();
+		if (iBuffer.Length())
+			{
+			SendBuffer();
+			}
+		iThreadLock.Signal();
+
+		TRequestStatus status;
+		TPckg<RemoteFunctionCallData> data(aRequestData);
+		DRVRPANIC_ASSERT(data().SerialisedLength() <= KMaxRequestSize, EDriverPanicOperationDataTooBig);
+		UTIL_TRACE("RGuestVideoDriver::ExecuteCommand direct send, req length=%d", data().SerialisedLength());
+		DoRequest(GuestVideoDriver::ERequestExecuteCommand, status, (TAny*)&data);
+		User::WaitForRequest(status);
+		// status <> 0 if write of reply data failed
+		DRVRPANIC_ASSERT_DEBUG(status.Int() == KErrNone, EDriverPanicRequestStatusErrorInExecuteCommandFn);
+		}
+	}
+
+// Flush video Command buffer
+EXPORT_C void RGuestVideoDriver::Flush()
+	{
+	iThreadLock.Wait();
+	if (iIsOpen && iBuffer.Length())
+		{
+		SendBuffer();
+		}
+	iThreadLock.Signal();
+	}
+
+
+// -----------------------------------------------------------------------------
+// RGuestVideoDriver::BufferCommand
+// -----------------------------------------------------------------------------
+//
+TBool RGuestVideoDriver::BufferCommand( RemoteFunctionCallData& aRequestData )
+	{
+	DRVRPANIC_ASSERT_DEBUG(iThreadLock.IsHeld(), EDriverPanicBufferCommandFnDoesNotHaveThreadLock);
+	TBool result = EFalse;
+	SerializedFunctionCall data( aRequestData );
+
+	const TUint32 len = aRequestData.SerialisedLength();
+	const TInt alignmentAdjIndex( RemoteFunctionCallData::AlignIndex( iBuffer.Length(), 4 ) );
+
+	if ( (alignmentAdjIndex + len) < iBuffer.MaxLength() )
+		{
+		//There is enough space left on local buffer
+		iBuffer.SetLength( alignmentAdjIndex + len );
+		TPtrC8 serialisedDataPtr = iBuffer.Right( len );
+		TInt wlen = data.WriteToBuffer( const_cast<TUint8*>(serialisedDataPtr.Ptr()), len, 0 );
+		DRVRPANIC_ASSERT(wlen == len, EDriverPanicBufferWriteFailed);
+		result = ETrue;
+		}
+
+	UTIL_TRACE("RGuestVideoDriver::BufferCommand length=%d, Req len=%d, result=%d",
+			iBuffer.Length(), len, result);
+	return result;
+	}
+
+// -----------------------------------------------------------------------------
+// RGuestVideoDriver::MapToHWAddress
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RGuestVideoDriver::MapToHWAddress( const TInt aChunkHandle, TUint32& aHWAddress )
+    {
+    TPckgBuf<TInt> handle( aChunkHandle );
+    TPckg<TUint32> address( aHWAddress );
+    return DoControl( GuestVideoDriver::ERequestMapAddress, (TAny*)&handle, (TAny*)&address );
+    }
+
+// -----------------------------------------------------------------------------
+// RGuestVideoDriver::EglGetSgHandles
+// -----------------------------------------------------------------------------
+//
+EXPORT_C TInt RGuestVideoDriver::EglGetSgHandles( const TUint64 aId, TUint64 *aSgHandles )
+    {
+    TPckg<TUint64> sgId( aId );
+    TPckg<TUint64> sgHandles( *aSgHandles );
+    return DoControl( GuestVideoDriver::ERequestSgHandles, (TAny*)&sgId, (TAny*)&sgHandles );
+    }
+
+// -----------------------------------------------------------------------------
+// RGuestVideoDriver::SendBuffer
+// -----------------------------------------------------------------------------
+//
+void RGuestVideoDriver::SendBuffer()
+    {
+	UTIL_TRACE("RGuestVideoDriver::SendBuffer length=%d", iBuffer.Length());
+	DRVRPANIC_ASSERT_DEBUG(iThreadLock.IsHeld(), EDriverPanicSendBufferFnDoesNotHaveThreadLock);
+    TRequestStatus status;
+
+    DoRequest(GuestVideoDriver::ERequestLoadCommands, status, (TAny*)&iBuffer);
+
+    User::WaitForRequest( status );
+
+    iBuffer.Zero();
+	UTIL_TRACE("RGuestVideoDriver::SendBuffer status=%d", status.Int());
+	// Commands expecting a reply should never come through here, so status should always be KErrNone
+	DRVRPANIC_ASSERT(status.Int() == KErrNone, EDriverPanicSendBufferFailed);
+    }
--- a/guestrendering/guestvideodriver/group/bld.inf	Tue Aug 17 16:01:36 2010 +0100
+++ b/guestrendering/guestvideodriver/group/bld.inf	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,20 @@
+// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Project file for the guest video driver used in simulation environments
+
+#include "../api/group/bld.inf"
+#include "../ldd/group/bld.inf"
+
+PRJ_EXPORTS
+../rom/guestvideodriver.iby           /epoc32/rom/include/guestvideodriver.iby
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/ldd/group/bld.inf	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,23 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Build information file for Logical Device Driver for Virtual Video HW Device
+
+PRJ_PLATFORMS
+ARMV5
+
+PRJ_MMPFILES
+#ifdef FAISALMEMON_S4_SGIMAGE
+reqhandlerextension.mmp
+#endif
+// now lets tackle virtualvideohwdevice.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/ldd/group/reqhandlerextension.mmp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// 
+//
+
+#include <kernel/kern_ext.mmh>
+
+
+TARGET reqhandlerextension.dll
+TARGETTYPE KEXT
+UID 0x1000008D
+VENDORID 0x70000001
+EXPORTLIBRARY   reqhandlerextension.lib
+LINKAS          reqhandlerextension.dll
+DEFFILE         /epoc32/include/def/eabi/reqhandlerextension.def
+
+CAPABILITY ALL
+
+OS_LAYER_ESTLIB_SYSTEMINCLUDE
+// SYSTEMINCLUDE   /epoc32/include/drivers
+// SYSTEMINCLUDE   /epoc32/include/internal
+OS_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE     ../../../serialiser/inc
+
+USERINCLUDE ../inc
+SOURCEPATH ../src
+SOURCE reqhandlerextension.cpp
+
+
+EPOCALLOWDLLDATA
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,68 @@
+/*
+* ==============================================================================
+*  Name        : VirtualVideoHwDevice.mmp
+*  Part of     : aasw / aamm
+*  Description : Project information file for Graphics Hw LDD.
+*  Version     : %version:7 %
+*
+*  Copyright © 2002-2010 Nokia. All rights reserved.
+*  This material, including documentation and any related 
+*  computer programs, is protected by copyright controlled by 
+*  Nokia. All rights are reserved. Copying, including 
+*  reproducing, storing, adapting or translating, any 
+*  or all of this material requires the prior written consent of 
+*  Nokia. This material also contains confidential 
+*  information which may not be disclosed to others without the 
+*  prior written consent of Nokia.
+* ==============================================================================
+*/
+
+#include <kernel/kern_ext.mmh>
+
+TARGET          platsimvideohw.ldd
+TARGETTYPE      ldd
+ 
+UID             0 0x20026A2E //- 0x20026A32
+LINKAS          platsimvideohw.ldd
+VENDORID        0x70000001
+CAPABILITY      all
+
+OS_LAYER_SYSTEMINCLUDE
+OS_LAYER_KERNEL_SYSTEMINCLUDE
+OS_LAYER_ESTLIB_SYSTEMINCLUDE
+USERINCLUDE     ../inc
+USERINCLUDE     ../../commoninc
+SYSTEMINCLUDE   /epoc32/include/drivers
+SYSTEMINCLUDE   /epoc32/include/internal
+
+SOURCEPATH      ../src
+SOURCE          virtualvideohwdevice.cpp
+SOURCE          virtualvideohwchannel.cpp
+SOURCE          devicereqhandler.cpp
+SOURCE          virtualvideohwinterface.cpp
+
+USERINCLUDE     ../../../serialiser/inc
+USERINCLUDE     ../../../graphicsresourceimplementation/inc
+
+SOURCEPATH      ../../../serialiser/src
+SOURCE remotefunctioncall.cpp
+SOURCE serializedfunctioncall.cpp
+SOURCE eglrfc.cpp
+SOURCE openvgrfc.cpp
+SOURCE driverrfc.cpp
+SOURCE opengles11rfc.cpp
+
+#if defined(NCP_COMMON_RAPU_FAMILY)
+LIBRARY         karap.lib
+#else
+LIBRARY         VariantTarget(kanomadik,lib)
+#endif // NCP_COMMON_RAPU_FAMILY
+
+LIBRARY			reqhandlerextension.lib
+LIBRARY			sgextension.lib
+
+start wins
+win32_headers
+end
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/ldd/src/devicereqhandler.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,1439 @@
+/*
+ * =============================================================================
+ *  Name        : devicereqhandler.cpp
+ *  Part of     : 
+ *  Description : Implementation of the class DDeviceReqHandler.
+ *  Version     : %version:6 %
+ *
+ *  Copyright © 2008-2010 Nokia. All rights reserved.
+ *  This material, including documentation and any related
+ *  computer programs, is protected by copyright controlled by
+ *  Nokia. All rights are reserved. Copying, including
+ *  reproducing, storing, adapting or translating, any
+ *  or all of this material requires the prior written consent of
+ *  Nokia. This material also contains confidential
+ *  information which may not be disclosed to others without the
+ *  prior written consent of Nokia.
+ * =============================================================================
+ */
+
+
+// INCLUDE FILES
+#include <platform.h>
+#include <assp.h>
+#include <kernel/kernel.h>
+#include <e32cmn.h>
+
+#include "devicereqhandler.h"
+#include "virtualvideohwinterface.h"
+
+#include "virtualvideotracing.h"
+
+#include "remotefunctioncall.h"
+#include "serializedfunctioncall.h"
+#include "driverrfc.h"
+#include "openvgrfc.h" //For the opcodes
+#include "eglrfc.h" //For the opcodes
+#include "opengles11rfc.h" //For the opcodes
+
+
+using namespace PlatsimVideoDriver;
+
+// LOCAL DATA TYPES
+TInt CmpTPbsIds(const TPbSId& a, const TPbSId& b)
+    {
+    if( a.iPbuffer == b.iPbuffer )
+        return 0;
+    else
+        return b.iPbuffer - a.iPbuffer;
+    }
+
+TInt CmpTVGIsIds(const TVGISId& a, const TVGISId& b)
+    {
+    if( a.iVGImage == b.iVGImage )
+        return 0;
+    else
+        return b.iVGImage - a.iVGImage;
+    }
+/*
+ * Copies data from client space to the request buffer during serialisation
+ */
+class TDataFromClientSpaceCopier: public MDataCopier
+    {
+public:
+    TDataFromClientSpaceCopier( DThread* aUserThread ):
+        iUserThread(aUserThread)
+        {
+        }
+    
+    TInt CopyData( TUint8* aDest, const TUint8* aSource, TUint32 aSize )
+        {
+        memcpy( aDest, aSource, aSize );
+        return KErrNone;
+        }
+    
+    TInt CopyVector( TUint8* aDest, const TUint8* aSource, TUint32 aSize )
+        {
+        return Kern::ThreadRawRead( iUserThread, aSource, aDest, aSize );
+        }
+
+    DThread* iUserThread;
+    };
+
+/*
+ * Copies data to client space from the request buffer during deserialisation
+ */
+class TDataToClientSpaceCopier: public MDataCopier
+    {
+public:
+    TDataToClientSpaceCopier( DThread* aUserThread ):
+        iUserThread(aUserThread)
+        {
+        }
+    
+    TInt CopyData( TUint8* aDest, const TUint8* aSource, TUint32 aSize )
+        {
+        memcpy( aDest, aSource, aSize );
+        return KErrNone;
+        }
+    
+    TInt CopyVector( TUint8* aDest, const TUint8* aSource, TUint32 aSize )
+        {
+        return Kern::ThreadRawWrite(iUserThread, aDest, aSource, aSize );
+        }
+
+    DThread* iUserThread;
+    };
+
+// LOCAL FUNCTION DEFINITIONS
+
+// -----------------------------------------------------------------------------
+// ListRemoteFunctionCall
+// -----------------------------------------------------------------------------
+//
+inline void ListRemoteFunctionCall(RemoteFunctionCallData& call)
+    {
+#if _DEBUG
+    VVHW_TRACE("RFC: %u %u %u %u %u %u %u",
+    call.Header().iOpCode,
+    call.Header().iTransactionId,
+    call.Header().iProcessId,
+    call.Header().iThreadId,
+    call.Header().iParameterCount,
+    call.Header().iOpType,
+    call.Header().iReturnValue);
+    
+    for ( TInt i = 0; i < call.Header().iParameterCount; i++)
+        {
+        RemoteFunctionCallData::TParam param = call.Parameters()[i];
+
+        TUint32 dir = param.iDir;
+        TUint32 type = param.iType;
+
+        
+        if ( RemoteFunctionCallData::TParam::ESimple == param.iType )
+            {
+            TUint32 datatype = param.iSimpleParam.iDataType; 
+            VVHW_TRACE("RFC Simple Param %d: %u %u %u",i, dir, type, datatype );
+            }
+        else if ( RemoteFunctionCallData::TParam::EVector == param.iType )
+            {
+            TUint32 datatype = param.iVectorParam.iDataType; 
+            TUint32 size = param.iVectorParam.iVectorLength;
+            VVHW_TRACE("RFC Vec Param %d: %u %u %u %u",i, dir, type, datatype, size );
+            }
+        }
+#endif // _DEBUG
+    }
+
+
+// CONSTANTS
+const TInt KDfcPriority = 1;
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// Isr
+// Interrupt service routine
+// -----------------------------------------------------------------------------
+//
+void Isr( TAny* aParam )
+    {
+    DDeviceReqHandler* handler = ( DDeviceReqHandler* )aParam;
+    Interrupt::Disable( handler->InterruptId() );
+    handler->Dfc().Add();
+    }
+
+// -----------------------------------------------------------------------------
+// DfcFunc
+// Function to call when HW has an interrupt
+// -----------------------------------------------------------------------------
+//
+void DfcFunc( TAny* aParam )
+    {
+    DDeviceReqHandler* handler = ( DDeviceReqHandler* )aParam;
+    handler->ProcessDfc();
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+
+// -----------------------------------------------------------------------------
+// DDeviceReqHandler::DDeviceReqHandler
+// -----------------------------------------------------------------------------
+//
+DDeviceReqHandler::DDeviceReqHandler(
+    DVirtualVideoHwInterface& aHwInterface,
+    TDfcQue* aQueue) :
+    iPbufferSgMapOrder ( &CmpTPbsIds ),
+    iVGImageSgMapOrder ( &CmpTVGIsIds ),
+    iCurrClientData(NULL),
+    iInitialized(EFalse),
+    iHwInterface( aHwInterface ),
+    iDfc( DfcFunc, (TAny*)this, aQueue, KDfcPriority ),
+    iInterruptId( 0 ),
+    iTransactionId( 1 ),
+    iRequestBuffer( *this, VVI_PARAMETERS_INPUT_MEMORY_SIZE )
+    {
+    iDriverRfcProcessId = 0;
+    iDriverRfcThreadId  = 0;
+    iOpType       = 0; 
+    iOpChainPhase = 0;
+    iInterruptId  = VVI_IRQ;
+    VVHW_TRACE( "DDeviceReqHandler constructor" );
+    VVHW_TRACE( "Called in process/thread %0x / %0x", Kern::CurrentProcess().iId, Kern::CurrentThread().iId );
+    TInt err = Interrupt::Bind( iInterruptId, Isr, ( TAny* )this );
+    if ( err != KErrNone )
+        {
+        VVHW_TRACE( "Interrupt::Bind Error: %d", err );
+        }
+    err = Interrupt::Enable( iInterruptId );
+    if ( err != KErrNone )
+        {
+        Interrupt::Unbind( iInterruptId );
+        iInterruptId = 0;
+        VVHW_TRACE( "Interrupt::Enable Error: %d", err );
+        }
+    iRequestBuffer.InitBuffer();
+    //Register this object with the extension
+    VVHW_TRACE( "DDeviceReqHandler calling ReqHandlerExtension" );
+    ReqHandlerExtension::SetReqHandler( this );
+    }
+
+// -----------------------------------------------------------------------------
+// DDeviceReqHandler::~DDeviceReqHandler
+// -----------------------------------------------------------------------------
+//
+DDeviceReqHandler::~DDeviceReqHandler()
+    {
+    for( TInt i=0; i < iClientData.Count(); ++i )
+        {
+        delete iClientData[i];
+        }
+    iClientData.Close();
+    Interrupt::Disable( iInterruptId );
+    Interrupt::Unbind( iInterruptId );
+    iInterruptId = 0;
+    }
+
+// -----------------------------------------------------------------------------
+// DDeviceReqHandler::HandleClientShutdown
+// -----------------------------------------------------------------------------
+//
+TInt DDeviceReqHandler::HandleClientShutdown( TUint aProcessId, TUint aThreadId )
+    {
+    VVHW_TRACE("DDeviceReqHandler::HandleClientShutdown");
+    TInt err( KErrNone );
+    TAsyncRequest* req = AllocRequest( NULL, NULL, NULL, NULL, TAsyncRequest::ERTDriver );
+    
+    if ( req )
+        {
+        DriverRFC drfc( req->iRemoteFunctionCall );
+        drfc.Init( DriverRFC::EDrvClientShutdown, RemoteFunctionCallData::EOpRequest );        
+        req->iRemoteFunctionCall.SetTransactionId( ++iTransactionId );
+        req->iRemoteFunctionCall.SetThreadInformation( aProcessId, aThreadId );        
+        iPendingRequestRoot.AppendToLast( req );
+        TInt ret = ProcessNextPendingRequest();
+        while ( KErrNone == ret )
+            {
+            ret = ProcessNextPendingRequest();
+            }
+        }
+    else
+        {
+        err = KErrNoMemory;
+        }
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// DDeviceReqHandler::ProcessNextPendingRequest
+// -----------------------------------------------------------------------------
+//
+TInt DDeviceReqHandler::ProcessNextPendingRequest()
+    {
+    VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest");
+    TInt err( KErrNone );
+    TAsyncRequest* req = iPendingRequestRoot.iNext;
+    if ( !req )
+        {
+        VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest !req");
+        return KErrUnderflow;
+        }
+    //Try to serve the client from here, or do some sgImage specific stuff
+    TInt mode = InterpretRequest( req );
+    switch( mode )
+        {
+        case ENormal:
+            {
+            //Nothing, process as normal
+            break;
+            }
+        case EHandled:
+            {
+            //Already handled, remove and signal complete
+            req->RemoveFromList( &iPendingRequestRoot );
+            Kern::RequestComplete( req->iAsyncClient, req->iStatus, KErrNone );
+            ReleaseRequest( req );
+            return KErrNone;//Change to "err" if you add lines above this that may set it to something else
+            }
+        case EQueued:
+            {
+            //To be removed from the usual queues, but not deleted (released) or completed
+            req->RemoveFromList( &iPendingRequestRoot );
+            return KErrNone;
+            }
+        default:
+            {
+            break;
+            }
+        }
+    
+    if ( TAsyncRequest::ERTCommandLoad == req->iCommandLoadRequest )
+        {
+        VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands");
+        TInt loaderr( KErrNone );
+        TInt len = Kern::ThreadGetDesLength( req->iAsyncClient, req->iA1 );
+
+        if ( len < 0 )
+            {
+            VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands len < 0");
+            return KErrUnderflow;;
+            }
+
+        if ( !iRequestBuffer.CheckForSpace( len ) )
+           {
+           //Not enough space
+           VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands No space");
+           return KErrNoMemory;
+           }
+
+        req->RemoveFromList( &iPendingRequestRoot );
+
+        const TUint32 base( iRequestBuffer.AllocateBytes( len ) );
+
+        //Next, serialize the call to the HW memory
+        const TLinAddr paramAddr( iHwInterface.InputParametersAddress() + base );
+
+        TPtr8 ptr(reinterpret_cast<TUint8*>(paramAddr), 0, len );
+        
+        //Read the RemoveFunctionCall
+        loaderr = Kern::ThreadDesRead( req->iAsyncClient, req->iA1, ptr, 0, 0 );
+        VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands ThreadDesRead %d", loaderr);
+
+        if ( KErrNone == loaderr )
+            {
+            VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands CommitBytes");
+            iRequestBuffer.CommitBytes( base, len );
+            iHwInterface.IssueCommand( VVI_EXECUTE );
+            }
+        Kern::RequestComplete( req->iAsyncClient, req->iStatus, loaderr );
+        ReleaseRequest( req );
+        }
+    else //ERTRequest or ERTDriver
+        {
+#if _DEBUG
+        ListRemoteFunctionCall( req->iRemoteFunctionCall );
+#endif
+       VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest req %u tid %u opcode %u", 
+            req, req->iRemoteFunctionCall.Header().iTransactionId,
+            req->iRemoteFunctionCall.Header().iOpCode );
+        const TUint32 serializedLength( req->iRemoteFunctionCall.SerialisedLength() );
+        if ( !iRequestBuffer.CheckForSpace( serializedLength ) )
+           {
+           //Not enough space
+           VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest No space");
+           return KErrOverflow;
+           }
+    
+        req->RemoveFromList( &iPendingRequestRoot );
+    
+        if ( RemoteFunctionCallData::EOpRequestWithReply == req->iRemoteFunctionCall.Header().iOpType )
+            {
+            VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest 3");
+            iSerializedRequestRoot.AppendToLast( req );
+            }
+        TDataFromClientSpaceCopier datacopier( req->iAsyncClient );
+        SerializedFunctionCall sfc( req->iRemoteFunctionCall );
+        
+        if ( TAsyncRequest::ERTRequest == req->iCommandLoadRequest )
+            {
+            sfc.SetDataCopier( &datacopier );            
+            }
+        
+        const TUint32 base( iRequestBuffer.AllocateBytes( serializedLength ) );
+    
+        //Next, serialize the call to the HW memory
+        const TLinAddr paramAddr( iHwInterface.InputParametersAddress() + base );
+    
+        TInt len = sfc.WriteToBuffer( reinterpret_cast<TUint8*>(paramAddr),
+                VVI_PARAMETERS_INPUT_MEMORY_SIZE - 1 - base );
+        
+        sfc.SetDataCopier( NULL );
+        VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest Write at index %u with length %u", base, len );
+        iRequestBuffer.CommitBytes( base, serializedLength );
+    
+        iHwInterface.IssueCommand( VVI_EXECUTE );
+        
+        if ( RemoteFunctionCallData::EOpRequest == req->iRemoteFunctionCall.Header().iOpType )
+            {
+            if ( TAsyncRequest::ERTRequest == req->iCommandLoadRequest )
+                {
+                VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest RequestComplete");
+                Kern::RequestComplete( req->iAsyncClient, req->iStatus, KErrNone );
+                }
+            ReleaseRequest( req );
+            }
+        }
+    VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest DONE");
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// DDeviceReqHandler::HandleLoadCommands
+// -----------------------------------------------------------------------------
+//
+TInt DDeviceReqHandler::HandleLoadCommands(
+        DThread*& aUserThread,
+        TRequestStatus* aStatus,
+        TAny* aA1 )
+    {
+    VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands");
+    TInt err( KErrNone );
+    TAsyncRequest* req = AllocRequest( aStatus, aUserThread, aA1, NULL, TAsyncRequest::ERTCommandLoad );
+    
+    if ( req )
+        {
+        TInt len = Kern::ThreadGetDesLength( req->iAsyncClient, req->iA1 );
+    
+        if ( len < 0 )
+            {
+            err = len;//TODO: this sucks
+            ReleaseRequest( req );
+            return err;
+            }
+            
+        iPendingRequestRoot.AppendToLast( req );
+        TInt ret = ProcessNextPendingRequest();
+        while ( KErrNone == ret )
+            {
+            ret = ProcessNextPendingRequest();
+            }
+        }
+    else
+        {
+        err = KErrNoMemory;
+        }
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// DDeviceReqHandler::HandleExecuteAsync
+// -----------------------------------------------------------------------------
+//
+TInt DDeviceReqHandler::HandleExecuteAsync(
+        DThread*& aUserThread,
+        TRequestStatus* aStatus,
+        TAny* a1 )
+    {
+    VVHW_TRACE("DDeviceReqHandler::HandleExecuteAsync");
+    TInt err( KErrNone );
+    TAsyncRequest* req = AllocRequest( aStatus, aUserThread, a1, NULL );
+    
+    if ( req )
+        {
+        TInt len = Kern::ThreadGetDesLength( req->iAsyncClient, req->iA1 );
+    
+        if ( len < 0 )
+            {
+            err = len;
+            ReleaseRequest( req );
+            return err;
+            }
+    
+        TPckg<RemoteFunctionCallData> rcallbuf( req->iRemoteFunctionCall );
+        
+        //Read the RemoteFunctionCall
+        err = Kern::ThreadDesRead( req->iAsyncClient, req->iA1, rcallbuf, 0, 0 );
+
+        if ( KErrNone != err )
+            {
+            ReleaseRequest( req );
+            return err;
+            }
+        
+        req->iRemoteFunctionCall.SetTransactionId( ++iTransactionId );
+
+        iPendingRequestRoot.AppendToLast( req );
+        TInt ret = ProcessNextPendingRequest();
+        while ( KErrNone == ret )
+            {
+            ret = ProcessNextPendingRequest();
+            }
+        }
+    else
+        {
+        err = KErrNoMemory;
+        }
+    VVHW_TRACE("DDeviceReqHandler::HandleExecuteAsync <-");
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// DDeviceReqHandler::ProcessDfc
+// -----------------------------------------------------------------------------
+//
+void DDeviceReqHandler::ProcessDfc()
+    {
+    VVHW_TRACE("DDeviceReqHandler::ProcessDfc");
+    TUint32 error( 0 );
+    iHwInterface.GetRegisterValue( DVirtualVideoHwInterface::ERegError, error );
+
+    TUint32 transactionId;
+    iHwInterface.GetRegisterValue( DVirtualVideoHwInterface::ERegRequestId, transactionId );
+
+    TAsyncRequest* req = iSerializedRequestRoot.iNext;
+    VVHW_TRACE( "DDeviceReqHandler::ProcessDfc req %u transactionid %u", req, transactionId );
+    
+
+    if ( req && transactionId == req->iRemoteFunctionCall.Header().iTransactionId )
+        {
+        req->RemoveFromList( &iSerializedRequestRoot );
+        
+        //Check if the request was scheduler-initiated
+        TBool driverInitiated(EFalse);
+        if( iSchedulerInitiatedTransactionIds.Count() > 0 )
+            {
+            for( int i=0;i<iSchedulerInitiatedTransactionIds.Count();++i )
+                {
+                if( iSchedulerInitiatedTransactionIds[i].iTransactionId == req->iRemoteFunctionCall.Header().iTransactionId )
+                    {
+                driverInitiated = ETrue;
+                    //This will be used in the "consume" function later on in many cases
+                    iSchedulerInitiatedTransactionData = iSchedulerInitiatedTransactionIds[i].iTransactionData; 
+                    iSchedulerInitiatedTransactionIds.Remove( i );
+                    break;
+                    }
+                }
+            }
+        
+        if( driverInitiated )
+            {
+            //This branch is for the purpose of handling commands that have been initiated from (this) 
+            //Command Scheduler, and not a client thread. So far no cases exists, where this would
+            //imply notifying a (client) DLL, so RequestComplete does not have to be called here (this could change later).
+            //Parse result and write vectors back to client space
+            if ( 0 == error )
+                {
+                //Parse result and write vectors back to client space        
+                TDataToClientSpaceCopier datacopier2( req->iAsyncClient );
+                RemoteFunctionCallData rfc;
+                SerializedFunctionCall sfc( rfc );
+                sfc.SetDataCopier( &datacopier2 );
+                const TLinAddr paramAddr( iHwInterface.OutputParametersAddress() );
+                VVHW_TRACE("DDeviceReqHandler::ProcessDfc parse");
+                sfc.ParseBuffer( reinterpret_cast<TUint8*>( paramAddr ), VVI_PARAMETERS_OUTPUT_MEMORY_SIZE );
+                TPckg<RemoteFunctionCallData> resultbuf( rfc );
+                req->iRemoteFunctionCall = resultbuf();//Get the object; its in the same address space 
+                VVHW_TRACE("DDeviceReqHandler::ProcessDfc ThreadDesWrite err=%d (data len=%d)", error, resultbuf.Length());
+                sfc.SetDataCopier( NULL );
+                }
+
+            error = ResetAndEnableInterrupt( DVirtualVideoHwInterface::EInterruptNewDataAvailable );
+            ConsumeSchedulerInitiatedRequestResult( req );
+            }
+        else
+            {
+			TInt desWriteError = KErrNone;
+            if ( 0 == error )
+                {
+                //Parse result and write vectors back to client space
+				// TODO for performance only write back result & output vectors, not whole request buffer
+                TDataToClientSpaceCopier datacopier2( req->iAsyncClient );
+                RemoteFunctionCallData rfc;
+                SerializedFunctionCall sfc( rfc );
+                sfc.SetDataCopier( &datacopier2 );
+                const TLinAddr paramAddr( iHwInterface.OutputParametersAddress() );
+                VVHW_TRACE("DDeviceReqHandler::ProcessDfc parse");
+                sfc.ParseBuffer( reinterpret_cast<TUint8*>( paramAddr ), VVI_PARAMETERS_OUTPUT_MEMORY_SIZE );
+                TPckg<RemoteFunctionCallData> resultbuf( rfc );
+                desWriteError = Kern::ThreadDesWrite( req->iAsyncClient, req->iA1, resultbuf, 0, 0 );
+                VVHW_TRACE("DDeviceReqHandler::ProcessDfc ThreadDesWrite err=%d (data len=%d)",desWriteError, resultbuf.Length());
+                sfc.SetDataCopier( NULL );
+                }
+
+            Kern::RequestComplete( req->iAsyncClient, req->iStatus, desWriteError );
+            ResetAndEnableInterrupt( DVirtualVideoHwInterface::EInterruptNewDataAvailable );
+            ReleaseRequest( req );
+            }
+        }
+    else
+        {
+        ResetAndEnableInterrupt( DVirtualVideoHwInterface::EInterruptNewDataAvailable );
+        }
+    VVHW_TRACE("DDeviceReqHandler::ProcessDfc ProcessNextPendingRequest");
+    
+    TInt ret = ProcessNextPendingRequest();
+    while ( KErrNone == ret )
+        {
+        ret = ProcessNextPendingRequest();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// DDeviceReqHandler::AllocRequest
+// -----------------------------------------------------------------------------
+//
+DDeviceReqHandler::TAsyncRequest* DDeviceReqHandler::AllocRequest( TRequestStatus* aStatus,
+        DThread* aAsyncClient,
+        TAny* aA1,
+        TAny* aA2,
+        DDeviceReqHandler::TAsyncRequest::TRequestType aRequestType )
+    {
+    TAsyncRequest* req( NULL );
+    if ( iFreeCount )
+        {
+        req = iFreeListRoot.iNext;
+        req->RemoveFromList( &iFreeListRoot );
+        req->Init( aStatus, aAsyncClient, aA1, aA2, aRequestType );
+        iFreeCount--;
+        }
+    else
+        {
+        VVHW_TRACE("DDeviceReqHandler::AllocRequest new");
+        req = new TAsyncRequest( aStatus, aAsyncClient, aA1, aA2, aRequestType );
+        }
+    return req;
+    }
+
+// -----------------------------------------------------------------------------
+// DDeviceReqHandler::ReleaseRequest
+// -----------------------------------------------------------------------------
+//
+void DDeviceReqHandler::ReleaseRequest( DDeviceReqHandler::TAsyncRequest* aReq )
+    {
+    if ( iFreeCount > KMaxFreeRequests )
+        {
+        VVHW_TRACE("DDeviceReqHandler::AllocRequest delete");
+        delete aReq;
+        }
+    else
+        {
+        aReq->AppendToList( &iFreeListRoot );
+        iFreeCount++;
+        }
+    }
+
+
+
+void DDeviceReqHandler::RemoveClientData( const TUint32 aProcId, const TUint32 aThreadId )
+    {
+    VVHW_TRACE("DDeviceReqHandler::RemoveClientData (%d/%d)", aProcId, aThreadId );
+    TPerThreadData* data( NULL );
+    for( TInt i=0; i < iClientData.Count(); ++i )
+        {
+        if( iClientData[i]->sameThread( aProcId, aThreadId ) )
+            {
+            data = iClientData[i];
+            iClientData.Remove(i);
+            if( data == iCurrClientData )
+                {
+                iCurrClientData = 0;
+                }
+            delete data;
+            break;
+            }
+        }
+    }
+
+TBool DDeviceReqHandler::InitiateRequestWithReply( TAsyncRequest* aRec, TAny* aTransactionData )
+    {
+    VVHW_TRACE("DDeviceReqHandler::InitiateRequestWithReply" );
+    if( iDriverRfcThreadId == 0 || iDriverRfcProcessId == 0 )
+        {
+        iDriverRfcProcessId = Kern::CurrentProcess().iId;
+        iDriverRfcThreadId  = Kern::CurrentThread().iId;
+        }
+    //iReqIssueMutex.Wait();
+    const TUint32 serializedLength( aRec->iRemoteFunctionCall.SerialisedLength() );
+    if ( !iRequestBuffer.CheckForSpace( serializedLength ) )
+       {
+       return EFalse;
+       }
+    ++iTransactionId;
+    aRec->iRemoteFunctionCall.SetTransactionId( iTransactionId );
+    aRec->iRemoteFunctionCall.SetOperationType( RemoteFunctionCallData::EOpRequestWithReply );
+    aRec->iAsyncClient = &(Kern::CurrentThread());
+    aRec->iRemoteFunctionCall.SetThreadInformation( iDriverRfcProcessId, iDriverRfcThreadId );
+    
+    iSchedulerInitiatedTransactionIds.Append( TTransactionInfo( iTransactionId, aTransactionData ) );
+    VVHW_TRACE("DDeviceReqHandler::InitiateRequestWithReply ids len=%d transaction id = %u proc/thread = %u / %u api/op = %0x / %0x", iSchedulerInitiatedTransactionIds.Count(), iTransactionId, Kern::CurrentProcess().iId, Kern::CurrentThread().iId, aRec->iRemoteFunctionCall.Header().iApiUid, aRec->iRemoteFunctionCall.Header().iOpCode );
+    if( aRec->iRemoteFunctionCall.Header().iApiUid )
+        {
+        VVHW_TRACE("DDeviceReqHandler::InitiateRequestWithReply request's api is SERIALISED_DRIVER_API_UID" );
+        }
+    
+    iSerializedRequestRoot.AppendToLast( aRec );//we need the result, so add to the dfc handled requests
+    TDataFromClientSpaceCopier datacopier( aRec->iAsyncClient );
+    SerializedFunctionCall sfc( aRec->iRemoteFunctionCall );
+    
+    sfc.SetDataCopier( &datacopier );//We know this is a "request" (precondition)
+    const TUint32 base( iRequestBuffer.AllocateBytes( serializedLength ) );
+    //Next, serialize the call to the HW memory
+    const TLinAddr paramAddr( iHwInterface.InputParametersAddress() + base );
+    TInt len = sfc.WriteToBuffer( reinterpret_cast<TUint8*>(paramAddr), VVI_PARAMETERS_INPUT_MEMORY_SIZE - 1 - base );
+    VVHW_TRACE("DDeviceReqHandler::InitiateRequestWithReply len = %d", len);
+    sfc.SetDataCopier( NULL );
+    iRequestBuffer.CommitBytes( base, serializedLength );
+    iHwInterface.IssueCommand( VVI_EXECUTE );
+    VVHW_TRACE("DDeviceReqHandler::InitiateRequestWithReply issued");
+    return ETrue;
+    }
+
+/**
+ * This routine adds extra info about the sgImage's pbuffer handle for syncing,
+ * when that is required. 
+ * 1. checks the sgImage handle, and if it's not NULL, then
+ *  2. Get the sgImage's metadata
+ *  3. Check if the vgImage is "dirty", and if yes,
+ *      then append the pbuffer handle as a parameter to the call   
+ *  4. Set the pbuffer "dirty", if aSetBufferDirty is ETrue
+ */
+
+void DDeviceReqHandler::getVGSyncInOp( TAsyncRequest* aReq, TInt aSgHandleIndexInReq, TBool aSetBufferDirty )
+    {    
+    VVHW_TRACE( "DDeviceReqHandler::getVGSyncInOp" );
+    EGLSurface surface( EGL_NO_SURFACE );//The pbuffer surface to sync from, if needed
+    VGboolean syncNeeded = VG_FALSE;
+    OpenVgRFC call( aReq->iRemoteFunctionCall );
+    TUint64 sgId(NULL);
+    
+    if( call.Data().Header().iParameterCount > aSgHandleIndexInReq )
+        {
+        call.GetTUint64( sgId, aSgHandleIndexInReq );
+        }
+    else
+        {
+        return;//No sgImage handle appended on the client side, just exit
+        }
+    
+    if( sgId != NULL )
+        {
+        VVHW_TRACE( "DDeviceReqHandler::getVGSyncInOp SgImage-backing VGImage found" );
+        DSgResource* resource;
+        HBuf8* data = OpenSgImageMetaData( sgId, resource );
+        if( data )
+            {
+            TSgImageMetaData sginfo (((TPckgBuf<TSgImageMetaData>*) data)->operator ()());
+            
+            if( !sginfo.iVGImageClean )
+                {
+                //set the sync bit as clean now.
+                sginfo.iVGImageClean = ETrue;
+                //Additional info for the host side to use
+                syncNeeded = VG_TRUE;
+                surface = sginfo.iPbufferHandle;
+                }
+            if( aSetBufferDirty )
+                {
+                sginfo.iPbufferClean = EFalse;
+                }
+            resource->SetMetaData( *data );
+            delete data;//delete the copy of the metadata descriptor
+            }
+        }
+    if( syncNeeded )
+        {
+        call.AppendParam ( (int)surface );
+        }
+    }
+
+
+void DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult( TAsyncRequest* aReq )
+    {
+    const TUint32 proc_id( aReq->iRemoteFunctionCall.Header().iProcessId );
+    const TUint32 thread_id( aReq->iRemoteFunctionCall.Header().iThreadId );
+    const TUint32 apicode( aReq->iRemoteFunctionCall.Header().iApiUid );
+    const TUint32 opcode( aReq->iRemoteFunctionCall.Header().iOpCode );
+    VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult: process/thread id : %d / %d", Kern::CurrentProcess().iId, Kern::CurrentThread().iId );
+    VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult: process/thread id : %d / %d API/opcode = %0x/%0x", proc_id, thread_id, apicode, opcode );
+    TPerThreadData* data(0);
+    for( TInt i=0; i < iClientData.Count(); ++i )
+        {
+        if( iClientData[i]->sameThread( proc_id, thread_id ))
+            {
+            data = iClientData[i];
+            break;
+            }
+        }
+    
+    switch ( apicode )
+        {
+        case SERIALISED_DRIVER_API_UID:
+            {
+            switch( opcode )
+                {
+                case DriverRFC::EDrvCreatePbufferSg:
+                    {
+                    VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult : EDrvCreatePbufferSg" );
+                    if( iSchedulerInitiatedTransactionData )
+                        {
+                        ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle = aReq->iRemoteFunctionCall.Header().iReturnValue;
+                        VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult pbuffer=%u", ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle );
+                        }
+                    TPbSId obj ( ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle,
+                                 ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId );
+                    iPbufferSgMap.InsertInOrder( obj, iPbufferSgMapOrder );
+                    VVHW_TRACE( "pbuffer creation RequestComplete. Inserted (%u, %u) into sg map. Notify thread %u, request status %u",
+                                                                    ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle,
+                                                                    ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId,
+                                                                    aReq->iAsyncClient,
+                                                                    aReq->iStatus );
+                    *(aReq->iStatus) = 0;//REquestComplete doesn't work
+                    VVHW_TRACE( "Pbuffer creation RequestComplete" );
+                    break;
+                    }
+                case DriverRFC::EDrvCreateVGImageSg:
+                    {
+                    VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult : EDrvCreateVGImageSg" );
+                    if( iSchedulerInitiatedTransactionData )
+                        {
+                        ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iVGImageHandle = aReq->iRemoteFunctionCall.Header().iReturnValue;
+                        }
+                    TVGISId obj ( ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iVGImageHandle,
+                                 ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId );
+                    iVGImageSgMap.InsertInOrder( obj, iVGImageSgMapOrder );
+                    VVHW_TRACE( "pbuffer creation RequestComplete. Inserted (%u, %u) into sg map. Notify thread %u, request status %u",
+                               ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iVGImageHandle,
+                               ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId,
+                               aReq->iAsyncClient,
+                               aReq->iStatus );
+                    *(aReq->iStatus) = 0;//REquestComplete doesn't work
+                    VVHW_TRACE( "VGImage creation RequestComplete" );
+                    break;
+                    }
+                case DriverRFC::EDrvDeleteSgImage:
+                    {
+                    *(aReq->iStatus) = 0;
+                    }
+                case DriverRFC::EDrvSyncVGImageFromPBuffer:
+                    {
+                    ((TAsyncRequest*)iSchedulerInitiatedTransactionData)->AppendToList( (TAsyncRequest*)(&iPendingRequestRoot) );
+                    break;
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+            }
+        case SERIALISED_OPENVG_API_UID:
+            {
+            switch( opcode )
+                {
+                case OpenVgRFC::EvgGetError:
+                    {
+                    VVHW_TRACE("OpenVgRFC::EvgGetError");
+                    data->iErrorVG = aReq->iRemoteFunctionCall.Header().iReturnValue;
+                    data->iErrUpdatedVG = EFalse;//TODO: ETrue
+                    break;
+                    }
+                default:{break;}
+                }
+            break;
+            }
+        case SERIALISED_EGL_API_UID:
+            {
+            switch( opcode )
+                {
+                case EglRFC::EeglGetError:
+                    {
+                    VVHW_TRACE("EglRFC::EeglGetError");
+                    data->iErrorEGL = aReq->iRemoteFunctionCall.Header().iReturnValue;
+                    data->iErrUpdatedEGL = EFalse;//TODO: ETrue
+                    break;
+                    }
+                default:
+                    {break;}
+                }
+            break;
+            }
+        case SERIALISED_OPENGLES_1_1_API_UID:
+            {
+            switch( opcode )
+                {
+                case OpenGlES11RFC::EglGetError:
+                    {
+                    VVHW_TRACE("OpenGlES11RFC::EglGetError");
+                    data->iErrorGLES = aReq->iRemoteFunctionCall.Header().iReturnValue;
+                    data->iErrUpdatedGLES = EFalse;//TODO: ETrue
+                    }
+                default:{break;}
+                }
+            break;
+            }
+        default:{break;}
+        }
+
+    VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult return value: %d", aReq->iRemoteFunctionCall.Header().iReturnValue );
+    if( data )
+        {
+        VVHW_TRACE("errors EGL/VG/GLES=%0x/%0x/%0x", data->iErrorEGL, data->iErrorVG, data->iErrorGLES );
+        }
+    //Delete the request object, as it is no longer needed
+    aReq->iStatus = 0;
+    aReq->iAsyncClient = 0;
+    delete aReq;
+    VVHW_TRACE("DDeviceReqHandle::ConsumeSchedulerInitiatedRequestResult done.");
+    }
+
+/**
+ * DDeviceReqHandler::CreateSgImagePbuffer
+ * @param aInfo the info 
+ */
+void DDeviceReqHandler::CreateSgImagePbuffer( const TSgImageMetaData& aInfo, TRequestStatus* aStatus, DThread* aThread )
+    {
+    //eglCreatePbufferSurface
+    //
+    VVHW_TRACE("DDeviceReqHandler::CreateSgImagePbuffer ->");
+    if( !iCurrClientData )
+        {return;}
+    TBool allok = ETrue;
+    TAsyncRequest* req(0);
+    TPckg<TUint32> res( iOpReturn );
+    *aStatus = KRequestPending;
+    VVHW_TRACE("DDeviceReqHandler::CreateSgImagePbuffer request from thread %u, requeststatus %u", aThread, aStatus );
+    req = AllocRequest( aStatus, aThread, NULL, (TAny*)(&res), TAsyncRequest::ERTRequest );
+    if( req )
+        {
+        DriverRFC call( req->iRemoteFunctionCall );
+        call.Init( DriverRFC::EDrvCreatePbufferSg );
+        
+        call.AppendEGLint  ( aInfo.iSizeInPixels.iWidth );
+        call.AppendEGLint  ( aInfo.iSizeInPixels.iHeight );
+        call.AppendEGLint  ( aInfo.iPixelFormat );
+
+        TPckg<RemoteFunctionCallData> data( req->iRemoteFunctionCall );
+        req->iA1 = (TAny*)( &data );
+        allok = InitiateRequestWithReply( req, (TAny*)(&aInfo) );
+        }
+    if( !allok )
+        {
+        //request not sent, or something else went wrong. Tell the client its over
+        //TODO: somehow dispose of the pbuffer that might have been created
+        }
+    while( *(aStatus) == KRequestPending )
+        {
+        NKern::Sleep( 20 );   
+        }
+    VVHW_TRACE("DDeviceReqHandler::CreateSgImagePBuffer <-");
+    return;
+    }
+
+void DDeviceReqHandler::CreateSgImageVGImage( const TSgImageMetaData& aInfo, TRequestStatus* aStatus, DThread* aThread )
+    {
+    //eglCreatePbufferSurface
+    //
+    VVHW_TRACE("DDeviceReqHandler::CreateSgImageVGImage ->");
+    if( !iCurrClientData )
+        {return;}
+    TBool allok = ETrue;
+    TAsyncRequest* req(0);
+    TPckg<TUint32> res( iOpReturn );
+    *aStatus = KRequestPending;
+    //make a request for the vgImage
+    req = AllocRequest( aStatus, aThread, NULL, (TAny*)(&res), TAsyncRequest::ERTRequest );
+    if( req )
+        {
+        DriverRFC call( req->iRemoteFunctionCall );
+        call.Init( DriverRFC::EDrvCreateVGImageSg );
+        
+        call.AppendEGLint  ( aInfo.iSizeInPixels.iWidth );
+        call.AppendEGLint  ( aInfo.iSizeInPixels.iHeight );
+        call.AppendEGLint  ( aInfo.iPixelFormat );
+
+        TPckg<RemoteFunctionCallData> data( req->iRemoteFunctionCall );
+        req->iA1 = (TAny*)(&data);
+        allok = InitiateRequestWithReply( req, (TAny*)(&aInfo) );
+        }
+    if( !allok )
+        {
+        //request not sent, or something else went wrong. Tell the client its over
+        //TODO: somehow dispose of the image that might have been created
+        //Kern::RequestComplete( aStatus, KErrGeneral );
+        }
+    while( *(aStatus) == KRequestPending )
+        {
+        NKern::Sleep( 20 );
+        }
+    VVHW_TRACE("DDeviceReqHandler::CreateSgImageVGImage <-");
+    return;
+    }
+
+
+
+
+TInt DDeviceReqHandler::DestroySgImage( const TUint64 aId )
+    {
+    VVHW_TRACE("DDeviceReqHandler::DestroySgImage ->");
+    TBool allok = ETrue;
+    TAsyncRequest* req(0);
+    TPckg<TUint32> res( iOpReturn );
+    EGLSurface surface(0);
+    VGImage    image(0);
+    
+    DSgResource* resource;
+    HBuf8* data = OpenSgImageMetaData( aId, resource );
+    if( data )
+        {
+        TSgImageMetaData sginfo (((TPckgBuf<TSgImageMetaData>*) data)->operator ()());
+        surface = sginfo.iPbufferHandle;
+        //TODO: are there other cases: e.g. can the vgimage be destroyed without destroying the surface?
+        if( sginfo.iUsage || ESgUsageBitOpenVgImage )
+            {
+            image = sginfo.iVGImageHandle;
+            }
+        delete data;
+        }
+    TRequestStatus status = KRequestPending;
+    //make a request for the vgImage
+    req = AllocRequest( &status, &Kern::CurrentThread(), NULL, (TAny*)(&res), TAsyncRequest::ERTRequest );
+    allok = (req?EFalse:ETrue);
+    if( req )
+        {
+        DriverRFC call( req->iRemoteFunctionCall );
+        call.Init( DriverRFC::EDrvDeleteSgImage );
+        
+        call.AppendEGLSurface( surface );
+        call.AppendVGParam ( image );
+
+        TPckg<RemoteFunctionCallData> data( req->iRemoteFunctionCall );
+        req->iA1 = (TAny*)(&data);
+        allok = InitiateRequestWithReply( req, 0 );
+        }
+    if( !allok )
+        {
+        //TODO
+        }
+    while( status == KRequestPending )
+        {
+        NKern::Sleep( 20 );
+        }
+    VVHW_TRACE("DDeviceReqHandler::DestroySgImage <-");
+    return 1;
+    }
+
+
+DDeviceReqHandler::TRequestMode DDeviceReqHandler::InterpretRequest( TAsyncRequest* aReq )
+    {
+    TRequestMode alreadyProcessed( ENormal );//processed here? The return value
+    const TUint32 proc_id( aReq->iRemoteFunctionCall.Header().iProcessId );
+    const TUint32 thread_id( aReq->iRemoteFunctionCall.Header().iThreadId );
+    const TUint32 apicode( aReq->iRemoteFunctionCall.Header().iApiUid );
+    const TUint32 opcode( aReq->iRemoteFunctionCall.Header().iOpCode );
+    
+    VVHW_TRACE( "DDeviceReqHandler::InterpretRequest in the process/thread %0x / %0x", Kern::CurrentProcess().iId, Kern::CurrentThread().iId );
+    
+    TBool ErrUpdatedVG = EFalse;//is the error updated during this function call
+    TBool ErrUpdatedEGL = EFalse;//is the error updated during this function call
+    TBool ErrUpdatedGLES = EFalse;//is the error updated during this function call
+    //Get a data object to work with
+    //(either a previously used client data object, or create a new one)
+    TPerThreadData* data(NULL);
+    if( iCurrClientData &&
+        iCurrClientData->sameThread( proc_id, thread_id ))
+        {
+        //the same client as previously
+        data = iCurrClientData;
+        }
+    else
+        {
+        //Check if this client is already known
+        for( TInt i=0; i < iClientData.Count(); ++i )
+            {
+            if( iClientData[i]->sameThread( proc_id, thread_id ))
+                {
+                data = iClientData[i];
+                break;
+                }
+            }
+        if( !data )
+            {
+            data = new TPerThreadData( aReq->iStatus, aReq->iAsyncClient, proc_id, thread_id );
+            iClientData.Append( data );
+            }
+        if( iCurrClientData )
+            {
+            VVHW_TRACE( "DDeviceReqHandler::InterpretRequest: SWITCHING CONTEXT: %d / %d -> %d / %d",
+                    iCurrClientData->iProcessId,
+                    iCurrClientData->iThreadId,
+                    proc_id,
+                    thread_id );
+            //Some other things need to be done here as well, as per 5.2 in the "Implementing SgImage" design doc
+            //TODO: currently the context switch does not need to be done on this level
+            }
+        //Context switched, or no previous client. Current set to new current.
+        iCurrClientData = data;
+        }
+    //Invariant: "data" and "iCurrClient" are the same and not null after this line
+    VVHW_TRACE("DDeviceReqHandler::InterpretRequest: number of clients = %d", iClientData.Count() );
+    
+    
+    iCurrClientData->iCurrApiUid = apicode;
+    iCurrClientData->iCurrOpCode = opcode;
+    VVHW_TRACE( "DDeviceReqHandler::InterpretRequest: process/thread id : %d / %d API/opcode = %d/%0x", proc_id, thread_id, apicode, opcode );
+    
+    
+    switch ( apicode )
+        {
+        case SERIALISED_DRIVER_API_UID:
+            {
+            VVHW_TRACE("Driver request (must be a shutdown for %d / %d)", proc_id, thread_id  );
+            if( opcode == DriverRFC::EDrvClientShutdown )
+                {
+                RemoveClientData( proc_id, thread_id );
+                }
+            break;
+            }
+        case SERIALISED_OPENVG_API_UID:
+            {
+            VVHW_TRACE("OpenVG request" );
+            switch( opcode )
+                {
+                case OpenVgRFC::EvgGetError:
+                    {
+                    break;
+                    }
+                //We need to catch all the operations that create or access VGImage buffers
+                case OpenVgRFC::EvgChildImage:
+                    {
+                    VVHW_TRACE("vgChildImage" );
+                    break;
+                    }
+                case OpenVgRFC::EvgDestroyImage:
+                    {
+                    VVHW_TRACE("vgDestroyImage" );
+                    break;
+                    }
+                case OpenVgRFC::EvgFinish:
+                    {
+                    VVHW_TRACE("vgFinish" );
+                    //A sync is required if there are any native pixmaps backing surfaces in the current context
+                    break;
+                    }
+                /* 
+                The sgImage ID is a 64-bit value, it has to be serialised as 2 32-bit values, thus occupying
+                2 parameter slots each. The sgImage ID position is thus the second last + last parameters in the 
+                parameter list
+                */ 
+                case OpenVgRFC::EvgClearImage:
+                    {
+                    VVHW_TRACE("vgClearImage" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );
+                    break;
+                    }
+                case OpenVgRFC::EvgImageSubData:
+                    {
+                    VVHW_TRACE("vgImageSubData" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );
+                    break;
+                    }
+                case OpenVgRFC::EvgGetPixels:
+                    {
+                    VVHW_TRACE("vgGetPixels" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );
+                    break;
+                    }
+                case OpenVgRFC::EvgSetPixels:
+                    {
+                    VVHW_TRACE("vgSetPixels" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );
+                    break;
+                    }
+                case OpenVgRFC::EvgCopyImage:
+                    {
+                    VVHW_TRACE("vgCopyImage" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );
+                    break;
+                    }
+                case OpenVgRFC::EvgDrawImage:
+                    {
+                    VVHW_TRACE("vgDrawImage" );
+                    break;
+                    }
+                case OpenVgRFC::EvgColorMatrix:
+                    {
+                    VVHW_TRACE("vgColorMatrix" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src
+                    break;
+                    }
+                case OpenVgRFC::EvgConvolve:
+                    {
+                    VVHW_TRACE("vgConvolve" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src
+                    break;
+                    }
+                case OpenVgRFC::EvgSeparableConvolve:
+                    {
+                    VVHW_TRACE("vgSeparableConvolve" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src
+                    break;
+                    }
+                case OpenVgRFC::EvgGaussianBlur:
+                    {
+                    VVHW_TRACE("vgGaussianBlur" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src
+                    break;
+                    }
+                case OpenVgRFC::EvgLookup:
+                    {
+                    VVHW_TRACE("vgLookup" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src
+                    break;
+                    }
+                case OpenVgRFC::EvgLookupSingle:
+                    {
+                    VVHW_TRACE("vgLookupSingle" );
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst
+                    getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src
+                    break;
+                    }
+                case OpenVgRFC::EvgPathBounds:
+                    {
+                    VVHW_TRACE("vgPathBounds" );
+                    break;
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+            break;
+            }
+        case SERIALISED_EGL_API_UID:
+            {
+            VVHW_TRACE("EGL request" );
+            switch( opcode )
+                {
+                case EglRFC::EeglMetaSgGetHandles:
+                    {
+                    VVHW_TRACE("EglRFC::EeglMetaSgGetHandles" );
+                    EglRFC call( aReq->iRemoteFunctionCall );
+                    TUint64 id(0);
+                    EGLint* handles;
+                    EGLint handles_size;
+                    
+                    call.GetTUint64( id, 0 );
+                    call.GetEGLintVectorData( handles, handles_size, 2 );
+                    DSgResource* resource;
+                    VVHW_TRACE("EglRFC::EeglMetaSgGetHandles openSgImageMetaData" );
+                    HBuf8* data = OpenSgImageMetaData( id, resource );
+                    if( data && handles_size >= 2 )
+                        {
+                        TSgImageMetaData sginfo (((TPckgBuf<TSgImageMetaData>*) data)->operator ()());
+                        handles[0] = sginfo.iPbufferHandle;
+                        handles[1] = sginfo.iVGImageHandle;
+                        call.SetReturnValue( (int)EGL_TRUE );
+                        }
+                    else
+                        {
+                        call.SetReturnValue( (int)EGL_FALSE );
+                        }
+                    alreadyProcessed = EHandled;
+					break;
+                    }
+                case EglRFC::EeglCreateContext:
+                    {
+                    //if no share_context specified, pass the sgImage pool context
+                    VVHW_TRACE("eglCreateContext" );
+                    break;
+                    }
+                case EglRFC::EeglMakeCurrent:
+                    {
+                    EGLDisplay dpy;
+                    EGLSurface draw;
+                    EGLSurface read;
+                    EGLContext ctx;
+                    EGLint syncRequirement(0);//no sync = 0
+                    
+                    EglRFC call( aReq->iRemoteFunctionCall );
+                    call.GetEGLDisplay( dpy, 0 );
+                    call.GetEGLSurface( draw, 1 );
+                    call.GetEGLSurface( read, 2 );
+                    call.GetEGLContext( ctx, 3 );
+                    VGImage img = 0;
+                    
+                    TPbSId obj ( draw, 0 );
+
+                    TInt sgIdIndex = iPbufferSgMap.FindInOrder( obj, iPbufferSgMapOrder );
+                    if( sgIdIndex != KErrNotFound )
+                        {
+                        DSgResource* resource;
+                        HBuf8* data = OpenSgImageMetaData( iPbufferSgMap[sgIdIndex].iSgId, resource );
+                        if( data )
+                            {
+                            TSgImageMetaData sginfo (((TPckgBuf<TSgImageMetaData>*) data)->operator ()());
+                            
+                            if( !sginfo.iPbufferClean )
+                                {
+                                img = sginfo.iVGImageHandle;
+                                //sync with the underlying pbuffer surface
+                                syncRequirement = syncRequirement | KSyncDrawSurface;
+                                call.AppendEGLint( img );
+                                }
+                            delete data;
+                            }
+                        }
+                    obj.iPbuffer = read;
+                    obj.iSgId = 0;
+
+                    sgIdIndex = iPbufferSgMap.FindInOrder( obj, iPbufferSgMapOrder );
+                    if( sgIdIndex != KErrNotFound )
+                        {
+                        DSgResource* resource;
+                        HBuf8* data = OpenSgImageMetaData( iPbufferSgMap[sgIdIndex].iSgId, resource );
+                        if( data )
+                            {
+                            TSgImageMetaData sginfo (((TPckgBuf<TSgImageMetaData>*) data)->operator ()());
+                            
+                            if( !sginfo.iPbufferClean )
+                                {
+                                img = sginfo.iVGImageHandle;
+                                //sync with the underlying pbuffer surface
+                                syncRequirement = syncRequirement | KSyncReadSurface;
+                                }
+                            delete data;
+                            }
+                        }
+                    call.AppendEGLint( syncRequirement );
+                    call.AppendEGLint( img );
+                    
+                    VVHW_TRACE("eglMakeCurrent %u", iCurrClientData->iContext );
+                    break;
+                    }
+                case EglRFC::EeglMakeCurrentSg:
+                    {
+                    VVHW_TRACE("eglMakeCurrentSg" );
+                    break;
+                    }
+                case EglRFC::EeglCreatePixmapSurfaceSg:
+                    {
+                    alreadyProcessed = EHandled;//This will be handled here
+                    
+                    TUint64 sgId;
+                    EglRFC call( aReq->iRemoteFunctionCall );
+                    call.GetTUint64( sgId, 0 );//get the sgImage id
+                    
+                    DSgResource* resource;
+                    HBuf8* data = OpenSgImageMetaData( sgId, resource );
+                    if( data )
+                        {
+                            TSgImageMetaData sginfo (((TPckgBuf<TSgImageMetaData>*) data)->operator ()());
+                            resource->SetMetaData( (*data) );
+                            aReq->iRemoteFunctionCall.SetReturnValue( sginfo.iPbufferHandle );
+                            delete data;
+                        }
+                    else
+                        {
+                        aReq->iRemoteFunctionCall.SetReturnValue( EGL_NO_SURFACE );
+                        }
+                    //Find the sgimage's pbuffer surface, then return that
+                    VVHW_TRACE( "EeglCreatePixmapSurfaceSg" );
+                    break;
+                    }
+                case EglRFC::EeglCreatePbufferFromClientBuffer:
+                    {
+                    //if a sgImage-backing VGImage handle is passed here, then fail with EGL_BAD_ACCESS
+                    
+                    VVHW_TRACE("eglCreatePbufferFromClientBuffer" );
+                    break;
+                    }
+                case EglRFC::EeglGetError:
+                    {
+                    VVHW_TRACE("eglGetError" );
+                    break;
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }//switch opcode (EGL)
+                
+            break;
+            }
+        case SERIALISED_OPENGLES_1_1_API_UID:
+            {
+            VVHW_TRACE("OpenGLES request" );
+            switch( opcode )
+                {
+                case OpenGlES11RFC::EglGetError:
+                    {
+                    //Get the GLES error
+                    }
+                default:
+                    {
+                    break;
+                    }
+                }
+            break;
+            }
+        default:
+            {
+            break;
+            }
+        }//switch apicode
+    //VVHW_TRACE( "DDeviceReqHandler::InterpretRequest: opcode : %d ", data->iCurrOpCode );
+    if( iCurrClientData )//This could have been removed, in a call to RemoveClientData
+        {
+        iCurrClientData->iErrUpdatedVG = ErrUpdatedVG;
+        iCurrClientData->iErrUpdatedEGL = ErrUpdatedEGL;
+        iCurrClientData->iErrUpdatedGLES = ErrUpdatedGLES;
+        }
+    return alreadyProcessed;
+    }
+
+HBuf8* DDeviceReqHandler::OpenSgImageMetaData( const TUint64 aId, DSgResource*& aResource )
+    {
+    VVHW_TRACE("DDeviceReqHandler::OpenSgImageMetaData 0x%lx", aId );
+    aResource = 0;
+    HBuf8* data(0);
+    TInt sgOpenErr( KErrNone );
+    
+    sgOpenErr = SgExtension::FindAndOpenResource( aId, aResource );//Open the sgimage resource
+    VVHW_TRACE(" sgOpenErr %d", sgOpenErr);
+    if( sgOpenErr == KErrNone )
+        {
+        data = HBuf8::New( aResource->GetMetaDataSize() );
+        if( data )
+            {
+            aResource->GetMetaData( (*data) );
+            }
+        }
+    return data;//If there was a problem, this is zero. Ownership belongs to caller
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/ldd/src/reqhandlerextension.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,139 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Platsim video driver - request handler extension (a.k.a. Command Scheduler extension)
+//
+
+#include <kernel/kern_priv.h>
+#include <kernel.h>
+#include <graphics/reqhandlerextension.h>
+
+DReqHandlerExtensionImpl* TheReqHandlerExtensionImpl = NULL;
+
+DECLARE_STANDARD_EXTENSION()
+	{
+	__KTRACE_OPT(KBOOT, Kern::Printf("Starting TheReqHandlerExtension"));
+	TInt err;
+	TheReqHandlerExtensionImpl = new DReqHandlerExtensionImpl;
+	if (TheReqHandlerExtensionImpl)
+		{
+		err = TheReqHandlerExtensionImpl->Construct();
+		if (err != KErrNone)
+			{
+			delete TheReqHandlerExtensionImpl;
+			TheReqHandlerExtensionImpl = NULL;
+			}
+		}
+	else
+		{
+		err = KErrNoMemory;
+		}
+	if (err != KErrNone)
+		{
+		__KTRACE_OPT(KBOOT, Kern::Printf("Error: TheReqHandlerExtension failed to start"));
+		}
+	return err;
+	}
+
+
+EXPORT_C TInt ReqHandlerExtension::CreateSgImagePbuffer( const TSgImageMetaData& aInfo )
+	{
+    VVHW_TRACE( "ReqHandlerExtension::CreateSgImagePbuffer ->" );
+	if ( !TheReqHandlerExtensionImpl )
+		{
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: The ReqHandlerExtension not ready"));
+		return KErrNotReady;
+		}
+	TRequestStatus status = KRequestPending;
+	TheReqHandlerExtensionImpl->CreateSgImagePbuffer( aInfo, &status, &Kern::CurrentThread() );
+	//Kern::WaitForRequest( status );
+	VVHW_TRACE( "ReqHandlerExtension::CreateSgImagePbuffer <-" );
+	return 0;
+	}
+
+EXPORT_C TInt ReqHandlerExtension::CreateSgImageVGImage( const TSgImageMetaData& aInfo )
+    {
+    VVHW_TRACE( "ReqHandlerExtension::CreateSgImageVGImage" );
+    if ( !TheReqHandlerExtensionImpl )
+        {
+        __KTRACE_OPT(KPANIC, Kern::Printf("Error: The ReqHandlerExtension not ready"));
+        return KErrNotReady;
+        }
+    TRequestStatus status;
+    TheReqHandlerExtensionImpl->CreateSgImageVGImage( aInfo, &status, &Kern::CurrentThread() );
+    //Kern::WaitForRequest( status );
+    return 0;
+    }
+
+
+EXPORT_C TInt ReqHandlerExtension::DestroySgImage( const TUint64 aId )
+	{
+    VVHW_TRACE( "ReqHandlerExtension::DestroySgImage" );
+	if ( !TheReqHandlerExtensionImpl )
+		{
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: The ReqHandlerExtension not ready"));
+		return KErrNotReady;
+		}
+	return TheReqHandlerExtensionImpl->DestroySgImage( aId );
+	}
+
+EXPORT_C TInt ReqHandlerExtension::SetReqHandler( MReqHandlerCallback* aHandler )
+	{
+	if ( !TheReqHandlerExtensionImpl )
+		{
+		__KTRACE_OPT(KPANIC, Kern::Printf("Error: The ReqHandlerExtension not ready"));
+		return KErrNotReady;
+		}
+	return TheReqHandlerExtensionImpl->SetReqHandler( aHandler );
+	}
+
+//Implementation
+
+TInt DReqHandlerExtensionImpl::Construct()
+	{
+	return Kern::MutexCreate(iMutex, KNullDesC8, KMutexOrdGeneral0);
+	}
+
+void DReqHandlerExtensionImpl::CreateSgImagePbuffer( const TSgImageMetaData& aInfo, TRequestStatus* aStatus, DThread* aThread )
+	{
+	if( iCallBackHandler )
+        {
+		return iCallBackHandler->CreateSgImagePbuffer( aInfo, aStatus, aThread );
+		}
+	}
+
+void DReqHandlerExtensionImpl::CreateSgImageVGImage( const TSgImageMetaData& aInfo, TRequestStatus* aStatus, DThread* aThread )
+    {
+    if( iCallBackHandler )
+        {
+        return iCallBackHandler->CreateSgImageVGImage( aInfo, aStatus, aThread );
+        }
+    }
+
+TInt DReqHandlerExtensionImpl::DestroySgImage( const TUint64 aId )
+	{
+	if( iCallBackHandler )
+        {
+        TRequestStatus status;
+	    TInt err = iCallBackHandler->DestroySgImage( aId );
+	    return err; 
+		}
+    return 0;
+	}
+
+TInt DReqHandlerExtensionImpl::SetReqHandler( MReqHandlerCallback* aHandler )
+	{
+	iCallBackHandler = aHandler;
+	return 1;
+	}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/ldd/src/virtualvideohwchannel.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,284 @@
+/*
+ * =============================================================================
+ *  Name        : virtualvideohwchannel.cpp
+ *  Part of     : 
+ *  Description : Implementation of the class DVirtualVideoHwChannel.
+ *  Version     : %version:2 %
+ *
+ *  Copyright © 2002-2010 Nokia. All rights reserved.
+ *  This material, including documentation and any related
+ *  computer programs, is protected by copyright controlled by
+ *  Nokia. All rights are reserved. Copying, including
+ *  reproducing, storing, adapting or translating, any
+ *  or all of this material requires the prior written consent of
+ *  Nokia. This material also contains confidential
+ *  information which may not be disclosed to others without the
+ *  prior written consent of Nokia.
+ * =============================================================================
+ */
+
+// INCLUDE FILES
+#include <kernel/kernel.h>
+#include <assp.h>
+
+#include "virtualvideohwchannel.h"
+#include "virtualvideohwdeviceinterface.h"
+#include "platsimvideodriverprotocol.h"
+#include "platsimvideodrivercommon.h"
+#include "devicereqhandler.h"
+#include "serializedfunctioncall.h"
+
+
+// CONSTANTS
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwChannel::DVirtualVideoHwChannel
+// -----------------------------------------------------------------------------
+//
+DVirtualVideoHwChannel::DVirtualVideoHwChannel(
+    MVirtualVideoHwDeviceInterface& aDeviceInterface,
+    DVirtualVideoHwInterface& aHwInterface,
+    DDeviceReqHandler& aDeviceReqHandler,
+    TDfcQue* aQueue ) :
+    iDeviceInterface( aDeviceInterface ),
+    iHwInterface( aHwInterface ),
+    iReqHandler( aDeviceReqHandler )
+    {    
+    SetDfcQ( aQueue );
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwChannel::~DVirtualVideoHwChannel
+// -----------------------------------------------------------------------------
+//
+DVirtualVideoHwChannel::~DVirtualVideoHwChannel()
+    {
+    // Enter critical section
+    NKern::ThreadEnterCS();
+    iMsgQ.CompleteAll( KErrAbort );
+    // Leave critical section
+    NKern::ThreadLeaveCS();
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwChannel::Request
+// -----------------------------------------------------------------------------
+//
+TInt DVirtualVideoHwChannel::Request( TInt aReqNo, TAny *a1, TAny *a2 )
+    {
+    TInt result = DLogicalChannel::Request( aReqNo, a1, a2 );
+    return result;
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwChannel::HandleMsg
+// -----------------------------------------------------------------------------
+//
+void DVirtualVideoHwChannel::HandleMsg( TMessageBase* aMsgRequest )
+    {
+    DThread* userThread = aMsgRequest->Client();
+    TThreadMessage& msg = *(TThreadMessage*)aMsgRequest;
+    // Default error condition
+    TInt err = KErrNone; 
+
+    if ( msg.iValue == ECloseMsg )
+        {
+        iReqHandler.HandleClientShutdown( userThread->iOwningProcess->iId, userThread->iId );
+        msg.Complete( KErrNone, EFalse );
+        return;
+        }
+    
+    if ( msg.iValue < 0 )
+        {
+        TRequestStatus* status = (TRequestStatus*)msg.Ptr0();
+        err = DoRequest( userThread, ~msg.iValue, status, msg.Ptr1(), msg.Ptr2() );
+        if( err != KErrNone )
+            {
+            Kern::RequestComplete( userThread, status, err );
+            }
+        err = KErrNone;
+        }
+    else
+        {
+        err = DoControl( userThread, msg.iValue, msg.Ptr0(), msg.Ptr1() );
+        }
+
+    msg.Complete( err, ETrue );
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwChannel::DoCreate
+// -----------------------------------------------------------------------------
+//
+TInt DVirtualVideoHwChannel::DoCreate( TInt /*aUnit*/, const TDesC* /*aInfo*/, const TVersion& aVer )
+    {
+    using namespace PlatsimVideoDriver;
+    TInt err = KErrNone;
+    
+    if ( ! Kern::QueryVersionSupported(
+            TVersion(
+                    KMajorVer,
+                    KMinorVer,
+                    KBuildVer ),
+            aVer ) )
+        {
+        return KErrNotSupported; 
+        }
+
+    iMsgQ.Receive();
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwChannel::DoRequest
+// -----------------------------------------------------------------------------
+//
+TInt DVirtualVideoHwChannel::DoRequest(
+        DThread*& aUserThread,
+        TInt aReqNo,
+        TRequestStatus* aStatus,
+        TAny* a1,
+        TAny* a2 )
+    {
+    using namespace PlatsimVideoDriver;
+
+    // Default error condition
+    TInt err = KErrNone; 
+
+    switch( aReqNo )
+        {
+        case ERequestExecuteCommand:
+            {
+            err = iReqHandler.HandleExecuteAsync(
+                    aUserThread,
+                    aStatus,
+                    a1);
+            break;
+            }
+        case ERequestLoadCommands:
+            {
+            err = iReqHandler.HandleLoadCommands(
+                    aUserThread, 
+                    aStatus,
+                    a1 );
+            break;
+            }
+        default:
+            {
+            // Other requests are not supported
+            err = KErrNotSupported;
+            }
+            break;
+        }
+    return err;
+    }
+
+
+
+TInt DVirtualVideoHwChannel::GetSgImageMetaData(TSgImageMetaData& aSgInfo, const TUint64 aId)
+	{
+	VVHW_TRACE("DVirtualVideoHwChannel::OpenSgImageMetaData 0x%lx", aId );
+	DSgResource* sgResource = NULL;
+	TInt metaDataErr = SgExtension::FindAndOpenResource( aId, sgResource );//Open the sgimage resource
+	
+	if ( metaDataErr == KErrNone )
+		{
+		TPckgBuf<TSgImageMetaData> metaDataPckg;
+		
+		metaDataErr = sgResource->GetMetaData( metaDataPckg );
+		if ( metaDataErr == KErrNone )
+			{
+			aSgInfo = metaDataPckg();
+			}
+
+		sgResource->Close();
+		}
+	return metaDataErr;
+	}
+
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwChannel::DoControl
+// -----------------------------------------------------------------------------
+//
+TInt DVirtualVideoHwChannel::DoControl(
+        DThread*& aUserThread,
+        TInt aFunction,
+        TAny* a1,
+        TAny* a2 )
+    {
+    using namespace PlatsimVideoDriver;
+    
+    // Default error condition
+    TInt err = KErrNone; 
+
+    switch( aFunction )
+        {
+        case ERequestMapAddress:
+            {
+            TPckgBuf<TInt> handle;
+            err = Kern::ThreadDesRead( aUserThread, a1, handle, 0, 0 );
+            if ( KErrNone == err )
+                {
+                DChunk* chunk = Kern::OpenSharedChunk( aUserThread, handle(), EFalse );
+                if ( chunk )
+                    {
+                    TLinAddr kernelAddress;
+                    TUint32 mapAttr;
+                    TUint32 physicalAddress( 0 );
+                    TInt ret = Kern::ChunkPhysicalAddress( chunk, 0, chunk->Size(), 
+                            kernelAddress, mapAttr, physicalAddress );
+                    
+                    TPckgC<TUint32> address( physicalAddress );
+                    err = Kern::ThreadDesWrite( aUserThread, a2, address, 0, 0, aUserThread );
+                    Kern::ChunkClose( chunk );
+                    chunk = NULL;
+                    }
+                else
+                    {
+                    err = KErrGeneral;
+                    }
+                }
+            break;
+            }
+        case ERequestSgHandles:
+            {
+            VVHW_TRACE("DVirtualVideoHwChannel::DoControl - ERequestSgHandles" );
+            TPckgBuf<TUint64> sgId;
+            err = Kern::ThreadDesRead( aUserThread, a1, sgId, 0, 0 );
+            if( KErrNone == err )
+                {
+				TSgImageMetaData sgInfo;
+				err = GetSgImageMetaData( sgInfo, sgId());
+				if ( KErrNone == err )
+					{
+					// package the handles into 64-bit value, since there's only one parameter (a2) available
+					TUint64 sgHandles = (((TUint64)sgInfo.iPbufferHandle)&0xFFFFFFFF) + (((TUint64)sgInfo.iVGImageHandle)<<32);
+					TPckg<TUint64> handles(sgHandles);
+					err = Kern::ThreadDesWrite( aUserThread, a2, handles, 0, 0);
+					if(err)
+					    VVHW_TRACE("DVirtualVideoHwChannel::DoControl - ThreadDesWrite error=%d", err);
+					}
+				else
+					{
+					VVHW_TRACE("DVirtualVideoHwChannel::DoControl - OpenSgImageMetaData failed" );
+					}
+                }
+            else
+            	{
+				VVHW_TRACE("DVirtualVideoHwChannel::DoControl - ThreadDesRead err=%i", err );
+                }
+            break;
+            }
+        default:
+            {
+            // Other functions are not supported
+            err = KErrNotSupported;
+            }
+            break;
+        }
+
+    return err;
+    }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/ldd/src/virtualvideohwdevice.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,169 @@
+/*
+ * =============================================================================
+ *  Name        : virtualvideohwdevice.cpp
+ *  Part of     : 
+ *  Description : Implementation of the class DVirtualVideoHwDevice.
+ *  Version     : %version:3 %
+ *
+ *  Copyright © 2002-2008 Nokia. All rights reserved.
+ *  This material, including documentation and any related
+ *  computer programs, is protected by copyright controlled by
+ *  Nokia. All rights are reserved. Copying, including
+ *  reproducing, storing, adapting or translating, any
+ *  or all of this material requires the prior written consent of
+ *  Nokia. This material also contains confidential
+ *  information which may not be disclosed to others without the
+ *  prior written consent of Nokia.
+ * =============================================================================
+ */
+
+
+// INCLUDE FILES
+#include <kernel/kernel.h>
+#include <assp.h>
+
+#include "virtualvideohwdevice.h"
+#include "virtualvideohwchannel.h"
+#include "platsimvideodriverprotocol.h"
+#include "platsimvideodrivercommon.h"
+#include "virtualvideohwinterface.h"
+#include "devicereqhandler.h"
+#include "virtualvideotracing.h"
+
+const TInt KPriority = 27; // DfcQue0 has same priority
+
+// a .LDD requires that the first exported function creates the device. By
+// returning a concrete DLogicalDevice-derived class, this implements
+// polymorphism using a named DLL.
+DECLARE_STANDARD_LDD()
+    {
+    return new DVirtualVideoHwDevice; 
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwDevice::DVirtualVideoHwDevice
+// -----------------------------------------------------------------------------
+//
+DVirtualVideoHwDevice::DVirtualVideoHwDevice()
+    {
+    // No need to set iParseMask as we don't have PDD.
+    // Just set the version.
+    using namespace PlatsimVideoDriver;
+    iVersion = TVersion( KMajorVer, KMinorVer, KBuildVer );
+    VVHW_TRACE("DVirtualVideoHwDevice::DVirtualVideoHwDevice");
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwDevice::Install
+// -----------------------------------------------------------------------------
+//
+TInt DVirtualVideoHwDevice::Install()
+    {
+    // Our name, used by User::FreeLogicalDevice 
+    TInt err = SetName( &PlatsimVideoDriver::KDeviceName );
+    if ( err != KErrNone )
+        {
+        VVHW_TRACE("DVirtualVideoHwDevice::Install SetName %d", err);
+        return err;
+        }
+
+    // Enter critical section
+    NKern::ThreadEnterCS();
+    
+    err = Kern::DfcQCreate( iDfcQ, KPriority, &PlatsimVideoDriver::KDfcThreadName );
+
+    // Leave critical section
+    NKern::ThreadLeaveCS();
+
+    if ( err != KErrNone )
+        {
+        VVHW_TRACE("DVirtualVideoHwDevice::Install Kern::DfcQCreate %d", err);
+        return err;
+        }
+    
+    iHwInterface = new DVirtualVideoHwInterface;
+    if ( !iHwInterface )
+        {
+        return KErrNoMemory;
+        }
+
+    err = iHwInterface->InitRegisterMemory();
+    if ( err != KErrNone )
+        {
+        VVHW_TRACE("DVirtualVideoHwDevice::Install InitRegisterMemory %d", err);
+        return err;
+        }
+
+    err = iHwInterface->InitParametersInputMemory();
+    if ( err != KErrNone )
+        {
+        VVHW_TRACE("DVirtualVideoHwDevice::Install InitParametersInputMemory %d", err);
+        return err;
+        }
+
+    err = iHwInterface->InitParametersOutputMemory();
+    if ( err != KErrNone )
+        {
+        VVHW_TRACE("DVirtualVideoHwDevice::Install InitParametersOutputMemory %d", err);
+        return err;
+        }
+
+    iDeviceReqHandler = new DDeviceReqHandler( *iHwInterface, iDfcQ );
+    if ( !iDeviceReqHandler )
+        {
+        return KErrNoMemory;
+        }
+
+    VVHW_TRACE("DVirtualVideoHwDevice::Install return %d", err);
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwDevice::~DVirtualVideoHwDevice
+// -----------------------------------------------------------------------------
+//
+DVirtualVideoHwDevice::~DVirtualVideoHwDevice()
+    {
+    delete iDeviceReqHandler;
+    delete iDfcQ;
+    delete iHwInterface;
+    VVHW_TRACE("DVirtualVideoHwDevice:~DVirtualVideoHwDevice");
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwDevice::GetCaps
+// -----------------------------------------------------------------------------
+//
+void DVirtualVideoHwDevice::GetCaps( TDes8& aDes ) const
+    {
+    TVersion version; 
+
+    // fill it with information
+    version = iVersion; 
+
+    // copy as much of our information as will fit into this descriptor
+    aDes.Copy( (TUint8*)&version, Min( aDes.MaxLength(), sizeof( version ) ) );
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwDevice::Create
+// -----------------------------------------------------------------------------
+//
+TInt DVirtualVideoHwDevice::Create( DLogicalChannelBase*& aChannel )
+    { 
+    aChannel = NULL;
+    TInt error = KErrNone;
+    aChannel = new DVirtualVideoHwChannel(
+            *this,
+            *iHwInterface,
+            *iDeviceReqHandler,
+            iDfcQ);
+    
+    if ( !aChannel )
+        {
+        error = KErrNoMemory;
+        }
+    return error;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/ldd/src/virtualvideohwinterface.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,267 @@
+/*
+ * =============================================================================
+ *  Name        : virtualvideohwinterface.cpp
+ *  Part of     : 
+ *  Description : Implementation file for the class DVirtualVideoHwInterface.
+ *  Version     : %version:3 %
+ *
+ *  Copyright © 2002-2009 Nokia. All rights reserved.
+ *  This material, including documentation and any related
+ *  computer programs, is protected by copyright controlled by
+ *  Nokia. All rights are reserved. Copying, including
+ *  reproducing, storing, adapting or translating, any
+ *  or all of this material requires the prior written consent of
+ *  Nokia. This material also contains confidential
+ *  information which may not be disclosed to others without the
+ *  prior written consent of Nokia.
+ * =============================================================================
+ */
+
+
+// INCLUDE FILES
+#include <platform.h>
+#include <kern_priv.h>
+
+#include "virtualvideointerfaceconstants.h"
+#include "virtualvideohwinterface.h"
+#include "virtualvideotracing.h"
+
+
+// CONSTANTS
+
+_LIT( KVirtualVideoHwInterfacePanic, "DVirtualVideoHwInterface" );
+
+// ============================ LOCAL DATA TYPES ===============================
+
+// Register offsets for playback and recording channels
+// Note: The orders of these must match the order of enumarations
+const TLinAddr KRegisterOffsets[] =
+    {
+    VVI_R_ID,
+    VVI_R_IRQ_ENABLE,
+    VVI_R_IRQ_STATUS,
+    VVI_R_COMMAND,
+    VVI_R_PARAMETER_LOAD,
+    VVI_R_ERROR,
+    VVI_R_INPUT_BUFFER_TAIL,
+    VVI_R_INPUT_BUFFER_HEAD,
+    VVI_R_INPUT_BUFFER_READ_COUNT,
+    VVI_R_INPUT_BUFFER_WRITE_COUNT,
+    VVI_R_INPUT_BUFFER_MAX_TAIL,
+    VVI_R_REQUEST_ID
+    };
+#define ASSERT_PANIC(c,p) __ASSERT_DEBUG(c,Kern::PanicCurrentThread(KVirtualVideoHwInterfacePanic,p));
+
+// ============================ LOCAL FUNCTIONS ================================
+
+// Get register offset for certain register range and register
+inline TLinAddr RegisterOffset( DVirtualVideoHwInterface::TRegister aRegister )
+    {
+    return KRegisterOffsets[aRegister];
+    }
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwInterface::DVirtualVideoHwInterface
+// -----------------------------------------------------------------------------
+//
+DVirtualVideoHwInterface::DVirtualVideoHwInterface()
+    {
+    iInputParametersMemoryChunk = NULL;
+    iOutputParametersMemoryChunk = NULL;
+    iRegisterMemoryChunk = NULL;
+    }
+
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwInterface::~DVirtualVideoHwInterface
+// -----------------------------------------------------------------------------
+//
+DVirtualVideoHwInterface::~DVirtualVideoHwInterface()
+    {
+    // Enter critical section
+    NKern::ThreadEnterCS();
+
+    if ( iInputParametersMemoryChunk )
+        {
+        Kern::ChunkClose( iInputParametersMemoryChunk );
+        }
+
+    if ( iOutputParametersMemoryChunk )
+        {
+        Kern::ChunkClose( iOutputParametersMemoryChunk );
+        }
+
+    if ( iRegisterMemoryChunk )
+        {
+        Kern::ChunkClose( iRegisterMemoryChunk );
+        }
+
+    iInputParametersMemoryChunk = NULL;
+    iOutputParametersMemoryChunk = NULL;
+    iRegisterMemoryChunk = NULL;
+
+    // Leave critical section
+    NKern::ThreadLeaveCS();
+    }
+
+TInt DVirtualVideoHwInterface::InitParametersInputMemory()
+    {
+    return InitPhysicalMemory( VVI_PARAMETERS_INPUT_BASE_ADDRESS, 
+            VVI_PARAMETERS_INPUT_MEMORY_SIZE, iInputParametersMemoryChunk, 
+            iInputParametersChunkKernelAddress );    
+    }
+
+TInt DVirtualVideoHwInterface::InitParametersOutputMemory()
+    {
+    return InitPhysicalMemory( VVI_PARAMETERS_OUTPUT_BASE_ADDRESS, 
+            VVI_PARAMETERS_OUTPUT_MEMORY_SIZE, iOutputParametersMemoryChunk, 
+            iOutputParametersChunkKernelAddress );    
+    }
+
+TInt DVirtualVideoHwInterface::InitRegisterMemory()
+    {
+    return InitPhysicalMemory( VVI_REGISTERS_BASE_ADDRESS, 
+            VVI_REGISTERS_MEMORY_SIZE, iRegisterMemoryChunk, 
+            iRegisterChunkKernelAddress );        
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwInterface::InitPhysicalMemory
+// -----------------------------------------------------------------------------
+//
+TInt DVirtualVideoHwInterface::InitPhysicalMemory( TUint32 aPhysicalAddress, 
+        TInt aMaxSize, DChunk*& aChunk, TLinAddr& aLinAddr )
+    {
+    TInt error = KErrNoMemory;
+    TChunkCreateInfo info;
+    info.iType = TChunkCreateInfo::ESharedKernelSingle;
+    info.iMaxSize = aMaxSize;
+	info.iMapAttr = EMapAttrFullyBlocking;
+    info.iOwnsMemory = EFalse;
+    info.iDestroyedDfc = NULL;
+    DChunk* chunk = NULL;
+    TUint32 mapAttr = 0;
+    TLinAddr chunkKernelAddress = 0;
+    
+    // Enter critical section while creating the chunk and commiting memory
+    NKern::ThreadEnterCS();
+
+    error = Kern::ChunkCreate( info, chunk, chunkKernelAddress, mapAttr );
+    if ( !error )
+        {
+        error = Kern::ChunkCommitPhysical(
+            chunk, 0, aMaxSize, aPhysicalAddress );
+        if ( error )
+            {
+            Kern::ChunkClose( chunk );
+            }
+        else
+            {
+            // Physical memory has been successfully committed to chunk
+            aChunk = chunk; 
+            aLinAddr = chunkKernelAddress;
+            }
+        }
+    chunk = NULL;
+
+    // Leave critical section
+    NKern::ThreadLeaveCS();
+    
+    VVHW_TRACE("DVirtualVideoHwInterface::InitPhysicalMemory return %d", error);
+    return error;
+    }
+
+// -----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwInterface::EnableInterrupts
+// -----------------------------------------------------------------------------
+//
+void DVirtualVideoHwInterface::EnableInterrupts( TUint32 aInterruptBitField )
+    {
+    SetRegisterValue( ERegIrqEnable, aInterruptBitField );
+    }
+
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwInterface::GetInterruptEnabledState
+// -----------------------------------------------------------------------------
+//
+void DVirtualVideoHwInterface::GetInterruptEnabledState( TUint32& aInterruptBitField )
+    {
+    GetRegisterValue( ERegIrqEnable, aInterruptBitField );
+    }
+
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwInterface::GetInterruptStatus
+// -----------------------------------------------------------------------------
+//
+void DVirtualVideoHwInterface::GetInterruptStatus( TUint32& aInterruptBitField )
+    {
+    GetRegisterValue( ERegIrqStatus, aInterruptBitField );
+    }
+
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwInterface::ResetInterruptStatus
+// -----------------------------------------------------------------------------
+//
+void DVirtualVideoHwInterface::ResetInterruptStatus( TUint32 aInterruptBitField )
+    {
+    SetRegisterValue( ERegIrqStatus, aInterruptBitField );
+    }
+
+
+// DVirtualVideoHwInterface::IssueCommand
+// -----------------------------------------------------------------------------
+//
+void DVirtualVideoHwInterface::IssueCommand( TUint32 aCommand )
+    {
+    SetRegisterValue( ERegCommand, aCommand );
+    }
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwInterface::GetRegisterValue
+// -----------------------------------------------------------------------------
+//
+void DVirtualVideoHwInterface::GetRegisterValue(
+    TRegister aRegister,
+    TUint32& aValue )
+    {
+    if ( iRegisterMemoryChunk )
+        {
+        TLinAddr offset = RegisterOffset( aRegister );
+        TUint32* ptr = reinterpret_cast<TUint32*>( iRegisterChunkKernelAddress + offset );
+        aValue = *ptr;
+        }
+    else
+        {
+        Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady );
+        }
+    }
+
+
+// -----------------------------------------------------------------------------
+// DVirtualVideoHwInterface::SetRegisterValue
+// -----------------------------------------------------------------------------
+//
+void DVirtualVideoHwInterface::SetRegisterValue(
+    TRegister aRegister,
+    TUint32 aValue )
+    {
+    if ( iRegisterMemoryChunk )
+        {
+        TLinAddr offset = RegisterOffset( aRegister );
+        TUint32* ptr = reinterpret_cast<TUint32*>( iRegisterChunkKernelAddress + offset );
+        *ptr = aValue;
+        }
+    else
+        {
+        Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady );
+        }
+    }
+
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/guestvideodriver/rom/guestvideodriver.iby	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,27 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// ROM IBY file for Guest Video Driver
+
+#ifndef GUESTVIDEODRIVER_IBY
+#define GUESTVIDEODRIVER_IBY
+
+
+file=ABI_DIR\BUILD_DIR\guestvideohwapi.dll                SHARED_LIB_DIR\guestvideohwapi.dll
+
+extension[VARID]=KERNEL_DIR\BUILD_DIR\reqhandlerextension.dll   \sys\bin\reqhandlerextension.dll
+device[VARID]=KERNEL_DIR\BUILD_DIR\guestvideohw.ldd         \sys\bin\guestvideohw.ldd
+
+#endif // GUESTVIDEODRIVER_IBY
+
+//  End of File
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/eabi/vghwserialiseru.def	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,28 @@
+EXPORTS
+	_ZN18RemoteFunctionCall11AppendParamElPKhN22RemoteFunctionCallData15TParamDirectionE @ 1 NONAME
+	_ZN18RemoteFunctionCall11ReturnValueEv @ 2 NONAME
+	_ZN18RemoteFunctionCall12AppendVectorElmPKhN22RemoteFunctionCallData15TParamDirectionE @ 3 NONAME
+	_ZN18RemoteFunctionCall12SetParamDataElPKhi @ 4 NONAME
+	_ZN18RemoteFunctionCall13SetVectorDataElPKhii @ 5 NONAME
+	_ZN18RemoteFunctionCall14SetReturnValueEm @ 6 NONAME
+	_ZN18RemoteFunctionCall4DataEv @ 7 NONAME
+	_ZN18RemoteFunctionCall4InitElN22RemoteFunctionCallData14TOperationTypeE @ 8 NONAME
+	_ZN18RemoteFunctionCallC2ER22RemoteFunctionCallData @ 9 NONAME
+	_ZN22RemoteFunctionCallData10AlignIndexEil @ 10 NONAME
+	_ZN22RemoteFunctionCallData10ParametersEv @ 11 NONAME
+	_ZN22RemoteFunctionCallData13GetParamValueElPhi @ 12 NONAME
+	_ZN22RemoteFunctionCallData13GetVectorDataElPPvRii @ 13 NONAME
+	_ZN22RemoteFunctionCallData14ParameterCountEv @ 14 NONAME
+	_ZN22RemoteFunctionCallData14SetReturnValueEm @ 15 NONAME
+	_ZN22RemoteFunctionCallData16SetOperationTypeEl @ 16 NONAME
+	_ZN22RemoteFunctionCallData16SetTransactionIdEm @ 17 NONAME
+	_ZN22RemoteFunctionCallData20SetThreadInformationEmm @ 18 NONAME
+	_ZN22RemoteFunctionCallData8CopyDataEPhPKhl @ 19 NONAME
+	_ZN22SerializedFunctionCall11ParseBufferEPKhi @ 20 NONAME
+	_ZN22SerializedFunctionCall13SetDataCopierEP11MDataCopier @ 21 NONAME
+	_ZN22SerializedFunctionCall13WriteToBufferEPhii @ 22 NONAME
+	_ZN22SerializedFunctionCallC1ER22RemoteFunctionCallDataP11MDataCopier @ 23 NONAME
+	_ZN22SerializedFunctionCallC2ER22RemoteFunctionCallDataP11MDataCopier @ 24 NONAME
+	_ZNK22RemoteFunctionCallData16SerialisedLengthEv @ 25 NONAME
+	_ZNK22RemoteFunctionCallData6HeaderEv @ 26 NONAME
+
--- a/guestrendering/vghwserialiser/group/bld.inf	Tue Aug 17 16:01:36 2010 +0100
+++ b/guestrendering/vghwserialiser/group/bld.inf	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,21 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+PRJ_PLATFORMS
+DEFAULT -WINSCW
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+vghwserialiser.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/group/vghwserialiser.mmp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,39 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+
+TARGET		  	vghwserialiser.dll
+TARGETTYPE	  	dll
+UID				0x1000008d 0x2002B6E2
+capability      CAP_GENERAL_DLL //All-Tcb
+vendorid        VID_DEFAULT //0x101FB657 //Nokia vendor id 
+
+OS_LAYER_SYSTEMINCLUDE
+OS_LAYER_ESTLIB_SYSTEMINCLUDE
+
+USERINCLUDE     ../inc
+SOURCEPATH      ../src
+
+SOURCE remotefunctioncall.cpp
+SOURCE serializedfunctioncall.cpp
+
+DEFFILE ../eabi/vghwserialiser.def
+
+LIBRARY euser.lib
+
+#ifdef ENABLE_ABIV2_MODE
+  DEBUGGABLE_UDEBONLY
+#endif
+
+//EPOCALLOWDLLDATA
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/driverrfc.h	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,275 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+
+#ifndef DRIVERREMOTEFUNCTIONCALL_H_
+#define DRIVERREMOTEFUNCTIONCALL_H_
+
+#include "remotefunctioncall.h"
+#include "serialisedapiuids.h"
+
+#include "remotefunctioncall.h"
+
+#ifdef __SYMBIAN32__
+    #include <e32const.h>
+    #include <e32def.h>
+    #include <EGL/egl.h>
+#else
+    #include "EGL/egl.h"
+#endif
+
+#ifdef __SYMBIAN32__
+    #define __VG_OPENVG_H_
+    #include <VG/1.1/openvg.h>
+    #include <VG/vgu.h>
+#else
+    #define __OPENVGHEADERS_USE_VG_1_1
+    #include <VG/openvg.h>
+    #include "VG/vgu.h"
+#endif
+
+class DriverRFC: public RemoteFunctionCall
+    {
+public:
+    //Openvg pperation code
+    enum TOperationCode
+        {
+        EDrvClientShutdown,
+        EDrvCreatePoolContext, //for creating the pool context hostside
+        EDrvCreatePbufferSg,
+        EDrvCreateVGImageSg,
+        EDrvDeleteSgImage,
+        EDrvSyncVGImageFromPBuffer
+        };
+
+	//Parameter data type
+    enum TParamType
+        {        
+        EPTVoid,
+        EEGLBoolean,
+        EEGLint,
+        EEGLenum,
+        EEGLDisplay,
+        EEGLConfig,
+        EEGLSurface,
+        EEGLContext,
+        EEGLClientBuffer,
+        EEGLImageKHR,
+        EEGLNativeDisplayType,
+        EEGLNativeWindowType,
+        EEGLNativePixmapType,
+        EEGLVoid,
+        ETUint32,
+        //VG parameters
+        EVGfloat,
+        EVGbyte,
+        EVGubyte,
+        EVGshort,
+        EVGint,
+        EVGuint,
+        EVGbitfield,
+        EVGboolean,
+        EVGHandle,
+        EVGErrorCode,
+        EVGParamType, //10
+        EVGRenderingQuality,
+        EVGPixelLayout,
+        EVGMatrixMode,
+        EVGMaskOperation,
+        EVGPathDatatype,
+        EVGPathAbsRel,
+        EVGPathSegment,
+        EVGPathCommand,
+        EVGPath,
+        EVGPathCapabilities, //20
+        EVGPathParamType,
+        EVGCapStyle,
+        EVGJoinStyle,
+        EVGFillRule,
+        EVGPaintMode,
+        EVGPaint,
+        EVGPaintParamType,
+        EVGPaintType,
+        EVGColorRampSpreadMode,
+        EVGTilingMode, //30
+        EVGImageFormat,
+        EVGImage,
+        EVGImageQuality,
+        EVGImageParamType,
+        EVGImageMode,
+        EVGImageChannel,
+        EVGBlendMode,
+        EVGHardwareQueryType,
+        EVGHardwareQueryResult,
+        EVGStringID, //40
+        EVGvoid,
+        EVGUArcType,
+        EVGeglImageKHR
+        };
+
+    DriverRFC( RemoteFunctionCallData& aData ):
+        RemoteFunctionCall( aData )
+        {
+        }
+    
+	//Size of type aType
+	TInt GetTypeSize( TInt32 aParamType ) const;
+
+    //Alignemnt of type aType
+	TInt GetTypeAlignment( TInt32 aParamType ) const;
+
+    //Alignemnt of type aType
+	TUint32 GetAPIUid() const { return SERIALISED_DRIVER_API_UID; }
+	
+	
+	
+	inline void AppendEGLBoolean( const EGLBoolean& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLint( const EGLint& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLenum( const EGLenum& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLDisplay( const EGLDisplay& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLConfig( const EGLConfig& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLSurface( const EGLSurface& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLContext( const EGLContext& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLClientBuffer( const EGLClientBuffer& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLImageKHR( const EGLImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLNativeDisplayType( const NativeDisplayType& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLNativeWindowType( const NativeWindowType& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLNativePixmapType( const NativePixmapType& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );    
+#ifdef __SYMBIAN32__
+    inline void AppendEGLSize( const TSize& aSize, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+#endif
+
+    //Gets a simple parameter value from parameter array
+    inline void GetEGLBoolean( EGLBoolean& aParam, TInt aIndex );
+    inline void GetEGLint( EGLint& aParam, TInt aIndex );
+    inline void GetEGLenum( EGLenum& aParam, TInt aIndex );
+    inline void GetEGLDisplay( EGLDisplay& aParam, TInt aIndex );
+    inline void GetEGLConfig( EGLConfig& aParam, TInt aIndex );
+    inline void GetEGLSurface( EGLSurface& aParam, TInt aIndex );
+    inline void GetEGLContext( EGLContext& aParam, TInt aIndex );
+    inline void GetEGLClientBuffer( EGLClientBuffer& aParam, TInt aIndex );
+    inline void GetEGLImageKHR( EGLImageKHR& aParam, TInt aIndex );
+    inline void GetEGLNativeDisplayType( NativeDisplayType& aParam, TInt aIndex );
+    inline void GetEGLNativeWindowType( NativeWindowType& aParam, TInt aIndex );
+    inline void GetEGLNativePixmapType( NativePixmapType& aParam, TInt aIndex );
+
+    //Gets a pointer to an array parameter from parameter array
+    inline void GetEGLintVectorData( EGLint* &aData, TInt& aSize, TInt aIndex );
+    inline void GetEGLConfigVectorData( EGLConfig* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( void* &aData, TInt& aSize, TInt aIndex );
+
+    //Sets a pointer to the data of an array parameter
+    inline void SetEGLintVectorData( const EGLint* aData, TInt aLength, TInt aIndex );
+    inline void SetEGLConfigVectorData( const EGLConfig* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const void* aData, TInt aLength, TInt aIndex );
+
+    //Appends an array parameter to the parameter array
+    // Does not serialize any data
+    inline void AppendEGLintVector( const EGLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLConfigVector( const EGLConfig* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    
+    
+     inline void AppendTUint32( const TUint32& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+     inline void GetTUint32( TUint32& aParam, TInt aIndex );
+    
+//    
+    //VG parameters
+    //Appends a simple parameter to the parameter array
+    // Does not serialize any data
+    inline void AppendVGParam( const VGfloat& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGbyte& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGubyte& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGshort& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGint& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGuint& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGboolean& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGErrorCode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGParamType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGRenderingQuality& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGPixelLayout& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGMatrixMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGMaskOperation& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGPathDatatype& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGPathAbsRel& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGPathSegment& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGPathCommand& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );   
+    inline void AppendVGParam( const VGPathCapabilities& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGPathParamType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGCapStyle& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGJoinStyle& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGFillRule& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGPaintMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGPaintParamType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGPaintType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGColorRampSpreadMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGTilingMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGImageFormat& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGImageQuality& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGImageParamType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGImageMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGImageChannel& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGBlendMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGHardwareQueryType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGHardwareQueryResult& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGStringID& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVGParam( const VGUArcType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+#ifdef __SYMBIAN32__
+    inline void AppendVGParam( const VGeglImageKHR& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+#endif
+        
+    //Gets a simple parameter value from parameter array
+    inline void GetVGParamValue( VGfloat& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGbyte& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGubyte& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGshort& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGint& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGuint& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGboolean& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGErrorCode& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGParamType& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGRenderingQuality& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGPixelLayout& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGMatrixMode& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGMaskOperation& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGPathDatatype& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGPathAbsRel& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGPathSegment& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGPathCommand& aParam, TInt aIndex );   
+    inline void GetVGParamValue( VGPathCapabilities& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGPathParamType& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGCapStyle& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGJoinStyle& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGFillRule& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGPaintMode& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGPaintParamType& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGPaintType& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGColorRampSpreadMode& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGTilingMode& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGImageFormat& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGImageQuality& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGImageParamType& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGImageMode& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGImageChannel& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGBlendMode& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGHardwareQueryType& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGHardwareQueryResult& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGStringID& aParam, TInt aIndex );
+    inline void GetVGParamValue( VGUArcType& aParam, TInt aIndex );
+    
+
+    };
+#include "driverrfc.inl"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/driverrfc.inl	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,546 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+inline void DriverRFC::GetEGLBoolean( EGLBoolean& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLBoolean, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLint( EGLint& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLint, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLenum( EGLenum& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLenum, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLDisplay( EGLDisplay& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLDisplay, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLConfig( EGLConfig& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLConfig, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLSurface( EGLSurface& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLSurface, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLContext( EGLContext& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLContext, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLClientBuffer( EGLClientBuffer& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLClientBuffer, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLImageKHR( EGLImageKHR& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLImageKHR, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLNativeDisplayType( NativeDisplayType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLNativeDisplayType, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLNativeWindowType( NativeWindowType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLNativeWindowType, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLNativePixmapType( NativePixmapType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EEGLNativePixmapType, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetEGLintVectorData( EGLint* &aData, TInt& aSize, TInt aIndex )
+    {
+    iData.GetVectorData( EEGLint, (void**)&aData, aSize, aIndex );
+    }
+
+inline void DriverRFC::GetEGLConfigVectorData( EGLConfig* &aData, TInt& aSize, TInt aIndex )
+    {
+    iData.GetVectorData( EEGLConfig, (void**)&aData, aSize, aIndex );
+    }
+
+inline void DriverRFC::SetEGLintVectorData( const EGLint* aData, TInt aLength, TInt aIndex )
+    {
+    RemoteFunctionCall::SetVectorData( EEGLint, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+    }
+
+inline void DriverRFC::SetEGLConfigVectorData( const EGLConfig* aData, TInt aLength, TInt aIndex )
+    {
+    RemoteFunctionCall::SetVectorData( EEGLConfig, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+    }
+    
+
+inline void DriverRFC::AppendEGLBoolean( const EGLBoolean& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLBoolean, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLint( const EGLint& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLint, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLenum( const EGLenum& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLenum, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLDisplay( const EGLDisplay& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLDisplay, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLConfig( const EGLConfig& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLConfig, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLSurface( const EGLSurface& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLSurface, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLContext( const EGLContext& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLContext, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLClientBuffer( const EGLClientBuffer& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLClientBuffer, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLImageKHR( const EGLImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLImageKHR, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLNativeDisplayType( const NativeDisplayType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLNativeDisplayType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLNativeWindowType( const NativeWindowType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLNativeWindowType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLNativePixmapType( const NativePixmapType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLNativePixmapType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendEGLintVector( const EGLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EEGLint, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+inline void DriverRFC::AppendEGLConfigVector( const EGLConfig* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EEGLConfig, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+#ifdef __SYMBIAN32__
+inline void DriverRFC::AppendEGLSize( const TSize& aSize, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLint, reinterpret_cast<const TUint8*>(&aSize.iWidth), aDir );
+    AppendParam( EEGLint, reinterpret_cast<const TUint8*>(&aSize.iHeight), aDir );
+    }
+#endif
+
+inline void DriverRFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EEGLVoid, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+inline void DriverRFC::GetVectorData( void* &aData, TInt& aSize, TInt aIndex )
+    {
+    iData.GetVectorData( EEGLVoid, &aData, aSize, aIndex );
+    }
+
+inline void DriverRFC::SetVectorData( const void* aData, TInt aLength, TInt aIndex )
+    {
+    RemoteFunctionCall::SetVectorData( EEGLVoid, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+    }
+
+
+inline void DriverRFC::AppendTUint32( const TUint32& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( ETUint32, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::GetTUint32( TUint32& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::ETUint32, (TUint8*)&aParam, aIndex );
+    }
+
+//
+//
+//
+inline void DriverRFC::GetVGParamValue( VGfloat& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGfloat, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGbyte& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGbyte, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGubyte& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGubyte, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGshort& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGshort, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGint& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGint, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGuint& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGuint, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGboolean& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGboolean, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGErrorCode& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGErrorCode, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGParamType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGParamType, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGRenderingQuality& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGRenderingQuality, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPixelLayout& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPixelLayout, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGMatrixMode& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGMatrixMode, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGMaskOperation& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGMaskOperation, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPathDatatype& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPathDatatype, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPathAbsRel& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPathAbsRel, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPathSegment& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPathSegment, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPathCommand& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPathCommand, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPathCapabilities& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPathCapabilities, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPathParamType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPathParamType, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGCapStyle& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGCapStyle, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGJoinStyle& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGJoinStyle, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGFillRule& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGFillRule, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPaintMode& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPaintMode, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPaintParamType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPaintParamType, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGPaintType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGPaintType, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGColorRampSpreadMode& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGColorRampSpreadMode, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGTilingMode& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGTilingMode, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGImageFormat& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGImageFormat, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGImageQuality& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGImageQuality, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGImageParamType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGImageParamType, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGImageMode& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGImageMode, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGImageChannel& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGImageChannel, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGBlendMode& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGBlendMode, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGHardwareQueryType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGHardwareQueryType, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGHardwareQueryResult& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGHardwareQueryResult, (TUint8*)&aParam, aIndex );
+    }
+inline void DriverRFC::GetVGParamValue( VGStringID& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGStringID, (TUint8*)&aParam, aIndex );
+    }
+
+inline void DriverRFC::GetVGParamValue( VGUArcType& aParam, TInt aIndex )
+    {
+    iData.GetParamValue( DriverRFC::EVGUArcType, (TUint8*)&aParam, aIndex );
+    }
+    
+inline void DriverRFC::AppendVGParam( const VGfloat& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGfloat, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGbyte& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGbyte, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGubyte& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGubyte, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGshort& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGshort, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGint& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGint, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGuint& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+
+inline void DriverRFC::AppendVGParam( const VGboolean& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGboolean, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGErrorCode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGErrorCode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGParamType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGRenderingQuality& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGRenderingQuality, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPixelLayout& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPixelLayout, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGMatrixMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGMatrixMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGMaskOperation& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGMaskOperation, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPathDatatype& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathDatatype, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPathAbsRel& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathAbsRel, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPathSegment& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPathCommand& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPathCapabilities& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathCapabilities, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPathParamType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGCapStyle& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGCapStyle, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGJoinStyle& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGJoinStyle, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGFillRule& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGFillRule, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPaintMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPaintMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPaintParamType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGPaintType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGColorRampSpreadMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGColorRampSpreadMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGTilingMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGTilingMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGImageFormat& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageFormat, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGImageQuality& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageQuality, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGImageParamType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGImageMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGImageChannel& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageChannel, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGBlendMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGBlendMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGHardwareQueryType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGHardwareQueryType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGHardwareQueryResult& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGHardwareQueryResult, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGStringID& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGStringID, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void DriverRFC::AppendVGParam( const VGUArcType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGUArcType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+#ifdef __SYMBIAN32__
+inline void DriverRFC::AppendVGParam( const VGeglImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGeglImageKHR, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+#endif
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/eglrfc.h	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,186 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef EGLREMOTEFUNCTIONCALL_H_
+#define EGLREMOTEFUNCTIONCALL_H_
+
+#include "remotefunctioncall.h"
+
+#ifdef __SYMBIAN32__
+	#include <e32const.h>
+	#include <e32def.h>
+	#include <EGL/egl.h>
+#else
+	#include "EGL/egl.h"
+#endif
+
+
+enum TSelectionCriteria
+    {
+    EExact,
+    EAtLeast,
+    EMask,
+    ESpecial //This essentially means, don't compare
+    };
+
+//For adding a sync value to the egl calls
+const TInt KSyncReadSurface = 2;
+const TInt KSyncDrawSurface = 4;
+
+//This is the maximum number of configs that can be processed
+//when the client asks for sg-compatible or sg-incompatible configs
+const TInt KConfigsMaxCnt = 200;
+
+enum TMetaGetConfigsMode
+    {
+    EMetaGetConfigsAll,   //get all the configs available
+    EMetaGetConfigsSg,    //get configs supporting sg images
+    EMetaGetConfigsNonSg, //get configs not supporting sg images
+    };
+
+NONSHARABLE_CLASS(EglRFC): public RemoteFunctionCall
+    {
+public:
+    // EGL operation code
+    enum TOperationCode
+        {
+        // EGL 1.4
+        EeglGetError, // 0
+        EeglGetDisplay,
+        EeglInitialize,
+        EeglTerminate,
+        EeglQueryString, // not used
+        EeglGetConfigs,
+        EeglChooseConfig,
+        EeglGetConfigAttrib,
+        EeglCreateWindowSurface,
+        EeglCreatePbufferSurface,
+        EeglCreatePixmapSurface, // 10
+        EeglDestroySurface,
+        EeglQuerySurface,
+        EeglBindAPI,
+        EeglQueryAPI,
+        EeglWaitClient,
+        EeglReleaseThread,
+        EeglCreatePbufferFromClientBuffer,
+        EeglSurfaceAttrib,
+        EeglBindTexImage,
+        EeglReleaseTexImage, // 20
+        EeglSwapInterval,
+        EeglCreateContext,
+        EeglDestroyContext,
+        EeglMakeCurrent,
+        EeglGetCurrentContext,
+        EeglGetCurrentSurface,
+        EeglGetCurrentDisplay,
+        EeglQueryContext,
+        EeglWaitGL,
+        EeglWaitNative, // 30
+        EeglSwapBuffers,
+        EeglCopyBuffers,
+        EeglPlatsimSetSurfaceParams,
+        EeglPlatsimCopyImageData,
+        EeglPixmapSurfaceSizeChanged,
+        EeglMakeCurrentSg, //sgImage support
+        EeglCreatePixmapSurfaceSg,
+        EeglMetaGetConfigs,
+        EeglMetaSgGetHandles
+        };
+
+	//Parameter data type
+    enum TParamType
+        {        
+        EEGLBoolean,
+        EEGLint,
+        EEGLenum,
+        EEGLDisplay,
+        EEGLConfig,
+        EEGLSurface,
+        EEGLContext,
+        EEGLClientBuffer,
+        EEGLImageKHR,
+        EEGLNativeDisplayType,
+        EEGLNativeWindowType,
+        EEGLNativePixmapType,
+        EEGLVoid,
+        ETUint64
+        };
+
+    EglRFC( RemoteFunctionCallData& aData );
+    
+    inline void AppendTUint64( const TUint64& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+	inline void AppendEGLBoolean( const EGLBoolean& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLint( const EGLint& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLenum( const EGLenum& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLDisplay( const EGLDisplay& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLConfig( const EGLConfig& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLSurface( const EGLSurface& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLContext( const EGLContext& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLClientBuffer( const EGLClientBuffer& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLImageKHR( const EGLImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLNativeDisplayType( const NativeDisplayType& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLNativeWindowType( const NativeWindowType& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLNativePixmapType( const NativePixmapType& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+#ifdef __SYMBIAN32__
+    inline void AppendEGLSize( const TSize& aSize, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+#endif
+
+    //Gets a simple parameter value from parameter array
+    inline void GetTUint64( TUint64& aParam, TInt aIndex );
+    inline void GetEGLBoolean( EGLBoolean& aParam, TInt aIndex );
+    inline void GetEGLint( EGLint& aParam, TInt aIndex );
+    inline void GetEGLenum( EGLenum& aParam, TInt aIndex );
+    inline void GetEGLDisplay( EGLDisplay& aParam, TInt aIndex );
+    inline void GetEGLConfig( EGLConfig& aParam, TInt aIndex );
+    inline void GetEGLSurface( EGLSurface& aParam, TInt aIndex );
+    inline void GetEGLContext( EGLContext& aParam, TInt aIndex );
+    inline void GetEGLClientBuffer( EGLClientBuffer& aParam, TInt aIndex );
+    inline void GetEGLImageKHR( EGLImageKHR& aParam, TInt aIndex );
+    inline void GetEGLNativeDisplayType( NativeDisplayType& aParam, TInt aIndex );
+    inline void GetEGLNativeWindowType( NativeWindowType& aParam, TInt aIndex );
+    inline void GetEGLNativePixmapType( NativePixmapType& aParam, TInt aIndex );
+
+    //Gets a pointer to an array parameter from parameter array
+    inline void GetEGLintVectorData( EGLint* &aData, TInt& aSize, TInt aIndex );
+    inline void GetEGLConfigVectorData( EGLConfig* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( void* &aData, TInt& aSize, TInt aIndex );
+
+    //Sets a pointer to the data of an array parameter
+    inline void SetEGLintVectorData( const EGLint* aData, TInt aLength, TInt aIndex );
+    inline void SetEGLConfigVectorData( const EGLConfig* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const void* aData, TInt aLength, TInt aIndex );
+
+    //Appends an array parameter to the parameter array
+    // Does not serialize any data
+    inline void AppendEGLintVector( const EGLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendEGLConfigVector( const EGLConfig* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+
+	//Size of type aType
+	virtual TInt GetTypeSize( TInt32 aParamType ) const;
+
+    //Alignemnt of type aType
+	virtual TInt GetTypeAlignment( TInt32 aParamType ) const;
+
+    //Alignemnt of type aType
+	virtual TUint32 GetAPIUid() const;
+
+	static EGLint MetaGetConfigAttribute( int aIndex );
+	static EGLint MetaGetConfigAttributeSelCriteria( int aIndex );
+	static TInt MetaGetConfigAttributeCnt();
+    };
+
+#include "eglrfc.inl"
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/eglrfc.inl	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,205 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+inline void EglRFC::GetTUint64( TUint64& aParam, TInt aIndex )
+    {
+    // note that 64-bit values consume 2 param slots!
+    TUint32 lower, upper;
+    iData.GetParamValue( EglRFC::EEGLint, (TUint8*)&lower, aIndex );
+    iData.GetParamValue( EglRFC::EEGLint, (TUint8*)&upper, aIndex+1 );
+    aParam = (upper << 32) + lower;
+    }
+inline void EglRFC::GetEGLBoolean( EGLBoolean& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLBoolean, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLint( EGLint& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLint, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLenum( EGLenum& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLenum, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLDisplay( EGLDisplay& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLDisplay, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLConfig( EGLConfig& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLConfig, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLSurface( EGLSurface& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLSurface, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLContext( EGLContext& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLContext, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLClientBuffer( EGLClientBuffer& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLClientBuffer, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLImageKHR( EGLImageKHR& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLImageKHR, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLNativeDisplayType( NativeDisplayType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLNativeDisplayType, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLNativeWindowType( NativeWindowType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLNativeWindowType, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLNativePixmapType( NativePixmapType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( EglRFC::EEGLNativePixmapType, (TUint8*)&aParam, aIndex );
+	}
+
+inline void EglRFC::GetEGLintVectorData( EGLint* &aData, TInt& aSize, TInt aIndex )
+	{
+	iData.GetVectorData( EEGLint, (void**)&aData, aSize, aIndex );
+	}
+
+inline void EglRFC::GetEGLConfigVectorData( EGLConfig* &aData, TInt& aSize, TInt aIndex )
+	{
+	iData.GetVectorData( EEGLConfig, (void**)&aData, aSize, aIndex );
+	}
+
+inline void EglRFC::SetEGLintVectorData( const EGLint* aData, TInt aLength, TInt aIndex )
+	{
+	RemoteFunctionCall::SetVectorData( EEGLint, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+	}
+
+inline void EglRFC::SetEGLConfigVectorData( const EGLConfig* aData, TInt aLength, TInt aIndex )
+	{
+	RemoteFunctionCall::SetVectorData( EEGLConfig, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+	}
+    
+
+inline void EglRFC::AppendTUint64( const TUint64& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    // note that 64-bit values consume 2 param slots!
+    TUint32 lower = (TUint32)(aParam & 0xFFFFFFFF);
+    TUint32 upper = (TUint32)((aParam >> 32) & 0xFFFFFFFF);
+    AppendParam( EEGLint, reinterpret_cast<const TUint8*>(&lower), aDir );
+    AppendParam( EEGLint, reinterpret_cast<const TUint8*>(&upper), aDir );
+    }
+
+inline void EglRFC::AppendEGLBoolean( const EGLBoolean& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLBoolean, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLint( const EGLint& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLint, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLenum( const EGLenum& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLenum, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLDisplay( const EGLDisplay& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLDisplay, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLConfig( const EGLConfig& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLConfig, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLSurface( const EGLSurface& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLSurface, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLContext( const EGLContext& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLContext, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLClientBuffer( const EGLClientBuffer& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLClientBuffer, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLImageKHR( const EGLImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLImageKHR, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLNativeDisplayType( const NativeDisplayType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLNativeDisplayType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLNativeWindowType( const NativeWindowType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLNativeWindowType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLNativePixmapType( const NativePixmapType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLNativePixmapType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void EglRFC::AppendEGLintVector( const EGLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EEGLint, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+inline void EglRFC::AppendEGLConfigVector( const EGLConfig* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EEGLConfig, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+#ifdef __SYMBIAN32__
+// Appends Symbian TSize object as 2 integers, for width and height
+inline void EglRFC::AppendEGLSize( const TSize& aSize, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    AppendParam( EEGLint, reinterpret_cast<const TUint8*>(&aSize.iWidth), aDir );
+    AppendParam( EEGLint, reinterpret_cast<const TUint8*>(&aSize.iHeight), aDir );
+    }
+#endif
+
+inline void EglRFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EEGLVoid, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+inline void EglRFC::GetVectorData( void* &aData, TInt& aSize, TInt aIndex )
+	{
+	iData.GetVectorData( EEGLVoid, &aData, aSize, aIndex );
+	}
+
+inline void EglRFC::SetVectorData( const void* aData, TInt aLength, TInt aIndex )
+	{
+	RemoteFunctionCall::SetVectorData( EEGLVoid, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/opengles11rfc.h	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,280 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef OPENGLES11REMOTEFUNCTIONCALL_H_
+#define OPENGLES11REMOTEFUNCTIONCALL_H_
+
+#include "remotefunctioncall.h"
+
+#ifdef __SYMBIAN32__
+	#include <GLES/gl.h>
+#else
+	#include "GLES/gl.h"
+	#include "GLES/glextplatform.h"
+#endif
+
+//OpenGlES11 remote function call
+// Represents a function call and contains information about 
+// parameters but does not serialize the data
+NONSHARABLE_CLASS(OpenGlES11RFC): public RemoteFunctionCall
+    {
+public:
+
+    //OpenEglES11 operation code
+    enum TOperationCode
+    {
+        EglActiveTexture,
+        EglAlphaFunc,
+        EglAlphaFuncx,
+        EglBindBuffer,
+        EglBindTexture,
+        EglBlendFunc,
+        EglBufferData,
+        EglBufferSubData,
+        EglClear,
+        EglClearColor,
+        EglClearColorx, // 10
+        EglClearDepthf,
+        EglClearDepthx,
+        EglClearStencil,
+        EglClientActiveTexture,
+        EglClipPlanef,
+        EglClipPlanex,
+        EglColor4f,
+        EglColor4ub,
+        EglColor4x,
+        EglColorMask, // 20
+        EglColorPointer,
+        EglCompressedTexImage2D,
+        EglCompressedTexSubImage2D,
+        EglCopyTexImage2D,
+        EglCopyTexSubImage2D,
+        EglCullFace,
+        EglDeleteBuffers,
+        EglDeleteTextures,
+        EglDepthFunc,
+        EglDepthMask, // 30
+        EglDepthRangef,
+        EglDepthRangex,
+        EglDisable,
+        EglDisableClientState,
+        EglDrawArrays,
+        EglDrawElements,
+        EglEnable,
+        EglEnableClientState,
+        EglFinish,
+        EglFlush, // 40
+        EglFogf,
+        EglFogfv,
+        EglFogx,
+        EglFogxv,
+        EglFrontFace,
+        EglFrustumf,
+        EglFrustumx,
+        EglGenBuffers,
+        EglGenTextures,
+        EglGetBooleanv, // 50
+        EglGetBufferParameteriv,
+        EglGetClipPlanef,
+        EglGetClipPlanex,
+        EglGetError,
+        EglGetFixedv,
+        EglGetFloatv,
+        EglGetIntegerv,
+        EglGetLightfv,
+        EglGetLightxv,
+        EglGetMaterialfv, // 60
+        EglGetMaterialxv,
+        EglGetPointerv,
+        EglGetString,
+        EglGetTexEnvfv,
+        EglGetTexEnviv,
+        EglGetTexEnvxv,
+        EglGetTexParameterfv,
+        EglGetTexParameteriv,
+        EglGetTexParameterxv,
+        EglHint, // 70
+        EglIsBuffer,
+        EglIsEnabled,
+        EglIsTexture,
+        EglLightModelf,
+        EglLightModelfv,
+        EglLightModelx,
+        EglLightModelxv,
+        EglLightf,
+        EglLightfv,
+        EglLightx, // 80
+        EglLightxv,
+        EglLineWidth,
+        EglLineWidthx,
+        EglLoadIdentity,
+        EglLoadMatrixf,
+        EglLoadMatrixx,
+        EglLogicOp,
+        EglMaterialf,
+        EglMaterialfv,
+        EglMaterialx, // 90
+        EglMaterialxv,
+        EglMatrixMode,
+        EglMultMatrixf,
+        EglMultMatrixx,
+        EglMultiTexCoord4f,
+        EglMultiTexCoord4x,
+        EglNormal3f,
+        EglNormal3x,
+        EglNormalPointer,
+        EglOrthof, // 100
+        EglOrthox,
+        EglPixelStorei,
+        EglPointParameterf,
+        EglPointParameterfv,
+        EglPointParameterx,
+        EglPointParameterxv,
+        EglPointSize,
+        EglPointSizex,
+        EglPolygonOffset,
+        EglPolygonOffsetx, // 110
+        EglPopMatrix,
+        EglPushMatrix,
+        EglReadPixels,
+        EglRotatef,
+        EglRotatex,
+        EglSampleCoverage,
+        EglSampleCoveragex,
+        EglScalef,
+        EglScalex,
+        EglScissor, // 120
+        EglShadeModel,
+        EglStencilFunc,
+        EglStencilMask,
+        EglStencilOp,
+        EglTexCoordPointer,
+        EglTexEnvf,
+        EglTexEnvfv,
+        EglTexEnvi,
+        EglTexEnviv,
+        EglTexEnvx, // 130
+        EglTexEnvxv,
+        EglTexImage2D,
+        EglTexParameterf,
+        EglTexParameterfv,
+        EglTexParameteri,
+        EglTexParameteriv,
+        EglTexParameterx,
+        EglTexParameterxv,
+        EglTexSubImage2D,
+        EglTranslatef, // 140
+        EglTranslatex,
+        EglVertexPointer,
+        EglViewport,
+        // from Eglextplatform.h
+        EglCurrentPaletteMatrixOES,
+        EglDrawTexfOES,
+        EglDrawTexfvOES,
+        EglDrawTexiOES,
+        EglDrawTexivOES,
+        EglDrawTexsOES,
+        EglDrawTexsvOES, // 150
+        EglDrawTexxOES,
+        EglDrawTexxvOES,
+        EglLoadPaletteFromModelViewMatrixOES,
+        EglMatrixIndexPointerOES,
+        EglQueryMatrixxOES,
+        EglWeightPointerOES,
+        // client shutdown
+        EClientShutdown
+
+    };
+
+    //Parameter data type
+    enum TParamType
+    {
+        EGLbyte,
+        EGLubyte,
+        EGLshort,
+        EGLushort,
+        EGLint,
+        EGLuint,
+        EGLfloat,
+        EGLvoid,
+        // the following parameters are typedeffed to same types as the previous ones
+        EGLboolean,
+        EGLbitfield,
+        EGLclampf,
+        EGLclampx,
+        EGLenum,
+        EGLfixed,
+        EGLintptr,
+        EGLsizei,
+        EGLsizeiptr
+    };
+
+    OpenGlES11RFC( RemoteFunctionCallData& aData );
+    
+    //Appends a simple parameter to the parameter array
+    // Does not serialize any data
+    inline void AppendParam( const GLbyte& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const GLubyte& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const GLshort& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const GLushort& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const GLint& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const GLuint& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const GLfloat& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+        
+    //Gets a simple parameter value from parameter array
+    inline void GetParamValue( GLbyte& aParam, TInt aIndex );
+    inline void GetParamValue( GLubyte& aParam, TInt aIndex );
+    inline void GetParamValue( GLshort& aParam, TInt aIndex );
+    inline void GetParamValue( GLushort& aParam, TInt aIndex );
+    inline void GetParamValue( GLint& aParam, TInt aIndex );
+    inline void GetParamValue( GLuint& aParam, TInt aIndex );
+    inline void GetParamValue( GLfloat& aParam, TInt aIndex );
+    
+    //Gets a pointer to an array parameter from parameter array
+    inline void GetVectorData( GLint* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( GLuint* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( GLshort* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( GLfloat* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( GLboolean* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( void* &aData, TInt& aSize, TInt aIndex );
+
+    //Sets a pointer to the data of an array parameter
+    inline void SetVectorData( const GLint* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const GLuint* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const GLshort* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const GLfloat* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const GLboolean* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const void* aData, TInt aLength, TInt aIndex );
+
+    //Appends an array parameter to the parameter array
+    // Does not serialize any data
+    inline void AppendVector( const GLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const GLuint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const GLshort* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const GLfloat* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const GLboolean* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    
+    //Size of type aType
+    TInt GetTypeSize( TInt32 aParamType ) const;
+
+    //Alignemnt of type aType
+	TInt GetTypeAlignment( TInt32 aParamType ) const;
+
+    //Alignemnt of type aType
+	TUint32 GetAPIUid() const;
+    };
+
+#include "opengles11rfc.inl"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/opengles11rfc.inl	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,150 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+inline void OpenGlES11RFC::GetParamValue( GLbyte& aParam, TInt aIndex )
+{
+    iData.GetParamValue( OpenGlES11RFC::EGLbyte, (TUint8*)&aParam, aIndex );
+}
+inline void OpenGlES11RFC::GetParamValue( GLubyte& aParam, TInt aIndex )
+{
+    iData.GetParamValue( OpenGlES11RFC::EGLubyte, (TUint8*)&aParam, aIndex );
+}
+inline void OpenGlES11RFC::GetParamValue( GLshort& aParam, TInt aIndex )
+{
+    iData.GetParamValue( OpenGlES11RFC::EGLshort, (TUint8*)&aParam, aIndex );
+}
+inline void OpenGlES11RFC::GetParamValue( GLushort& aParam, TInt aIndex )
+{
+    iData.GetParamValue( OpenGlES11RFC::EGLushort, (TUint8*)&aParam, aIndex );
+}
+inline void OpenGlES11RFC::GetParamValue( GLint& aParam, TInt aIndex )
+{
+    iData.GetParamValue( OpenGlES11RFC::EGLint, (TUint8*)&aParam, aIndex );
+}
+inline void OpenGlES11RFC::GetParamValue( GLuint& aParam, TInt aIndex )
+{
+    iData.GetParamValue( OpenGlES11RFC::EGLuint, (TUint8*)&aParam, aIndex );
+}
+inline void OpenGlES11RFC::GetParamValue( GLfloat& aParam, TInt aIndex )
+{
+    iData.GetParamValue( OpenGlES11RFC::EGLfloat, (TUint8*)&aParam, aIndex );
+}
+
+
+inline void OpenGlES11RFC::GetVectorData( GLint* &aData, TInt& aSize, TInt aIndex )
+{
+    iData.GetVectorData( EGLint, (void**)&aData, aSize, aIndex );
+}
+inline void OpenGlES11RFC::GetVectorData( GLuint* &aData, TInt& aSize, TInt aIndex )
+{
+    iData.GetVectorData( EGLuint, (void**)&aData, aSize, aIndex );
+}
+inline void OpenGlES11RFC::GetVectorData( GLshort* &aData, TInt& aSize, TInt aIndex )
+{
+    iData.GetVectorData( EGLshort, (void**)&aData, aSize, aIndex );
+}
+inline void OpenGlES11RFC::GetVectorData( GLfloat* &aData, TInt& aSize, TInt aIndex )
+{
+    iData.GetVectorData( EGLfloat, (void**)&aData, aSize, aIndex );
+}
+inline void OpenGlES11RFC::GetVectorData( GLboolean* &aData, TInt& aSize, TInt aIndex )
+{
+    iData.GetVectorData( EGLboolean, (void**)&aData, aSize, aIndex );
+}
+inline void OpenGlES11RFC::GetVectorData( void* &aData, TInt& aSize, TInt aIndex )
+{
+    iData.GetVectorData( EGLvoid, &aData, aSize, aIndex );
+}
+
+
+inline void OpenGlES11RFC::SetVectorData( const GLint* aData, TInt aLength, TInt aIndex )
+{
+    RemoteFunctionCall::SetVectorData( EGLint, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+}
+inline void OpenGlES11RFC::SetVectorData( const GLuint* aData, TInt aLength, TInt aIndex )
+{
+    RemoteFunctionCall::SetVectorData( EGLuint, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+}
+inline void OpenGlES11RFC::SetVectorData( const GLshort* aData, TInt aLength, TInt aIndex )
+{
+    RemoteFunctionCall::SetVectorData( EGLshort, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+}
+inline void OpenGlES11RFC::SetVectorData( const GLfloat* aData, TInt aLength, TInt aIndex )
+{
+    RemoteFunctionCall::SetVectorData( EGLfloat, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+}
+inline void OpenGlES11RFC::SetVectorData( const GLboolean* aData, TInt aLength, TInt aIndex )
+{
+    RemoteFunctionCall::SetVectorData( EGLboolean, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+}
+inline void OpenGlES11RFC::SetVectorData( const void* aData, TInt aLength, TInt aIndex )
+{
+    RemoteFunctionCall::SetVectorData( EGLvoid, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+}
+
+
+inline void OpenGlES11RFC::AppendParam( const GLbyte& aParam, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendParam( EGLbyte, reinterpret_cast<const TUint8*>(&aParam), aDir );
+}
+inline void OpenGlES11RFC::AppendParam( const GLubyte& aParam, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendParam( EGLubyte, reinterpret_cast<const TUint8*>(&aParam), aDir );
+}
+inline void OpenGlES11RFC::AppendParam( const GLshort& aParam, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendParam( EGLshort, reinterpret_cast<const TUint8*>(&aParam), aDir );
+}
+inline void OpenGlES11RFC::AppendParam( const GLushort& aParam, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendParam( EGLushort, reinterpret_cast<const TUint8*>(&aParam), aDir );
+}
+inline void OpenGlES11RFC::AppendParam( const GLint& aParam, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendParam( EGLint, reinterpret_cast<const TUint8*>(&aParam), aDir );
+}
+inline void OpenGlES11RFC::AppendParam( const GLuint& aParam, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendParam( EGLuint, reinterpret_cast<const TUint8*>(&aParam), aDir );
+}
+inline void OpenGlES11RFC::AppendParam( const GLfloat& aParam, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendParam( EGLfloat, reinterpret_cast<const TUint8*>(&aParam), aDir );
+}
+
+
+inline void OpenGlES11RFC::AppendVector( const GLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendVector( EGLint, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+}
+inline void OpenGlES11RFC::AppendVector( const GLuint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendVector( EGLuint, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+}
+inline void OpenGlES11RFC::AppendVector( const GLshort* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendVector( EGLshort, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+}
+inline void OpenGlES11RFC::AppendVector( const GLfloat* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendVector( EGLfloat, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+}
+inline void OpenGlES11RFC::AppendVector( const GLboolean* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendVector( EGLboolean, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+}
+inline void OpenGlES11RFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+{
+    RemoteFunctionCall::AppendVector( EGLvoid, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/openvgrfc.h	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,315 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef OPENVGREMOTEFUNCTIONCALL_H_
+#define OPENVGREMOTEFUNCTIONCALL_H_
+
+#include "remotefunctioncall.h"
+
+#ifdef __SYMBIAN32__
+	#define __VG_OPENVG_H_
+	#include <VG/1.1/openvg.h>
+	#include <VG/vgu.h>
+#else
+    #define __OPENVGHEADERS_USE_VG_1_1
+    #include <VG/openvg.h>
+    #include "VG/vgu.h"
+#endif
+
+//OpenVG remote function call
+// Represents a function call and contains information about 
+// parameters but does not serialize the data
+NONSHARABLE_CLASS(OpenVgRFC): public RemoteFunctionCall
+    {
+public:
+
+    //Openvg pperation code
+    enum TOperationCode
+        {
+        EvgGetError,
+        EvgGetPaint,
+        EvgCreatePaint,
+        EvgInterpolatePath,
+        EvgPathLength,
+        EvgGetPathCapabilities,
+        EvgCreatePath,
+        EvgGetf,
+        EvgGeti,
+        EvgGetVectorSize,
+        EvgGetParameterf, //10
+        EvgGetParameteri,
+        EvgGetParameterVectorSize,
+        EvgCreateMaskLayer,
+        EvgGetColor,
+        EvgCreateImage,
+        EvgChildImage,
+        EvgGetParent, // now handled in Client DLL
+        EvgCreateFont,
+        EvgHardwareQuery,
+        EvgGetParameterfv, //20
+        EvgGetParameteriv,
+        EvgGetString,
+        EvgGetfv,
+        EvgGetiv,
+        EvgGetMatrix,
+        EvgGetImageSubData,
+        EvgReadPixels,
+        EvgFlush,
+        EvgFinish,
+        EvgSetf, //30
+        EvgSeti,
+        EvgSetfv,
+        EvgSetiv,
+        EvgSetParameterf,
+        EvgSetParameteri,
+        EvgSetParameterfv,
+        EvgSetParameteriv,
+        EvgLoadIdentity,
+        EvgLoadMatrix,
+        EvgMultMatrix, //40
+        EvgTranslate,
+        EvgScale,
+        EvgShear,
+        EvgRotate,
+        EvgMask,
+        EvgRenderToMask,
+        EvgDestroyMaskLayer,
+        EvgFillMaskLayer,
+        EvgCopyMask,
+        EvgClear, //50
+        EvgClearPath,
+        EvgDestroyPath,
+        EvgRemovePathCapabilities,
+        EvgAppendPath,
+        EvgAppendPathData, //55
+        EvgModifyPathCoords,
+        EvgTransformPath,
+        EvgPointAlongPath,
+        EvgPathBounds,
+        EvgPathTransformedBounds, //60
+        EvgDrawPath,
+        EvgDestroyPaint,
+        EvgSetPaint,
+        EvgSetColor,
+        EvgPaintPattern,
+        EvgDestroyImage,
+        EvgClearImage,
+        EvgImageSubData,
+        EvgCopyImage,
+        EvgDrawImage,
+        EvgSetPixels,
+        EvgWritePixels,
+        EvgGetPixels,
+        EvgCopyPixels,
+        EvgDestroyFont,
+        EvgSetGlyphToPath,
+        EvgSetGlyphToImage,
+        EvgClearGlyph,
+        EvgDrawGlyph,
+        EvgDrawGlyphs, //80
+        EvgColorMatrix,
+        EvgConvolve,
+        EvgSeparableConvolve,
+        EvgGaussianBlur,
+        EvgLookup,
+        EvgLookupSingle,
+		EvgePathCoordsSizeInBytes, //Not part of OpenVG 1.1
+        //Openvgu 1.1
+        EvguLine,
+        EvguPolygon,
+        EvguRect,
+        EvguRoundRect,
+        EvguEllipse,
+        EvguArc,
+        EvguComputeWarpQuadToSquare,
+        EvguComputeWarpSquareToQuad,
+        EvguComputeWarpQuadToQuad,
+		EClientShutdown,
+		// /* OpenVG extension #4, KHR_EGL_image */
+		EvgCreateEGLImageTargetKHR,
+        };
+
+    //Parameter data type
+    enum TParamType
+        {
+        EVGfloat,
+        EVGbyte,
+        EVGubyte,
+        EVGshort,
+        EVGint,
+        EVGuint,
+        EVGbitfield,
+        EVGboolean,
+        EVGHandle,
+        EVGErrorCode,
+        EVGParamType, //10
+        EVGRenderingQuality,
+        EVGPixelLayout,
+        EVGMatrixMode,
+        EVGMaskOperation,
+        EVGPathDatatype,
+        EVGPathAbsRel,
+        EVGPathSegment,
+        EVGPathCommand,
+        EVGPath,
+        EVGPathCapabilities, //20
+        EVGPathParamType,
+        EVGCapStyle,
+        EVGJoinStyle,
+        EVGFillRule,
+        EVGPaintMode,
+        EVGPaint,
+        EVGPaintParamType,
+        EVGPaintType,
+        EVGColorRampSpreadMode,
+        EVGTilingMode, //30
+        EVGImageFormat,
+        EVGImage,
+        EVGImageQuality,
+        EVGImageParamType,
+        EVGImageMode,
+        EVGImageChannel,
+        EVGBlendMode,
+        EVGHardwareQueryType,
+        EVGHardwareQueryResult,
+        EVGStringID, //40
+        EVGvoid,
+        EVGUArcType,
+        EVGeglImageKHR,
+        ETUint64
+        };
+
+    OpenVgRFC( RemoteFunctionCallData& aData );
+    
+    //Appends a simple parameter to the parameter array
+    // Does not serialize any data
+    inline void AppendTUint64( const TUint64& aParam, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGfloat& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGbyte& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGubyte& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGshort& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGint& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGuint& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGboolean& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGErrorCode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGParamType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGRenderingQuality& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGPixelLayout& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGMatrixMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGMaskOperation& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGPathDatatype& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGPathAbsRel& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGPathSegment& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGPathCommand& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );   
+    inline void AppendParam( const VGPathCapabilities& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGPathParamType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGCapStyle& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGJoinStyle& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGFillRule& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGPaintMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGPaintParamType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGPaintType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGColorRampSpreadMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGTilingMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGImageFormat& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGImageQuality& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGImageParamType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGImageMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGImageChannel& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGBlendMode& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGHardwareQueryType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGHardwareQueryResult& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGStringID& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendParam( const VGUArcType& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+#ifdef __SYMBIAN32__
+    inline void AppendParam( const VGeglImageKHR& aParam, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+#endif
+        
+    //Gets a simple parameter value from parameter array
+    inline void GetTUint64( TUint64& aParam, TInt aIndex );
+    inline void GetParamValue( VGfloat& aParam, TInt aIndex );
+    inline void GetParamValue( VGbyte& aParam, TInt aIndex );
+    inline void GetParamValue( VGubyte& aParam, TInt aIndex );
+    inline void GetParamValue( VGshort& aParam, TInt aIndex );
+    inline void GetParamValue( VGint& aParam, TInt aIndex );
+    inline void GetParamValue( VGuint& aParam, TInt aIndex );
+    inline void GetParamValue( VGboolean& aParam, TInt aIndex );
+    inline void GetParamValue( VGErrorCode& aParam, TInt aIndex );
+    inline void GetParamValue( VGParamType& aParam, TInt aIndex );
+    inline void GetParamValue( VGRenderingQuality& aParam, TInt aIndex );
+    inline void GetParamValue( VGPixelLayout& aParam, TInt aIndex );
+    inline void GetParamValue( VGMatrixMode& aParam, TInt aIndex );
+    inline void GetParamValue( VGMaskOperation& aParam, TInt aIndex );
+    inline void GetParamValue( VGPathDatatype& aParam, TInt aIndex );
+    inline void GetParamValue( VGPathAbsRel& aParam, TInt aIndex );
+    inline void GetParamValue( VGPathSegment& aParam, TInt aIndex );
+    inline void GetParamValue( VGPathCommand& aParam, TInt aIndex );   
+    inline void GetParamValue( VGPathCapabilities& aParam, TInt aIndex );
+    inline void GetParamValue( VGPathParamType& aParam, TInt aIndex );
+    inline void GetParamValue( VGCapStyle& aParam, TInt aIndex );
+    inline void GetParamValue( VGJoinStyle& aParam, TInt aIndex );
+    inline void GetParamValue( VGFillRule& aParam, TInt aIndex );
+    inline void GetParamValue( VGPaintMode& aParam, TInt aIndex );
+    inline void GetParamValue( VGPaintParamType& aParam, TInt aIndex );
+    inline void GetParamValue( VGPaintType& aParam, TInt aIndex );
+    inline void GetParamValue( VGColorRampSpreadMode& aParam, TInt aIndex );
+    inline void GetParamValue( VGTilingMode& aParam, TInt aIndex );
+    inline void GetParamValue( VGImageFormat& aParam, TInt aIndex );
+    inline void GetParamValue( VGImageQuality& aParam, TInt aIndex );
+    inline void GetParamValue( VGImageParamType& aParam, TInt aIndex );
+    inline void GetParamValue( VGImageMode& aParam, TInt aIndex );
+    inline void GetParamValue( VGImageChannel& aParam, TInt aIndex );
+    inline void GetParamValue( VGBlendMode& aParam, TInt aIndex );
+    inline void GetParamValue( VGHardwareQueryType& aParam, TInt aIndex );
+    inline void GetParamValue( VGHardwareQueryResult& aParam, TInt aIndex );
+    inline void GetParamValue( VGStringID& aParam, TInt aIndex );
+    inline void GetParamValue( VGUArcType& aParam, TInt aIndex );
+
+    //Gets a pointer to an array parameter from parameter array
+    inline void GetVectorData( VGfloat* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( VGint* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( VGuint* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( VGshort* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( VGubyte* &aData, TInt& aSize, TInt aIndex );
+    inline void GetVectorData( void* &aData, TInt& aSize, TInt aIndex );
+
+    //Sets a pointer to the data of an array parameter
+    inline void SetVectorData( const VGfloat* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const VGint* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const VGuint* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const VGshort* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const VGubyte* aData, TInt aLength, TInt aIndex );
+    inline void SetVectorData( const void* aData, TInt aLength, TInt aIndex );
+
+    //Appends an array parameter to the parameter array
+    // Does not serialize any data
+    inline void AppendVector( const VGfloat* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const VGint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const VGuint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const VGshort* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const VGubyte* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    inline void AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection iDir = RemoteFunctionCallData::EIn );
+    
+    //Size of type aType
+    TInt GetTypeSize( TInt32 aParamType ) const;
+
+    //Alignemnt of type aType
+	TInt GetTypeAlignment( TInt32 aParamType ) const;
+
+    //Alignemnt of type aType
+	TUint32 GetAPIUid() const;
+    };
+
+#include "openvgrfc.inl"
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/openvgrfc.inl	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,462 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+inline void OpenVgRFC::GetTUint64( TUint64& aParam, TInt aIndex )
+    {
+    // note that 64-bit values consume 2 param slots!
+    TUint32 lower, upper;
+    iData.GetParamValue( OpenVgRFC::EVGuint, (TUint8*)&lower, aIndex );
+    iData.GetParamValue( OpenVgRFC::EVGuint, (TUint8*)&upper, aIndex+1 );
+    aParam = (upper << 32) + lower;
+    }
+inline void OpenVgRFC::GetParamValue( VGfloat& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGfloat, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGbyte& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGbyte, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGubyte& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGubyte, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGshort& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGshort, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGint& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGint, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGuint& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGuint, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGboolean& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGboolean, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGErrorCode& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGErrorCode, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGParamType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGParamType, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGRenderingQuality& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGRenderingQuality, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPixelLayout& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPixelLayout, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGMatrixMode& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGMatrixMode, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGMaskOperation& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGMaskOperation, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPathDatatype& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPathDatatype, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPathAbsRel& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPathAbsRel, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPathSegment& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPathSegment, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPathCommand& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPathCommand, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPathCapabilities& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPathCapabilities, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPathParamType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPathParamType, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGCapStyle& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGCapStyle, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGJoinStyle& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGJoinStyle, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGFillRule& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGFillRule, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPaintMode& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPaintMode, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPaintParamType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPaintParamType, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGPaintType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGPaintType, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGColorRampSpreadMode& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGColorRampSpreadMode, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGTilingMode& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGTilingMode, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGImageFormat& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGImageFormat, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGImageQuality& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGImageQuality, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGImageParamType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGImageParamType, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGImageMode& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGImageMode, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGImageChannel& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGImageChannel, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGBlendMode& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGBlendMode, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGHardwareQueryType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGHardwareQueryType, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGHardwareQueryResult& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGHardwareQueryResult, (TUint8*)&aParam, aIndex );
+	}
+inline void OpenVgRFC::GetParamValue( VGStringID& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGStringID, (TUint8*)&aParam, aIndex );
+	}
+
+inline void OpenVgRFC::GetParamValue( VGUArcType& aParam, TInt aIndex )
+	{
+	iData.GetParamValue( OpenVgRFC::EVGUArcType, (TUint8*)&aParam, aIndex );
+	}
+
+inline void OpenVgRFC::GetVectorData( VGfloat* &aData, TInt& aSize, TInt aIndex )
+	{
+	iData.GetVectorData( EVGfloat, (void**)&aData, aSize, aIndex );
+	}
+
+inline void OpenVgRFC::GetVectorData( VGint* &aData, TInt& aSize, TInt aIndex )
+	{
+	iData.GetVectorData( EVGint, (void**)&aData, aSize, aIndex );
+	}
+
+inline void OpenVgRFC::GetVectorData( VGuint* &aData, TInt& aSize, TInt aIndex )
+	{
+	iData.GetVectorData( EVGuint, (void**)&aData, aSize, aIndex );
+	}
+
+inline void OpenVgRFC::GetVectorData( VGshort* &aData, TInt& aSize, TInt aIndex )
+	{
+	iData.GetVectorData( EVGshort, (void**)&aData, aSize, aIndex );
+	}
+
+inline void OpenVgRFC::GetVectorData( VGubyte* &aData, TInt& aSize, TInt aIndex )
+	{
+	iData.GetVectorData( EVGubyte, (void**)&aData, aSize, aIndex );
+	}
+
+inline void OpenVgRFC::GetVectorData( void* &aData, TInt& aSize, TInt aIndex )
+	{
+	iData.GetVectorData( EVGvoid, &aData, aSize, aIndex );
+	}
+
+inline void OpenVgRFC::SetVectorData( const VGfloat* aData, TInt aLength, TInt aIndex )
+	{
+	RemoteFunctionCall::SetVectorData( EVGfloat, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+	}
+
+inline void OpenVgRFC::SetVectorData( const VGint* aData, TInt aLength, TInt aIndex )
+	{
+	RemoteFunctionCall::SetVectorData( EVGint, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+	}
+
+inline void OpenVgRFC::SetVectorData( const VGuint* aData, TInt aLength, TInt aIndex )
+	{
+	RemoteFunctionCall::SetVectorData( EVGuint, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+	}
+
+inline void OpenVgRFC::SetVectorData( const VGshort* aData, TInt aLength, TInt aIndex )
+	{
+	RemoteFunctionCall::SetVectorData( EVGshort, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+	}
+
+inline void OpenVgRFC::SetVectorData( const VGubyte* aData, TInt aLength, TInt aIndex )
+	{
+	RemoteFunctionCall::SetVectorData( EVGubyte, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+	}
+
+inline void OpenVgRFC::SetVectorData( const void* aData, TInt aLength, TInt aIndex )
+	{
+	RemoteFunctionCall::SetVectorData( EVGvoid, reinterpret_cast<const TUint8*>(aData), aLength, aIndex );
+	}
+    
+inline void OpenVgRFC::AppendTUint64( const TUint64& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    // note that 64-bit values consume 2 param slots!
+    TUint32 lower = (TUint32)(aParam & 0xFFFFFFFF);
+    TUint32 upper = (TUint32)((aParam >> 32) & 0xFFFFFFFF);
+    RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast<const TUint8*>(&lower), aDir );
+    RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast<const TUint8*>(&upper), aDir );
+    }
+inline void OpenVgRFC::AppendParam( const VGfloat& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGfloat, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGbyte& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGbyte, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGubyte& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGubyte, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGshort& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGshort, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGint& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGint, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGuint& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+
+inline void OpenVgRFC::AppendParam( const VGboolean& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGboolean, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGErrorCode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGErrorCode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGParamType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGRenderingQuality& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGRenderingQuality, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPixelLayout& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPixelLayout, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGMatrixMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGMatrixMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGMaskOperation& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGMaskOperation, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPathDatatype& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathDatatype, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPathAbsRel& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathAbsRel, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPathSegment& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPathCommand& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPathCapabilities& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathCapabilities, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPathParamType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPathParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGCapStyle& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGCapStyle, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGJoinStyle& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGJoinStyle, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGFillRule& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGFillRule, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPaintMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPaintMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPaintParamType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGPaintType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGColorRampSpreadMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGColorRampSpreadMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGTilingMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGTilingMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGImageFormat& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageFormat, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGImageQuality& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageQuality, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGImageParamType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageParamType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGImageMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGImageChannel& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGImageChannel, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGBlendMode& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGBlendMode, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGHardwareQueryType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGHardwareQueryType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGHardwareQueryResult& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGHardwareQueryResult, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGStringID& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGStringID, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+inline void OpenVgRFC::AppendParam( const VGUArcType& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGUArcType, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+
+#ifdef __SYMBIAN32__
+inline void OpenVgRFC::AppendParam( const VGeglImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendParam( EVGeglImageKHR, reinterpret_cast<const TUint8*>(&aParam), aDir );
+    }
+#endif
+
+inline void OpenVgRFC::AppendVector( const VGfloat* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EVGfloat, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+inline void OpenVgRFC::AppendVector( const VGint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EVGint, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+inline void OpenVgRFC::AppendVector( const VGuint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EVGuint, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+inline void OpenVgRFC::AppendVector( const VGshort* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EVGshort, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+inline void OpenVgRFC::AppendVector( const VGubyte* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EVGubyte, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
+
+inline void OpenVgRFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir )
+    {
+    RemoteFunctionCall::AppendVector( EVGvoid, aLength, reinterpret_cast<const TUint8*>( aData ), aDir );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/remotefunctioncall.h	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,189 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef REMOTEFUNCTIONCALL_H_
+#define REMOTEFUNCTIONCALL_H_
+
+#include "serializerplatform.h"
+#include <string.h>
+class RemoteFunctionCall;
+
+class RemoteFunctionCallData
+    {
+    friend class SerializedFunctionCall;
+    friend class RemoteFunctionCall;
+public:
+    //Simple data copier
+    SER_IMPORT_C static void CopyData( TUint8* aDest, const TUint8* aSource, TInt32 aSize );
+    SER_IMPORT_C static TInt AlignIndex( TInt aIndex, const TInt32 aAlignment );
+    
+public:
+    //Max number of parameters
+    enum
+        {
+        KMaxParameterCount = 34
+        };
+
+    //Operation type
+    enum TOperationType
+        {
+        EOpRequest,
+        EOpRequestWithReply,
+        EOpReply
+        };
+
+    //The direction of parameters
+    enum TParamDirection
+        {
+        EIn = 1,
+        EOut = 2,
+        EInOut = 3
+        };
+
+	//Parameters of max 4 bytes of size
+    class TSimpleParam
+        {
+		public:
+	    TUint32 Size() const;
+        TInt32 iDataType;
+        TUint32 iData;
+        TInt8 iDataTypeSize;
+        };
+
+    //Parameters with arbitrary size
+    class TVectorParam
+        {
+		public:
+	    TUint32 Size( TParamDirection aDir, TOperationType aOpType, TInt aIndexToAlign ) const;
+        TInt32 iDataTypeSize;
+        TInt32 iDataType;
+        TUint32 iVectorLength;
+        TUint8* iCallerAddress;
+        const TUint8* iData;
+        TInt8 iDataTypeAlignment;
+        };
+
+    //Parameter
+    class TParam
+        {
+		public:
+        enum TType
+            {
+            ESimple,
+            EVector
+            };
+
+        TUint32 Size( TOperationType aOpType, TInt aIndexToAlign = 0 ) const;
+
+		//Data
+        TParamDirection iDir;
+        TParam::TType iType;
+        union
+            {
+            TSimpleParam iSimpleParam;
+            TVectorParam iVectorParam;
+            };
+        };
+    
+    //Function call header, common information about function call
+    struct THeader
+        {
+        TInt32 iOpCode;
+        TUint32 iTransactionId;
+        TUint32 iProcessId;
+        TUint32 iThreadId;
+        TInt32 iParameterCount;
+        TInt32 iOpType;
+        TUint32 iReturnValue;
+		TUint32 iApiUid;
+        };
+
+    //Identifier for the call sequency
+    SER_IMPORT_C void SetTransactionId( TUint32 aTransactionId );
+
+    //Operation type
+    SER_IMPORT_C void SetOperationType( TInt32 aOpType );
+
+    //Return value
+    SER_IMPORT_C void SetReturnValue( TUint32 aRetVal );
+
+    //General information about function call
+    SER_IMPORT_C const THeader& Header() const;
+
+    //Parameters
+    SER_IMPORT_C TInt ParameterCount();
+
+    //Parameter array
+    SER_IMPORT_C TParam* Parameters();
+
+    //Sets thread information for request
+    SER_IMPORT_C void SetThreadInformation( const TUint32 aProcessId, const TUint32 aThreadId );
+
+    //Length of serialised function call
+    SER_IMPORT_C TUint32 SerialisedLength() const;
+
+    //Get pointer to vector data
+    SER_IMPORT_C void GetVectorData( TInt32 aParamType, void** aData, TInt& aSize, TInt aIndex );
+
+    //Get parameter value
+    SER_IMPORT_C void GetParamValue( TInt32 aParamType, TUint8* aData, TInt aIndex );
+
+protected:
+    //General information about function call
+    THeader& HeaderData();
+
+    //Function information
+    THeader iHeader;
+
+    //Function parameters
+    TParam iParameters[KMaxParameterCount];
+	};
+
+//Remote function call
+// Represents a function call and contains information about 
+// parameters but does not serialize the data
+class RemoteFunctionCall
+    {
+public:
+    SER_IMPORT_C RemoteFunctionCall( RemoteFunctionCallData& aData );
+    
+    //Initialises this object
+    SER_IMPORT_C void Init( TInt32 aOpCode, RemoteFunctionCallData::TOperationType aOpType = RemoteFunctionCallData::EOpRequestWithReply );
+
+    SER_IMPORT_C RemoteFunctionCallData& Data();
+    
+    SER_IMPORT_C TUint32 ReturnValue();
+
+    SER_IMPORT_C void SetReturnValue( TUint32 aRetValue );
+
+    //Size of type aType
+	virtual TInt GetTypeSize( TInt32 aParamType ) const = 0;
+
+    //Alignemnt of type aType
+	virtual TInt GetTypeAlignment( TInt32 aParamType ) const = 0;
+
+    //Alignemnt of type aType
+	virtual TUint32 GetAPIUid() const = 0;
+
+protected:
+	SER_IMPORT_C void AppendParam( TInt32 aParamType, const TUint8* aData, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    SER_IMPORT_C void AppendVector( TInt32 aParamType, TUint32 aLength, const TUint8* aData, RemoteFunctionCallData::TParamDirection aDir = RemoteFunctionCallData::EIn );
+    SER_IMPORT_C void SetParamData( TInt32 aParamType, const TUint8* aData, TInt aIndex );
+    SER_IMPORT_C void SetVectorData( TInt32 aParamType, const TUint8* aData, TInt aLength, TInt aIndex );
+
+protected:
+    RemoteFunctionCallData& iData;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/requestbuffer.h	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,255 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef REQUEST_BUFFER_H_
+#define REQUEST_BUFFER_H_
+
+#include "serializerplatform.h"
+
+/*
+ * Base for ring buffer users
+ */
+class MRequestBufferBookKeepingBase
+    {
+public:
+    virtual TUint32 GetWriteCount() = 0;
+    virtual TUint32 GetReadCount() = 0;
+    virtual TUint32 BufferTail() = 0;
+    };
+
+/*
+ * Ring buffer writer. Data source for ring buffer.
+ */
+class MRequestBufferBookKeepingWriter: public MRequestBufferBookKeepingBase
+    {
+public:
+    virtual TUint32 BufferHead() = 0;
+    virtual void SetBufferHead( TUint32 aIndex ) = 0;
+    virtual void IncrementWriteCount( TUint32 aWriteCount ) = 0;
+    virtual void SetMaxTailIndex( TUint32 aIndex ) = 0;
+    };
+
+/*
+ * Ring buffer reader. Data consumer for ring buffer.
+ */
+class MRequestBufferBookKeepingReader: public MRequestBufferBookKeepingBase
+    {
+public:
+    virtual void SetBufferTail( TUint32 aIndex ) = 0;
+    virtual void IncrementReadCount( TUint32 aReadCount ) = 0;
+    virtual TUint32 MaxTailIndex() = 0;
+    };
+
+class RequestBufferBase
+    {
+public:
+
+    /*
+     * 
+     */
+    static TUint32 AdjustAlignment( TUint32 aIndex, const TUint32 aAlignment )
+    {
+    const TUint32 remainder = aIndex % aAlignment;
+    if ( remainder )
+        {
+        aIndex += aAlignment - remainder;
+        }
+    return aIndex;
+    }
+        
+protected:
+
+    /*
+     * 
+     */
+    RequestBufferBase( TUint32 aSize ):
+        iSize( aSize )
+        {}
+    
+protected:
+    const TUint32 iSize;
+    };
+
+
+
+class RequestBufferWriter: RequestBufferBase
+    {
+public:
+
+    /*
+     * 
+     */
+    RequestBufferWriter( MRequestBufferBookKeepingWriter& aBookKeeper, TUint32 aSize ): 
+        RequestBufferBase( aSize ),
+        iBookKeeper( aBookKeeper )
+        {}
+    
+    /*
+     * 
+     */
+    void InitBuffer()
+        {
+        iBookKeeper.SetBufferHead( 0 );    
+        iBookKeeper.SetMaxTailIndex( iSize );
+        }
+    
+    /*
+     * Does not check for free space, assure free space by using CheckForSpace
+     */
+    TUint32 AllocateBytes( const TUint32 aBytes )
+        {
+        TUint32 base = iBookKeeper.BufferHead();
+        if ( base + aBytes > iSize )
+            {
+            iBookKeeper.SetMaxTailIndex( base );
+            base = 0;
+            }
+        else if ( iBookKeeper.BufferTail() <= base )
+            {
+            iBookKeeper.SetMaxTailIndex( iSize );
+            }
+        return base;
+        }
+
+    /*
+     * Does not check for free space, assure free space by using CheckForSpace
+     */
+    void CommitBytes( const TUint32 aBase, const TUint32 aBytes )
+        {
+        //TUint32 base = CheckIndexForWrapAround( AdjustAlignment( aBase + aBytes, 4 ) );
+        TUint32 base = AdjustAlignment( aBase + aBytes, 4 );
+		const TUint32 inc( base - aBase );
+        iBookKeeper.SetBufferHead( base );
+        iBookKeeper.IncrementWriteCount( inc );
+        }
+
+    /*
+     * 
+     */
+    TBool CheckForSpace( const TUint32 aSpaceNeeded )
+        {
+        const TUint32 inputBufferHead( iBookKeeper.BufferHead() );
+        const TUint32 inputBufferTail( iBookKeeper.BufferTail() );
+        //Notice that tail might grow during the execution of this function
+        // but it would only cause false negative as a result
+
+        //Buffer can be empty or full
+        if ( inputBufferHead == inputBufferTail )
+            {
+            //Check if the buffer is full or empty
+            if ( iBookKeeper.GetWriteCount() - iBookKeeper.GetReadCount() )
+                {
+                //Buffer is full
+                return EFalse;
+                }
+            }
+
+        //Let's check if the SFC fits to the buffer
+        const TUint32 newHeadIndex = inputBufferHead + aSpaceNeeded;// + alignmentAdjust;
+
+        if ( inputBufferHead < inputBufferTail && newHeadIndex > inputBufferTail )
+            {
+            //Buffer does not have enough space
+            return EFalse; 
+            }
+        else if ( inputBufferHead >= inputBufferTail )
+            {
+            if ( newHeadIndex > iSize && aSpaceNeeded > inputBufferTail )
+                {
+                //Buffer does not have enough space
+                return EFalse;
+                }
+            }
+        return ETrue;        
+        }
+    
+private:
+    MRequestBufferBookKeepingWriter& iBookKeeper;
+    };
+
+class RequestBufferReader: public RequestBufferBase
+    {
+public:
+    /*
+     * 
+     */
+    RequestBufferReader( MRequestBufferBookKeepingReader& aBookKeeper, TUint32 aSize ): 
+        RequestBufferBase( aSize ),
+        iBookKeeper( aBookKeeper )
+        {}
+    
+    /*
+     * 
+     */
+    void InitBuffer()
+        {
+        iBookKeeper.SetBufferTail( 0 );
+        }
+    
+    /*
+     * 
+     */
+    TUint32 GetReadIndex()
+        {
+		const TUint32 bufTail( iBookKeeper.BufferTail() );
+		const TUint32 bufTail2( CheckIndexForWrapAround( bufTail ) );
+        if ( bufTail != bufTail2 )
+			{
+			iBookKeeper.SetBufferTail( bufTail2 );
+			}
+		return bufTail2;
+        }
+    
+    /*
+     * 
+     */
+    void FreeBytes( TUint32 aBytes )
+        {
+		const TUint32 oldTail(iBookKeeper.BufferTail());
+        TUint32 newBufferTail = AdjustAlignment( aBytes + oldTail, 4 );
+		const TUint32 inc( newBufferTail - oldTail );
+        newBufferTail = CheckIndexForWrapAround( newBufferTail );
+        iBookKeeper.IncrementReadCount( inc );
+        iBookKeeper.SetBufferTail( newBufferTail );
+        }
+
+    /*
+     * 
+     */
+    TBool IsDataAvailable()
+        {
+		const TUint32 readc( iBookKeeper.GetReadCount() );
+		const TUint32 writec( iBookKeeper.GetWriteCount() );
+        return readc != writec;
+        }   
+    
+    /*
+     * 
+     */
+    TUint32 CheckIndexForWrapAround( TUint32 aIndex )
+        {
+        //Head is behind of tail when MaxTailIndex is applied so
+        // this routine works for head, too
+        if ( aIndex >= iBookKeeper.MaxTailIndex() )
+            {
+            return 0;
+            }
+        return aIndex;
+        }
+
+private:
+    MRequestBufferBookKeepingReader& iBookKeeper;
+    };
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/serialisedapiuids.h	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,26 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef SERIALISEDAPIUIDS_H_
+#define SERIALISEDAPIUIDS_H_
+
+#define SERIALISED_DRIVER_API_UID 0x2002B6E3
+#define SERIALISED_OPENVG_API_UID 0x2002B6E4
+#define SERIALISED_EGL_API_UID 0x2002B6E5
+#define SERIALISED_OPENGLES_1_1_API_UID 0x2002B6E6
+
+//Added for the purpose of perfoming more complex operations from the Command Scheduler
+#define SERIALISED_META_UID 0x2002B6E7
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/serializedfunctioncall.h	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,163 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef SERIALIZEDFUNCTIONCALL_H_
+#define SERIALIZEDFUNCTIONCALL_H_
+
+#include "serializerplatform.h"
+
+class RemoteFunctionCallData;
+//Copy operations for simple and array parameters
+class MDataCopier
+    {
+public:
+    virtual TInt CopyData( TUint8* aDest, const TUint8* aSource, TUint32 aSize ) = 0; 
+    virtual TInt CopyVector( TUint8* aDest, const TUint8* aSource, TUint32 aSize ) = 0;
+    };
+
+/**
+ * Serialized function call.
+ * Serializes the parameters to a given memory location. 
+ */ 
+class SerializedFunctionCall
+    {
+public:    
+    
+    //Parse error
+    enum TError
+        {
+        ESuccess,
+        EMoreData,
+        EParseError
+        };
+    
+    //Parse state
+    enum TParseState
+        {
+        EReadingApiUid,
+        EReadingOpCode,
+        EReadingTransactionId,
+        EReadingParameterCount,
+        EReadingProcessId,
+        EReadingThreadId,
+        EReadingOpType,
+        EReadingReturnValue,
+        EReadingParamDir,
+        EReadingParamType,
+        EReadingSimpleParamType,
+        EReadingSimpleParamData,
+        EReadingVectorParamType,
+        EReadingVectorParamDataSize,
+        EReadingVectorParamVectorLength,
+        EReadingVectorParamCallerAddress,
+        EReadingVectorParamData,
+        EReadingDone
+        };
+    
+    //Constructor
+	SER_IMPORT_C SerializedFunctionCall( RemoteFunctionCallData& aRFC, MDataCopier* aDataCopier = NULL );
+
+    SER_IMPORT_C void SetDataCopier( MDataCopier* aDataCopier );
+
+    //Parses a serialized function call. Updates parameter array and utilises data copier to
+    // copy array parameters
+    SER_IMPORT_C TInt ParseBuffer( const TUint8* aBuffer, const TInt aBufferLength );
+        
+    //Serializes function call to a stream.
+    SER_IMPORT_C TInt WriteToBuffer( TUint8* aBuffer, const TInt aStreamMaxLength, TInt aOffset = 0 );
+    
+private:
+
+    //Writes header to stream
+    TInt WriteHeaderToBuffer( TUint8* aBuffer, const TInt aStreamMaxLength, TInt aOffset = 0 );
+
+    //Reads header from buffer
+    TInt ReadHeaderFromBuffer( const TUint8* aBuffer, const TInt aBufferLength );
+
+    //Writes a data. Accounts destination buffer overflow and can continue write
+    // from a given offset
+    TInt Write( TUint8* aDest, TInt& aDestIndex, const TInt aDestSize,
+            const TUint8* aSource, const TInt aSize, TInt& aSourceIndex, 
+            const TInt aOffset, TBool aVector );
+    
+    //Serializes a simple param to a current stream
+    TInt WriteParam( const TUint8* aParam, const TInt aParamSize );
+
+    //Serializes an array param to a current stream
+    //TInt WriteVector( const TUint8* aParam, const TInt aParamSize );
+	TInt WriteVector( const TUint8* aParam, const TInt32 aDataTypeSize, const TInt aVectorSize, const TInt8 aDataTypeAlignment );
+
+    //Initialises write state
+    void StartWrite( TUint8* aBuffer, const TInt aStreamMaxLength, TInt aOffset = 0 );
+    
+    //Gets a direct pointer to the stream data for an array parameter
+	//TUint8* ReadVector( const TInt aParamSize );
+	TUint8* ReadVectorPointer( const TInt32 aDataTypeSize, const TInt aVectorSize, const TInt8 aDataTypeAlignment );
+	
+	//Reads simple parameter from a stream
+    TInt ReadParam( TUint8* aParam, const TInt aParamSize );
+    
+    //Reads an array parameter from a stream and utilises data copier for data transfer
+	//TInt ReadVectorParam( TUint8* aParam, const TInt aParamSize );
+	TInt ReadVectorParam( TUint8* aParam, const TInt32 aDataTypeSize, const TInt aVectorSize, const TInt8 aDataTypeAlignment );
+
+    //Reads a data. Accounts source buffer overflow and can continue read
+    // from a given offset
+	TInt Read( TUint8* aDest, TInt& aDestIndex, const TInt aDestSize,
+            const TUint8* aSource, TInt& aSourceIndex, const TInt aSourceSize, TBool aVector );
+
+    //Initialises a read state
+    void StartRead( const TUint8* aBuffer, const TInt aBufferLength );
+
+    //Last error
+    TError GetLastError() { return iError; }
+
+	RemoteFunctionCallData& GetRemoteFunctionCall() { return iRFC; }
+
+private:
+	RemoteFunctionCallData& iRFC;
+    MDataCopier* iDataCopier;
+
+    TError iError;
+
+	struct WriteState
+		{
+		//Write state
+		TUint8* iBuffer;
+		TInt iDestIndex;
+		TInt iStreamMaxLength;
+		TInt iSourceIndex;
+		TInt iOffset;        
+		};
+
+	struct ReadState
+		{
+		//Read state
+		TInt iReadDestOffset;
+		const TUint8* iReadBuffer;
+		TInt iReadBufferIndex;
+		TInt iReadBufferLength;
+		TParseState iParseState;
+		TInt iParamsIndex;
+		};
+
+	union 
+		{
+		WriteState iWriteState;
+		ReadState iReadState;
+		};
+
+	};
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/inc/serializerplatform.h	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,58 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#ifndef SERIALIZER_PLATFORM_H_
+#define SERIALIZER_PLATFORM_H_
+
+#ifdef __SYMBIAN32__
+#include <e32const.h>
+#include <e32def.h>
+
+#ifdef __KERNEL_MODE__
+#include <e32cmn.h>
+#undef ASSERT(x)
+#define ASSERT(x)
+#define SER_IMPORT_C
+#define SER_EXPORT_C
+#else
+#include <e32std.h>
+#define SER_IMPORT_C IMPORT_C
+#define SER_EXPORT_C EXPORT_C
+#endif
+#else
+#include <wchar.h>
+#include <assert.h>
+
+#define ASSERT assert
+typedef void TAny;
+typedef signed char TInt8;
+typedef unsigned char TUint8;
+typedef short int TInt16;
+typedef unsigned short int TUint16;
+typedef long int TInt32;
+typedef unsigned long int TUint32;
+typedef signed int TInt;
+typedef long int TBool;
+typedef unsigned long long TUint64;
+enum 
+{ 
+	EFalse = 0,
+	ETrue = 1
+};
+#define SER_IMPORT_C
+#define SER_EXPORT_C
+#define NONSHARABLE_CLASS( x ) class x
+#endif
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/src/driverrfc.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,128 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#include "driverrfc.h"
+#include "serialisedapiuids.h"
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+//DriverRFC::DriverRFC( RemoteFunctionCallData& aData ):
+//    RemoteFunctionCall( aData )
+//    {
+//    }
+
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt DriverRFC::GetTypeAlignment( TInt32 aType ) const
+    {
+    TInt ret(0);
+    if ( EEGLVoid == aType )
+        {
+        ret = 4;
+        }
+    else
+        {
+        ret = GetTypeSize( aType );
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt DriverRFC::GetTypeSize( TInt32 aType ) const
+    {
+    TInt size(0);
+    switch ( aType )
+        {
+        case EEGLVoid:
+            size = 1;
+            break;
+        case EEGLBoolean:
+        case EEGLint:
+        case EEGLenum:
+        case EEGLDisplay:
+        case EEGLConfig:
+        case EEGLSurface:
+        case EEGLContext:
+        case EEGLClientBuffer:
+        case EEGLImageKHR:
+        case EEGLNativeDisplayType:
+        case EEGLNativeWindowType:
+        case EEGLNativePixmapType:
+        case ETUint32:
+            size = 4;
+            break;
+        //VG Types
+        case EVGvoid:
+        case EVGbyte:
+        case EVGubyte:
+            size = 1;
+            break;
+        case EVGshort:
+            size = 2;
+            break;
+        case EVGfloat:
+        case EVGint:
+        case EVGuint:
+        case EVGbitfield:
+        case EVGboolean:
+        case EVGHandle:
+        case EVGErrorCode:
+        case EVGParamType:
+        case EVGRenderingQuality:
+        case EVGPixelLayout:
+        case EVGMatrixMode:
+        case EVGMaskOperation:
+        case EVGPathDatatype:
+        case EVGPathAbsRel:
+        case EVGPathSegment:
+        case EVGPathCommand:
+        case EVGPath:
+        case EVGPathCapabilities:
+        case EVGPathParamType:
+        case EVGCapStyle:
+        case EVGJoinStyle:
+        case EVGFillRule:
+        case EVGPaintMode:
+        case EVGPaint:
+        case EVGPaintParamType:
+        case EVGPaintType:
+        case EVGColorRampSpreadMode:
+        case EVGTilingMode:
+        case EVGImageFormat:
+        case EVGImage:
+        case EVGImageQuality:
+        case EVGImageParamType:
+        case EVGImageMode:
+        case EVGImageChannel:
+        case EVGBlendMode:
+        case EVGHardwareQueryType:
+        case EVGHardwareQueryResult:
+        case EVGStringID:
+        case EVGeglImageKHR:
+            size = 4;
+            break;
+        default:
+            ASSERT( EFalse );
+            break;
+        }
+    return size;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/src/eglrfc.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,165 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#include "eglrfc.h"
+#include "serialisedapiuids.h"
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+EglRFC::EglRFC( RemoteFunctionCallData& aData ):
+    RemoteFunctionCall( aData )
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TUint32 EglRFC::GetAPIUid() const
+    {
+	return SERIALISED_EGL_API_UID;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt EglRFC::GetTypeAlignment( TInt32 aType ) const
+    {
+    TInt ret(0);
+    if ( EEGLVoid == aType )
+        {
+        ret = 4;
+        }
+    else
+        {
+        ret = GetTypeSize( aType );
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt EglRFC::GetTypeSize( TInt32 aType ) const
+    {
+	TInt size(0);
+	switch ( aType )
+        {
+        case EEGLVoid:
+            size = 1;
+            break;
+        case EEGLBoolean:
+        case EEGLint:
+        case EEGLenum:
+        case EEGLDisplay:
+        case EEGLConfig:
+        case EEGLSurface:
+        case EEGLContext:
+        case EEGLClientBuffer:
+        case EEGLImageKHR:
+        case EEGLNativeDisplayType:
+        case EEGLNativeWindowType:
+        case EEGLNativePixmapType:
+            size = 4;
+            break;
+        case ETUint64:
+            size = 8;
+            break;
+        default:
+            ASSERT( EFalse );
+            break;
+        }
+	return size;
+    }
+
+EGLint EglRFC::MetaGetConfigAttribute( int aIndex )
+        {
+    static const EGLint attribs[] =
+    {
+        EGL_BUFFER_SIZE,
+        EGL_RED_SIZE,
+        EGL_GREEN_SIZE,
+        EGL_BLUE_SIZE,
+        EGL_LUMINANCE_SIZE,
+        EGL_ALPHA_SIZE,
+        EGL_ALPHA_MASK_SIZE,
+        EGL_BIND_TO_TEXTURE_RGB,
+        EGL_BIND_TO_TEXTURE_RGBA,
+        EGL_COLOR_BUFFER_TYPE,
+        EGL_CONFIG_CAVEAT,
+        EGL_CONFIG_ID,
+        EGL_CONFORMANT,
+        EGL_DEPTH_SIZE,
+        EGL_LEVEL,
+        EGL_MATCH_NATIVE_PIXMAP,
+        EGL_MAX_SWAP_INTERVAL,
+        EGL_MIN_SWAP_INTERVAL,
+        EGL_NATIVE_RENDERABLE,
+        EGL_NATIVE_VISUAL_TYPE,
+        EGL_RENDERABLE_TYPE,
+        EGL_SAMPLE_BUFFERS,
+        EGL_SAMPLES,
+        EGL_STENCIL_SIZE,
+        EGL_SURFACE_TYPE,
+        EGL_TRANSPARENT_TYPE,
+        EGL_TRANSPARENT_RED_VALUE,
+        EGL_TRANSPARENT_GREEN_VALUE,
+        EGL_TRANSPARENT_BLUE_VALUE
+    };
+    return attribs[aIndex];
+        }
+EGLint EglRFC::MetaGetConfigAttributeSelCriteria( int aIndex )
+    {
+    static const EGLint attrib_selection_criteria[] =
+    {
+    EAtLeast,
+    EAtLeast,
+    EAtLeast,
+    EAtLeast,
+    EAtLeast,
+    EAtLeast,
+    EAtLeast,
+    EExact,
+    EExact,
+    EExact,
+    EExact,
+    EExact,
+    EMask,
+    EAtLeast,
+    EExact,
+    ESpecial,
+    EExact,
+    EExact,
+    EExact,
+    EExact,
+    EMask,
+    EAtLeast,
+    EAtLeast,
+    EAtLeast,
+    EMask,
+    EExact,
+    EExact,
+    EExact,
+    EExact
+    };
+    return attrib_selection_criteria[aIndex];
+    }
+TInt EglRFC::MetaGetConfigAttributeCnt()
+        {
+    return 29;
+        }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/src/opengles11rfc.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,73 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+
+#include "opengles11rfc.h"
+#include "serialisedapiuids.h"
+
+OpenGlES11RFC::OpenGlES11RFC( RemoteFunctionCallData& aData ):
+    RemoteFunctionCall( aData )
+    {    
+    }
+
+TUint32 OpenGlES11RFC::GetAPIUid() const
+{
+	return SERIALISED_OPENGLES_1_1_API_UID;
+}
+
+TInt OpenGlES11RFC::GetTypeAlignment( TInt32 aType ) const
+{
+    TInt ret(0);
+    if ( EGLvoid == aType )
+        {
+        ret = 4;
+        }
+    else
+        {
+        ret = GetTypeSize( aType );
+        }
+    return ret;
+}
+
+TInt OpenGlES11RFC::GetTypeSize( TInt32 aType ) const
+{
+    TInt size(0);
+    switch ( aType )
+    {
+    case EGLvoid:
+    case EGLubyte:
+    case EGLboolean:
+        size = 1;
+        break;
+    case EGLshort:
+        size = 2;
+        break;
+    case EGLbitfield:
+    case EGLclampf:
+    case EGLclampx:
+    case EGLenum:
+    case EGLfixed:
+    case EGLfloat:
+    case EGLint:
+    case EGLintptr:
+    case EGLsizei:
+    case EGLsizeiptr:
+    case EGLuint:
+        size = 4;
+        break;
+    default:
+        break;
+    }
+    return size;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/src/openvgrfc.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,120 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+
+#include "openvgrfc.h"
+#include "serialisedapiuids.h"
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+OpenVgRFC::OpenVgRFC( RemoteFunctionCallData& aData ):
+    RemoteFunctionCall( aData )
+    {    
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TUint32 OpenVgRFC::GetAPIUid() const
+    {
+	return SERIALISED_OPENVG_API_UID;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt OpenVgRFC::GetTypeAlignment( TInt32 aType ) const
+    {
+    TInt ret(0);
+    if ( EVGvoid == aType )
+        {
+        ret = 4;
+        }
+    else
+        {
+        ret = GetTypeSize( aType );
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt OpenVgRFC::GetTypeSize( TInt32 aType ) const
+    {
+	TInt size(0);
+	switch ( aType )
+        {
+        case EVGvoid:
+        case EVGbyte:
+        case EVGubyte:
+            size = 1;
+            break;
+        case EVGshort:
+            size = 2;
+            break;
+        case EVGfloat:
+        case EVGint:
+        case EVGuint:
+        case EVGbitfield:
+        case EVGboolean:
+        case EVGHandle:
+        case EVGErrorCode:
+        case EVGParamType:
+        case EVGRenderingQuality:
+        case EVGPixelLayout:
+        case EVGMatrixMode:
+        case EVGMaskOperation:
+        case EVGPathDatatype:
+        case EVGPathAbsRel:
+        case EVGPathSegment:
+        case EVGPathCommand:
+        case EVGPath:
+        case EVGPathCapabilities:
+        case EVGPathParamType:
+        case EVGCapStyle:
+        case EVGJoinStyle:
+        case EVGFillRule:
+        case EVGPaintMode:
+        case EVGPaint:
+        case EVGPaintParamType:
+        case EVGPaintType:
+        case EVGColorRampSpreadMode:
+        case EVGTilingMode:
+        case EVGImageFormat:
+        case EVGImage:
+        case EVGImageQuality:
+        case EVGImageParamType:
+        case EVGImageMode:
+        case EVGImageChannel:
+        case EVGBlendMode:
+        case EVGHardwareQueryType:
+        case EVGHardwareQueryResult:
+        case EVGStringID:
+        case EVGeglImageKHR:
+            size = 4;
+            break;
+        case ETUint64:
+            size = 8;
+            break;
+        default:
+            break;
+        }
+	return size;
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/src/remotefunctioncall.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,435 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#include "remotefunctioncall.h"
+
+// Symbian User mode Panic & debugging information
+#if defined(__SYMBIAN32__) && !defined(__KERNEL_MODE__)
+#define USE_SYMBIAN_CLIENT_PANICS
+#include <e32debug.h>
+#include "serialisedapiuids.h"
+// Platsim Serialiser panic codes
+typedef enum
+	{
+	ESerPanicMaxParamCountExceeded=1,
+	ESerPanicRequestOperationHasOutParameter,
+	ESerPanicVectorPtrIsNull,
+	ESerPanicVectorSizeIsNegative,
+	} TSerialiserPanic;
+
+_LIT(KSerialiserPanicCategory, "Vghw Ser");
+
+#ifdef _DEBUG
+	#define VGSERPANIC_ASSERT(condition, panic, api, opcode, pcount) if (!(condition)) \
+			{ SerialiserPanic(panic, #condition, __FILE__, __LINE__, api, opcode, pcount); }
+#else
+	#define VGSERPANIC_ASSERT(condition, panic, api, opcode, pcount) if (!(condition)) \
+			{ SerialiserPanic(panic, NULL, NULL, __LINE__, api, opcode, pcount); }
+#endif
+
+void SerialiserPanic(TSerialiserPanic aPanicCode, char* aCondition, char* aFile, TInt aLine, TInt32 aApiUid, TInt32 aOpcode, TInt32 aParamCount)
+	{
+	if (aCondition && aFile)
+		{
+		RDebug::Printf("Vghw Serialiser Panic %d for failed Assert (%s), at %s:%d", aPanicCode, aCondition, aFile, aLine);
+		}
+	else
+		{  
+		RDebug::Printf("Vghw Serialiser Panic %d for failed Assert (line %d)", aPanicCode, aLine);
+		}
+		
+	switch (aApiUid)
+		{
+		case SERIALISED_EGL_API_UID:
+			RDebug::Printf("Api=SERIALISED_EGL_API_UID, aOpcode=%d, ParamCount=%d", aOpcode, aParamCount);
+			break;
+		case SERIALISED_OPENGLES_1_1_API_UID:
+			RDebug::Printf("Api=SERIALISED_OPENGLES_1_1_API_UID, aOpcode=%d, ParamCount=%d", aOpcode, aParamCount);
+			break;
+		case SERIALISED_OPENVG_API_UID:
+			RDebug::Printf("Api=SERIALISED_OPENVG_API_UID, aOpcode=%d, ParamCount=%d", aOpcode, aParamCount);
+			break;
+		default:
+			RDebug::Printf("Api=%d, aOpcode=%d, ParamCount=%d", aApiUid, aOpcode, aParamCount);
+			break;
+		}
+	User::Panic(KSerialiserPanicCategory, aPanicCode);
+	}
+#endif
+
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TUint32 RemoteFunctionCallData::TSimpleParam::Size() const
+	{
+	TUint32 size(0);
+    size += sizeof( iDataType );
+    size += sizeof( iDataTypeSize );
+    size += iDataTypeSize;
+	return size;
+	}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TUint32 RemoteFunctionCallData::TVectorParam::Size( TParamDirection aDir, TOperationType aOpType, TInt aIndexToAlign ) const
+    {
+    TUint32 size(0);
+    size += sizeof( iDataType );
+    size += sizeof( iVectorLength );
+    size += sizeof( iCallerAddress );
+    size += sizeof( iDataTypeSize );
+    size += sizeof( iDataTypeAlignment );
+
+    if ( ( (aDir & EIn) && ( EOpRequestWithReply == aOpType || EOpRequest == aOpType ) ) 
+            ||
+         ( ( aDir & EOut ) && aOpType == EOpReply ) 
+        )
+        {            
+        if ( iVectorLength )
+            {
+            TInt aNewIndex = RemoteFunctionCallData::AlignIndex( aIndexToAlign + size, iDataTypeAlignment );
+            size += aNewIndex - ( aIndexToAlign + size );
+            }
+        size += iDataTypeSize*iVectorLength;
+        }
+    return size;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TUint32 RemoteFunctionCallData::TParam::Size( TOperationType aOpType, TInt aIndexToAlign ) const
+    {
+	TUint32 size(0);
+    size += sizeof( iDir );
+    size += sizeof( iType );
+    if ( TParam::ESimple == iType )
+        {
+        size += iSimpleParam.Size();
+        }
+    else if ( TParam::EVector == iType )
+        {
+        size += iVectorParam.Size( iDir, aOpType, aIndexToAlign + size );
+        }
+	return size;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCallData::CopyData( TUint8* aDest, const TUint8* aSource, TInt32 aSize )
+    {
+    memcpy( aDest, aSource, aSize );
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C TInt RemoteFunctionCallData::AlignIndex( TInt aIndex, const TInt32 aAlignment )
+    {
+    const TInt remainder = aIndex % aAlignment;
+    if ( remainder )
+        {
+        aIndex += aAlignment - remainder;
+        }
+    return aIndex;    
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C TUint32 RemoteFunctionCallData::SerialisedLength() const
+    {
+    TUint32 size(0);
+    size += sizeof( iHeader.iOpCode );
+    size += sizeof( iHeader.iTransactionId );
+    size += sizeof( iHeader.iProcessId );
+    size += sizeof( iHeader.iThreadId );
+    size += sizeof( iHeader.iParameterCount );
+    size += sizeof( iHeader.iOpType );
+    size += sizeof( iHeader.iReturnValue );
+    size += sizeof( iHeader.iApiUid );
+
+    for ( TInt i = 0; i < iHeader.iParameterCount; i++ )
+        {
+        size += iParameters[i].Size( (RemoteFunctionCallData::TOperationType)iHeader.iOpType, size );
+        }
+    
+    return size;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCallData::SetThreadInformation( const TUint32 aProcessId, const TUint32 aThreadId )
+    { 
+    iHeader.iProcessId = aProcessId; iHeader.iThreadId = aThreadId; 
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCallData::SetTransactionId( TUint32 aTransactionId )
+    { 
+    iHeader.iTransactionId = aTransactionId; 
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCallData::SetOperationType( TInt32 aOpType )
+    { 
+    iHeader.iOpType = aOpType; 
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCallData::SetReturnValue( TUint32 aRetVal )
+    { 
+    iHeader.iReturnValue = aRetVal; 
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C const RemoteFunctionCallData::THeader& RemoteFunctionCallData::Header() const 
+    { 
+    return iHeader; 
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C TInt RemoteFunctionCallData::ParameterCount()
+    { 
+    return iHeader.iParameterCount; 
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C RemoteFunctionCallData::TParam* RemoteFunctionCallData::Parameters()
+    { 
+    return iParameters; 
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+RemoteFunctionCallData::THeader& RemoteFunctionCallData::HeaderData()
+    { 
+    return iHeader; 
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCallData::GetVectorData( TInt32 aParamType, void** aData, TInt& aSize, TInt aIndex )
+    {
+    ASSERT( iParameters[aIndex].iVectorParam.iDataType == aParamType );
+    ASSERT( aIndex < iHeader.iParameterCount );
+
+    *aData = (void*)iParameters[aIndex].iVectorParam.iData;
+    aSize = iParameters[aIndex].iVectorParam.iVectorLength;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCallData::GetParamValue( TInt32 aParamType, TUint8* aData, TInt aIndex )
+    {
+    ASSERT( iParameters[aIndex].iSimpleParam.iDataType == aParamType );
+    ASSERT( aIndex < iHeader.iParameterCount );
+
+    RemoteFunctionCallData::CopyData( aData, (TUint8*)&iParameters[aIndex].iSimpleParam.iData, iParameters[aIndex].iSimpleParam.iDataTypeSize );
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCall::Init( TInt32 aOpCode, RemoteFunctionCallData::TOperationType aOpType )
+    {
+    iData.iHeader.iOpCode = aOpCode;
+    iData.iHeader.iParameterCount = 0;
+    iData.iHeader.iTransactionId = 0;
+    iData.iHeader.iOpType = aOpType;
+    iData.iHeader.iProcessId = 0;
+    iData.iHeader.iThreadId = 0;
+    iData.iHeader.iApiUid = GetAPIUid();
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C RemoteFunctionCall::RemoteFunctionCall( RemoteFunctionCallData& aData ):
+    iData( aData )
+    {
+    
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCall::SetVectorData( TInt32 aParamType, const TUint8* aData, TInt aLength, TInt aIndex )
+	{
+	ASSERT( iData.iParameters[aIndex].iVectorParam.iDataType == aParamType );
+	ASSERT( aIndex < iData.iHeader.iParameterCount );
+	ASSERT( static_cast<TUint32>(aLength) <= iData.iParameters[aIndex].iVectorParam.iVectorLength );
+	ASSERT( RemoteFunctionCallData::EIn != iData.iParameters[aIndex].iDir );
+	
+	iData.iParameters[aIndex].iVectorParam.iData = aData;
+	iData.iParameters[aIndex].iVectorParam.iVectorLength = aLength;
+	}
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCall::SetParamData( TInt32 aParamType, const TUint8* aData, TInt aIndex )
+    {
+    ASSERT( iData.iParameters[aIndex].iSimpleParam.iDataType == aParamType );
+    ASSERT( aIndex < iData.iHeader.iParameterCount );
+    ASSERT( RemoteFunctionCallData::EIn != iData.iParameters[aIndex].iDir );
+
+    RemoteFunctionCallData::CopyData( (TUint8*)&iData.iParameters[aIndex].iSimpleParam.iData, aData, iData.iParameters[aIndex].iSimpleParam.iDataTypeSize );    
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCall::AppendParam( TInt32 aParamType, const TUint8* aData, RemoteFunctionCallData::TParamDirection aDir )
+    {
+#ifdef USE_SYMBIAN_CLIENT_PANICS
+	VGSERPANIC_ASSERT( iData.iHeader.iParameterCount < RemoteFunctionCallData::KMaxParameterCount,
+		ESerPanicMaxParamCountExceeded, iData.iHeader.iApiUid, iData.iHeader.iOpCode, iData.iHeader.iParameterCount);
+	VGSERPANIC_ASSERT( (RemoteFunctionCallData::EIn == aDir) || (iData.iHeader.iOpCode != RemoteFunctionCallData::EOpRequest),
+		ESerPanicRequestOperationHasOutParameter, iData.iHeader.iApiUid, iData.iHeader.iOpCode, iData.iHeader.iParameterCount);
+#else
+	ASSERT( iData.iHeader.iParameterCount < RemoteFunctionCallData::KMaxParameterCount );
+#endif
+
+	RemoteFunctionCallData::TParam param;
+    param.iType = RemoteFunctionCallData::TParam::ESimple;
+    param.iDir = aDir;
+    param.iSimpleParam.iDataType = aParamType;
+    param.iSimpleParam.iDataTypeSize = GetTypeSize( param.iSimpleParam.iDataType );
+    RemoteFunctionCallData::CopyData( (TUint8*)&param.iSimpleParam.iData, aData, param.iSimpleParam.iDataTypeSize );
+    iData.iParameters[iData.iHeader.iParameterCount] = param;
+    iData.iHeader.iParameterCount++;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCall::AppendVector( TInt32 aParamType, TUint32 aLength, const TUint8* aData, RemoteFunctionCallData::TParamDirection aDir )
+    {        
+#ifdef USE_SYMBIAN_CLIENT_PANICS
+	VGSERPANIC_ASSERT( iData.iHeader.iParameterCount < RemoteFunctionCallData::KMaxParameterCount,
+		ESerPanicMaxParamCountExceeded, iData.iHeader.iApiUid, iData.iHeader.iOpCode, iData.iHeader.iParameterCount);
+	VGSERPANIC_ASSERT( (aLength & 0x80000000) == 0,
+		ESerPanicVectorSizeIsNegative, iData.iHeader.iApiUid, iData.iHeader.iOpCode, iData.iHeader.iParameterCount);
+#else
+	ASSERT( iData.iHeader.iParameterCount < RemoteFunctionCallData::KMaxParameterCount );
+    ASSERT( (RemoteFunctionCallData::EIn == aDir) || (iData.iHeader.iOpCode != RemoteFunctionCallData::EOpRequest) );
+#endif
+
+
+	RemoteFunctionCallData::TParam param;
+    param.iType = RemoteFunctionCallData::TParam::EVector;
+    param.iDir = aDir;
+    param.iVectorParam.iDataType = aParamType;
+    param.iVectorParam.iData = aData;
+    param.iVectorParam.iDataTypeSize = GetTypeSize( aParamType );
+    param.iVectorParam.iDataTypeAlignment = GetTypeAlignment( aParamType );
+	
+	if ( aData )
+		{
+		param.iVectorParam.iVectorLength = aLength;
+		}
+	else
+		{
+#ifdef USE_SYMBIAN_CLIENT_PANICS
+		VGSERPANIC_ASSERT( (aLength == 0) || (aDir != RemoteFunctionCallData::EIn),
+				ESerPanicVectorPtrIsNull, iData.iHeader.iApiUid, iData.iHeader.iOpCode, iData.iHeader.iParameterCount);
+#endif
+		param.iVectorParam.iVectorLength = 0;
+		}
+
+    if ( RemoteFunctionCallData::EOut & aDir )
+        {
+#ifdef USE_SYMBIAN_CLIENT_PANICS
+		VGSERPANIC_ASSERT( iData.iHeader.iOpCode != RemoteFunctionCallData::EOpRequest,
+				ESerPanicRequestOperationHasOutParameter, iData.iHeader.iApiUid, iData.iHeader.iOpCode, iData.iHeader.iParameterCount);
+#endif
+        param.iVectorParam.iCallerAddress = const_cast<TUint8*>( aData );
+        }
+    else
+        {
+        param.iVectorParam.iCallerAddress = NULL;
+        }
+
+    iData.iParameters[iData.iHeader.iParameterCount] = param;
+    iData.iHeader.iParameterCount++;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C RemoteFunctionCallData& RemoteFunctionCall::Data()
+    {
+    return iData;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C TUint32 RemoteFunctionCall::ReturnValue()
+    {
+    return iData.Header().iReturnValue;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void RemoteFunctionCall::SetReturnValue( TUint32 aRetValue )
+    {
+    iData.SetReturnValue( aRetValue );
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/guestrendering/vghwserialiser/src/serializedfunctioncall.cpp	Fri Aug 20 18:02:40 2010 +0100
@@ -0,0 +1,495 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+
+#include "serializedfunctioncall.h"
+#include "remotefunctioncall.h"
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt SerializedFunctionCall::Write( TUint8* aDest, TInt& aDestIndex, const TInt aDestSize,
+        const TUint8* aSource, const TInt aSize, TInt& aSourceIndex, const TInt aOffset, TBool aVector )
+    {        
+    if ( aSourceIndex + aSize > aOffset )
+        {
+        TInt32 offset(0);
+        TInt32 size( aSize );  
+        if ( aOffset - aSourceIndex > 0 )
+            {
+            offset = aOffset - aSourceIndex;
+            size = aSize - offset;
+            }
+
+        if ( aDestIndex + size >= aDestSize )
+            {
+            size = aDestSize - aDestIndex;
+            }
+
+        if ( aSource )
+            {
+            if ( iDataCopier && aVector )
+                {
+                iDataCopier->CopyVector( &aDest[aDestIndex], &aSource[offset], size );
+                }
+            else if ( iDataCopier )
+                {
+                iDataCopier->CopyData( &aDest[aDestIndex], &aSource[offset], size );            
+                }
+            else
+                {
+				RemoteFunctionCallData::CopyData( &aDest[aDestIndex], &aSource[offset], size );
+                }
+            }
+        aSourceIndex += size;
+        aDestIndex += size;
+        }
+    else
+        {
+        aSourceIndex += aSize;
+        }
+    return aDestSize - aDestIndex; 
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt SerializedFunctionCall::WriteParam( const TUint8* aParam, const TInt aParamSize )
+    {
+    ASSERT( aParam );
+
+    return Write( iWriteState.iBuffer, iWriteState.iDestIndex, iWriteState.iStreamMaxLength,
+            aParam, aParamSize, iWriteState.iSourceIndex, iWriteState.iOffset, 0 );        
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt SerializedFunctionCall::WriteVector( const TUint8* aParam, const TInt32 aDataTypeSize, const TInt aVectorSize, const TInt8 aDataTypeAlignment )
+    {
+    ASSERT( aParam );
+    iWriteState.iDestIndex = RemoteFunctionCallData::AlignIndex( iWriteState.iDestIndex, aDataTypeAlignment );
+    return Write( iWriteState.iBuffer, iWriteState.iDestIndex, iWriteState.iStreamMaxLength,
+            aParam, aVectorSize*aDataTypeSize, iWriteState.iSourceIndex, iWriteState.iOffset, 1 );        
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt SerializedFunctionCall::ReadParam( TUint8* aParam, const TInt aParamSize )
+    {
+    return Read( aParam, iReadState.iReadDestOffset, aParamSize, 
+        iReadState.iReadBuffer, iReadState.iReadBufferIndex, iReadState.iReadBufferLength, 0 );        
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt SerializedFunctionCall::ReadVectorParam( TUint8* aParam, 
+		const TInt32 aDataTypeSize, const TInt aVectorSize, const TInt8 aDataTypeAlignment )
+    {
+	iReadState.iReadBufferIndex = RemoteFunctionCallData::AlignIndex( iReadState.iReadBufferIndex, aDataTypeAlignment );
+    return Read( aParam, iReadState.iReadDestOffset, aVectorSize*aDataTypeSize, 
+        iReadState.iReadBuffer, iReadState.iReadBufferIndex, iReadState.iReadBufferLength, 1 );        
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TUint8* SerializedFunctionCall::ReadVectorPointer( 
+		const TInt32 aDataTypeSize, const TInt aVectorSize, const TInt8 aDataTypeAlignment )
+    {
+	iReadState.iReadBufferIndex = RemoteFunctionCallData::AlignIndex( iReadState.iReadBufferIndex, aDataTypeAlignment );
+	TUint8* data = const_cast<TUint8*>(&iReadState.iReadBuffer[iReadState.iReadBufferIndex]);
+	iReadState.iReadBufferIndex += aVectorSize*aDataTypeSize;
+    iReadState.iReadDestOffset += 0;
+	return data;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt SerializedFunctionCall::Read( TUint8* aDest, TInt& aDestIndex, const TInt aDestSize,
+        const TUint8* aSource, TInt& aSourceIndex, const TInt aSourceSize, TBool aVector )
+    {
+    TInt ret(1);
+    TInt size = aDestSize - aDestIndex;
+    if ( aSourceIndex + size > aSourceSize )
+        {
+        //Read buffer overflow
+        iError = EMoreData;
+        ret = 0;
+        size = aSourceSize - aSourceIndex; 
+        }
+    
+    if ( iDataCopier && aVector )
+        {
+        iDataCopier->CopyVector( &aDest[aDestIndex], &aSource[aSourceIndex], size );
+        }
+    else if ( iDataCopier )
+        {
+        iDataCopier->CopyData( &aDest[aDestIndex], &aSource[aSourceIndex], size );            
+        }
+    else
+        {
+		RemoteFunctionCallData::CopyData( &aDest[aDestIndex], &aSource[aSourceIndex], size );
+        }
+
+    aSourceIndex += size;
+    aDestIndex += size;
+    
+    if ( ret )
+        {
+        aDestIndex = 0;
+        }
+    return ret;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void SerializedFunctionCall::StartRead( const TUint8* aBuffer, const TInt aBufferLength )
+    {
+    iReadState.iReadBuffer = aBuffer;
+    iReadState.iReadBufferIndex = 0;
+    iReadState.iReadBufferLength = aBufferLength;
+    iReadState.iParseState = EReadingApiUid;
+    iReadState.iReadDestOffset = 0;
+    iError = ESuccess;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt SerializedFunctionCall::ReadHeaderFromBuffer( const TUint8* aBuffer, const TInt aBufferLength )
+    {
+    iReadState.iParamsIndex = 0;
+    StartRead( aBuffer, aBufferLength );
+
+    if ( EReadingApiUid == iReadState.iParseState )
+        {
+        if ( !ReadParam( (TUint8*)&iRFC.HeaderData().iApiUid, 
+                sizeof(iRFC.HeaderData().iApiUid) ) )
+            {
+            return 0;
+            }
+        iReadState.iParseState = EReadingOpCode;
+        }
+
+	if ( EReadingOpCode == iReadState.iParseState )
+        {
+        if ( !ReadParam( (TUint8*)&iRFC.HeaderData().iOpCode, 
+                sizeof(iRFC.HeaderData().iOpCode) ) )
+            {
+            return 0;
+            }
+        iReadState.iParseState = EReadingTransactionId;
+        }
+
+    if ( iReadState.iParseState == EReadingTransactionId )
+        {
+        if ( !ReadParam( (TUint8*)&iRFC.HeaderData().iTransactionId, 
+                sizeof(iRFC.HeaderData().iTransactionId) ) )
+            {
+            return 0;
+            }
+        iReadState.iParseState = EReadingParameterCount;
+        }
+    if ( iReadState.iParseState == EReadingParameterCount )
+        {
+        if ( !ReadParam( (TUint8*)&iRFC.HeaderData().iParameterCount, 
+                sizeof(iRFC.HeaderData().iParameterCount) ) )
+            {
+            return 0;
+            }
+        iReadState.iParseState = EReadingProcessId;
+        }
+    if ( iReadState.iParseState == EReadingProcessId )
+        {
+        if ( !ReadParam( (TUint8*)&iRFC.HeaderData().iProcessId, 
+                sizeof(iRFC.HeaderData().iProcessId) ) )
+            {
+            return 0;
+            }
+        iReadState.iParseState = EReadingThreadId;
+        }
+    if ( iReadState.iParseState == EReadingThreadId )
+        {
+        if ( !ReadParam( (TUint8*)&iRFC.HeaderData().iThreadId, 
+                sizeof(iRFC.HeaderData().iThreadId) ) )
+            {
+            return 0;
+            }
+        iReadState.iParseState = EReadingOpType;
+        }
+    if ( iReadState.iParseState == EReadingOpType )
+        {
+        if ( !ReadParam( (TUint8*)&iRFC.HeaderData().iOpType, 
+                sizeof(iRFC.HeaderData().iOpType) ) )
+            {
+            return 0;
+            }
+        iReadState.iParseState = EReadingReturnValue;
+        }
+    if ( iReadState.iParseState == EReadingReturnValue )
+        {
+        if ( !ReadParam( (TUint8*)&iRFC.HeaderData().iReturnValue, 
+                sizeof(iRFC.HeaderData().iReturnValue) ) )
+            {
+            return 0;
+            }
+        iReadState.iParseState = EReadingParamDir;
+        }
+    
+    return 1;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C TInt SerializedFunctionCall::ParseBuffer( const TUint8* aBuffer, const TInt aBufferLength )
+    {
+    StartRead( aBuffer, aBufferLength );
+    if ( ReadHeaderFromBuffer( aBuffer, aBufferLength ) )
+        {        
+        for ( ;iReadState.iParamsIndex < iRFC.Header().iParameterCount; iReadState.iParamsIndex++ )
+            {
+			RemoteFunctionCallData::TParam& param( iRFC.Parameters()[iReadState.iParamsIndex] );
+    
+            ReadParam( (TUint8*)&param.iDir, sizeof(param.iDir) );
+            if ( ReadParam( (TUint8*)&param.iType, sizeof(param.iType) ) )
+                {
+    
+                if ( RemoteFunctionCallData::TParam::ESimple == param.iType )
+                    {
+                    ReadParam( (TUint8*)&param.iSimpleParam.iDataType, sizeof(param.iSimpleParam.iDataType) ); 
+                    ReadParam( (TUint8*)&param.iSimpleParam.iDataTypeSize, sizeof(param.iSimpleParam.iDataTypeSize) ); 
+                    ReadParam( (TUint8*)&param.iSimpleParam.iData, param.iSimpleParam.iDataTypeSize );
+                    }
+                else if ( RemoteFunctionCallData::TParam::EVector == param.iType )
+                    {
+                    ReadParam( (TUint8*)&param.iVectorParam.iDataType, sizeof(param.iVectorParam.iDataType) );
+                    ReadParam( (TUint8*)&param.iVectorParam.iVectorLength, sizeof(param.iVectorParam.iVectorLength) );            
+                    ReadParam( (TUint8*)&param.iVectorParam.iCallerAddress, sizeof(param.iVectorParam.iCallerAddress) );
+                    ReadParam( (TUint8*)&param.iVectorParam.iDataTypeSize, sizeof(param.iVectorParam.iDataTypeSize) );
+                    ReadParam( (TUint8*)&param.iVectorParam.iDataTypeAlignment, sizeof(param.iVectorParam.iDataTypeAlignment) );
+                    
+                    if ( !param.iVectorParam.iVectorLength )
+                        {
+                        param.iVectorParam.iData = NULL;
+						param.iVectorParam.iCallerAddress = NULL;
+                        }
+                    else if ( (param.iDir & RemoteFunctionCallData::EIn) && ( RemoteFunctionCallData::EOpRequest == iRFC.Header().iOpType || RemoteFunctionCallData::EOpRequestWithReply == iRFC.Header().iOpType ) )
+                        {
+                        param.iVectorParam.iData = ReadVectorPointer( param.iVectorParam.iDataTypeSize, param.iVectorParam.iVectorLength, param.iVectorParam.iDataTypeAlignment );
+                        }
+                    else if ( (param.iDir & RemoteFunctionCallData::EOut) && iRFC.Header().iOpType == RemoteFunctionCallData::EOpReply ) 
+                        {
+                        ReadVectorParam( (TUint8*)param.iVectorParam.iCallerAddress, 
+                                param.iVectorParam.iDataTypeSize, param.iVectorParam.iVectorLength, param.iVectorParam.iDataTypeAlignment );
+                        }
+                    }
+                else
+                    {
+                    //Parse error
+                    iError = EParseError;
+                    return -1;
+                    }
+                }
+            }
+        iReadState.iParseState = EReadingDone;
+        }
+    else
+        {
+        iError = EParseError;
+        return -1;
+        }
+    return iReadState.iReadBufferIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+void SerializedFunctionCall::StartWrite( TUint8* aBuffer, const TInt aStreamMaxLength, TInt aOffset )
+    {
+    iWriteState.iBuffer = aBuffer;
+    iWriteState.iDestIndex = 0;
+    iWriteState.iStreamMaxLength = aStreamMaxLength;
+    iWriteState.iSourceIndex = 0;
+    iWriteState.iOffset = aOffset;
+    iError = ESuccess;    
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+TInt SerializedFunctionCall::WriteHeaderToBuffer( TUint8* aBuffer, const TInt aStreamMaxLength, TInt aOffset )
+    {
+    StartWrite( aBuffer, aStreamMaxLength, aOffset );
+    if ( !WriteParam( (TUint8*)&iRFC.Header().iApiUid, 
+            sizeof(iRFC.Header().iApiUid) ) )
+        {
+        return iWriteState.iSourceIndex;
+        }
+    if ( !WriteParam( (TUint8*)&iRFC.Header().iOpCode, 
+            sizeof(iRFC.Header().iOpCode) ) )
+        {
+        return iWriteState.iSourceIndex;
+        }
+    if ( !WriteParam( (TUint8*)&iRFC.Header().iTransactionId, 
+            sizeof(iRFC.Header().iTransactionId) ) )
+        {
+        return iWriteState.iSourceIndex;
+        }
+    if ( !WriteParam( (TUint8*)&iRFC.Header().iParameterCount, 
+            sizeof(iRFC.Header().iParameterCount) ) )
+        {
+        return iWriteState.iSourceIndex;
+        }
+    if ( !WriteParam( (TUint8*)&iRFC.Header().iProcessId, 
+            sizeof(iRFC.Header().iProcessId) ) )
+        {
+        return iWriteState.iSourceIndex;
+        }
+    if ( !WriteParam( (TUint8*)&iRFC.Header().iThreadId, 
+            sizeof(iRFC.Header().iThreadId) ) )
+        {
+        return iWriteState.iSourceIndex;
+        }
+    if ( !WriteParam( (TUint8*)&iRFC.Header().iOpType, 
+            sizeof(iRFC.Header().iOpType) ) )
+        {
+        return iWriteState.iSourceIndex;
+        }
+    if ( !WriteParam( (TUint8*)&iRFC.Header().iReturnValue, 
+            sizeof(iRFC.Header().iReturnValue) ) )
+        {
+        return iWriteState.iSourceIndex;
+        }
+    return iWriteState.iSourceIndex;
+    }
+
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C TInt SerializedFunctionCall::WriteToBuffer( TUint8* aBuffer, const TInt aStreamMaxLength, TInt aOffset )
+    {
+    WriteHeaderToBuffer( aBuffer, aStreamMaxLength, aOffset );
+    for ( TInt i = 0; i < iRFC.Header().iParameterCount; i++ )
+        {
+        const RemoteFunctionCallData::TParam& param( iRFC.Parameters()[i] );
+        
+        if ( !WriteParam( (TUint8*)&param.iDir, 
+                sizeof(param.iDir) ) )
+            {
+            break;
+            }
+
+        if ( !WriteParam( (TUint8*)&param.iType, 
+                sizeof(param.iType) ) )
+            {
+            break;
+            }
+        
+		if ( RemoteFunctionCallData::TParam::ESimple == param.iType )
+            {
+            if ( !WriteParam( (TUint8*)&param.iSimpleParam.iDataType, 
+                    sizeof(param.iSimpleParam.iDataType) ) )
+                {
+                break;
+                }
+            if ( !WriteParam( (TUint8*)&param.iSimpleParam.iDataTypeSize, 
+                    sizeof(param.iSimpleParam.iDataTypeSize) ) )
+                {
+                break;
+                }
+
+			if ( !WriteParam( (TUint8*)&param.iSimpleParam.iData, param.iSimpleParam.iDataTypeSize ) )
+                {
+                break;
+                }
+            }
+        else if ( RemoteFunctionCallData::TParam::EVector == param.iType )
+            {
+            if ( !WriteParam( (TUint8*)&param.iVectorParam.iDataType, sizeof(param.iVectorParam.iDataType) ))
+                {
+                break;
+                }
+
+            if ( !WriteParam( (TUint8*)&param.iVectorParam.iVectorLength, sizeof(param.iVectorParam.iVectorLength) ))
+                {
+                break;
+                }
+
+            if ( !WriteParam( (TUint8*)&param.iVectorParam.iCallerAddress, sizeof(param.iVectorParam.iCallerAddress) ))
+                {
+                break;
+                }
+
+            if ( !WriteParam( (TUint8*)&param.iVectorParam.iDataTypeSize, sizeof(param.iVectorParam.iDataTypeSize) ))
+                {
+                break;
+                }
+
+            if ( !WriteParam( (TUint8*)&param.iVectorParam.iDataTypeAlignment, sizeof(param.iVectorParam.iDataTypeAlignment) ))
+                {
+                break;
+                }
+
+            if ( param.iVectorParam.iVectorLength && ( ( (param.iDir & RemoteFunctionCallData::EIn) && ( RemoteFunctionCallData::EOpRequestWithReply == iRFC.Header().iOpType || RemoteFunctionCallData::EOpRequest == iRFC.Header().iOpType ) ) ||
+                    ( (param.iDir & RemoteFunctionCallData::EOut) && iRFC.Header().iOpType == RemoteFunctionCallData::EOpReply ) ) )
+                {
+                //Only serialise vector data if data is valid and the direction matches
+                if ( !WriteVector( param.iVectorParam.iData, param.iVectorParam.iDataTypeSize, param.iVectorParam.iVectorLength, param.iVectorParam.iDataTypeAlignment ) )
+                    {
+                    break;
+                    }
+                }
+            }
+        }
+    
+    return iWriteState.iDestIndex;
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C void SerializedFunctionCall::SetDataCopier( MDataCopier* aDataCopier )
+    {
+    iDataCopier = aDataCopier;        
+    }
+
+// -----------------------------------------------------------------------------
+// 
+// -----------------------------------------------------------------------------
+//
+SER_EXPORT_C SerializedFunctionCall::SerializedFunctionCall( RemoteFunctionCallData& aRFC, MDataCopier* aDataCopier ):
+	iRFC( aRFC ),
+    iDataCopier( aDataCopier )
+    {
+    }