# HG changeset patch # User Matt Plumtree # Date 1286376190 -3600 # Node ID 4f400a6ea71f80160ea29e8d016c0319a6174d79 # Parent 3b4f7e9d873f0096b91a00c01a5edc2ec9775755 Rearrange the package to put certain components into a new collection, vghwinterface. Remove unpopulated syborggraphicswrapper, as it will be integrated into the vghwapiwrapper (ne khronosapiwrapper). diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/api/group/bld.inf --- a/guestrendering/guestvideodriver/api/group/bld.inf Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -// 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/api/group/guestvideodriver.mmp --- a/guestrendering/guestvideodriver/api/group/guestvideodriver.mmp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -// 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 - -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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/api/src/guestvideodriver.cpp --- a/guestrendering/guestvideodriver/api/src/guestvideodriver.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,264 +0,0 @@ -// 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 -#include -#include -#include - -#include -#include -#include - -#include "remotefunctioncall.h" -#include "serializedfunctioncall.h" - -// tracing -#ifdef _DEBUG -#include - #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 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(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 handle( aChunkHandle ); - TPckg address( aHWAddress ); - return DoControl( GuestVideoDriver::ERequestMapAddress, (TAny*)&handle, (TAny*)&address ); - } - -// ----------------------------------------------------------------------------- -// RGuestVideDriver::GetSurfaceBufferBaseAddress -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RGuestVideoDriver::GetSurfaceBufferBaseAddress( TUint32& aSurfaceBufferBaseAddress ) - { - TPckg address( aSurfaceBufferBaseAddress ); - return DoControl( GuestVideoDriver::ERequestSurfaceBufferBaseAddress, (TAny*)&address ); - } - -// ----------------------------------------------------------------------------- -// RGuestVideoDriver::EglGetSgHandles -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt RGuestVideoDriver::EglGetSgHandles( const TUint64 aId, TUint64 *aSgHandles ) - { - TPckg sgId( aId ); - TPckg 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); - } diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/group/bld.inf --- a/guestrendering/guestvideodriver/group/bld.inf Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -// 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/ldd/group/bld.inf --- a/guestrendering/guestvideodriver/ldd/group/bld.inf Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -// 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 -virtualvideohwdevice.mmp diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/ldd/group/reqhandlerextension.mmp --- a/guestrendering/guestvideodriver/ldd/group/reqhandlerextension.mmp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -// 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 - - -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 - diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp --- a/guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -// 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 - -TARGET guestvideohw.ldd -TARGETTYPE ldd - - -UID 0 0x20026A2E //- 0x20026A32 -LINKAS guestvideohw.ldd -VENDORID 0x70000001 -CAPABILITY all -DEFFILE /epoc32/include/def/eabi/guestvideohw.def - -EPOCALLOWDLLDATA - -OS_LAYER_SYSTEMINCLUDE -OS_LAYER_KERNEL_SYSTEMINCLUDE -OS_LAYER_ESTLIB_SYSTEMINCLUDE -USERINCLUDE ../inc -USERINCLUDE ../../commoninc - -// NOTE the old name was "adaptation". The new layer name is "adapt". -// If your repository is off ...adaptation, re-sync it from its new home -// for example http://developer.symbian.org/oss/FCL/sf/adapt/qemu -#include <../../../../../../adapt/qemu/baseport/syborg/variant.mmh> -USERINCLUDE ../../../../../../adapt/qemu/baseport/syborg/specific - -SYSTEMINCLUDE /epoc32/include/drivers - -SOURCEPATH ../src -SOURCE virtualvideohwdevice.cpp -SOURCE virtualvideohwchannel.cpp -SOURCE devicereqhandler.cpp -SOURCE virtualvideohwinterface.cpp - -USERINCLUDE ../../../vghwserialiser/inc -#ifdef FAISALMEMON_S4_SGIMAGE -USERINCLUDE ../../../graphicsresourceimplementation/inc -#endif - -SOURCEPATH ../../../vghwserialiser/src -SOURCE remotefunctioncall.cpp -SOURCE serializedfunctioncall.cpp -SOURCE eglrfc.cpp -SOURCE openvgrfc.cpp -SOURCE driverrfc.cpp -SOURCE opengles11rfc.cpp - -// We need to link to some ASSP kernel extension here -// TODO FAISALMEMON Need to confirm the correct library -LIBRARY kasyborg.lib - -#ifdef FAISALMEMON_S4_SGIMAGE -LIBRARY reqhandlerextension.lib -LIBRARY sgextension.lib -#endif - -start wins -win32_headers -end diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/ldd/src/devicereqhandler.cpp --- a/guestrendering/guestvideodriver/ldd/src/devicereqhandler.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1453 +0,0 @@ -// 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: -// Device Request Handler Implementation - - -#include -#include -#include -#include - -#include -#include -#include - -#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 GuestVideoDriver; - -// 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" ); -#ifdef FAISALMEMON_S4_SGIMAGE - ReqHandlerExtension::SetReqHandler( this ); -#endif - } - -// ----------------------------------------------------------------------------- -// 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(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(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 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;iiRemoteFunctionCall.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( paramAddr ), VVI_PARAMETERS_OUTPUT_MEMORY_SIZE ); - TPckg 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( paramAddr ), VVI_PARAMETERS_OUTPUT_MEMORY_SIZE ); - TPckg 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(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" ); - 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 - } - -#ifdef FAISALMEMON_S4_SGIMAGE - EGLSurface surface( EGL_NO_SURFACE );//The pbuffer surface to sync from, if needed - VGboolean syncNeeded = VG_FALSE; - if( sgId != NULL ) - { - VVHW_TRACE( "DDeviceReqHandler::getVGSyncInOp SgImage-backing VGImage found" ); - DSgResource* resource; - HBuf8* data = OpenSgImageMetaData( sgId, resource ); - if( data ) - { - TSgImageMetaData sginfo (((TPckgBuf*) 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 ); - } -#endif - } - - -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" ); -#ifdef FAISALMEMON_S4_SGIMAGE - 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 -#endif - VVHW_TRACE( "Pbuffer creation RequestComplete" ); - break; - } - case DriverRFC::EDrvCreateVGImageSg: - { - VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult : EDrvCreateVGImageSg" ); -#ifdef FAISALMEMON_S4_SGIMAGE - 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 -#endif - 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."); - } - -#ifdef FAISALMEMON_S4_SGIMAGE -/** - * 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 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 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 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 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; - } -#endif - -TInt DDeviceReqHandler::DestroySgImage( const TUint64 aId ) - { - VVHW_TRACE("DDeviceReqHandler::DestroySgImage ->"); - -#ifdef FAISALMEMON_S4_SGIMAGE - TBool allok = ETrue; - TAsyncRequest* req(0); - TPckg res( iOpReturn ); - EGLSurface surface(0); - VGImage image(0); - DSgResource* resource; - HBuf8* data = OpenSgImageMetaData( aId, resource ); - if( data ) - { - TSgImageMetaData sginfo (((TPckgBuf*) 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 data( req->iRemoteFunctionCall ); - req->iA1 = (TAny*)(&data); - allok = InitiateRequestWithReply( req, 0 ); - } - if( !allok ) - { - //TODO - } - while( status == KRequestPending ) - { - NKern::Sleep( 20 ); - } -#endif - - 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 ); -#ifdef FAISALMEMON_S4_SGIMAGE - DSgResource* resource; - VVHW_TRACE("EglRFC::EeglMetaSgGetHandles openSgImageMetaData" ); - HBuf8* data = OpenSgImageMetaData( id, resource ); - if( data && handles_size >= 2 ) - { - TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); - handles[0] = sginfo.iPbufferHandle; - handles[1] = sginfo.iVGImageHandle; - call.SetReturnValue( (int)EGL_TRUE ); - } - else - { - call.SetReturnValue( (int)EGL_FALSE ); - } - alreadyProcessed = EHandled; -#endif - 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 ) - { -#ifdef FAISALMEMON_S4_SGIMAGE - DSgResource* resource; - HBuf8* data = OpenSgImageMetaData( iPbufferSgMap[sgIdIndex].iSgId, resource ); - if( data ) - { - TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); - - if( !sginfo.iPbufferClean ) - { - img = sginfo.iVGImageHandle; - //sync with the underlying pbuffer surface - syncRequirement = syncRequirement | KSyncDrawSurface; - call.AppendEGLint( img ); - } - delete data; - } -#endif - } - obj.iPbuffer = read; - obj.iSgId = 0; - - sgIdIndex = iPbufferSgMap.FindInOrder( obj, iPbufferSgMapOrder ); - if( sgIdIndex != KErrNotFound ) - { -#ifdef FAISALMEMON_S4_SGIMAGE - DSgResource* resource; - HBuf8* data = OpenSgImageMetaData( iPbufferSgMap[sgIdIndex].iSgId, resource ); - if( data ) - { - TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); - - if( !sginfo.iPbufferClean ) - { - img = sginfo.iVGImageHandle; - //sync with the underlying pbuffer surface - syncRequirement = syncRequirement | KSyncReadSurface; - } - delete data; - } -#endif - } - 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 - -#ifdef FAISALMEMON_S4_SGIMAGE - DSgResource* resource; - HBuf8* data = OpenSgImageMetaData( sgId, resource ); - if( data ) - { - TSgImageMetaData sginfo (((TPckgBuf*) 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 -#endif - 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; - } - -#ifdef FAISALMEMON_S4_SGIMAGE -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 - } -#endif diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/ldd/src/reqhandlerextension.cpp --- a/guestrendering/guestvideodriver/ldd/src/reqhandlerextension.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -// 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 - request handler extension (a.k.a. Command Scheduler extension) -// - -#include -#include -#include - -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; - } - diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/ldd/src/virtualvideohwchannel.cpp --- a/guestrendering/guestvideodriver/ldd/src/virtualvideohwchannel.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,288 +0,0 @@ -// 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: -// Virtual Video Hardware Channel implementation - -#include -#include - -#include -#include -#include -#include -#include - -#include "serializedfunctioncall.h" - -// ----------------------------------------------------------------------------- -// 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 GuestVideoDriver; - 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 GuestVideoDriver; - - // 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; - } - - - -#ifdef FAISALMEMON_S4_SGIMAGE -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 metaDataPckg; - - metaDataErr = sgResource->GetMetaData( metaDataPckg ); - if ( metaDataErr == KErrNone ) - { - aSgInfo = metaDataPckg(); - } - - sgResource->Close(); - } - return metaDataErr; - } -#endif - - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwChannel::DoControl -// ----------------------------------------------------------------------------- -// -TInt DVirtualVideoHwChannel::DoControl( - DThread*& aUserThread, - TInt aFunction, - TAny* a1, - TAny* a2 ) - { - using namespace GuestVideoDriver; - - // Default error condition - TInt err = KErrNone; - - switch( aFunction ) - { - case ERequestMapAddress: - { - TPckgBuf 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 address( physicalAddress ); - err = Kern::ThreadDesWrite( aUserThread, a2, address, 0, 0, aUserThread ); - Kern::ChunkClose( chunk ); - chunk = NULL; - } - else - { - err = KErrGeneral; - } - } - break; - } - case ERequestSurfaceBufferBaseAddress: - { - TPhysAddr physicalAddress(0); - physicalAddress = iHwInterface.GetSurfaceBufferBase(); - TPckgC address(physicalAddress); - err = Kern::ThreadDesWrite(aUserThread, a1, address, 0, 0, aUserThread); - break; - } -#ifdef FAISALMEMON_S4_SGIMAGE - case ERequestSgHandles: - { - VVHW_TRACE("DVirtualVideoHwChannel::DoControl - ERequestSgHandles" ); - TPckgBuf 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 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; - } -#endif - default: - { - // Other functions are not supported - err = KErrNotSupported; - } - break; - } - - return err; - } - diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/ldd/src/virtualvideohwdevice.cpp --- a/guestrendering/guestvideodriver/ldd/src/virtualvideohwdevice.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -// 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: -// Virtual Video Hardware Device Implementation - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -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 GuestVideoDriver; - iVersion = TVersion( KMajorVer, KMinorVer, KBuildVer ); - iHwInterface = new DVirtualVideoHwInterface; - Kern::Printf("DVirtualVideoHwDevice::DVirtualVideoHwDevice()<"); - VVHW_TRACE("DVirtualVideoHwDevice::DVirtualVideoHwDevice"); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwDevice::Install -// ----------------------------------------------------------------------------- -// -TInt DVirtualVideoHwDevice::Install() - { - // Our name, used by User::FreeLogicalDevice - TInt err = SetName( &GuestVideoDriver::KDeviceName ); - if ( err != KErrNone ) - { - VVHW_TRACE("DVirtualVideoHwDevice::Install SetName %d", err); - return err; - } - - // Enter critical section - NKern::ThreadEnterCS(); - - err = Kern::DfcQCreate( iDfcQ, KPriority, &GuestVideoDriver::KDfcThreadName ); - - // Leave critical section - NKern::ThreadLeaveCS(); - - if ( err != KErrNone ) - { - VVHW_TRACE("DVirtualVideoHwDevice::Install Kern::DfcQCreate %d", err); - return err; - } - - // We have already created this during construction - // 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; - } diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/ldd/src/virtualvideohwinterface.cpp --- a/guestrendering/guestvideodriver/ldd/src/virtualvideohwinterface.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,327 +0,0 @@ -// 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: -// Implementation of Virtual Video Hardware Interface - - -// INCLUDE FILES -#include -#include - -#include -#include -#include -#include "syborg.h" - -// CONSTANTS - -#ifdef PLATSIM_CONFIG -_LIT( KVirtualVideoHwInterfacePanic, "DVirtualVideoHwInterface" ); -#endif - -// ============================ LOCAL DATA TYPES =============================== - -TPhysAddr DVirtualVideoHwInterface::iVideoRamBasePhys = NULL; - -// 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, - VVI_R_SHARED_CMD_MEMORY_BASE, - VVI_R_SHARED_SURFACEBUFFER_MEMORY_BASE - }; -#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() - { - VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()>"); - iInputParametersMemoryChunk = NULL; - iOutputParametersMemoryChunk = NULL; - iRegisterMemoryChunk = NULL; - -#ifdef PLATSIM_CONFIG - iVideoRamBasePhys = VVI_BASE; -#else - // Reserve a contiguous memory chunk for graphics usage - TUint32 ramSize = VVI_PARAMETERS_INPUT_MEMORY_SIZE + - VVI_PARAMETERS_OUTPUT_MEMORY_SIZE + - VVI_SURFACEBUFFER_MEMORY_SIZE; - TInt r = Epoc::AllocPhysicalRam( ramSize, iVideoRamBasePhys ); - VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface() AllocPhysicalRam %d", r); - if (r != KErrNone) - { - NKern::ThreadLeaveCS(); - Kern::Fault("DVirtualVideoHwInterface Allocate Ram %d",r); - } - SetSharedCmdMemBase( iVideoRamBasePhys + VVI_PARAMETERS_INPUT_BASE_ADDRESS ); - SetSharedSurfacebufferMemBase( iVideoRamBasePhys + VVI_SURFACEBUFFER_BASE_ADDRESS ); - -#endif // PLATSIM_CONFIG - VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()<"); - } - - -// ----------------------------------------------------------------------------- -// 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( iVideoRamBasePhys + VVI_PARAMETERS_INPUT_BASE_ADDRESS, - VVI_PARAMETERS_INPUT_MEMORY_SIZE, iInputParametersMemoryChunk, - iInputParametersChunkKernelAddress ); - } - -TInt DVirtualVideoHwInterface::InitParametersOutputMemory() - { - return InitPhysicalMemory( iVideoRamBasePhys + VVI_PARAMETERS_OUTPUT_BASE_ADDRESS, - VVI_PARAMETERS_OUTPUT_MEMORY_SIZE, iOutputParametersMemoryChunk, - iOutputParametersChunkKernelAddress ); - } - -TInt DVirtualVideoHwInterface::InitRegisterMemory() - { -#ifdef PLATSIM_CONFIG - return InitPhysicalMemory( VVI_REGISTERS_BASE_ADDRESS, - VVI_REGISTERS_MEMORY_SIZE, iRegisterMemoryChunk, - iRegisterChunkKernelAddress ); -#else - return KErrNone; -#endif // PLATSIM_CONFIG - } - -// ----------------------------------------------------------------------------- -// 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::SetSharedCmdMemBase -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::SetSharedCmdMemBase( TUint32 aPhysicalAddress ) - { - VVHW_TRACE("DVirtualVideoHwInterface::SetSharedCmdMemBase 0x%08x", aPhysicalAddress); - SetRegisterValue( ERegSharedCmdMemBase, aPhysicalAddress ); - } - -void DVirtualVideoHwInterface::SetSharedSurfacebufferMemBase( TUint32 aPhysicalAddress ) - { - VVHW_TRACE("DVirtualVideoHwInterface::SetSharedSurfacebufferMemBase 0x%08x", aPhysicalAddress); - SetRegisterValue( ERegSharedSurfacebufferMemBase, aPhysicalAddress ); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::GetRegisterValue -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::GetRegisterValue( - TRegister aRegister, - TUint32& aValue ) - { - if ( iRegisterMemoryChunk ) - { - TLinAddr offset = RegisterOffset( aRegister ); - TUint32* ptr = reinterpret_cast( iRegisterChunkKernelAddress + offset ); - aValue = *ptr; - } - else - { -#ifdef PLATSIM_CONFIG - Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady ); -#else - TLinAddr offset = RegisterOffset( aRegister ); - aValue = ReadReg( KHwGraphicsRegBase, offset ); -#endif // PLATSIM_CONFIG - } - } - - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::SetRegisterValue -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::SetRegisterValue( - TRegister aRegister, - TUint32 aValue ) - { - if ( iRegisterMemoryChunk ) - { - TLinAddr offset = RegisterOffset( aRegister ); - TUint32* ptr = reinterpret_cast( iRegisterChunkKernelAddress + offset ); - *ptr = aValue; - } - else - { -#ifdef PLATSIM_CONFIG - Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady ); -#else - TLinAddr offset = RegisterOffset( aRegister ); - WriteReg( KHwGraphicsRegBase, offset, aValue ); -#endif // PLATSIM_CONFIG - } - } - -EXPORT_C TPhysAddr DVirtualVideoHwInterface::GetSurfaceBufferBase() - { - TPhysAddr ret = 0; - if( iVideoRamBasePhys != 0 ) - { - ret = iVideoRamBasePhys + VVI_SURFACEBUFFER_BASE_ADDRESS; - } - return ret; - } - diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/guestvideodriver/rom/guestvideodriver.iby --- a/guestrendering/guestvideodriver/rom/guestvideodriver.iby Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -// 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 - -#ifdef FAISALMEMON_S4_SGIMAGE -extension[VARID]=KERNEL_DIR\BUILD_DIR\reqhandlerextension.dll \sys\bin\reqhandlerextension.dll -#endif -device[VARID]=KERNEL_DIR\BUILD_DIR\guestvideohw.ldd \sys\bin\guestvideohw.ldd - -#endif // GUESTVIDEODRIVER_IBY - -// End of File diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/eabi/vghwserialiseru.def --- a/guestrendering/vghwserialiser/eabi/vghwserialiseru.def Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -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 - diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/group/bld.inf --- a/guestrendering/vghwserialiser/group/bld.inf Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,21 +0,0 @@ -// 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/group/vghwserialiser.mmp --- a/guestrendering/vghwserialiser/group/vghwserialiser.mmp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -// 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/driverrfc.h --- a/guestrendering/vghwserialiser/inc/driverrfc.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,276 +0,0 @@ -// 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 - #include - #include -#else - #include "EGL/egl.h" - #include "EGL/eglext.h" -#endif - -#ifdef __SYMBIAN32__ - #define __VG_OPENVG_H_ - #include - #include -#else - #define __OPENVGHEADERS_USE_VG_1_1 - #include - #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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/driverrfc.inl --- a/guestrendering/vghwserialiser/inc/driverrfc.inl Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,546 +0,0 @@ -// 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(aData), aLength, aIndex ); - } - -inline void DriverRFC::SetEGLConfigVectorData( const EGLConfig* aData, TInt aLength, TInt aIndex ) - { - RemoteFunctionCall::SetVectorData( EEGLConfig, reinterpret_cast(aData), aLength, aIndex ); - } - - -inline void DriverRFC::AppendEGLBoolean( const EGLBoolean& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLBoolean, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLint( const EGLint& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLint, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLenum( const EGLenum& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLenum, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLDisplay( const EGLDisplay& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLDisplay, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLConfig( const EGLConfig& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLConfig, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLSurface( const EGLSurface& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLSurface, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLContext( const EGLContext& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLContext, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLClientBuffer( const EGLClientBuffer& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLClientBuffer, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLImageKHR( const EGLImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLImageKHR, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLNativeDisplayType( const NativeDisplayType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLNativeDisplayType, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLNativeWindowType( const NativeWindowType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLNativeWindowType, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLNativePixmapType( const NativePixmapType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLNativePixmapType, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendEGLintVector( const EGLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EEGLint, aLength, reinterpret_cast( aData ), aDir ); - } - -inline void DriverRFC::AppendEGLConfigVector( const EGLConfig* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EEGLConfig, aLength, reinterpret_cast( aData ), aDir ); - } - -#ifdef __SYMBIAN32__ -inline void DriverRFC::AppendEGLSize( const TSize& aSize, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLint, reinterpret_cast(&aSize.iWidth), aDir ); - AppendParam( EEGLint, reinterpret_cast(&aSize.iHeight), aDir ); - } -#endif - -inline void DriverRFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EEGLVoid, aLength, reinterpret_cast( 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(aData), aLength, aIndex ); - } - - -inline void DriverRFC::AppendTUint32( const TUint32& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( ETUint32, reinterpret_cast(&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(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGbyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGbyte, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGubyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGubyte, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGshort& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGshort, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGint& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGint, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGuint& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast(&aParam), aDir ); - } - - -inline void DriverRFC::AppendVGParam( const VGboolean& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGboolean, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGErrorCode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGErrorCode, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGRenderingQuality& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGRenderingQuality, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPixelLayout& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPixelLayout, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGMatrixMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGMatrixMode, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGMaskOperation& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGMaskOperation, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPathDatatype& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathDatatype, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPathAbsRel& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathAbsRel, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPathSegment& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPathCommand& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPathCapabilities& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathCapabilities, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPathParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGCapStyle& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGCapStyle, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGJoinStyle& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGJoinStyle, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGFillRule& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGFillRule, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPaintMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPaintMode, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPaintParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGPaintType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGColorRampSpreadMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGColorRampSpreadMode, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGTilingMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGTilingMode, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGImageFormat& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageFormat, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGImageQuality& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageQuality, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGImageParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGImageMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageMode, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGImageChannel& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageChannel, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGBlendMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGBlendMode, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGHardwareQueryType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGHardwareQueryType, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGHardwareQueryResult& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGHardwareQueryResult, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGStringID& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGStringID, reinterpret_cast(&aParam), aDir ); - } - -inline void DriverRFC::AppendVGParam( const VGUArcType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGUArcType, reinterpret_cast(&aParam), aDir ); - } - -#ifdef __SYMBIAN32__ -inline void DriverRFC::AppendVGParam( const VGeglImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGeglImageKHR, reinterpret_cast(&aParam), aDir ); - } -#endif - - diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/eglrfc.h --- a/guestrendering/vghwserialiser/inc/eglrfc.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,187 +0,0 @@ -// 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 - #include - #include -#else - #include "EGL/egl.h" - #include "EGL/eglext.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, - EeglSimulatorSetSurfaceParams, - EeglSimulatorCopyImageData, - 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/eglrfc.inl --- a/guestrendering/vghwserialiser/inc/eglrfc.inl Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,205 +0,0 @@ -// 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 = ((TUint64)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(aData), aLength, aIndex ); - } - -inline void EglRFC::SetEGLConfigVectorData( const EGLConfig* aData, TInt aLength, TInt aIndex ) - { - RemoteFunctionCall::SetVectorData( EEGLConfig, reinterpret_cast(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(&lower), aDir ); - AppendParam( EEGLint, reinterpret_cast(&upper), aDir ); - } - -inline void EglRFC::AppendEGLBoolean( const EGLBoolean& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLBoolean, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLint( const EGLint& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLint, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLenum( const EGLenum& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLenum, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLDisplay( const EGLDisplay& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLDisplay, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLConfig( const EGLConfig& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLConfig, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLSurface( const EGLSurface& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLSurface, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLContext( const EGLContext& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLContext, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLClientBuffer( const EGLClientBuffer& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLClientBuffer, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLImageKHR( const EGLImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLImageKHR, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLNativeDisplayType( const NativeDisplayType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLNativeDisplayType, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLNativeWindowType( const NativeWindowType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLNativeWindowType, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLNativePixmapType( const NativePixmapType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - AppendParam( EEGLNativePixmapType, reinterpret_cast(&aParam), aDir ); - } - -inline void EglRFC::AppendEGLintVector( const EGLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EEGLint, aLength, reinterpret_cast( aData ), aDir ); - } - -inline void EglRFC::AppendEGLConfigVector( const EGLConfig* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EEGLConfig, aLength, reinterpret_cast( 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(&aSize.iWidth), aDir ); - AppendParam( EEGLint, reinterpret_cast(&aSize.iHeight), aDir ); - } -#endif - -inline void EglRFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EEGLVoid, aLength, reinterpret_cast( 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(aData), aLength, aIndex ); - } diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/opengles11rfc.h --- a/guestrendering/vghwserialiser/inc/opengles11rfc.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,280 +0,0 @@ -// 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 -#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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/opengles11rfc.inl --- a/guestrendering/vghwserialiser/inc/opengles11rfc.inl Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -// 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(aData), aLength, aIndex ); -} -inline void OpenGlES11RFC::SetVectorData( const GLuint* aData, TInt aLength, TInt aIndex ) -{ - RemoteFunctionCall::SetVectorData( EGLuint, reinterpret_cast(aData), aLength, aIndex ); -} -inline void OpenGlES11RFC::SetVectorData( const GLshort* aData, TInt aLength, TInt aIndex ) -{ - RemoteFunctionCall::SetVectorData( EGLshort, reinterpret_cast(aData), aLength, aIndex ); -} -inline void OpenGlES11RFC::SetVectorData( const GLfloat* aData, TInt aLength, TInt aIndex ) -{ - RemoteFunctionCall::SetVectorData( EGLfloat, reinterpret_cast(aData), aLength, aIndex ); -} -inline void OpenGlES11RFC::SetVectorData( const GLboolean* aData, TInt aLength, TInt aIndex ) -{ - RemoteFunctionCall::SetVectorData( EGLboolean, reinterpret_cast(aData), aLength, aIndex ); -} -inline void OpenGlES11RFC::SetVectorData( const void* aData, TInt aLength, TInt aIndex ) -{ - RemoteFunctionCall::SetVectorData( EGLvoid, reinterpret_cast(aData), aLength, aIndex ); -} - - -inline void OpenGlES11RFC::AppendParam( const GLbyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendParam( EGLbyte, reinterpret_cast(&aParam), aDir ); -} -inline void OpenGlES11RFC::AppendParam( const GLubyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendParam( EGLubyte, reinterpret_cast(&aParam), aDir ); -} -inline void OpenGlES11RFC::AppendParam( const GLshort& aParam, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendParam( EGLshort, reinterpret_cast(&aParam), aDir ); -} -inline void OpenGlES11RFC::AppendParam( const GLushort& aParam, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendParam( EGLushort, reinterpret_cast(&aParam), aDir ); -} -inline void OpenGlES11RFC::AppendParam( const GLint& aParam, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendParam( EGLint, reinterpret_cast(&aParam), aDir ); -} -inline void OpenGlES11RFC::AppendParam( const GLuint& aParam, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendParam( EGLuint, reinterpret_cast(&aParam), aDir ); -} -inline void OpenGlES11RFC::AppendParam( const GLfloat& aParam, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendParam( EGLfloat, reinterpret_cast(&aParam), aDir ); -} - - -inline void OpenGlES11RFC::AppendVector( const GLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendVector( EGLint, aLength, reinterpret_cast( aData ), aDir ); -} -inline void OpenGlES11RFC::AppendVector( const GLuint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendVector( EGLuint, aLength, reinterpret_cast( aData ), aDir ); -} -inline void OpenGlES11RFC::AppendVector( const GLshort* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendVector( EGLshort, aLength, reinterpret_cast( aData ), aDir ); -} -inline void OpenGlES11RFC::AppendVector( const GLfloat* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendVector( EGLfloat, aLength, reinterpret_cast( aData ), aDir ); -} -inline void OpenGlES11RFC::AppendVector( const GLboolean* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendVector( EGLboolean, aLength, reinterpret_cast( aData ), aDir ); -} -inline void OpenGlES11RFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) -{ - RemoteFunctionCall::AppendVector( EGLvoid, aLength, reinterpret_cast( aData ), aDir ); -} diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/openvgrfc.h --- a/guestrendering/vghwserialiser/inc/openvgrfc.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,315 +0,0 @@ -// 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 - #include -#else - #define __OPENVGHEADERS_USE_VG_1_1 - #include - #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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/openvgrfc.inl --- a/guestrendering/vghwserialiser/inc/openvgrfc.inl Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,462 +0,0 @@ -// 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 = ((TUint64)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(aData), aLength, aIndex ); - } - -inline void OpenVgRFC::SetVectorData( const VGint* aData, TInt aLength, TInt aIndex ) - { - RemoteFunctionCall::SetVectorData( EVGint, reinterpret_cast(aData), aLength, aIndex ); - } - -inline void OpenVgRFC::SetVectorData( const VGuint* aData, TInt aLength, TInt aIndex ) - { - RemoteFunctionCall::SetVectorData( EVGuint, reinterpret_cast(aData), aLength, aIndex ); - } - -inline void OpenVgRFC::SetVectorData( const VGshort* aData, TInt aLength, TInt aIndex ) - { - RemoteFunctionCall::SetVectorData( EVGshort, reinterpret_cast(aData), aLength, aIndex ); - } - -inline void OpenVgRFC::SetVectorData( const VGubyte* aData, TInt aLength, TInt aIndex ) - { - RemoteFunctionCall::SetVectorData( EVGubyte, reinterpret_cast(aData), aLength, aIndex ); - } - -inline void OpenVgRFC::SetVectorData( const void* aData, TInt aLength, TInt aIndex ) - { - RemoteFunctionCall::SetVectorData( EVGvoid, reinterpret_cast(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(&lower), aDir ); - RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast(&upper), aDir ); - } -inline void OpenVgRFC::AppendParam( const VGfloat& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGfloat, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGbyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGbyte, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGubyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGubyte, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGshort& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGshort, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGint& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGint, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGuint& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast(&aParam), aDir ); - } - - -inline void OpenVgRFC::AppendParam( const VGboolean& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGboolean, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGErrorCode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGErrorCode, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGRenderingQuality& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGRenderingQuality, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPixelLayout& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPixelLayout, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGMatrixMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGMatrixMode, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGMaskOperation& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGMaskOperation, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPathDatatype& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathDatatype, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPathAbsRel& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathAbsRel, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPathSegment& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPathCommand& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPathCapabilities& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathCapabilities, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPathParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPathParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGCapStyle& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGCapStyle, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGJoinStyle& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGJoinStyle, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGFillRule& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGFillRule, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPaintMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPaintMode, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPaintParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGPaintType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGColorRampSpreadMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGColorRampSpreadMode, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGTilingMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGTilingMode, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGImageFormat& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageFormat, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGImageQuality& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageQuality, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGImageParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageParamType, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGImageMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageMode, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGImageChannel& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGImageChannel, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGBlendMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGBlendMode, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGHardwareQueryType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGHardwareQueryType, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGHardwareQueryResult& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGHardwareQueryResult, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGStringID& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGStringID, reinterpret_cast(&aParam), aDir ); - } - -inline void OpenVgRFC::AppendParam( const VGUArcType& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGUArcType, reinterpret_cast(&aParam), aDir ); - } - -#ifdef __SYMBIAN32__ -inline void OpenVgRFC::AppendParam( const VGeglImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendParam( EVGeglImageKHR, reinterpret_cast(&aParam), aDir ); - } -#endif - -inline void OpenVgRFC::AppendVector( const VGfloat* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EVGfloat, aLength, reinterpret_cast( aData ), aDir ); - } - -inline void OpenVgRFC::AppendVector( const VGint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EVGint, aLength, reinterpret_cast( aData ), aDir ); - } - -inline void OpenVgRFC::AppendVector( const VGuint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EVGuint, aLength, reinterpret_cast( aData ), aDir ); - } - -inline void OpenVgRFC::AppendVector( const VGshort* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EVGshort, aLength, reinterpret_cast( aData ), aDir ); - } - -inline void OpenVgRFC::AppendVector( const VGubyte* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EVGubyte, aLength, reinterpret_cast( aData ), aDir ); - } - -inline void OpenVgRFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) - { - RemoteFunctionCall::AppendVector( EVGvoid, aLength, reinterpret_cast( aData ), aDir ); - } diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/remotefunctioncall.h --- a/guestrendering/vghwserialiser/inc/remotefunctioncall.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,189 +0,0 @@ -// 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 -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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/requestbuffer.h --- a/guestrendering/vghwserialiser/inc/requestbuffer.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -// 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/serialisedapiuids.h --- a/guestrendering/vghwserialiser/inc/serialisedapiuids.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -// 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/serializedfunctioncall.h --- a/guestrendering/vghwserialiser/inc/serializedfunctioncall.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,163 +0,0 @@ -// 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/inc/serializerplatform.h --- a/guestrendering/vghwserialiser/inc/serializerplatform.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -// 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 -#include - -#ifdef __KERNEL_MODE__ -#include -#undef ASSERT(x) -#define ASSERT(x) -#define SER_IMPORT_C -#define SER_EXPORT_C -#else -#include -#define SER_IMPORT_C IMPORT_C -#define SER_EXPORT_C EXPORT_C -#endif -#else -#include -#include - -#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 diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/src/driverrfc.cpp --- a/guestrendering/vghwserialiser/src/driverrfc.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -// 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; - } diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/src/eglrfc.cpp --- a/guestrendering/vghwserialiser/src/eglrfc.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -// 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; - } diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/src/opengles11rfc.cpp --- a/guestrendering/vghwserialiser/src/opengles11rfc.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -// 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; -} diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/src/openvgrfc.cpp --- a/guestrendering/vghwserialiser/src/openvgrfc.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -// 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; - } diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/src/remotefunctioncall.cpp --- a/guestrendering/vghwserialiser/src/remotefunctioncall.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,435 +0,0 @@ -// 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 -#include "serialisedapiuids.h" -// Guest 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(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*)¶m.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( 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 ); - } diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwserialiser/src/serializedfunctioncall.cpp --- a/guestrendering/vghwserialiser/src/serializedfunctioncall.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,495 +0,0 @@ -// 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(&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*)¶m.iDir, sizeof(param.iDir) ); - if ( ReadParam( (TUint8*)¶m.iType, sizeof(param.iType) ) ) - { - - if ( RemoteFunctionCallData::TParam::ESimple == param.iType ) - { - ReadParam( (TUint8*)¶m.iSimpleParam.iDataType, sizeof(param.iSimpleParam.iDataType) ); - ReadParam( (TUint8*)¶m.iSimpleParam.iDataTypeSize, sizeof(param.iSimpleParam.iDataTypeSize) ); - ReadParam( (TUint8*)¶m.iSimpleParam.iData, param.iSimpleParam.iDataTypeSize ); - } - else if ( RemoteFunctionCallData::TParam::EVector == param.iType ) - { - ReadParam( (TUint8*)¶m.iVectorParam.iDataType, sizeof(param.iVectorParam.iDataType) ); - ReadParam( (TUint8*)¶m.iVectorParam.iVectorLength, sizeof(param.iVectorParam.iVectorLength) ); - ReadParam( (TUint8*)¶m.iVectorParam.iCallerAddress, sizeof(param.iVectorParam.iCallerAddress) ); - ReadParam( (TUint8*)¶m.iVectorParam.iDataTypeSize, sizeof(param.iVectorParam.iDataTypeSize) ); - ReadParam( (TUint8*)¶m.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*)¶m.iDir, - sizeof(param.iDir) ) ) - { - break; - } - - if ( !WriteParam( (TUint8*)¶m.iType, - sizeof(param.iType) ) ) - { - break; - } - - if ( RemoteFunctionCallData::TParam::ESimple == param.iType ) - { - if ( !WriteParam( (TUint8*)¶m.iSimpleParam.iDataType, - sizeof(param.iSimpleParam.iDataType) ) ) - { - break; - } - if ( !WriteParam( (TUint8*)¶m.iSimpleParam.iDataTypeSize, - sizeof(param.iSimpleParam.iDataTypeSize) ) ) - { - break; - } - - if ( !WriteParam( (TUint8*)¶m.iSimpleParam.iData, param.iSimpleParam.iDataTypeSize ) ) - { - break; - } - } - else if ( RemoteFunctionCallData::TParam::EVector == param.iType ) - { - if ( !WriteParam( (TUint8*)¶m.iVectorParam.iDataType, sizeof(param.iVectorParam.iDataType) )) - { - break; - } - - if ( !WriteParam( (TUint8*)¶m.iVectorParam.iVectorLength, sizeof(param.iVectorParam.iVectorLength) )) - { - break; - } - - if ( !WriteParam( (TUint8*)¶m.iVectorParam.iCallerAddress, sizeof(param.iVectorParam.iCallerAddress) )) - { - break; - } - - if ( !WriteParam( (TUint8*)¶m.iVectorParam.iDataTypeSize, sizeof(param.iVectorParam.iDataTypeSize) )) - { - break; - } - - if ( !WriteParam( (TUint8*)¶m.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 ) - { - } diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwutils/eabi/vghwutilsu.def --- a/guestrendering/vghwutils/eabi/vghwutilsu.def Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -EXPORTS - _Z9VghwPanic10TVghwPanicPcS0_S0_i @ 1 NONAME - _ZN10CVghwUtils14MapToHWAddressEiRm @ 2 NONAME - _ZN10CVghwUtils20DriverExecuteCommandER22RemoteFunctionCallData @ 3 NONAME - _ZN10CVghwUtils11InitStaticsEv @ 4 NONAME - _ZN10CVghwUtils5AllocEi @ 5 NONAME - _ZN10CVghwUtils4FreeEPv @ 6 NONAME - _ZN10CVghwUtils7GetHeapEv @ 7 NONAME - _ZN10CVghwUtils16SwitchToVghwHeapEv @ 8 NONAME - _ZN10CVghwUtils18SwitchFromVghwHeapEP5RHeap @ 9 NONAME - Reserved10 @ 10 NONAME ABSENT - Reserved11 @ 11 NONAME ABSENT - _ZN10CVghwUtils17CreateThreadStateEv @ 12 NONAME - _ZN10CVghwUtils18ReleaseThreadStateEv @ 13 NONAME - _ZN10CVghwUtils14EglThreadStateEv @ 14 NONAME - _ZN10CVghwUtils9VgContextEv @ 15 NONAME - _ZN10CVghwUtils11GlesContextEv @ 16 NONAME - _ZN15TEglThreadState8EglErrorEv @ 17 NONAME - _ZN15TEglThreadState17ExecEglBooleanCmdER6EglRFC @ 18 NONAME - _ZN15TEglThreadState17ExecEglContextCmdER6EglRFC @ 19 NONAME - _ZN15TEglThreadState17ExecEglSurfaceCmdER6EglRFC @ 20 NONAME - _ZN10CVghwUtils16EglManagementApiEv @ 21 NONAME - _ZN10CVghwUtils15EglGetSgHandlesEyPy @ 22 NONAME - _ZN10CVghwUtils14DestroyStaticsEv @ 23 NONAME - _ZN10CVghwUtils19SetEglManagementApiEP17MEglManagementApi @ 24 NONAME - _ZN10CVghwUtils14SetVgApiForEglEP12MVgApiForEgl @ 25 NONAME - _ZN10CVghwUtils18SetGles11ApiForEglEP16MGles11ApiForEgl @ 26 NONAME - _ZN10CVghwUtils17SetGles2ApiForEglEP15MGles2ApiForEgl @ 27 NONAME - _ZN10CVghwUtils11VgApiForEglEv @ 28 NONAME - _ZN10CVghwUtils15Gles11ApiForEglEv @ 29 NONAME - _ZN10CVghwUtils14Gles2ApiForEglEv @ 30 NONAME - _ZN10CVghwUtils27GetSurfaceBufferBaseAddressERm @ 31 NONAME diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwutils/group/bld.inf --- a/guestrendering/vghwutils/group/bld.inf Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -// 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 VG Hardware Utilities - -PRJ_PLATFORMS -DEFAULT -WINSCW - -PRJ_EXPORTS -../rom/vghwutils.iby /epoc32/rom/include/vghwutils.iby - -PRJ_MMPFILES -vghwutils.mmp diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwutils/group/vghwutils.mmp --- a/guestrendering/vghwutils/group/vghwutils.mmp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -// 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 vghwutils - -TARGET vghwutils.dll -TARGETTYPE dll -UID 0x1000008d 0x20026A32 -capability CAP_GENERAL_DLL //All -Tcb -vendorid VID_DEFAULT //0x101FB657 //Nokia vendor id - -OS_LAYER_ESTLIB_SYSTEMINCLUDE -OS_LAYER_SYSTEMINCLUDE -USERINCLUDE ../inc -SYSTEMINCLUDE /epoc32/include -//systeminclude /epoc32/include/libc // STDLIB include files -//systeminclude /epoc32/include/vg // OpenVG include files -USERINCLUDE ../../vghwserialiser/inc -// userinclude ../../platsimvideodriver/api/inc // Local include files -// userinclude ../../platsimvideodriver/commoninc // Local include files - -SOURCEPATH ../src - -SOURCE vghwutils.cpp - -// constructors & such for OpenVgRFC and EglRFC objects -SOURCEPATH ../../vghwserialiser/src -SOURCE eglrfc.cpp -SOURCE openvgrfc.cpp -SOURCE opengles11rfc.cpp - - -//nostrictdef - -LIBRARY euser.lib -LIBRARY guestvideohwapi.lib -LIBRARY vghwserialiser.lib - -#ifdef ENABLE_ABIV2_MODE -DEBUGGABLE_UDEBONLY -#endif - -EPOCALLOWDLLDATA diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwutils/inc/vghwutils.h --- a/guestrendering/vghwutils/inc/vghwutils.h Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,342 +0,0 @@ -// 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 __VGHWUTILS_H__ -#define __VGHWUTILS_H__ - -// Include Files -#include // CBase -#include -#include -#include -#include "eglrfc.h" - - -class RGuestVideoDriver; - -// Virtual Graphics Hardware per thread data: TEglThreadState is concrete, MVgContext & MGlesContext are per API interfaces -class TEglThreadState; -class MGlesContext; -class MVgContext; - -// data serialisation packages -class OpenVgRFC; -class EglRFC; -class RemoteFunctionCall; -class RemoteFunctionCallData; - -// tracing -#ifdef _DEBUG - #include - #define UTIL_TRACE(fmt, args...) RDebug::Printf(fmt, ##args) - #define VGHWPANIC_ASSERT(condition, panic) if (!(condition)) { VghwPanic(panic, #panic, #condition, __FILE__, __LINE__); } - #define VGHWPANIC_ASSERT_DEBUG(condition, panic) if (!(condition)) { VghwPanic(panic, #panic, #condition, __FILE__, __LINE__); } -#else - #define UTIL_TRACE(fmt, args...) - #define VGHWPANIC_ASSERT(condition, panic) if (!(condition)) { VghwPanic(panic, NULL, NULL, NULL, __LINE__); } - #define VGHWPANIC_ASSERT_DEBUG(condition, panic) -#endif - - -// Simulator Virtual Graphics Hardware panic codes -typedef enum - { - EVghwPanicNoVideoChannel = 1, - EVghwPanicOperationDataTooBig, - EVghwPanicDriverOpenError, - EVghwPanicVghwHeapDoesNotExist, - EVghwPanicInitializeFailed, - EVghwPanicGraphicsDriverNotOpen, - EVghwPanicSwitchToVghwHeapOldHeapIsVghwHeap, - EVghwPanicSwitchFromVghwHeapParamIsNull, - EVghwPanicSwitchFromVghwHeapOldHeapIsNotVghwHeap, - EVghwPanicSwitchFromVghwHeapParamIsVghwHeap, // 10 - EVghwPanicGraphicsCreationLockDoesNotExist, - EVghwPanicExecuteCommandFailed, - EVghwPanicBadVgErrorValue, - EVghwPanicBadGlesErrorValue, - EVghwPanicBadEglErrorValue, - EVghwPanicBadEglBoundApi, - } TVghwPanic; - -// This panic function is exported to allow inline functions to use it -IMPORT_C void VghwPanic(TVghwPanic aPanicCode, char* aPanicName, char* aCondition, char* aFile, TInt aLine); - - -// Mix-in class: EGL support functions, including SgImage support, expected to be called by Open VG and Open GL ES -class MEglManagementApi - { -public: - virtual TBool EglImageOpenForVgImage(EGLImageKHR aImage, TSize& aSize, VGHandle& aVgHandle, TUint64& aSgImageId) = 0; - virtual void EglImageClose(EGLImageKHR aImage) = 0; - // ToDo add an API so that Open VG can query the size of the current Context's surface - }; - - -typedef void (*ExtensionProcPointer)(...); - - -// Private interfaces for EGL to call into Open VG -class MVgApiForEgl - { -public: - virtual ExtensionProcPointer guestGetVgProcAddress (const char *aProcName) = 0; - }; - - -// Private interfaces for EGL to call into Open GL ES 1.1 -class MGles11ApiForEgl - { -public: - virtual ExtensionProcPointer guestGetGles11ProcAddress (const char *aProcName) = 0; - }; - - -// Private interfaces for EGL to call into Open GL ES 2 -class MGles2ApiForEgl - { -public: - virtual ExtensionProcPointer guestGetGles2ProcAddress (const char *aProcName) = 0; - }; - - -/* - VGHWUtils APIs are static for ease of use by the other Simulator Graphics DLLs. - - One (singleton) instance is created as Writeable Static Data when the DLL is loaded. - After initialization this will hold process-wide data - e.g. a memory heap for Graphics DLLs - to store local Symbian client state information. - - ToDo maybe make this a Symbian X class because it owns resources, but only as static data. - */ -NONSHARABLE_CLASS(CVghwUtils): public CBase - { - friend class TEglThreadState; // to limit visibility of DriverExecuteCommand -public: - // open Driver connection, create Memory Heap, etc... - IMPORT_C static void InitStatics(); - IMPORT_C static void DestroyStatics(); - - IMPORT_C static TInt MapToHWAddress(const TInt aChunkHandle, TUint32& aHWAddress); - IMPORT_C static TInt GetSurfaceBufferBaseAddress(TUint32& aHWAddress); - IMPORT_C static TInt EglGetSgHandles(const TUint64 aId, TUint64 *aSgHandles); - - // VG Memory Pool APIs (One heap is created for the process, for use by all Simulator Graphics DLLs) - IMPORT_C static TAny* Alloc(TInt aSize); - IMPORT_C static void Free(TAny* aPtr); - IMPORT_C static RHeap* GetHeap(); - IMPORT_C static RHeap* SwitchToVghwHeap(); - IMPORT_C static void SwitchFromVghwHeap(RHeap* aOldHeapPtr); - // handy function for Debug Asserts - static inline TBool UsingVghwHeap() { return &User::Heap() == GetHeap(); } - - // if this thread does not have a state object try to alloc a new one - IMPORT_C static TEglThreadState* CreateThreadState(); - // current state object, if any, for this thread (for EGL) - IMPORT_C static TEglThreadState* EglThreadState(); - // current state object, if Open VG, for this thread (as tracked by EGL DLL) - IMPORT_C static MVgContext* VgContext(); - // current state object for Open GL ES 1.1, for this thread (as tracked by EGL DLL) - IMPORT_C static MGlesContext* GlesContext(); - // free current state object, if any, for this thread - IMPORT_C static void ReleaseThreadState(); - - IMPORT_C static void SetEglManagementApi(MEglManagementApi* aEglManagementApi); - IMPORT_C static MEglManagementApi* EglManagementApi(); - - // Private interfaces for EGL to call into Open GL ES and Open VG (avoids breaking DEF file compatibility) - IMPORT_C static void SetVgApiForEgl(MVgApiForEgl* aVgApiForEgl); - IMPORT_C static MVgApiForEgl* VgApiForEgl(); - - IMPORT_C static void SetGles11ApiForEgl(MGles11ApiForEgl* aGles11ApiForEgl); - IMPORT_C static MGles11ApiForEgl* Gles11ApiForEgl(); - - IMPORT_C static void SetGles2ApiForEgl(MGles2ApiForEgl* aGles2ApiForEgl); - IMPORT_C static MGles2ApiForEgl* Gles2ApiForEgl(); - -protected: - IMPORT_C static void DriverExecuteCommand(RemoteFunctionCallData& aRequestData); - -private: - inline static RGuestVideoDriver& Driver(); - -private: - // everything is zeroed on construction, call Initialize() to prepare - volatile static TBool iInitialized; // NB "volatile" used for thread safety in InitStaticse() - static TInt iVghwInitMutex; // required for thread safety in Initialize() - - // static member objects - static RGuestVideoDriver* iDriver; - static RHeap* iHeap; - static MEglManagementApi* iEglManagementApi; - static MVgApiForEgl* iVgApiForEgl; - static MGles11ApiForEgl* iGles11ApiForEgl; - static MGles2ApiForEgl* iGles2ApiForEgl; - static TBool iLoadedOpenVgDll; - static TBool iLoadedOpenGles11Dll; - static TBool iLoadedOpenGles2Dll; - }; - - -// Basic interface for sending GL ES 1.1 commands down to Host Open GL ES implementation - can be expanded later -class MGlesContext - { -public: - // Execute Open GL ES 1.1 commands - virtual void ExecuteGlesCommand(RemoteFunctionCall& aGlesRequestData) = 0; - virtual void ExecuteGlesFlushCommand() = 0; - virtual void ExecuteGlesFinishCommand() = 0; - // GLES state - virtual void SetGlesError(GLenum aGlesErrorCode) = 0; - virtual GLenum GlesError() = 0; - // ToDo make context tracking work for VG & GL ES - virtual EGLContext GlesEglContext() = 0; - }; - - -// Basic interface for sending VG commands down to Host Open VG implementation - can be expanded later -class MVgContext - { -public: - // Execute Open VG commands - virtual void ExecuteVgCommand(OpenVgRFC& aVgApiData) = 0; - virtual void ExecuteVgFlushCommand() = 0; - virtual void ExecuteVgFinishCommand() = 0; - // VG state - virtual void SetVgError(VGErrorCode aVgErrorCode) = 0; - virtual VGErrorCode VgError() = 0; - virtual EGLContext VgEglContext() = 0; - }; - - -NONSHARABLE_CLASS(TEglThreadState) : public MGlesContext, public MVgContext - { - friend class CVghwUtils; // to manage creation / delete of per thread state -public: - // Execute EGL commands, and analyse for success - IMPORT_C EGLBoolean ExecEglBooleanCmd(EglRFC& aEglApiData); - IMPORT_C EGLContext ExecEglContextCmd(EglRFC& aEglApiData); - IMPORT_C EGLSurface ExecEglSurfaceCmd(EglRFC& aEglApiData); - // ToDo add static export for eglTerminate - - // Execute EGL commands whose return value cannot be tested for fail/success - inline void ExecuteEglNeverErrorCmd(EglRFC& aEglApiData); - // EGL thread state - inline void ClearEglError(); - inline void SetEglError(EGLint aEglError); - IMPORT_C EGLint EglError(); - inline void SetEglBoundApi(EGLenum aEglBoundApi); - inline EGLenum EglBoundApi(); - inline EGLint PeekEglError(); // reads DLL set error code (only) - - // MGlesContext: Execute Open GL ES 1.1 commands & manage Open GL ES state - virtual void ExecuteGlesCommand(RemoteFunctionCall& aGlesRequestData); - virtual void ExecuteGlesFlushCommand(); - virtual void ExecuteGlesFinishCommand(); - virtual void SetGlesError(GLenum aGlesErrorCode); - virtual GLenum GlesError(); - virtual EGLContext GlesEglContext(); - - // MVgContext: Execute Open VG commands & manage Open VG state - virtual void ExecuteVgCommand(OpenVgRFC& aVgApiData); - virtual void ExecuteVgFlushCommand(); - virtual void ExecuteVgFinishCommand(); - virtual void SetVgError(VGErrorCode aVgErrorCode); - virtual VGErrorCode VgError(); - virtual EGLContext VgEglContext(); - -protected: - static TEglThreadState* New(); - void Destroy(); - TEglThreadState(); - ~TEglThreadState(); - -private: - GLenum GetHostGlesError(); - VGErrorCode GetHostVgError(); - -private: - // EGL thread state - EGLint iEglError; - TBool iEglHostHasRecentError; - // currently bound graphics API - EGLenum iEglBoundApi; - - // Open VG context for thread - VGErrorCode iVgError; - EGLContext iVgEglContext; - TBool iVgCommandsSinceGetError; - TBool iVgCommandsSinceFlush; - TBool iVgCommandsSinceFinish; - - // Open GL ES 1.1 context for thread - GLenum iGlesError; - EGLContext iGlesEglContext; - TBool iGlesCommandsSinceGetError; - TBool iGlesCommandsSinceFlush; - TBool iGlesCommandsSinceFinish; - }; - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// TVghwThreadState inline functions - -void TEglThreadState::ClearEglError() - { - UTIL_TRACE(" TVghwThreadState::ClearEglError"); - iEglError = EGL_SUCCESS; - iEglHostHasRecentError = EFalse; - } - - -void TEglThreadState::SetEglError(EGLint aEglError) - { - UTIL_TRACE(" TVghwThreadState::SetEglError error=0x%x", aEglError); - VGHWPANIC_ASSERT_DEBUG((aEglError >= EGL_SUCCESS) && (aEglError <= 0x301F), EVghwPanicBadEglErrorValue); - iEglError = aEglError; - iEglHostHasRecentError = EFalse; - } - - -EGLint TEglThreadState::PeekEglError() // reads DLL set error code - { - return iEglError; - } - - -void TEglThreadState::SetEglBoundApi(EGLenum aEglBoundApi) - { - VGHWPANIC_ASSERT_DEBUG((aEglBoundApi == EGL_OPENGL_ES_API) || (aEglBoundApi == EGL_OPENVG_API), EVghwPanicBadEglBoundApi); - iEglBoundApi = aEglBoundApi; - } - - -EGLenum TEglThreadState::EglBoundApi() - { - return iEglBoundApi; - } - -// Execute EGL Command simple variants - -void TEglThreadState::ExecuteEglNeverErrorCmd(EglRFC& aEglApiData) - { // for EGL commands which cannot have a host error - CVghwUtils::DriverExecuteCommand(aEglApiData.Data()); - iEglHostHasRecentError = EFalse; - iEglError = EGL_SUCCESS; - } - -#endif // __VGHWUTILS_H__ diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwutils/rom/vghwutils.iby --- a/guestrendering/vghwutils/rom/vghwutils.iby Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -// 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 GUESTRENDERING_VGHWUTILS_IBY -#define GUESTRENDERING_VGHWUTILS_IBY - - -file=ABI_DIR\BUILD_DIR\vghwutils.dll \sys\bin\vghwutils.dll - - -#endif // GUESTRENDERING_VGHWUTILS_IBY - -// End of File diff -r 3b4f7e9d873f -r 4f400a6ea71f guestrendering/vghwutils/src/vghwutils.cpp --- a/guestrendering/vghwutils/src/vghwutils.cpp Wed Sep 29 09:49:13 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,908 +0,0 @@ -// 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 -#include - -#include - -#include "vghwutils.h" -#include "eglrfc.h" -#include "openvgrfc.h" -#include "opengles11rfc.h" - -#ifdef _DEBUG -#define EGL_ERROR_PRINT(T, E) EglErrorPrint(T, E) -#define GLES_ERROR_PRINT(T, E) GlesErrorPrint(T, E) -#define VG_ERROR_PRINT(T, E) VgErrorPrint(T, E) -static void EglErrorPrint(char* aTitle, EGLint aEglError); -static void GlesErrorPrint(char* aTitle, GLenum aGlesError); -static void VgErrorPrint(char* aTitle, VGErrorCode aVgError); -#else -#define EGL_ERROR_PRINT(T, E) -#define GLES_ERROR_PRINT(T, E) -#define VG_ERROR_PRINT(T, E) -#endif - - -// Min & Max sizes for creating Memory Heap for Guest Graphics DLLs -#define KVghwHeapMin 0x1000 -#define KVghwHeapMax 0x100000 - - -// protection against concurrent initialisation from multiple threads -volatile TBool CVghwUtils::iInitialized = EFalse; -TInt CVghwUtils::iVghwInitMutex = 0; - -// static member objects - Writeable Static Data -RGuestVideoDriver* CVghwUtils::iDriver = NULL; -RHeap* CVghwUtils::iHeap = NULL; -MEglManagementApi* CVghwUtils::iEglManagementApi = NULL; -MVgApiForEgl* CVghwUtils::iVgApiForEgl = NULL; -MGles11ApiForEgl* CVghwUtils::iGles11ApiForEgl = NULL; -MGles2ApiForEgl* CVghwUtils::iGles2ApiForEgl = NULL; -TBool CVghwUtils::iLoadedOpenVgDll = EFalse; -TBool CVghwUtils::iLoadedOpenGles11Dll = EFalse; -TBool CVghwUtils::iLoadedOpenGles2Dll = EFalse; - - - -_LIT(KVghwPanicCategory, "Guest VGHW"); - - -// NOTE: Exported because some VGHW functions are inline and could Assert & Panic from somewhere else -EXPORT_C void VghwPanic(TVghwPanic aPanicCode, char* aPanicName, char* aCondition, char* aFile, TInt aLine) - { - if (aCondition && aFile) - { - RDebug::Printf("VghwUtils Panic %s for failed Assert (%s), at %s:%d", aPanicName, aCondition, aFile, aLine); - } - else - { - RDebug::Printf("VghwUtils Panic %d for failed Assert (line %d)", aPanicCode, aLine); - } - - User::Panic(KVghwPanicCategory, aPanicCode); - } - -// inline functions - -RGuestVideoDriver& CVghwUtils::Driver() - { - // TODO remove this later in refactoring - Open VG & GL ES commands should not reach here before EGL has initialized the singleton - if (!iInitialized || !iDriver) - { - UTIL_TRACE("CVghwUtils::Driver called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); - InitStatics(); - } - VGHWPANIC_ASSERT(iInitialized && iDriver, EVghwPanicGraphicsDriverNotOpen); - return *iDriver; - } - - -EXPORT_C void CVghwUtils::DestroyStatics() - { -#ifdef _DEBUG - TUint64 processId = RProcess().Id().Id(); - TUint64 threadId = RThread().Id().Id(); - UTIL_TRACE("CVghwUtils::DestroyStatics iInitialized=%d, iDriver=0x%x, iHeap=0x%x, Process=0x%lx, Thread=0x%lx", - iInitialized, iDriver, iHeap, processId, threadId); -#endif - if (iHeap) - { - if (iDriver) - { - iDriver->Flush(); - iDriver->Close(); - RHeap* threadHeap = SwitchToVghwHeap(); - delete iDriver; - SwitchFromVghwHeap(threadHeap); - iDriver = NULL; - } - iHeap->Reset(); - iHeap->Close(); - iHeap = NULL; - } - if (iInitialized) - { - iInitialized = EFalse; - } - } - - -// Ensure Graphics memory heap is created, and Open driver channel -EXPORT_C void CVghwUtils::InitStatics() - { -#ifdef _DEBUG - TUint64 processId = RProcess().Id().Id(); - TUint64 threadId = RThread().Id().Id(); - UTIL_TRACE("CVghwUtils::InitStatics start Process=0x%lx, Thread=0x%lx, iInitialized=%d", - processId, threadId, iInitialized); -#endif - // bootstrap creation of mutexes and Graphics memory heap - while (!iInitialized) - { - TInt creationError = KErrNone; - // thread safe initialization - // LockedDec() returns the value prior to decrement - if (0 != User::LockedDec(iVghwInitMutex)) - { - User::AfterHighRes(1000); // Yield X microseconds, review length if code is changed - } - else - { - // volatile attribute forces rereading of the pointer, in case another thread has done the allocation - if (!iInitialized) - { // loop style init exits if any stage fails, and gives per step debug logging - TInt step = 0; - do - { - switch (step) - { - case 0: - // guarantee that initialisation of the object is flushed before the pointer is published - __e32_atomic_store_rel_ptr(&iHeap, User::ChunkHeap(NULL, KVghwHeapMin, KVghwHeapMax)); - if (!iHeap) - { - creationError = KErrNoMemory; - } - break; - case 1: - { - VGHWPANIC_ASSERT_DEBUG(iHeap, EVghwPanicVghwHeapDoesNotExist); - RHeap* threadHeap = User::SwitchHeap(iHeap); // switch to VGHW graphics Heap - iDriver = new RGuestVideoDriver(); - if (!iDriver) - { - creationError = KErrNoMemory; - } - User::SwitchHeap(threadHeap); // switch back to client Heap - } - break; - case 2: - creationError = User::LoadLogicalDevice(_L("guestvideohw")); - if ( (KErrNone == creationError) || (KErrAlreadyExists == creationError) ) - { - creationError = iDriver->Open(); - } - break; - default: // all initialisation steps completed - iInitialized = ETrue; - } - ++step; - } - while (!iInitialized && !creationError); - UTIL_TRACE("CVghwUtils::InitStatics %s step=%d; creationError=%d, iInitialized=%d, iDriver=0x%x, iHeap=0x%x", - creationError ? "failed at" : "completed", step, creationError, iInitialized, iDriver, iHeap); - } - } - User::LockedInc(iVghwInitMutex); - - VGHWPANIC_ASSERT(creationError == KErrNone, EVghwPanicInitializeFailed); - } - } - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -EXPORT_C void CVghwUtils::DriverExecuteCommand(RemoteFunctionCallData& aRequestData) - { - if (!iInitialized || !iDriver) - { - UTIL_TRACE("CVghwUtils::DriverExecuteCommand called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); - InitStatics(); - } - VGHWPANIC_ASSERT(iInitialized && iDriver, EVghwPanicGraphicsDriverNotOpen); - iDriver->ExecuteCommand(aRequestData); - } - - -// ----------------------------------------------------------------------------- -// Use driver to discover linear memory address of chunk. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CVghwUtils::MapToHWAddress( const TInt aChunkHandle, TUint32& aHWAddress ) - { - UTIL_TRACE("CVghwUtils::MapToHWAddress"); - return Driver().MapToHWAddress( aChunkHandle, aHWAddress ); - } - - -// SgImage support function - get underlying VGImage & Pbuffer handles -EXPORT_C TInt CVghwUtils::EglGetSgHandles( const TUint64 aId, TUint64 *aSgHandles ) - { - UTIL_TRACE("CVghwUtils::EglGetSgHandles"); - return Driver().EglGetSgHandles( aId, aSgHandles ); - } - - -// Memory Heap Management functions - -EXPORT_C TAny* CVghwUtils::Alloc(TInt aSize) - { - if (!iInitialized || !iHeap) - { - UTIL_TRACE("CVghwUtils::Alloc called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); - InitStatics(); - } - VGHWPANIC_ASSERT(iInitialized && iHeap, EVghwPanicVghwHeapDoesNotExist); - return iHeap->Alloc(aSize); - } - - -EXPORT_C void CVghwUtils::Free(TAny* aPtr) - { - if (!iInitialized || !iHeap) - { - UTIL_TRACE("CVghwUtils::Free called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); - InitStatics(); - } - VGHWPANIC_ASSERT(iInitialized && iHeap, EVghwPanicVghwHeapDoesNotExist); - iHeap->Free(aPtr); - } - - -EXPORT_C RHeap* CVghwUtils::GetHeap() - { - if (!iInitialized || !iHeap) - { - UTIL_TRACE("CVghwUtils::GetHeap called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); - InitStatics(); - } - VGHWPANIC_ASSERT(iInitialized && iHeap, EVghwPanicVghwHeapDoesNotExist); - return iHeap; - } - - -// Switch to VGHW Memory Heap. -EXPORT_C RHeap* CVghwUtils::SwitchToVghwHeap() - { - if (!iInitialized || !iHeap) - { - UTIL_TRACE("CVghwUtils::SwitchToVghwHeap called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); - InitStatics(); - } - VGHWPANIC_ASSERT(iHeap, EVghwPanicVghwHeapDoesNotExist); - RHeap* oldHeap = User::SwitchHeap(iHeap); // switch to Guest graphics heap - VGHWPANIC_ASSERT(oldHeap != iHeap, EVghwPanicSwitchToVghwHeapOldHeapIsVghwHeap); - return oldHeap; - } - - -// Switch back to original heap -EXPORT_C void CVghwUtils::SwitchFromVghwHeap(RHeap* aOldHeapPtr) - { - if (!iInitialized || !iHeap) - { - UTIL_TRACE("CVghwUtils::SwitchFromVghwHeap called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); - InitStatics(); - } - VGHWPANIC_ASSERT(iHeap, EVghwPanicVghwHeapDoesNotExist); - VGHWPANIC_ASSERT(aOldHeapPtr, EVghwPanicSwitchFromVghwHeapParamIsNull); - VGHWPANIC_ASSERT(aOldHeapPtr != iHeap, EVghwPanicSwitchFromVghwHeapParamIsVghwHeap); - - RHeap* oldHeap = User::SwitchHeap(aOldHeapPtr); // switch from Guest graphics heap back to thread heap - VGHWPANIC_ASSERT(oldHeap == iHeap, EVghwPanicSwitchFromVghwHeapOldHeapIsNotVghwHeap); - } - - -// if this thread does not have an object try to alloc a new one -EXPORT_C TEglThreadState* CVghwUtils::CreateThreadState() - { - TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); - if (!threadState) - { - UTIL_TRACE("CVghwUtils::CreateThreadState - object is currently 0x%x, iInitialized=%d", - threadState, iInitialized); - if (!iInitialized) - { - InitStatics(); - } - threadState = TEglThreadState::New(); - Dll::SetTls(threadState); - } - return threadState; - } - - -// current state object, if any, for this thread -EXPORT_C TEglThreadState* CVghwUtils::EglThreadState() - { - TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); - return threadState; - } - - -// current state object, if Open VG is the current bound API, for this thread -EXPORT_C MVgContext* CVghwUtils::VgContext() - { - TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); - return threadState; - // ToDo sort this to check for valid Open VG context - /* - if (threadState && threadState->VgEglContext()) - return threadState; - return NULL; - */ - } - - -// current state object, if Open GL ES is the current bound API, for this thread (for EGL) -EXPORT_C MGlesContext* CVghwUtils::GlesContext() - { - TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); - return threadState; - // ToDo sort this to check for valid Open GL ES context - /* - if (threadState && threadState->GlesEglContext()) - return threadState; - return NULL; */ - } - - -// free current state object, if any, for this thread -EXPORT_C void CVghwUtils::ReleaseThreadState() - { - TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); - UTIL_TRACE("CVghwUtils::ReleaseThreadState - object = 0x%x", threadState); - if (threadState) - { - threadState->Destroy(); - Dll::FreeTls(); - } - } - - -EXPORT_C MEglManagementApi* CVghwUtils::EglManagementApi() - { - return iEglManagementApi; - } - - -EXPORT_C void CVghwUtils::SetEglManagementApi(MEglManagementApi* aEglManagementApi) - { - UTIL_TRACE("CVghwUtils::SetEglManagementApi aEglManagementApi=0x%x", aEglManagementApi); - iEglManagementApi = aEglManagementApi; - } - - -/* - Stored pointers into Open GL ES 1.1, GL ES 2 and Open VG are problematic if the DLL is later unloaded. - (RSgDriver::Open currently loads & unloads all the Open VG & GL ES DLLs, to determine features to publish.) - Possibly Open the DLL again when the non-NULL pointer is fetched by EGL, probably needs flags so that - this is only done once. - */ -EXPORT_C void CVghwUtils::SetVgApiForEgl(MVgApiForEgl* aVgApiForEgl) - { - UTIL_TRACE("CVghwUtils::SetVgApiForEgl aVgApiForEgl=0x%x, iVgApiForEgl=0x%x, iLoadedOpenVgDll=0x%x", - aVgApiForEgl, iVgApiForEgl, iLoadedOpenVgDll); - // don't let a thread set this to NULL if we have forced the DLL to stay loaded - if (aVgApiForEgl || !iLoadedOpenVgDll) - { - iVgApiForEgl = aVgApiForEgl; - } - } - - -EXPORT_C MVgApiForEgl* CVghwUtils::VgApiForEgl() - { - if (iVgApiForEgl && !iLoadedOpenVgDll) - { // ensure Open VG DLL stays loaded from now on - _LIT(KLibOpenVg, "libOpenVG.dll"); - RLibrary lib; - if (lib.Load(KLibOpenVg) == KErrNone) - { - UTIL_TRACE("CVghwUtils::VgApiForEgl - Open VG dll loaded, iVgApiForEgl=0x%x", iVgApiForEgl); - iLoadedOpenVgDll = ETrue; - return iVgApiForEgl; - } - } - UTIL_TRACE("CVghwUtils::VgApiForEgl - Open VG dll not loaded or not safe to use"); - return NULL; - } - - -EXPORT_C void CVghwUtils::SetGles11ApiForEgl(MGles11ApiForEgl* aGles11ApiForEgl) - { - UTIL_TRACE("CVghwUtils::SetGles11ApiForEgl aGles11ApiForEgl=0x%x, iGles11ApiForEgl=0x%x, iLoadedOpenGles11Dll=0x%x", - aGles11ApiForEgl, iGles11ApiForEgl, iLoadedOpenGles11Dll); - // don't let a thread set this to NULL if we have forced the DLL to stay loaded - if (aGles11ApiForEgl || !iLoadedOpenGles11Dll) - { - iGles11ApiForEgl = aGles11ApiForEgl; - } - } - - -EXPORT_C MGles11ApiForEgl* CVghwUtils::Gles11ApiForEgl() - { - if (iGles11ApiForEgl && !iLoadedOpenGles11Dll) - { // ensure Open VG DLL stays loaded from now on - _LIT(KLibOpenGles, "libGLESv1_CM.dll"); - RLibrary lib; - if (lib.Load(KLibOpenGles) == KErrNone) - { - UTIL_TRACE("CVghwUtils::Gles11ApiForEgl - Open GL ES 1.1 dll loaded, iGles11ApiForEgl=0x%x", iGles11ApiForEgl); - iLoadedOpenGles11Dll = ETrue; - return iGles11ApiForEgl; - } - } - UTIL_TRACE("CVghwUtils::Gles11ApiForEgl - Open GL ES 1.1 dll not loaded or not safe to use"); - return NULL; - } - - -EXPORT_C void CVghwUtils::SetGles2ApiForEgl(MGles2ApiForEgl* aGles2ApiForEgl) - { - UTIL_TRACE("CVghwUtils::SetGles2ApiForEgl aGles2ApiForEgl=0x%x, iGles2ApiForEgl=0x%x, iLoadedOpenGles2Dll=0x%x", - aGles2ApiForEgl, iGles2ApiForEgl, iLoadedOpenGles2Dll); - // don't let a thread set this to NULL if we have forced the DLL to stay loaded - if (aGles2ApiForEgl || !iLoadedOpenGles2Dll) - { - iGles2ApiForEgl = aGles2ApiForEgl; - } - } - - -EXPORT_C MGles2ApiForEgl* CVghwUtils::Gles2ApiForEgl() - { - if (iGles2ApiForEgl && !iLoadedOpenGles2Dll) - { // ensure Open VG DLL stays loaded from now on - _LIT(KLibOpenGles2, "libGLESv2.dll"); - RLibrary lib; - if (lib.Load(KLibOpenGles2) == KErrNone) - { - UTIL_TRACE("CVghwUtils::Gles2ApiForEgl - Open GL ES 2 dll loaded, iGles2ApiForEgl=0x%x", iGles2ApiForEgl); - iLoadedOpenGles2Dll = ETrue; - return iGles2ApiForEgl; - } - } - UTIL_TRACE("CVghwUtils::Gles2ApiForEgl - Open GL ES 2 dll not loaded or not safe to use"); - return NULL; - } - - -//////////////////////////////////////////////////////////////////////////////////// - -// factory method -TEglThreadState* TEglThreadState::New() - { - UTIL_TRACE("TEglThreadState::New"); - RHeap* currentHeap = CVghwUtils::SwitchToVghwHeap(); - TEglThreadState* self = new TEglThreadState(); - CVghwUtils::SwitchFromVghwHeap(currentHeap); - return self; - } - - -TEglThreadState::TEglThreadState() : - // EGL thread state - iEglError(EGL_SUCCESS), - iEglHostHasRecentError(EFalse), - // currently bound graphics API, initial value from EGL spec - iEglBoundApi(EGL_OPENGL_ES_API), - // Open VG thread state - iVgError(VG_NO_ERROR), - iVgEglContext(EGL_NO_CONTEXT), - iVgCommandsSinceGetError(EFalse), - iVgCommandsSinceFlush(EFalse), - iVgCommandsSinceFinish(EFalse), - // Open GL ES 1.1 state - iGlesError(GL_NO_ERROR), - iGlesEglContext(EGL_NO_CONTEXT), - iGlesCommandsSinceGetError(EFalse), - iGlesCommandsSinceFlush(EFalse), - iGlesCommandsSinceFinish(EFalse) - {} - - -void TEglThreadState::Destroy() - { - UTIL_TRACE("TEglThreadState::Destroy"); - RHeap* currentHeap = CVghwUtils::SwitchToVghwHeap(); - delete this; - CVghwUtils::SwitchFromVghwHeap(currentHeap); - } - - -TEglThreadState::~TEglThreadState() - {} - - -// ----------------------------------------------------------------------------- -// -// ----------------------------------------------------------------------------- -// -EXPORT_C EGLBoolean TEglThreadState::ExecEglBooleanCmd(EglRFC& aEglApiData) - { - CVghwUtils::DriverExecuteCommand(aEglApiData.Data()); - - EGLBoolean hostResult = (EGLBoolean) aEglApiData.ReturnValue(); - if (hostResult == EGL_TRUE) - { - ClearEglError(); - } - else - { // error present in host graphics stack - iEglHostHasRecentError = ETrue; - } - return hostResult; - } - - -EXPORT_C EGLContext TEglThreadState::ExecEglContextCmd(EglRFC& aEglApiData) - { - CVghwUtils::DriverExecuteCommand(aEglApiData.Data()); - - EGLContext hostResult = (EGLContext) aEglApiData.ReturnValue(); - if (hostResult != EGL_NO_CONTEXT) - { - ClearEglError(); - } - else - { // error present in host graphics stack - iEglHostHasRecentError = ETrue; - } - return hostResult; - } - - -EXPORT_C EGLSurface TEglThreadState::ExecEglSurfaceCmd(EglRFC& aEglApiData) - { - CVghwUtils::DriverExecuteCommand(aEglApiData.Data()); - - EGLSurface hostResult = (EGLSurface) aEglApiData.ReturnValue(); - if (hostResult != EGL_NO_SURFACE) - { - ClearEglError(); - } - else - { // error present in host graphics stack - iEglHostHasRecentError = ETrue; - } - return hostResult; - } - - -/* - Get details of the last EGL api error. - (Resets stored last error value to EGL_SUCCESS.) - - @return EGL_SUCCESS or an EGL_xxxx error constant. - */ -EXPORT_C EGLint TEglThreadState::EglError() - { - EGLint eglError = iEglError; - if (iEglHostHasRecentError) - { - // last EGL command was executed/failed in the Host side, so need to ask it for the error - RemoteFunctionCallData rfcdata; EglRFC eglApiData(rfcdata); - eglApiData.Init(EglRFC::EeglGetError); - CVghwUtils::DriverExecuteCommand(eglApiData.Data()); - eglError = (EGLint)eglApiData.ReturnValue(); - EGL_ERROR_PRINT("TEglThreadState::EglError newest error fetched from Host EGL", eglError); - iEglHostHasRecentError = EFalse; - } - else - { - EGL_ERROR_PRINT("TEglThreadState::EglError newest EGL error set by DLL", eglError); - } - iEglError = EGL_SUCCESS; - return eglError; - } - - -void TEglThreadState::ExecuteVgCommand(OpenVgRFC& aVgApiData) - { - CVghwUtils::DriverExecuteCommand(aVgApiData.Data()); - iVgCommandsSinceGetError = ETrue; - iVgCommandsSinceFlush = ETrue; - iVgCommandsSinceFinish = ETrue; - } - - -void TEglThreadState::ExecuteVgFlushCommand() - { - if (iVgCommandsSinceFlush) - { - RemoteFunctionCallData data; OpenVgRFC vgApiData(data); - vgApiData.Init(OpenVgRFC::EvgFlush); - - CVghwUtils::DriverExecuteCommand(vgApiData.Data()); - iVgCommandsSinceFlush = EFalse; - iVgCommandsSinceFinish = EFalse; - } - } - - -void TEglThreadState::ExecuteVgFinishCommand() - { - if (iVgCommandsSinceFinish) - { - RemoteFunctionCallData data; OpenVgRFC vgApiData(data); - vgApiData.Init(OpenVgRFC::EvgFinish); - - CVghwUtils::DriverExecuteCommand(vgApiData.Data()); - iVgCommandsSinceFinish = EFalse; - } - } - - -VGErrorCode TEglThreadState::VgError() - { - VGErrorCode vgError = iVgError; - VG_ERROR_PRINT("TEglThreadState::VgError oldest Open VG DLL error", vgError); - - if (iVgCommandsSinceGetError) - { // fetch and clear the host error state - VGErrorCode hostVgError = GetHostVgError(); - VG_ERROR_PRINT("TEglThreadState::VgError oldest Host Open VG DLL error", hostVgError); - - if (vgError == VG_NO_ERROR) - { - vgError = hostVgError; - } - iVgCommandsSinceGetError = EFalse; - } - - iVgError = VG_NO_ERROR; - return vgError; - } - - -VGErrorCode TEglThreadState::GetHostVgError() - { - RemoteFunctionCallData data; OpenVgRFC vgApiData(data); - vgApiData.Init( OpenVgRFC::EvgGetError ); - - CVghwUtils::DriverExecuteCommand(vgApiData.Data()); - return (VGErrorCode)vgApiData.ReturnValue(); - } - - -// Open GL ES - -GLenum TEglThreadState::GlesError() - { - GLenum glesError = iGlesError; - GLES_ERROR_PRINT("TEglThreadState::GlesError oldest Open GL ES DLL error", glesError); - - if (iGlesCommandsSinceGetError) - { // fetch and clear the host error state - GLenum hostGlesError = GetHostGlesError(); - GLES_ERROR_PRINT("TEglThreadState::GlesError oldest Host Open GL ES DLL error", hostGlesError); - - if (glesError == GL_NO_ERROR) - { - glesError = hostGlesError; - } - iGlesCommandsSinceGetError = EFalse; - } - - iGlesError = GL_NO_ERROR; - return glesError; - } - - -GLenum TEglThreadState::GetHostGlesError() - { - RemoteFunctionCallData data; - OpenGlES11RFC glesApiData(data); - glesApiData.Init(OpenGlES11RFC::EglGetError); - CVghwUtils::DriverExecuteCommand(glesApiData.Data()); - return (GLint)glesApiData.ReturnValue(); - } - - -void TEglThreadState::ExecuteGlesCommand(RemoteFunctionCall& aGlesRequestData) - { - CVghwUtils::DriverExecuteCommand(aGlesRequestData.Data()); - iGlesCommandsSinceGetError = ETrue; - iGlesCommandsSinceFlush = ETrue; - iGlesCommandsSinceFinish = ETrue; - } - - -void TEglThreadState::ExecuteGlesFlushCommand() - { - if (iGlesCommandsSinceFlush) - { - RemoteFunctionCallData rfcData; - OpenGlES11RFC glesApiData( rfcData ); - glesApiData.Init(OpenGlES11RFC::EglFlush, RemoteFunctionCallData::EOpRequest); - CVghwUtils::DriverExecuteCommand(glesApiData.Data()); - iGlesCommandsSinceFlush = EFalse; - iGlesCommandsSinceFinish = EFalse; - } - } - - -void TEglThreadState::ExecuteGlesFinishCommand() - { - if (iGlesCommandsSinceFinish) - { - RemoteFunctionCallData rfcData; - OpenGlES11RFC glesApiData( rfcData ); - glesApiData.Init(OpenGlES11RFC::EglFinish, RemoteFunctionCallData::EOpRequest); - CVghwUtils::DriverExecuteCommand(glesApiData.Data()); - iGlesCommandsSinceFinish = EFalse; - } - } - - -// Open VG state -void TEglThreadState::SetVgError(VGErrorCode aVgError) - { - VGHWPANIC_ASSERT_DEBUG( (aVgError >= VG_BAD_HANDLE_ERROR) && (aVgError <= 0x10FF), EVghwPanicBadVgErrorValue); - // for Open VG track the oldest uncleared error - VG_ERROR_PRINT("TEglThreadState::SetVgError error", aVgError); - if ( (iVgError == VG_NO_ERROR) && (aVgError >= VG_BAD_HANDLE_ERROR) && (aVgError <= 0x10FF) ) - { - if (iVgCommandsSinceGetError) - { - iVgError = GetHostVgError(); - VG_ERROR_PRINT("TEglThreadState::SetVgError oldest Host Open VG DLL error", iVgError); - if (iVgError != VG_NO_ERROR) - { - return; - } - } - iVgError = aVgError; - } - } - - -EGLContext TEglThreadState::VgEglContext() - { - return iVgEglContext; - } - - -// Open GL ES thread state -void TEglThreadState::SetGlesError(GLenum aGlesError) - { - VGHWPANIC_ASSERT_DEBUG( (aGlesError >= GL_INVALID_ENUM) && (aGlesError <= 0x05FF), EVghwPanicBadGlesErrorValue); - // for Open GL ES track the oldest uncleared error - GLES_ERROR_PRINT("TEglThreadState::SetGlesError error", aGlesError); - if ( (iGlesError == GL_NO_ERROR) && (aGlesError >= GL_INVALID_ENUM) && (aGlesError <= 0x05FF) ) - { - if (iGlesCommandsSinceGetError) - { - iGlesError = GetHostGlesError(); - GLES_ERROR_PRINT("TEglThreadState::SetGlesError oldest Host Open GL ES DLL error", iGlesError); - if (iGlesError != GL_NO_ERROR) - { - return; - } - } - iGlesError = aGlesError; - } - } - - -EGLContext TEglThreadState::GlesEglContext() - { - return iGlesEglContext; - } - -// ----------------------------------------------------------------------------- -// Use driver to discover base address of the surface memory. -// ----------------------------------------------------------------------------- -// -EXPORT_C TInt CVghwUtils::GetSurfaceBufferBaseAddress( TUint32& aHWAddress ) - { - UTIL_TRACE("CVghwUtils::GetSurfaceBufferBaseAddress"); - if (!iInitialized || !iDriver) - { - UTIL_TRACE("CVghwUtils::GetSurfaceBufferBaseAddress called before initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); - InitStatics(); - } - VGHWPANIC_ASSERT(iInitialized && iDriver, EVghwPanicGraphicsDriverNotOpen); - return iDriver->GetSurfaceBufferBaseAddress( aHWAddress ); - } - -#ifdef _DEBUG -static void EglErrorPrint(char* aTitle, EGLint aEglError) - { - char* errName = NULL; - switch (aEglError) - { - case EGL_SUCCESS: errName = "EGL_SUCCESS"; break; - case EGL_NOT_INITIALIZED: errName = "EGL_NOT_INITIALIZED"; break; - case EGL_BAD_ACCESS: errName = "EGL_BAD_ACCESS"; break; - case EGL_BAD_ALLOC: errName = "EGL_BAD_ALLOC"; break; - case EGL_BAD_ATTRIBUTE: errName = "EGL_BAD_ATTRIBUTE"; break; - case EGL_BAD_CONFIG: errName = "EGL_BAD_CONFIG"; break; - case EGL_BAD_CONTEXT: errName = "EGL_BAD_CONTEXT"; break; - case EGL_BAD_CURRENT_SURFACE: errName = "EGL_BAD_CURRENT_SURFACE"; break; - case EGL_BAD_DISPLAY: errName = "EGL_BAD_DISPLAY"; break; - case EGL_BAD_MATCH: errName = "EGL_BAD_MATCH"; break; - case EGL_BAD_NATIVE_PIXMAP: errName = "EGL_BAD_NATIVE_PIXMAP"; break; - case EGL_BAD_NATIVE_WINDOW: errName = "EGL_BAD_NATIVE_WINDOW"; break; - case EGL_BAD_PARAMETER: errName = "EGL_BAD_PARAMETER"; break; - case EGL_BAD_SURFACE: errName = "EGL_BAD_SURFACE"; break; - case EGL_CONTEXT_LOST: errName = "EGL_CONTEXT_LOST"; break; - default: break; // Error is from a new version of EGL - } - - if (errName) - { - UTIL_TRACE( " %s=%s (0x%x)", aTitle, errName, aEglError); - } - else - { - UTIL_TRACE( " %s=0x%x", aTitle, aEglError); - } - } - - -static void VgErrorPrint(char* aTitle, VGErrorCode aVgError) - { - char* errName = NULL; - switch (aVgError) - { - case VG_NO_ERROR: errName = "VG_NO_ERROR"; break; - case VG_BAD_HANDLE_ERROR: errName = "VG_BAD_HANDLE_ERROR"; break; - case VG_ILLEGAL_ARGUMENT_ERROR: errName = "VG_ILLEGAL_ARGUMENT_ERROR"; break; - case VG_OUT_OF_MEMORY_ERROR: errName = "VG_OUT_OF_MEMORY_ERROR"; break; - case VG_PATH_CAPABILITY_ERROR: errName = "VG_PATH_CAPABILITY_ERROR"; break; - case VG_UNSUPPORTED_IMAGE_FORMAT_ERROR: errName = "VG_UNSUPPORTED_IMAGE_FORMAT_ERROR"; break; - case VG_UNSUPPORTED_PATH_FORMAT_ERROR: errName = "VG_UNSUPPORTED_PATH_FORMAT_ERROR"; break; - case VG_IMAGE_IN_USE_ERROR: errName = "VG_IMAGE_IN_USE_ERROR"; break; - case VG_NO_CONTEXT_ERROR: errName = "VG_NO_CONTEXT_ERROR"; break; - default: break; // unknown error code from a new version of Open VG - } - - if (errName) - { - UTIL_TRACE( " %s=%s (0x%x)", aTitle, errName, aVgError); - } - else - { - UTIL_TRACE( " %s=0x%x", aTitle, aVgError); - } - } - - -static void GlesErrorPrint(char* aTitle, GLenum aGlesError) - { - char* errName = NULL; - switch (aGlesError) - { - case GL_NO_ERROR: errName = "GL_NO_ERROR"; break; - case GL_INVALID_ENUM: errName = "GL_INVALID_ENUM"; break; - case GL_INVALID_VALUE: errName = "GL_INVALID_VALUE"; break; - case GL_INVALID_OPERATION: errName = "GL_INVALID_OPERATION"; break; - case GL_STACK_OVERFLOW: errName = "GL_STACK_OVERFLOW"; break; - case GL_STACK_UNDERFLOW: errName = "GL_STACK_UNDERFLOW"; break; - case GL_OUT_OF_MEMORY: errName = "GL_OUT_OF_MEMORY"; break; - default: break; // unknown error code from a new version of Open GL ES - } - - if (errName) - { - UTIL_TRACE( " %s=%s (0x%x)", aTitle, errName, aGlesError); - } - else - { - UTIL_TRACE( " %s=0x%x", aTitle, aGlesError); - } - } -#endif - - -// end of file vghwutils.cpp diff -r 3b4f7e9d873f -r 4f400a6ea71f hostsupport/khronosapiwrapper/group/bld.inf diff -r 3b4f7e9d873f -r 4f400a6ea71f hostsupport/syborggraphicswrapper/group/bld.inf diff -r 3b4f7e9d873f -r 4f400a6ea71f package_definition.xml --- a/package_definition.xml Wed Sep 29 09:49:13 2010 +0100 +++ b/package_definition.xml Wed Oct 06 15:43:10 2010 +0100 @@ -1,6 +1,6 @@ - + Nokia @@ -17,14 +17,19 @@ - - + + + + + + + - + - + @@ -37,12 +42,6 @@ - - - - - - diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwapiwrapper/group/bld.inf diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/api/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/api/group/bld.inf Wed Oct 06 15:43:10 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/api/group/guestvideodriver.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/api/group/guestvideodriver.mmp Wed Oct 06 15:43:10 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 + +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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/api/src/guestvideodriver.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/api/src/guestvideodriver.cpp Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,264 @@ +// 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 +#include +#include +#include + +#include +#include +#include + +#include "remotefunctioncall.h" +#include "serializedfunctioncall.h" + +// tracing +#ifdef _DEBUG +#include + #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 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(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 handle( aChunkHandle ); + TPckg address( aHWAddress ); + return DoControl( GuestVideoDriver::ERequestMapAddress, (TAny*)&handle, (TAny*)&address ); + } + +// ----------------------------------------------------------------------------- +// RGuestVideDriver::GetSurfaceBufferBaseAddress +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RGuestVideoDriver::GetSurfaceBufferBaseAddress( TUint32& aSurfaceBufferBaseAddress ) + { + TPckg address( aSurfaceBufferBaseAddress ); + return DoControl( GuestVideoDriver::ERequestSurfaceBufferBaseAddress, (TAny*)&address ); + } + +// ----------------------------------------------------------------------------- +// RGuestVideoDriver::EglGetSgHandles +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt RGuestVideoDriver::EglGetSgHandles( const TUint64 aId, TUint64 *aSgHandles ) + { + TPckg sgId( aId ); + TPckg 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); + } diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/group/bld.inf Wed Oct 06 15:43:10 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/ldd/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/ldd/group/bld.inf Wed Oct 06 15:43:10 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 +virtualvideohwdevice.mmp diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/ldd/group/reqhandlerextension.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/ldd/group/reqhandlerextension.mmp Wed Oct 06 15:43:10 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 + + +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 + diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/ldd/group/virtualvideohwdevice.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/ldd/group/virtualvideohwdevice.mmp Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,74 @@ +// 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 + +TARGET guestvideohw.ldd +TARGETTYPE ldd + + +UID 0 0x20026A2E //- 0x20026A32 +LINKAS guestvideohw.ldd +VENDORID 0x70000001 +CAPABILITY all +DEFFILE /epoc32/include/def/eabi/guestvideohw.def + +EPOCALLOWDLLDATA + +OS_LAYER_SYSTEMINCLUDE +OS_LAYER_KERNEL_SYSTEMINCLUDE +OS_LAYER_ESTLIB_SYSTEMINCLUDE +USERINCLUDE ../inc +USERINCLUDE ../../commoninc + +// NOTE the old name was "adaptation". The new layer name is "adapt". +// If your repository is off ...adaptation, re-sync it from its new home +// for example http://developer.symbian.org/oss/FCL/sf/adapt/qemu +#include <../../../../../../adapt/qemu/baseport/syborg/variant.mmh> +USERINCLUDE ../../../../../../adapt/qemu/baseport/syborg/specific + +SYSTEMINCLUDE /epoc32/include/drivers + +SOURCEPATH ../src +SOURCE virtualvideohwdevice.cpp +SOURCE virtualvideohwchannel.cpp +SOURCE devicereqhandler.cpp +SOURCE virtualvideohwinterface.cpp + +USERINCLUDE ../../../vghwserialiser/inc +#ifdef FAISALMEMON_S4_SGIMAGE +USERINCLUDE ../../../graphicsresourceimplementation/inc +#endif + +SOURCEPATH ../../../vghwserialiser/src +SOURCE remotefunctioncall.cpp +SOURCE serializedfunctioncall.cpp +SOURCE eglrfc.cpp +SOURCE openvgrfc.cpp +SOURCE driverrfc.cpp +SOURCE opengles11rfc.cpp + +// We need to link to some ASSP kernel extension here +// TODO FAISALMEMON Need to confirm the correct library +LIBRARY kasyborg.lib + +#ifdef FAISALMEMON_S4_SGIMAGE +LIBRARY reqhandlerextension.lib +LIBRARY sgextension.lib +#endif + +start wins +win32_headers +end diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/ldd/src/devicereqhandler.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/ldd/src/devicereqhandler.cpp Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,1453 @@ +// 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: +// Device Request Handler Implementation + + +#include +#include +#include +#include + +#include +#include +#include + +#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 GuestVideoDriver; + +// 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" ); +#ifdef FAISALMEMON_S4_SGIMAGE + ReqHandlerExtension::SetReqHandler( this ); +#endif + } + +// ----------------------------------------------------------------------------- +// 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(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(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 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;iiRemoteFunctionCall.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( paramAddr ), VVI_PARAMETERS_OUTPUT_MEMORY_SIZE ); + TPckg 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( paramAddr ), VVI_PARAMETERS_OUTPUT_MEMORY_SIZE ); + TPckg 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(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" ); + 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 + } + +#ifdef FAISALMEMON_S4_SGIMAGE + EGLSurface surface( EGL_NO_SURFACE );//The pbuffer surface to sync from, if needed + VGboolean syncNeeded = VG_FALSE; + if( sgId != NULL ) + { + VVHW_TRACE( "DDeviceReqHandler::getVGSyncInOp SgImage-backing VGImage found" ); + DSgResource* resource; + HBuf8* data = OpenSgImageMetaData( sgId, resource ); + if( data ) + { + TSgImageMetaData sginfo (((TPckgBuf*) 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 ); + } +#endif + } + + +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" ); +#ifdef FAISALMEMON_S4_SGIMAGE + 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 +#endif + VVHW_TRACE( "Pbuffer creation RequestComplete" ); + break; + } + case DriverRFC::EDrvCreateVGImageSg: + { + VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult : EDrvCreateVGImageSg" ); +#ifdef FAISALMEMON_S4_SGIMAGE + 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 +#endif + 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."); + } + +#ifdef FAISALMEMON_S4_SGIMAGE +/** + * 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 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 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 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 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; + } +#endif + +TInt DDeviceReqHandler::DestroySgImage( const TUint64 aId ) + { + VVHW_TRACE("DDeviceReqHandler::DestroySgImage ->"); + +#ifdef FAISALMEMON_S4_SGIMAGE + TBool allok = ETrue; + TAsyncRequest* req(0); + TPckg res( iOpReturn ); + EGLSurface surface(0); + VGImage image(0); + DSgResource* resource; + HBuf8* data = OpenSgImageMetaData( aId, resource ); + if( data ) + { + TSgImageMetaData sginfo (((TPckgBuf*) 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 data( req->iRemoteFunctionCall ); + req->iA1 = (TAny*)(&data); + allok = InitiateRequestWithReply( req, 0 ); + } + if( !allok ) + { + //TODO + } + while( status == KRequestPending ) + { + NKern::Sleep( 20 ); + } +#endif + + 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 ); +#ifdef FAISALMEMON_S4_SGIMAGE + DSgResource* resource; + VVHW_TRACE("EglRFC::EeglMetaSgGetHandles openSgImageMetaData" ); + HBuf8* data = OpenSgImageMetaData( id, resource ); + if( data && handles_size >= 2 ) + { + TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); + handles[0] = sginfo.iPbufferHandle; + handles[1] = sginfo.iVGImageHandle; + call.SetReturnValue( (int)EGL_TRUE ); + } + else + { + call.SetReturnValue( (int)EGL_FALSE ); + } + alreadyProcessed = EHandled; +#endif + 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 ) + { +#ifdef FAISALMEMON_S4_SGIMAGE + DSgResource* resource; + HBuf8* data = OpenSgImageMetaData( iPbufferSgMap[sgIdIndex].iSgId, resource ); + if( data ) + { + TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); + + if( !sginfo.iPbufferClean ) + { + img = sginfo.iVGImageHandle; + //sync with the underlying pbuffer surface + syncRequirement = syncRequirement | KSyncDrawSurface; + call.AppendEGLint( img ); + } + delete data; + } +#endif + } + obj.iPbuffer = read; + obj.iSgId = 0; + + sgIdIndex = iPbufferSgMap.FindInOrder( obj, iPbufferSgMapOrder ); + if( sgIdIndex != KErrNotFound ) + { +#ifdef FAISALMEMON_S4_SGIMAGE + DSgResource* resource; + HBuf8* data = OpenSgImageMetaData( iPbufferSgMap[sgIdIndex].iSgId, resource ); + if( data ) + { + TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); + + if( !sginfo.iPbufferClean ) + { + img = sginfo.iVGImageHandle; + //sync with the underlying pbuffer surface + syncRequirement = syncRequirement | KSyncReadSurface; + } + delete data; + } +#endif + } + 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 + +#ifdef FAISALMEMON_S4_SGIMAGE + DSgResource* resource; + HBuf8* data = OpenSgImageMetaData( sgId, resource ); + if( data ) + { + TSgImageMetaData sginfo (((TPckgBuf*) 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 +#endif + 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; + } + +#ifdef FAISALMEMON_S4_SGIMAGE +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 + } +#endif diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/ldd/src/reqhandlerextension.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/ldd/src/reqhandlerextension.cpp Wed Oct 06 15:43:10 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: +// Guest video driver - request handler extension (a.k.a. Command Scheduler extension) +// + +#include +#include +#include + +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; + } + diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/ldd/src/virtualvideohwchannel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/ldd/src/virtualvideohwchannel.cpp Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,288 @@ +// 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: +// Virtual Video Hardware Channel implementation + +#include +#include + +#include +#include +#include +#include +#include + +#include "serializedfunctioncall.h" + +// ----------------------------------------------------------------------------- +// 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 GuestVideoDriver; + 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 GuestVideoDriver; + + // 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; + } + + + +#ifdef FAISALMEMON_S4_SGIMAGE +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 metaDataPckg; + + metaDataErr = sgResource->GetMetaData( metaDataPckg ); + if ( metaDataErr == KErrNone ) + { + aSgInfo = metaDataPckg(); + } + + sgResource->Close(); + } + return metaDataErr; + } +#endif + + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwChannel::DoControl +// ----------------------------------------------------------------------------- +// +TInt DVirtualVideoHwChannel::DoControl( + DThread*& aUserThread, + TInt aFunction, + TAny* a1, + TAny* a2 ) + { + using namespace GuestVideoDriver; + + // Default error condition + TInt err = KErrNone; + + switch( aFunction ) + { + case ERequestMapAddress: + { + TPckgBuf 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 address( physicalAddress ); + err = Kern::ThreadDesWrite( aUserThread, a2, address, 0, 0, aUserThread ); + Kern::ChunkClose( chunk ); + chunk = NULL; + } + else + { + err = KErrGeneral; + } + } + break; + } + case ERequestSurfaceBufferBaseAddress: + { + TPhysAddr physicalAddress(0); + physicalAddress = iHwInterface.GetSurfaceBufferBase(); + TPckgC address(physicalAddress); + err = Kern::ThreadDesWrite(aUserThread, a1, address, 0, 0, aUserThread); + break; + } +#ifdef FAISALMEMON_S4_SGIMAGE + case ERequestSgHandles: + { + VVHW_TRACE("DVirtualVideoHwChannel::DoControl - ERequestSgHandles" ); + TPckgBuf 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 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; + } +#endif + default: + { + // Other functions are not supported + err = KErrNotSupported; + } + break; + } + + return err; + } + diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/ldd/src/virtualvideohwdevice.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/ldd/src/virtualvideohwdevice.cpp Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,167 @@ +// 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: +// Virtual Video Hardware Device Implementation + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +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 GuestVideoDriver; + iVersion = TVersion( KMajorVer, KMinorVer, KBuildVer ); + iHwInterface = new DVirtualVideoHwInterface; + Kern::Printf("DVirtualVideoHwDevice::DVirtualVideoHwDevice()<"); + VVHW_TRACE("DVirtualVideoHwDevice::DVirtualVideoHwDevice"); + } + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwDevice::Install +// ----------------------------------------------------------------------------- +// +TInt DVirtualVideoHwDevice::Install() + { + // Our name, used by User::FreeLogicalDevice + TInt err = SetName( &GuestVideoDriver::KDeviceName ); + if ( err != KErrNone ) + { + VVHW_TRACE("DVirtualVideoHwDevice::Install SetName %d", err); + return err; + } + + // Enter critical section + NKern::ThreadEnterCS(); + + err = Kern::DfcQCreate( iDfcQ, KPriority, &GuestVideoDriver::KDfcThreadName ); + + // Leave critical section + NKern::ThreadLeaveCS(); + + if ( err != KErrNone ) + { + VVHW_TRACE("DVirtualVideoHwDevice::Install Kern::DfcQCreate %d", err); + return err; + } + + // We have already created this during construction + // 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; + } diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/ldd/src/virtualvideohwinterface.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/ldd/src/virtualvideohwinterface.cpp Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,327 @@ +// 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: +// Implementation of Virtual Video Hardware Interface + + +// INCLUDE FILES +#include +#include + +#include +#include +#include +#include "syborg.h" + +// CONSTANTS + +#ifdef PLATSIM_CONFIG +_LIT( KVirtualVideoHwInterfacePanic, "DVirtualVideoHwInterface" ); +#endif + +// ============================ LOCAL DATA TYPES =============================== + +TPhysAddr DVirtualVideoHwInterface::iVideoRamBasePhys = NULL; + +// 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, + VVI_R_SHARED_CMD_MEMORY_BASE, + VVI_R_SHARED_SURFACEBUFFER_MEMORY_BASE + }; +#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() + { + VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()>"); + iInputParametersMemoryChunk = NULL; + iOutputParametersMemoryChunk = NULL; + iRegisterMemoryChunk = NULL; + +#ifdef PLATSIM_CONFIG + iVideoRamBasePhys = VVI_BASE; +#else + // Reserve a contiguous memory chunk for graphics usage + TUint32 ramSize = VVI_PARAMETERS_INPUT_MEMORY_SIZE + + VVI_PARAMETERS_OUTPUT_MEMORY_SIZE + + VVI_SURFACEBUFFER_MEMORY_SIZE; + TInt r = Epoc::AllocPhysicalRam( ramSize, iVideoRamBasePhys ); + VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface() AllocPhysicalRam %d", r); + if (r != KErrNone) + { + NKern::ThreadLeaveCS(); + Kern::Fault("DVirtualVideoHwInterface Allocate Ram %d",r); + } + SetSharedCmdMemBase( iVideoRamBasePhys + VVI_PARAMETERS_INPUT_BASE_ADDRESS ); + SetSharedSurfacebufferMemBase( iVideoRamBasePhys + VVI_SURFACEBUFFER_BASE_ADDRESS ); + +#endif // PLATSIM_CONFIG + VVHW_TRACE("DVirtualVideoHwInterface::DVirtualVideoHwInterface()<"); + } + + +// ----------------------------------------------------------------------------- +// 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( iVideoRamBasePhys + VVI_PARAMETERS_INPUT_BASE_ADDRESS, + VVI_PARAMETERS_INPUT_MEMORY_SIZE, iInputParametersMemoryChunk, + iInputParametersChunkKernelAddress ); + } + +TInt DVirtualVideoHwInterface::InitParametersOutputMemory() + { + return InitPhysicalMemory( iVideoRamBasePhys + VVI_PARAMETERS_OUTPUT_BASE_ADDRESS, + VVI_PARAMETERS_OUTPUT_MEMORY_SIZE, iOutputParametersMemoryChunk, + iOutputParametersChunkKernelAddress ); + } + +TInt DVirtualVideoHwInterface::InitRegisterMemory() + { +#ifdef PLATSIM_CONFIG + return InitPhysicalMemory( VVI_REGISTERS_BASE_ADDRESS, + VVI_REGISTERS_MEMORY_SIZE, iRegisterMemoryChunk, + iRegisterChunkKernelAddress ); +#else + return KErrNone; +#endif // PLATSIM_CONFIG + } + +// ----------------------------------------------------------------------------- +// 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::SetSharedCmdMemBase +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::SetSharedCmdMemBase( TUint32 aPhysicalAddress ) + { + VVHW_TRACE("DVirtualVideoHwInterface::SetSharedCmdMemBase 0x%08x", aPhysicalAddress); + SetRegisterValue( ERegSharedCmdMemBase, aPhysicalAddress ); + } + +void DVirtualVideoHwInterface::SetSharedSurfacebufferMemBase( TUint32 aPhysicalAddress ) + { + VVHW_TRACE("DVirtualVideoHwInterface::SetSharedSurfacebufferMemBase 0x%08x", aPhysicalAddress); + SetRegisterValue( ERegSharedSurfacebufferMemBase, aPhysicalAddress ); + } + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::GetRegisterValue +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::GetRegisterValue( + TRegister aRegister, + TUint32& aValue ) + { + if ( iRegisterMemoryChunk ) + { + TLinAddr offset = RegisterOffset( aRegister ); + TUint32* ptr = reinterpret_cast( iRegisterChunkKernelAddress + offset ); + aValue = *ptr; + } + else + { +#ifdef PLATSIM_CONFIG + Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady ); +#else + TLinAddr offset = RegisterOffset( aRegister ); + aValue = ReadReg( KHwGraphicsRegBase, offset ); +#endif // PLATSIM_CONFIG + } + } + + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::SetRegisterValue +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::SetRegisterValue( + TRegister aRegister, + TUint32 aValue ) + { + if ( iRegisterMemoryChunk ) + { + TLinAddr offset = RegisterOffset( aRegister ); + TUint32* ptr = reinterpret_cast( iRegisterChunkKernelAddress + offset ); + *ptr = aValue; + } + else + { +#ifdef PLATSIM_CONFIG + Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady ); +#else + TLinAddr offset = RegisterOffset( aRegister ); + WriteReg( KHwGraphicsRegBase, offset, aValue ); +#endif // PLATSIM_CONFIG + } + } + +EXPORT_C TPhysAddr DVirtualVideoHwInterface::GetSurfaceBufferBase() + { + TPhysAddr ret = 0; + if( iVideoRamBasePhys != 0 ) + { + ret = iVideoRamBasePhys + VVI_SURFACEBUFFER_BASE_ADDRESS; + } + return ret; + } + diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwdriver/rom/guestvideodriver.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwdriver/rom/guestvideodriver.iby Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,29 @@ +// 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 + +#ifdef FAISALMEMON_S4_SGIMAGE +extension[VARID]=KERNEL_DIR\BUILD_DIR\reqhandlerextension.dll \sys\bin\reqhandlerextension.dll +#endif +device[VARID]=KERNEL_DIR\BUILD_DIR\guestvideohw.ldd \sys\bin\guestvideohw.ldd + +#endif // GUESTVIDEODRIVER_IBY + +// End of File diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/eabi/vghwserialiseru.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/eabi/vghwserialiseru.def Wed Oct 06 15:43:10 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 + diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/group/bld.inf Wed Oct 06 15:43:10 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/group/vghwserialiser.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/group/vghwserialiser.mmp Wed Oct 06 15:43:10 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/driverrfc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/driverrfc.h Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,276 @@ +// 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 + #include + #include +#else + #include "EGL/egl.h" + #include "EGL/eglext.h" +#endif + +#ifdef __SYMBIAN32__ + #define __VG_OPENVG_H_ + #include + #include +#else + #define __OPENVGHEADERS_USE_VG_1_1 + #include + #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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/driverrfc.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/driverrfc.inl Wed Oct 06 15:43:10 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(aData), aLength, aIndex ); + } + +inline void DriverRFC::SetEGLConfigVectorData( const EGLConfig* aData, TInt aLength, TInt aIndex ) + { + RemoteFunctionCall::SetVectorData( EEGLConfig, reinterpret_cast(aData), aLength, aIndex ); + } + + +inline void DriverRFC::AppendEGLBoolean( const EGLBoolean& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLBoolean, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLint( const EGLint& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLint, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLenum( const EGLenum& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLenum, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLDisplay( const EGLDisplay& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLDisplay, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLConfig( const EGLConfig& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLConfig, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLSurface( const EGLSurface& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLSurface, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLContext( const EGLContext& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLContext, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLClientBuffer( const EGLClientBuffer& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLClientBuffer, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLImageKHR( const EGLImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLImageKHR, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLNativeDisplayType( const NativeDisplayType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLNativeDisplayType, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLNativeWindowType( const NativeWindowType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLNativeWindowType, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLNativePixmapType( const NativePixmapType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLNativePixmapType, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendEGLintVector( const EGLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EEGLint, aLength, reinterpret_cast( aData ), aDir ); + } + +inline void DriverRFC::AppendEGLConfigVector( const EGLConfig* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EEGLConfig, aLength, reinterpret_cast( aData ), aDir ); + } + +#ifdef __SYMBIAN32__ +inline void DriverRFC::AppendEGLSize( const TSize& aSize, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLint, reinterpret_cast(&aSize.iWidth), aDir ); + AppendParam( EEGLint, reinterpret_cast(&aSize.iHeight), aDir ); + } +#endif + +inline void DriverRFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EEGLVoid, aLength, reinterpret_cast( 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(aData), aLength, aIndex ); + } + + +inline void DriverRFC::AppendTUint32( const TUint32& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( ETUint32, reinterpret_cast(&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(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGbyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGbyte, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGubyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGubyte, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGshort& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGshort, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGint& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGint, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGuint& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast(&aParam), aDir ); + } + + +inline void DriverRFC::AppendVGParam( const VGboolean& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGboolean, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGErrorCode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGErrorCode, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGRenderingQuality& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGRenderingQuality, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPixelLayout& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPixelLayout, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGMatrixMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGMatrixMode, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGMaskOperation& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGMaskOperation, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPathDatatype& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathDatatype, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPathAbsRel& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathAbsRel, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPathSegment& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPathCommand& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPathCapabilities& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathCapabilities, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPathParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGCapStyle& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGCapStyle, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGJoinStyle& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGJoinStyle, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGFillRule& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGFillRule, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPaintMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPaintMode, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPaintParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGPaintType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGColorRampSpreadMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGColorRampSpreadMode, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGTilingMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGTilingMode, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGImageFormat& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageFormat, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGImageQuality& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageQuality, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGImageParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGImageMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageMode, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGImageChannel& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageChannel, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGBlendMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGBlendMode, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGHardwareQueryType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGHardwareQueryType, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGHardwareQueryResult& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGHardwareQueryResult, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGStringID& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGStringID, reinterpret_cast(&aParam), aDir ); + } + +inline void DriverRFC::AppendVGParam( const VGUArcType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGUArcType, reinterpret_cast(&aParam), aDir ); + } + +#ifdef __SYMBIAN32__ +inline void DriverRFC::AppendVGParam( const VGeglImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGeglImageKHR, reinterpret_cast(&aParam), aDir ); + } +#endif + + diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/eglrfc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/eglrfc.h Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,187 @@ +// 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 + #include + #include +#else + #include "EGL/egl.h" + #include "EGL/eglext.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, + EeglSimulatorSetSurfaceParams, + EeglSimulatorCopyImageData, + 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/eglrfc.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/eglrfc.inl Wed Oct 06 15:43:10 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 = ((TUint64)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(aData), aLength, aIndex ); + } + +inline void EglRFC::SetEGLConfigVectorData( const EGLConfig* aData, TInt aLength, TInt aIndex ) + { + RemoteFunctionCall::SetVectorData( EEGLConfig, reinterpret_cast(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(&lower), aDir ); + AppendParam( EEGLint, reinterpret_cast(&upper), aDir ); + } + +inline void EglRFC::AppendEGLBoolean( const EGLBoolean& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLBoolean, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLint( const EGLint& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLint, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLenum( const EGLenum& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLenum, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLDisplay( const EGLDisplay& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLDisplay, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLConfig( const EGLConfig& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLConfig, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLSurface( const EGLSurface& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLSurface, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLContext( const EGLContext& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLContext, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLClientBuffer( const EGLClientBuffer& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLClientBuffer, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLImageKHR( const EGLImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLImageKHR, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLNativeDisplayType( const NativeDisplayType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLNativeDisplayType, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLNativeWindowType( const NativeWindowType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLNativeWindowType, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLNativePixmapType( const NativePixmapType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + AppendParam( EEGLNativePixmapType, reinterpret_cast(&aParam), aDir ); + } + +inline void EglRFC::AppendEGLintVector( const EGLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EEGLint, aLength, reinterpret_cast( aData ), aDir ); + } + +inline void EglRFC::AppendEGLConfigVector( const EGLConfig* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EEGLConfig, aLength, reinterpret_cast( 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(&aSize.iWidth), aDir ); + AppendParam( EEGLint, reinterpret_cast(&aSize.iHeight), aDir ); + } +#endif + +inline void EglRFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EEGLVoid, aLength, reinterpret_cast( 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(aData), aLength, aIndex ); + } diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/opengles11rfc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/opengles11rfc.h Wed Oct 06 15:43:10 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 +#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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/opengles11rfc.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/opengles11rfc.inl Wed Oct 06 15:43:10 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(aData), aLength, aIndex ); +} +inline void OpenGlES11RFC::SetVectorData( const GLuint* aData, TInt aLength, TInt aIndex ) +{ + RemoteFunctionCall::SetVectorData( EGLuint, reinterpret_cast(aData), aLength, aIndex ); +} +inline void OpenGlES11RFC::SetVectorData( const GLshort* aData, TInt aLength, TInt aIndex ) +{ + RemoteFunctionCall::SetVectorData( EGLshort, reinterpret_cast(aData), aLength, aIndex ); +} +inline void OpenGlES11RFC::SetVectorData( const GLfloat* aData, TInt aLength, TInt aIndex ) +{ + RemoteFunctionCall::SetVectorData( EGLfloat, reinterpret_cast(aData), aLength, aIndex ); +} +inline void OpenGlES11RFC::SetVectorData( const GLboolean* aData, TInt aLength, TInt aIndex ) +{ + RemoteFunctionCall::SetVectorData( EGLboolean, reinterpret_cast(aData), aLength, aIndex ); +} +inline void OpenGlES11RFC::SetVectorData( const void* aData, TInt aLength, TInt aIndex ) +{ + RemoteFunctionCall::SetVectorData( EGLvoid, reinterpret_cast(aData), aLength, aIndex ); +} + + +inline void OpenGlES11RFC::AppendParam( const GLbyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendParam( EGLbyte, reinterpret_cast(&aParam), aDir ); +} +inline void OpenGlES11RFC::AppendParam( const GLubyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendParam( EGLubyte, reinterpret_cast(&aParam), aDir ); +} +inline void OpenGlES11RFC::AppendParam( const GLshort& aParam, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendParam( EGLshort, reinterpret_cast(&aParam), aDir ); +} +inline void OpenGlES11RFC::AppendParam( const GLushort& aParam, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendParam( EGLushort, reinterpret_cast(&aParam), aDir ); +} +inline void OpenGlES11RFC::AppendParam( const GLint& aParam, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendParam( EGLint, reinterpret_cast(&aParam), aDir ); +} +inline void OpenGlES11RFC::AppendParam( const GLuint& aParam, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendParam( EGLuint, reinterpret_cast(&aParam), aDir ); +} +inline void OpenGlES11RFC::AppendParam( const GLfloat& aParam, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendParam( EGLfloat, reinterpret_cast(&aParam), aDir ); +} + + +inline void OpenGlES11RFC::AppendVector( const GLint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendVector( EGLint, aLength, reinterpret_cast( aData ), aDir ); +} +inline void OpenGlES11RFC::AppendVector( const GLuint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendVector( EGLuint, aLength, reinterpret_cast( aData ), aDir ); +} +inline void OpenGlES11RFC::AppendVector( const GLshort* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendVector( EGLshort, aLength, reinterpret_cast( aData ), aDir ); +} +inline void OpenGlES11RFC::AppendVector( const GLfloat* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendVector( EGLfloat, aLength, reinterpret_cast( aData ), aDir ); +} +inline void OpenGlES11RFC::AppendVector( const GLboolean* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendVector( EGLboolean, aLength, reinterpret_cast( aData ), aDir ); +} +inline void OpenGlES11RFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) +{ + RemoteFunctionCall::AppendVector( EGLvoid, aLength, reinterpret_cast( aData ), aDir ); +} diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/openvgrfc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/openvgrfc.h Wed Oct 06 15:43:10 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 + #include +#else + #define __OPENVGHEADERS_USE_VG_1_1 + #include + #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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/openvgrfc.inl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/openvgrfc.inl Wed Oct 06 15:43:10 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 = ((TUint64)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(aData), aLength, aIndex ); + } + +inline void OpenVgRFC::SetVectorData( const VGint* aData, TInt aLength, TInt aIndex ) + { + RemoteFunctionCall::SetVectorData( EVGint, reinterpret_cast(aData), aLength, aIndex ); + } + +inline void OpenVgRFC::SetVectorData( const VGuint* aData, TInt aLength, TInt aIndex ) + { + RemoteFunctionCall::SetVectorData( EVGuint, reinterpret_cast(aData), aLength, aIndex ); + } + +inline void OpenVgRFC::SetVectorData( const VGshort* aData, TInt aLength, TInt aIndex ) + { + RemoteFunctionCall::SetVectorData( EVGshort, reinterpret_cast(aData), aLength, aIndex ); + } + +inline void OpenVgRFC::SetVectorData( const VGubyte* aData, TInt aLength, TInt aIndex ) + { + RemoteFunctionCall::SetVectorData( EVGubyte, reinterpret_cast(aData), aLength, aIndex ); + } + +inline void OpenVgRFC::SetVectorData( const void* aData, TInt aLength, TInt aIndex ) + { + RemoteFunctionCall::SetVectorData( EVGvoid, reinterpret_cast(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(&lower), aDir ); + RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast(&upper), aDir ); + } +inline void OpenVgRFC::AppendParam( const VGfloat& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGfloat, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGbyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGbyte, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGubyte& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGubyte, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGshort& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGshort, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGint& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGint, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGuint& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGuint, reinterpret_cast(&aParam), aDir ); + } + + +inline void OpenVgRFC::AppendParam( const VGboolean& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGboolean, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGErrorCode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGErrorCode, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGRenderingQuality& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGRenderingQuality, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPixelLayout& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPixelLayout, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGMatrixMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGMatrixMode, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGMaskOperation& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGMaskOperation, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPathDatatype& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathDatatype, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPathAbsRel& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathAbsRel, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPathSegment& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPathCommand& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathSegment, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPathCapabilities& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathCapabilities, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPathParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPathParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGCapStyle& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGCapStyle, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGJoinStyle& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGJoinStyle, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGFillRule& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGFillRule, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPaintMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPaintMode, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPaintParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGPaintType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGPaintParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGColorRampSpreadMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGColorRampSpreadMode, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGTilingMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGTilingMode, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGImageFormat& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageFormat, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGImageQuality& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageQuality, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGImageParamType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageParamType, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGImageMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageMode, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGImageChannel& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGImageChannel, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGBlendMode& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGBlendMode, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGHardwareQueryType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGHardwareQueryType, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGHardwareQueryResult& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGHardwareQueryResult, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGStringID& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGStringID, reinterpret_cast(&aParam), aDir ); + } + +inline void OpenVgRFC::AppendParam( const VGUArcType& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGUArcType, reinterpret_cast(&aParam), aDir ); + } + +#ifdef __SYMBIAN32__ +inline void OpenVgRFC::AppendParam( const VGeglImageKHR& aParam, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendParam( EVGeglImageKHR, reinterpret_cast(&aParam), aDir ); + } +#endif + +inline void OpenVgRFC::AppendVector( const VGfloat* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EVGfloat, aLength, reinterpret_cast( aData ), aDir ); + } + +inline void OpenVgRFC::AppendVector( const VGint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EVGint, aLength, reinterpret_cast( aData ), aDir ); + } + +inline void OpenVgRFC::AppendVector( const VGuint* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EVGuint, aLength, reinterpret_cast( aData ), aDir ); + } + +inline void OpenVgRFC::AppendVector( const VGshort* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EVGshort, aLength, reinterpret_cast( aData ), aDir ); + } + +inline void OpenVgRFC::AppendVector( const VGubyte* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EVGubyte, aLength, reinterpret_cast( aData ), aDir ); + } + +inline void OpenVgRFC::AppendVector( const void* aData, TInt aLength, RemoteFunctionCallData::TParamDirection aDir ) + { + RemoteFunctionCall::AppendVector( EVGvoid, aLength, reinterpret_cast( aData ), aDir ); + } diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/remotefunctioncall.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/remotefunctioncall.h Wed Oct 06 15:43:10 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 +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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/requestbuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/requestbuffer.h Wed Oct 06 15:43:10 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/serialisedapiuids.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/serialisedapiuids.h Wed Oct 06 15:43:10 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/serializedfunctioncall.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/serializedfunctioncall.h Wed Oct 06 15:43:10 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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/inc/serializerplatform.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/inc/serializerplatform.h Wed Oct 06 15:43:10 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 +#include + +#ifdef __KERNEL_MODE__ +#include +#undef ASSERT(x) +#define ASSERT(x) +#define SER_IMPORT_C +#define SER_EXPORT_C +#else +#include +#define SER_IMPORT_C IMPORT_C +#define SER_EXPORT_C EXPORT_C +#endif +#else +#include +#include + +#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 diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/src/driverrfc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/src/driverrfc.cpp Wed Oct 06 15:43:10 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; + } diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/src/eglrfc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/src/eglrfc.cpp Wed Oct 06 15:43:10 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; + } diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/src/opengles11rfc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/src/opengles11rfc.cpp Wed Oct 06 15:43:10 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; +} diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/src/openvgrfc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/src/openvgrfc.cpp Wed Oct 06 15:43:10 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; + } diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/src/remotefunctioncall.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/src/remotefunctioncall.cpp Wed Oct 06 15:43:10 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 +#include "serialisedapiuids.h" +// Guest 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(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*)¶m.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( 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 ); + } diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwserialiser/src/serializedfunctioncall.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwserialiser/src/serializedfunctioncall.cpp Wed Oct 06 15:43:10 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(&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*)¶m.iDir, sizeof(param.iDir) ); + if ( ReadParam( (TUint8*)¶m.iType, sizeof(param.iType) ) ) + { + + if ( RemoteFunctionCallData::TParam::ESimple == param.iType ) + { + ReadParam( (TUint8*)¶m.iSimpleParam.iDataType, sizeof(param.iSimpleParam.iDataType) ); + ReadParam( (TUint8*)¶m.iSimpleParam.iDataTypeSize, sizeof(param.iSimpleParam.iDataTypeSize) ); + ReadParam( (TUint8*)¶m.iSimpleParam.iData, param.iSimpleParam.iDataTypeSize ); + } + else if ( RemoteFunctionCallData::TParam::EVector == param.iType ) + { + ReadParam( (TUint8*)¶m.iVectorParam.iDataType, sizeof(param.iVectorParam.iDataType) ); + ReadParam( (TUint8*)¶m.iVectorParam.iVectorLength, sizeof(param.iVectorParam.iVectorLength) ); + ReadParam( (TUint8*)¶m.iVectorParam.iCallerAddress, sizeof(param.iVectorParam.iCallerAddress) ); + ReadParam( (TUint8*)¶m.iVectorParam.iDataTypeSize, sizeof(param.iVectorParam.iDataTypeSize) ); + ReadParam( (TUint8*)¶m.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*)¶m.iDir, + sizeof(param.iDir) ) ) + { + break; + } + + if ( !WriteParam( (TUint8*)¶m.iType, + sizeof(param.iType) ) ) + { + break; + } + + if ( RemoteFunctionCallData::TParam::ESimple == param.iType ) + { + if ( !WriteParam( (TUint8*)¶m.iSimpleParam.iDataType, + sizeof(param.iSimpleParam.iDataType) ) ) + { + break; + } + if ( !WriteParam( (TUint8*)¶m.iSimpleParam.iDataTypeSize, + sizeof(param.iSimpleParam.iDataTypeSize) ) ) + { + break; + } + + if ( !WriteParam( (TUint8*)¶m.iSimpleParam.iData, param.iSimpleParam.iDataTypeSize ) ) + { + break; + } + } + else if ( RemoteFunctionCallData::TParam::EVector == param.iType ) + { + if ( !WriteParam( (TUint8*)¶m.iVectorParam.iDataType, sizeof(param.iVectorParam.iDataType) )) + { + break; + } + + if ( !WriteParam( (TUint8*)¶m.iVectorParam.iVectorLength, sizeof(param.iVectorParam.iVectorLength) )) + { + break; + } + + if ( !WriteParam( (TUint8*)¶m.iVectorParam.iCallerAddress, sizeof(param.iVectorParam.iCallerAddress) )) + { + break; + } + + if ( !WriteParam( (TUint8*)¶m.iVectorParam.iDataTypeSize, sizeof(param.iVectorParam.iDataTypeSize) )) + { + break; + } + + if ( !WriteParam( (TUint8*)¶m.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 ) + { + } diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwutils/eabi/vghwutilsu.def --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwutils/eabi/vghwutilsu.def Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,32 @@ +EXPORTS + _Z9VghwPanic10TVghwPanicPcS0_S0_i @ 1 NONAME + _ZN10CVghwUtils14MapToHWAddressEiRm @ 2 NONAME + _ZN10CVghwUtils20DriverExecuteCommandER22RemoteFunctionCallData @ 3 NONAME + _ZN10CVghwUtils11InitStaticsEv @ 4 NONAME + _ZN10CVghwUtils5AllocEi @ 5 NONAME + _ZN10CVghwUtils4FreeEPv @ 6 NONAME + _ZN10CVghwUtils7GetHeapEv @ 7 NONAME + _ZN10CVghwUtils16SwitchToVghwHeapEv @ 8 NONAME + _ZN10CVghwUtils18SwitchFromVghwHeapEP5RHeap @ 9 NONAME + Reserved10 @ 10 NONAME ABSENT + Reserved11 @ 11 NONAME ABSENT + _ZN10CVghwUtils17CreateThreadStateEv @ 12 NONAME + _ZN10CVghwUtils18ReleaseThreadStateEv @ 13 NONAME + _ZN10CVghwUtils14EglThreadStateEv @ 14 NONAME + _ZN10CVghwUtils9VgContextEv @ 15 NONAME + _ZN10CVghwUtils11GlesContextEv @ 16 NONAME + _ZN15TEglThreadState8EglErrorEv @ 17 NONAME + _ZN15TEglThreadState17ExecEglBooleanCmdER6EglRFC @ 18 NONAME + _ZN15TEglThreadState17ExecEglContextCmdER6EglRFC @ 19 NONAME + _ZN15TEglThreadState17ExecEglSurfaceCmdER6EglRFC @ 20 NONAME + _ZN10CVghwUtils16EglManagementApiEv @ 21 NONAME + _ZN10CVghwUtils15EglGetSgHandlesEyPy @ 22 NONAME + _ZN10CVghwUtils14DestroyStaticsEv @ 23 NONAME + _ZN10CVghwUtils19SetEglManagementApiEP17MEglManagementApi @ 24 NONAME + _ZN10CVghwUtils14SetVgApiForEglEP12MVgApiForEgl @ 25 NONAME + _ZN10CVghwUtils18SetGles11ApiForEglEP16MGles11ApiForEgl @ 26 NONAME + _ZN10CVghwUtils17SetGles2ApiForEglEP15MGles2ApiForEgl @ 27 NONAME + _ZN10CVghwUtils11VgApiForEglEv @ 28 NONAME + _ZN10CVghwUtils15Gles11ApiForEglEv @ 29 NONAME + _ZN10CVghwUtils14Gles2ApiForEglEv @ 30 NONAME + _ZN10CVghwUtils27GetSurfaceBufferBaseAddressERm @ 31 NONAME diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwutils/group/bld.inf --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwutils/group/bld.inf Wed Oct 06 15:43:10 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 file for VG Hardware Utilities + +PRJ_PLATFORMS +DEFAULT -WINSCW + +PRJ_EXPORTS +../rom/vghwutils.iby /epoc32/rom/include/vghwutils.iby + +PRJ_MMPFILES +vghwutils.mmp diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwutils/group/vghwutils.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwutils/group/vghwutils.mmp Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,53 @@ +// 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 vghwutils + +TARGET vghwutils.dll +TARGETTYPE dll +UID 0x1000008d 0x20026A32 +capability CAP_GENERAL_DLL //All -Tcb +vendorid VID_DEFAULT //0x101FB657 //Nokia vendor id + +OS_LAYER_ESTLIB_SYSTEMINCLUDE +OS_LAYER_SYSTEMINCLUDE +USERINCLUDE ../inc +SYSTEMINCLUDE /epoc32/include +//systeminclude /epoc32/include/libc // STDLIB include files +//systeminclude /epoc32/include/vg // OpenVG include files +USERINCLUDE ../../vghwserialiser/inc +// userinclude ../../platsimvideodriver/api/inc // Local include files +// userinclude ../../platsimvideodriver/commoninc // Local include files + +SOURCEPATH ../src + +SOURCE vghwutils.cpp + +// constructors & such for OpenVgRFC and EglRFC objects +SOURCEPATH ../../vghwserialiser/src +SOURCE eglrfc.cpp +SOURCE openvgrfc.cpp +SOURCE opengles11rfc.cpp + + +//nostrictdef + +LIBRARY euser.lib +LIBRARY guestvideohwapi.lib +LIBRARY vghwserialiser.lib + +#ifdef ENABLE_ABIV2_MODE +DEBUGGABLE_UDEBONLY +#endif + +EPOCALLOWDLLDATA diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwutils/inc/vghwutils.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwutils/inc/vghwutils.h Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,342 @@ +// 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 __VGHWUTILS_H__ +#define __VGHWUTILS_H__ + +// Include Files +#include // CBase +#include +#include +#include +#include "eglrfc.h" + + +class RGuestVideoDriver; + +// Virtual Graphics Hardware per thread data: TEglThreadState is concrete, MVgContext & MGlesContext are per API interfaces +class TEglThreadState; +class MGlesContext; +class MVgContext; + +// data serialisation packages +class OpenVgRFC; +class EglRFC; +class RemoteFunctionCall; +class RemoteFunctionCallData; + +// tracing +#ifdef _DEBUG + #include + #define UTIL_TRACE(fmt, args...) RDebug::Printf(fmt, ##args) + #define VGHWPANIC_ASSERT(condition, panic) if (!(condition)) { VghwPanic(panic, #panic, #condition, __FILE__, __LINE__); } + #define VGHWPANIC_ASSERT_DEBUG(condition, panic) if (!(condition)) { VghwPanic(panic, #panic, #condition, __FILE__, __LINE__); } +#else + #define UTIL_TRACE(fmt, args...) + #define VGHWPANIC_ASSERT(condition, panic) if (!(condition)) { VghwPanic(panic, NULL, NULL, NULL, __LINE__); } + #define VGHWPANIC_ASSERT_DEBUG(condition, panic) +#endif + + +// Simulator Virtual Graphics Hardware panic codes +typedef enum + { + EVghwPanicNoVideoChannel = 1, + EVghwPanicOperationDataTooBig, + EVghwPanicDriverOpenError, + EVghwPanicVghwHeapDoesNotExist, + EVghwPanicInitializeFailed, + EVghwPanicGraphicsDriverNotOpen, + EVghwPanicSwitchToVghwHeapOldHeapIsVghwHeap, + EVghwPanicSwitchFromVghwHeapParamIsNull, + EVghwPanicSwitchFromVghwHeapOldHeapIsNotVghwHeap, + EVghwPanicSwitchFromVghwHeapParamIsVghwHeap, // 10 + EVghwPanicGraphicsCreationLockDoesNotExist, + EVghwPanicExecuteCommandFailed, + EVghwPanicBadVgErrorValue, + EVghwPanicBadGlesErrorValue, + EVghwPanicBadEglErrorValue, + EVghwPanicBadEglBoundApi, + } TVghwPanic; + +// This panic function is exported to allow inline functions to use it +IMPORT_C void VghwPanic(TVghwPanic aPanicCode, char* aPanicName, char* aCondition, char* aFile, TInt aLine); + + +// Mix-in class: EGL support functions, including SgImage support, expected to be called by Open VG and Open GL ES +class MEglManagementApi + { +public: + virtual TBool EglImageOpenForVgImage(EGLImageKHR aImage, TSize& aSize, VGHandle& aVgHandle, TUint64& aSgImageId) = 0; + virtual void EglImageClose(EGLImageKHR aImage) = 0; + // ToDo add an API so that Open VG can query the size of the current Context's surface + }; + + +typedef void (*ExtensionProcPointer)(...); + + +// Private interfaces for EGL to call into Open VG +class MVgApiForEgl + { +public: + virtual ExtensionProcPointer guestGetVgProcAddress (const char *aProcName) = 0; + }; + + +// Private interfaces for EGL to call into Open GL ES 1.1 +class MGles11ApiForEgl + { +public: + virtual ExtensionProcPointer guestGetGles11ProcAddress (const char *aProcName) = 0; + }; + + +// Private interfaces for EGL to call into Open GL ES 2 +class MGles2ApiForEgl + { +public: + virtual ExtensionProcPointer guestGetGles2ProcAddress (const char *aProcName) = 0; + }; + + +/* + VGHWUtils APIs are static for ease of use by the other Simulator Graphics DLLs. + + One (singleton) instance is created as Writeable Static Data when the DLL is loaded. + After initialization this will hold process-wide data - e.g. a memory heap for Graphics DLLs + to store local Symbian client state information. + + ToDo maybe make this a Symbian X class because it owns resources, but only as static data. + */ +NONSHARABLE_CLASS(CVghwUtils): public CBase + { + friend class TEglThreadState; // to limit visibility of DriverExecuteCommand +public: + // open Driver connection, create Memory Heap, etc... + IMPORT_C static void InitStatics(); + IMPORT_C static void DestroyStatics(); + + IMPORT_C static TInt MapToHWAddress(const TInt aChunkHandle, TUint32& aHWAddress); + IMPORT_C static TInt GetSurfaceBufferBaseAddress(TUint32& aHWAddress); + IMPORT_C static TInt EglGetSgHandles(const TUint64 aId, TUint64 *aSgHandles); + + // VG Memory Pool APIs (One heap is created for the process, for use by all Simulator Graphics DLLs) + IMPORT_C static TAny* Alloc(TInt aSize); + IMPORT_C static void Free(TAny* aPtr); + IMPORT_C static RHeap* GetHeap(); + IMPORT_C static RHeap* SwitchToVghwHeap(); + IMPORT_C static void SwitchFromVghwHeap(RHeap* aOldHeapPtr); + // handy function for Debug Asserts + static inline TBool UsingVghwHeap() { return &User::Heap() == GetHeap(); } + + // if this thread does not have a state object try to alloc a new one + IMPORT_C static TEglThreadState* CreateThreadState(); + // current state object, if any, for this thread (for EGL) + IMPORT_C static TEglThreadState* EglThreadState(); + // current state object, if Open VG, for this thread (as tracked by EGL DLL) + IMPORT_C static MVgContext* VgContext(); + // current state object for Open GL ES 1.1, for this thread (as tracked by EGL DLL) + IMPORT_C static MGlesContext* GlesContext(); + // free current state object, if any, for this thread + IMPORT_C static void ReleaseThreadState(); + + IMPORT_C static void SetEglManagementApi(MEglManagementApi* aEglManagementApi); + IMPORT_C static MEglManagementApi* EglManagementApi(); + + // Private interfaces for EGL to call into Open GL ES and Open VG (avoids breaking DEF file compatibility) + IMPORT_C static void SetVgApiForEgl(MVgApiForEgl* aVgApiForEgl); + IMPORT_C static MVgApiForEgl* VgApiForEgl(); + + IMPORT_C static void SetGles11ApiForEgl(MGles11ApiForEgl* aGles11ApiForEgl); + IMPORT_C static MGles11ApiForEgl* Gles11ApiForEgl(); + + IMPORT_C static void SetGles2ApiForEgl(MGles2ApiForEgl* aGles2ApiForEgl); + IMPORT_C static MGles2ApiForEgl* Gles2ApiForEgl(); + +protected: + IMPORT_C static void DriverExecuteCommand(RemoteFunctionCallData& aRequestData); + +private: + inline static RGuestVideoDriver& Driver(); + +private: + // everything is zeroed on construction, call Initialize() to prepare + volatile static TBool iInitialized; // NB "volatile" used for thread safety in InitStaticse() + static TInt iVghwInitMutex; // required for thread safety in Initialize() + + // static member objects + static RGuestVideoDriver* iDriver; + static RHeap* iHeap; + static MEglManagementApi* iEglManagementApi; + static MVgApiForEgl* iVgApiForEgl; + static MGles11ApiForEgl* iGles11ApiForEgl; + static MGles2ApiForEgl* iGles2ApiForEgl; + static TBool iLoadedOpenVgDll; + static TBool iLoadedOpenGles11Dll; + static TBool iLoadedOpenGles2Dll; + }; + + +// Basic interface for sending GL ES 1.1 commands down to Host Open GL ES implementation - can be expanded later +class MGlesContext + { +public: + // Execute Open GL ES 1.1 commands + virtual void ExecuteGlesCommand(RemoteFunctionCall& aGlesRequestData) = 0; + virtual void ExecuteGlesFlushCommand() = 0; + virtual void ExecuteGlesFinishCommand() = 0; + // GLES state + virtual void SetGlesError(GLenum aGlesErrorCode) = 0; + virtual GLenum GlesError() = 0; + // ToDo make context tracking work for VG & GL ES + virtual EGLContext GlesEglContext() = 0; + }; + + +// Basic interface for sending VG commands down to Host Open VG implementation - can be expanded later +class MVgContext + { +public: + // Execute Open VG commands + virtual void ExecuteVgCommand(OpenVgRFC& aVgApiData) = 0; + virtual void ExecuteVgFlushCommand() = 0; + virtual void ExecuteVgFinishCommand() = 0; + // VG state + virtual void SetVgError(VGErrorCode aVgErrorCode) = 0; + virtual VGErrorCode VgError() = 0; + virtual EGLContext VgEglContext() = 0; + }; + + +NONSHARABLE_CLASS(TEglThreadState) : public MGlesContext, public MVgContext + { + friend class CVghwUtils; // to manage creation / delete of per thread state +public: + // Execute EGL commands, and analyse for success + IMPORT_C EGLBoolean ExecEglBooleanCmd(EglRFC& aEglApiData); + IMPORT_C EGLContext ExecEglContextCmd(EglRFC& aEglApiData); + IMPORT_C EGLSurface ExecEglSurfaceCmd(EglRFC& aEglApiData); + // ToDo add static export for eglTerminate + + // Execute EGL commands whose return value cannot be tested for fail/success + inline void ExecuteEglNeverErrorCmd(EglRFC& aEglApiData); + // EGL thread state + inline void ClearEglError(); + inline void SetEglError(EGLint aEglError); + IMPORT_C EGLint EglError(); + inline void SetEglBoundApi(EGLenum aEglBoundApi); + inline EGLenum EglBoundApi(); + inline EGLint PeekEglError(); // reads DLL set error code (only) + + // MGlesContext: Execute Open GL ES 1.1 commands & manage Open GL ES state + virtual void ExecuteGlesCommand(RemoteFunctionCall& aGlesRequestData); + virtual void ExecuteGlesFlushCommand(); + virtual void ExecuteGlesFinishCommand(); + virtual void SetGlesError(GLenum aGlesErrorCode); + virtual GLenum GlesError(); + virtual EGLContext GlesEglContext(); + + // MVgContext: Execute Open VG commands & manage Open VG state + virtual void ExecuteVgCommand(OpenVgRFC& aVgApiData); + virtual void ExecuteVgFlushCommand(); + virtual void ExecuteVgFinishCommand(); + virtual void SetVgError(VGErrorCode aVgErrorCode); + virtual VGErrorCode VgError(); + virtual EGLContext VgEglContext(); + +protected: + static TEglThreadState* New(); + void Destroy(); + TEglThreadState(); + ~TEglThreadState(); + +private: + GLenum GetHostGlesError(); + VGErrorCode GetHostVgError(); + +private: + // EGL thread state + EGLint iEglError; + TBool iEglHostHasRecentError; + // currently bound graphics API + EGLenum iEglBoundApi; + + // Open VG context for thread + VGErrorCode iVgError; + EGLContext iVgEglContext; + TBool iVgCommandsSinceGetError; + TBool iVgCommandsSinceFlush; + TBool iVgCommandsSinceFinish; + + // Open GL ES 1.1 context for thread + GLenum iGlesError; + EGLContext iGlesEglContext; + TBool iGlesCommandsSinceGetError; + TBool iGlesCommandsSinceFlush; + TBool iGlesCommandsSinceFinish; + }; + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////// +// TVghwThreadState inline functions + +void TEglThreadState::ClearEglError() + { + UTIL_TRACE(" TVghwThreadState::ClearEglError"); + iEglError = EGL_SUCCESS; + iEglHostHasRecentError = EFalse; + } + + +void TEglThreadState::SetEglError(EGLint aEglError) + { + UTIL_TRACE(" TVghwThreadState::SetEglError error=0x%x", aEglError); + VGHWPANIC_ASSERT_DEBUG((aEglError >= EGL_SUCCESS) && (aEglError <= 0x301F), EVghwPanicBadEglErrorValue); + iEglError = aEglError; + iEglHostHasRecentError = EFalse; + } + + +EGLint TEglThreadState::PeekEglError() // reads DLL set error code + { + return iEglError; + } + + +void TEglThreadState::SetEglBoundApi(EGLenum aEglBoundApi) + { + VGHWPANIC_ASSERT_DEBUG((aEglBoundApi == EGL_OPENGL_ES_API) || (aEglBoundApi == EGL_OPENVG_API), EVghwPanicBadEglBoundApi); + iEglBoundApi = aEglBoundApi; + } + + +EGLenum TEglThreadState::EglBoundApi() + { + return iEglBoundApi; + } + +// Execute EGL Command simple variants + +void TEglThreadState::ExecuteEglNeverErrorCmd(EglRFC& aEglApiData) + { // for EGL commands which cannot have a host error + CVghwUtils::DriverExecuteCommand(aEglApiData.Data()); + iEglHostHasRecentError = EFalse; + iEglError = EGL_SUCCESS; + } + +#endif // __VGHWUTILS_H__ diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwutils/rom/vghwutils.iby --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwutils/rom/vghwutils.iby Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,25 @@ +// 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 GUESTRENDERING_VGHWUTILS_IBY +#define GUESTRENDERING_VGHWUTILS_IBY + + +file=ABI_DIR\BUILD_DIR\vghwutils.dll \sys\bin\vghwutils.dll + + +#endif // GUESTRENDERING_VGHWUTILS_IBY + +// End of File diff -r 3b4f7e9d873f -r 4f400a6ea71f vghwinterface/vghwutils/src/vghwutils.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vghwinterface/vghwutils/src/vghwutils.cpp Wed Oct 06 15:43:10 2010 +0100 @@ -0,0 +1,908 @@ +// 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 +#include + +#include + +#include "vghwutils.h" +#include "eglrfc.h" +#include "openvgrfc.h" +#include "opengles11rfc.h" + +#ifdef _DEBUG +#define EGL_ERROR_PRINT(T, E) EglErrorPrint(T, E) +#define GLES_ERROR_PRINT(T, E) GlesErrorPrint(T, E) +#define VG_ERROR_PRINT(T, E) VgErrorPrint(T, E) +static void EglErrorPrint(char* aTitle, EGLint aEglError); +static void GlesErrorPrint(char* aTitle, GLenum aGlesError); +static void VgErrorPrint(char* aTitle, VGErrorCode aVgError); +#else +#define EGL_ERROR_PRINT(T, E) +#define GLES_ERROR_PRINT(T, E) +#define VG_ERROR_PRINT(T, E) +#endif + + +// Min & Max sizes for creating Memory Heap for Guest Graphics DLLs +#define KVghwHeapMin 0x1000 +#define KVghwHeapMax 0x100000 + + +// protection against concurrent initialisation from multiple threads +volatile TBool CVghwUtils::iInitialized = EFalse; +TInt CVghwUtils::iVghwInitMutex = 0; + +// static member objects - Writeable Static Data +RGuestVideoDriver* CVghwUtils::iDriver = NULL; +RHeap* CVghwUtils::iHeap = NULL; +MEglManagementApi* CVghwUtils::iEglManagementApi = NULL; +MVgApiForEgl* CVghwUtils::iVgApiForEgl = NULL; +MGles11ApiForEgl* CVghwUtils::iGles11ApiForEgl = NULL; +MGles2ApiForEgl* CVghwUtils::iGles2ApiForEgl = NULL; +TBool CVghwUtils::iLoadedOpenVgDll = EFalse; +TBool CVghwUtils::iLoadedOpenGles11Dll = EFalse; +TBool CVghwUtils::iLoadedOpenGles2Dll = EFalse; + + + +_LIT(KVghwPanicCategory, "Guest VGHW"); + + +// NOTE: Exported because some VGHW functions are inline and could Assert & Panic from somewhere else +EXPORT_C void VghwPanic(TVghwPanic aPanicCode, char* aPanicName, char* aCondition, char* aFile, TInt aLine) + { + if (aCondition && aFile) + { + RDebug::Printf("VghwUtils Panic %s for failed Assert (%s), at %s:%d", aPanicName, aCondition, aFile, aLine); + } + else + { + RDebug::Printf("VghwUtils Panic %d for failed Assert (line %d)", aPanicCode, aLine); + } + + User::Panic(KVghwPanicCategory, aPanicCode); + } + +// inline functions + +RGuestVideoDriver& CVghwUtils::Driver() + { + // TODO remove this later in refactoring - Open VG & GL ES commands should not reach here before EGL has initialized the singleton + if (!iInitialized || !iDriver) + { + UTIL_TRACE("CVghwUtils::Driver called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); + InitStatics(); + } + VGHWPANIC_ASSERT(iInitialized && iDriver, EVghwPanicGraphicsDriverNotOpen); + return *iDriver; + } + + +EXPORT_C void CVghwUtils::DestroyStatics() + { +#ifdef _DEBUG + TUint64 processId = RProcess().Id().Id(); + TUint64 threadId = RThread().Id().Id(); + UTIL_TRACE("CVghwUtils::DestroyStatics iInitialized=%d, iDriver=0x%x, iHeap=0x%x, Process=0x%lx, Thread=0x%lx", + iInitialized, iDriver, iHeap, processId, threadId); +#endif + if (iHeap) + { + if (iDriver) + { + iDriver->Flush(); + iDriver->Close(); + RHeap* threadHeap = SwitchToVghwHeap(); + delete iDriver; + SwitchFromVghwHeap(threadHeap); + iDriver = NULL; + } + iHeap->Reset(); + iHeap->Close(); + iHeap = NULL; + } + if (iInitialized) + { + iInitialized = EFalse; + } + } + + +// Ensure Graphics memory heap is created, and Open driver channel +EXPORT_C void CVghwUtils::InitStatics() + { +#ifdef _DEBUG + TUint64 processId = RProcess().Id().Id(); + TUint64 threadId = RThread().Id().Id(); + UTIL_TRACE("CVghwUtils::InitStatics start Process=0x%lx, Thread=0x%lx, iInitialized=%d", + processId, threadId, iInitialized); +#endif + // bootstrap creation of mutexes and Graphics memory heap + while (!iInitialized) + { + TInt creationError = KErrNone; + // thread safe initialization + // LockedDec() returns the value prior to decrement + if (0 != User::LockedDec(iVghwInitMutex)) + { + User::AfterHighRes(1000); // Yield X microseconds, review length if code is changed + } + else + { + // volatile attribute forces rereading of the pointer, in case another thread has done the allocation + if (!iInitialized) + { // loop style init exits if any stage fails, and gives per step debug logging + TInt step = 0; + do + { + switch (step) + { + case 0: + // guarantee that initialisation of the object is flushed before the pointer is published + __e32_atomic_store_rel_ptr(&iHeap, User::ChunkHeap(NULL, KVghwHeapMin, KVghwHeapMax)); + if (!iHeap) + { + creationError = KErrNoMemory; + } + break; + case 1: + { + VGHWPANIC_ASSERT_DEBUG(iHeap, EVghwPanicVghwHeapDoesNotExist); + RHeap* threadHeap = User::SwitchHeap(iHeap); // switch to VGHW graphics Heap + iDriver = new RGuestVideoDriver(); + if (!iDriver) + { + creationError = KErrNoMemory; + } + User::SwitchHeap(threadHeap); // switch back to client Heap + } + break; + case 2: + creationError = User::LoadLogicalDevice(_L("guestvideohw")); + if ( (KErrNone == creationError) || (KErrAlreadyExists == creationError) ) + { + creationError = iDriver->Open(); + } + break; + default: // all initialisation steps completed + iInitialized = ETrue; + } + ++step; + } + while (!iInitialized && !creationError); + UTIL_TRACE("CVghwUtils::InitStatics %s step=%d; creationError=%d, iInitialized=%d, iDriver=0x%x, iHeap=0x%x", + creationError ? "failed at" : "completed", step, creationError, iInitialized, iDriver, iHeap); + } + } + User::LockedInc(iVghwInitMutex); + + VGHWPANIC_ASSERT(creationError == KErrNone, EVghwPanicInitializeFailed); + } + } + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +EXPORT_C void CVghwUtils::DriverExecuteCommand(RemoteFunctionCallData& aRequestData) + { + if (!iInitialized || !iDriver) + { + UTIL_TRACE("CVghwUtils::DriverExecuteCommand called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); + InitStatics(); + } + VGHWPANIC_ASSERT(iInitialized && iDriver, EVghwPanicGraphicsDriverNotOpen); + iDriver->ExecuteCommand(aRequestData); + } + + +// ----------------------------------------------------------------------------- +// Use driver to discover linear memory address of chunk. +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CVghwUtils::MapToHWAddress( const TInt aChunkHandle, TUint32& aHWAddress ) + { + UTIL_TRACE("CVghwUtils::MapToHWAddress"); + return Driver().MapToHWAddress( aChunkHandle, aHWAddress ); + } + + +// SgImage support function - get underlying VGImage & Pbuffer handles +EXPORT_C TInt CVghwUtils::EglGetSgHandles( const TUint64 aId, TUint64 *aSgHandles ) + { + UTIL_TRACE("CVghwUtils::EglGetSgHandles"); + return Driver().EglGetSgHandles( aId, aSgHandles ); + } + + +// Memory Heap Management functions + +EXPORT_C TAny* CVghwUtils::Alloc(TInt aSize) + { + if (!iInitialized || !iHeap) + { + UTIL_TRACE("CVghwUtils::Alloc called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); + InitStatics(); + } + VGHWPANIC_ASSERT(iInitialized && iHeap, EVghwPanicVghwHeapDoesNotExist); + return iHeap->Alloc(aSize); + } + + +EXPORT_C void CVghwUtils::Free(TAny* aPtr) + { + if (!iInitialized || !iHeap) + { + UTIL_TRACE("CVghwUtils::Free called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); + InitStatics(); + } + VGHWPANIC_ASSERT(iInitialized && iHeap, EVghwPanicVghwHeapDoesNotExist); + iHeap->Free(aPtr); + } + + +EXPORT_C RHeap* CVghwUtils::GetHeap() + { + if (!iInitialized || !iHeap) + { + UTIL_TRACE("CVghwUtils::GetHeap called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); + InitStatics(); + } + VGHWPANIC_ASSERT(iInitialized && iHeap, EVghwPanicVghwHeapDoesNotExist); + return iHeap; + } + + +// Switch to VGHW Memory Heap. +EXPORT_C RHeap* CVghwUtils::SwitchToVghwHeap() + { + if (!iInitialized || !iHeap) + { + UTIL_TRACE("CVghwUtils::SwitchToVghwHeap called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); + InitStatics(); + } + VGHWPANIC_ASSERT(iHeap, EVghwPanicVghwHeapDoesNotExist); + RHeap* oldHeap = User::SwitchHeap(iHeap); // switch to Guest graphics heap + VGHWPANIC_ASSERT(oldHeap != iHeap, EVghwPanicSwitchToVghwHeapOldHeapIsVghwHeap); + return oldHeap; + } + + +// Switch back to original heap +EXPORT_C void CVghwUtils::SwitchFromVghwHeap(RHeap* aOldHeapPtr) + { + if (!iInitialized || !iHeap) + { + UTIL_TRACE("CVghwUtils::SwitchFromVghwHeap called before EGL has initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); + InitStatics(); + } + VGHWPANIC_ASSERT(iHeap, EVghwPanicVghwHeapDoesNotExist); + VGHWPANIC_ASSERT(aOldHeapPtr, EVghwPanicSwitchFromVghwHeapParamIsNull); + VGHWPANIC_ASSERT(aOldHeapPtr != iHeap, EVghwPanicSwitchFromVghwHeapParamIsVghwHeap); + + RHeap* oldHeap = User::SwitchHeap(aOldHeapPtr); // switch from Guest graphics heap back to thread heap + VGHWPANIC_ASSERT(oldHeap == iHeap, EVghwPanicSwitchFromVghwHeapOldHeapIsNotVghwHeap); + } + + +// if this thread does not have an object try to alloc a new one +EXPORT_C TEglThreadState* CVghwUtils::CreateThreadState() + { + TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); + if (!threadState) + { + UTIL_TRACE("CVghwUtils::CreateThreadState - object is currently 0x%x, iInitialized=%d", + threadState, iInitialized); + if (!iInitialized) + { + InitStatics(); + } + threadState = TEglThreadState::New(); + Dll::SetTls(threadState); + } + return threadState; + } + + +// current state object, if any, for this thread +EXPORT_C TEglThreadState* CVghwUtils::EglThreadState() + { + TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); + return threadState; + } + + +// current state object, if Open VG is the current bound API, for this thread +EXPORT_C MVgContext* CVghwUtils::VgContext() + { + TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); + return threadState; + // ToDo sort this to check for valid Open VG context + /* + if (threadState && threadState->VgEglContext()) + return threadState; + return NULL; + */ + } + + +// current state object, if Open GL ES is the current bound API, for this thread (for EGL) +EXPORT_C MGlesContext* CVghwUtils::GlesContext() + { + TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); + return threadState; + // ToDo sort this to check for valid Open GL ES context + /* + if (threadState && threadState->GlesEglContext()) + return threadState; + return NULL; */ + } + + +// free current state object, if any, for this thread +EXPORT_C void CVghwUtils::ReleaseThreadState() + { + TEglThreadState* threadState = reinterpret_cast(Dll::Tls()); + UTIL_TRACE("CVghwUtils::ReleaseThreadState - object = 0x%x", threadState); + if (threadState) + { + threadState->Destroy(); + Dll::FreeTls(); + } + } + + +EXPORT_C MEglManagementApi* CVghwUtils::EglManagementApi() + { + return iEglManagementApi; + } + + +EXPORT_C void CVghwUtils::SetEglManagementApi(MEglManagementApi* aEglManagementApi) + { + UTIL_TRACE("CVghwUtils::SetEglManagementApi aEglManagementApi=0x%x", aEglManagementApi); + iEglManagementApi = aEglManagementApi; + } + + +/* + Stored pointers into Open GL ES 1.1, GL ES 2 and Open VG are problematic if the DLL is later unloaded. + (RSgDriver::Open currently loads & unloads all the Open VG & GL ES DLLs, to determine features to publish.) + Possibly Open the DLL again when the non-NULL pointer is fetched by EGL, probably needs flags so that + this is only done once. + */ +EXPORT_C void CVghwUtils::SetVgApiForEgl(MVgApiForEgl* aVgApiForEgl) + { + UTIL_TRACE("CVghwUtils::SetVgApiForEgl aVgApiForEgl=0x%x, iVgApiForEgl=0x%x, iLoadedOpenVgDll=0x%x", + aVgApiForEgl, iVgApiForEgl, iLoadedOpenVgDll); + // don't let a thread set this to NULL if we have forced the DLL to stay loaded + if (aVgApiForEgl || !iLoadedOpenVgDll) + { + iVgApiForEgl = aVgApiForEgl; + } + } + + +EXPORT_C MVgApiForEgl* CVghwUtils::VgApiForEgl() + { + if (iVgApiForEgl && !iLoadedOpenVgDll) + { // ensure Open VG DLL stays loaded from now on + _LIT(KLibOpenVg, "libOpenVG.dll"); + RLibrary lib; + if (lib.Load(KLibOpenVg) == KErrNone) + { + UTIL_TRACE("CVghwUtils::VgApiForEgl - Open VG dll loaded, iVgApiForEgl=0x%x", iVgApiForEgl); + iLoadedOpenVgDll = ETrue; + return iVgApiForEgl; + } + } + UTIL_TRACE("CVghwUtils::VgApiForEgl - Open VG dll not loaded or not safe to use"); + return NULL; + } + + +EXPORT_C void CVghwUtils::SetGles11ApiForEgl(MGles11ApiForEgl* aGles11ApiForEgl) + { + UTIL_TRACE("CVghwUtils::SetGles11ApiForEgl aGles11ApiForEgl=0x%x, iGles11ApiForEgl=0x%x, iLoadedOpenGles11Dll=0x%x", + aGles11ApiForEgl, iGles11ApiForEgl, iLoadedOpenGles11Dll); + // don't let a thread set this to NULL if we have forced the DLL to stay loaded + if (aGles11ApiForEgl || !iLoadedOpenGles11Dll) + { + iGles11ApiForEgl = aGles11ApiForEgl; + } + } + + +EXPORT_C MGles11ApiForEgl* CVghwUtils::Gles11ApiForEgl() + { + if (iGles11ApiForEgl && !iLoadedOpenGles11Dll) + { // ensure Open VG DLL stays loaded from now on + _LIT(KLibOpenGles, "libGLESv1_CM.dll"); + RLibrary lib; + if (lib.Load(KLibOpenGles) == KErrNone) + { + UTIL_TRACE("CVghwUtils::Gles11ApiForEgl - Open GL ES 1.1 dll loaded, iGles11ApiForEgl=0x%x", iGles11ApiForEgl); + iLoadedOpenGles11Dll = ETrue; + return iGles11ApiForEgl; + } + } + UTIL_TRACE("CVghwUtils::Gles11ApiForEgl - Open GL ES 1.1 dll not loaded or not safe to use"); + return NULL; + } + + +EXPORT_C void CVghwUtils::SetGles2ApiForEgl(MGles2ApiForEgl* aGles2ApiForEgl) + { + UTIL_TRACE("CVghwUtils::SetGles2ApiForEgl aGles2ApiForEgl=0x%x, iGles2ApiForEgl=0x%x, iLoadedOpenGles2Dll=0x%x", + aGles2ApiForEgl, iGles2ApiForEgl, iLoadedOpenGles2Dll); + // don't let a thread set this to NULL if we have forced the DLL to stay loaded + if (aGles2ApiForEgl || !iLoadedOpenGles2Dll) + { + iGles2ApiForEgl = aGles2ApiForEgl; + } + } + + +EXPORT_C MGles2ApiForEgl* CVghwUtils::Gles2ApiForEgl() + { + if (iGles2ApiForEgl && !iLoadedOpenGles2Dll) + { // ensure Open VG DLL stays loaded from now on + _LIT(KLibOpenGles2, "libGLESv2.dll"); + RLibrary lib; + if (lib.Load(KLibOpenGles2) == KErrNone) + { + UTIL_TRACE("CVghwUtils::Gles2ApiForEgl - Open GL ES 2 dll loaded, iGles2ApiForEgl=0x%x", iGles2ApiForEgl); + iLoadedOpenGles2Dll = ETrue; + return iGles2ApiForEgl; + } + } + UTIL_TRACE("CVghwUtils::Gles2ApiForEgl - Open GL ES 2 dll not loaded or not safe to use"); + return NULL; + } + + +//////////////////////////////////////////////////////////////////////////////////// + +// factory method +TEglThreadState* TEglThreadState::New() + { + UTIL_TRACE("TEglThreadState::New"); + RHeap* currentHeap = CVghwUtils::SwitchToVghwHeap(); + TEglThreadState* self = new TEglThreadState(); + CVghwUtils::SwitchFromVghwHeap(currentHeap); + return self; + } + + +TEglThreadState::TEglThreadState() : + // EGL thread state + iEglError(EGL_SUCCESS), + iEglHostHasRecentError(EFalse), + // currently bound graphics API, initial value from EGL spec + iEglBoundApi(EGL_OPENGL_ES_API), + // Open VG thread state + iVgError(VG_NO_ERROR), + iVgEglContext(EGL_NO_CONTEXT), + iVgCommandsSinceGetError(EFalse), + iVgCommandsSinceFlush(EFalse), + iVgCommandsSinceFinish(EFalse), + // Open GL ES 1.1 state + iGlesError(GL_NO_ERROR), + iGlesEglContext(EGL_NO_CONTEXT), + iGlesCommandsSinceGetError(EFalse), + iGlesCommandsSinceFlush(EFalse), + iGlesCommandsSinceFinish(EFalse) + {} + + +void TEglThreadState::Destroy() + { + UTIL_TRACE("TEglThreadState::Destroy"); + RHeap* currentHeap = CVghwUtils::SwitchToVghwHeap(); + delete this; + CVghwUtils::SwitchFromVghwHeap(currentHeap); + } + + +TEglThreadState::~TEglThreadState() + {} + + +// ----------------------------------------------------------------------------- +// +// ----------------------------------------------------------------------------- +// +EXPORT_C EGLBoolean TEglThreadState::ExecEglBooleanCmd(EglRFC& aEglApiData) + { + CVghwUtils::DriverExecuteCommand(aEglApiData.Data()); + + EGLBoolean hostResult = (EGLBoolean) aEglApiData.ReturnValue(); + if (hostResult == EGL_TRUE) + { + ClearEglError(); + } + else + { // error present in host graphics stack + iEglHostHasRecentError = ETrue; + } + return hostResult; + } + + +EXPORT_C EGLContext TEglThreadState::ExecEglContextCmd(EglRFC& aEglApiData) + { + CVghwUtils::DriverExecuteCommand(aEglApiData.Data()); + + EGLContext hostResult = (EGLContext) aEglApiData.ReturnValue(); + if (hostResult != EGL_NO_CONTEXT) + { + ClearEglError(); + } + else + { // error present in host graphics stack + iEglHostHasRecentError = ETrue; + } + return hostResult; + } + + +EXPORT_C EGLSurface TEglThreadState::ExecEglSurfaceCmd(EglRFC& aEglApiData) + { + CVghwUtils::DriverExecuteCommand(aEglApiData.Data()); + + EGLSurface hostResult = (EGLSurface) aEglApiData.ReturnValue(); + if (hostResult != EGL_NO_SURFACE) + { + ClearEglError(); + } + else + { // error present in host graphics stack + iEglHostHasRecentError = ETrue; + } + return hostResult; + } + + +/* + Get details of the last EGL api error. + (Resets stored last error value to EGL_SUCCESS.) + + @return EGL_SUCCESS or an EGL_xxxx error constant. + */ +EXPORT_C EGLint TEglThreadState::EglError() + { + EGLint eglError = iEglError; + if (iEglHostHasRecentError) + { + // last EGL command was executed/failed in the Host side, so need to ask it for the error + RemoteFunctionCallData rfcdata; EglRFC eglApiData(rfcdata); + eglApiData.Init(EglRFC::EeglGetError); + CVghwUtils::DriverExecuteCommand(eglApiData.Data()); + eglError = (EGLint)eglApiData.ReturnValue(); + EGL_ERROR_PRINT("TEglThreadState::EglError newest error fetched from Host EGL", eglError); + iEglHostHasRecentError = EFalse; + } + else + { + EGL_ERROR_PRINT("TEglThreadState::EglError newest EGL error set by DLL", eglError); + } + iEglError = EGL_SUCCESS; + return eglError; + } + + +void TEglThreadState::ExecuteVgCommand(OpenVgRFC& aVgApiData) + { + CVghwUtils::DriverExecuteCommand(aVgApiData.Data()); + iVgCommandsSinceGetError = ETrue; + iVgCommandsSinceFlush = ETrue; + iVgCommandsSinceFinish = ETrue; + } + + +void TEglThreadState::ExecuteVgFlushCommand() + { + if (iVgCommandsSinceFlush) + { + RemoteFunctionCallData data; OpenVgRFC vgApiData(data); + vgApiData.Init(OpenVgRFC::EvgFlush); + + CVghwUtils::DriverExecuteCommand(vgApiData.Data()); + iVgCommandsSinceFlush = EFalse; + iVgCommandsSinceFinish = EFalse; + } + } + + +void TEglThreadState::ExecuteVgFinishCommand() + { + if (iVgCommandsSinceFinish) + { + RemoteFunctionCallData data; OpenVgRFC vgApiData(data); + vgApiData.Init(OpenVgRFC::EvgFinish); + + CVghwUtils::DriverExecuteCommand(vgApiData.Data()); + iVgCommandsSinceFinish = EFalse; + } + } + + +VGErrorCode TEglThreadState::VgError() + { + VGErrorCode vgError = iVgError; + VG_ERROR_PRINT("TEglThreadState::VgError oldest Open VG DLL error", vgError); + + if (iVgCommandsSinceGetError) + { // fetch and clear the host error state + VGErrorCode hostVgError = GetHostVgError(); + VG_ERROR_PRINT("TEglThreadState::VgError oldest Host Open VG DLL error", hostVgError); + + if (vgError == VG_NO_ERROR) + { + vgError = hostVgError; + } + iVgCommandsSinceGetError = EFalse; + } + + iVgError = VG_NO_ERROR; + return vgError; + } + + +VGErrorCode TEglThreadState::GetHostVgError() + { + RemoteFunctionCallData data; OpenVgRFC vgApiData(data); + vgApiData.Init( OpenVgRFC::EvgGetError ); + + CVghwUtils::DriverExecuteCommand(vgApiData.Data()); + return (VGErrorCode)vgApiData.ReturnValue(); + } + + +// Open GL ES + +GLenum TEglThreadState::GlesError() + { + GLenum glesError = iGlesError; + GLES_ERROR_PRINT("TEglThreadState::GlesError oldest Open GL ES DLL error", glesError); + + if (iGlesCommandsSinceGetError) + { // fetch and clear the host error state + GLenum hostGlesError = GetHostGlesError(); + GLES_ERROR_PRINT("TEglThreadState::GlesError oldest Host Open GL ES DLL error", hostGlesError); + + if (glesError == GL_NO_ERROR) + { + glesError = hostGlesError; + } + iGlesCommandsSinceGetError = EFalse; + } + + iGlesError = GL_NO_ERROR; + return glesError; + } + + +GLenum TEglThreadState::GetHostGlesError() + { + RemoteFunctionCallData data; + OpenGlES11RFC glesApiData(data); + glesApiData.Init(OpenGlES11RFC::EglGetError); + CVghwUtils::DriverExecuteCommand(glesApiData.Data()); + return (GLint)glesApiData.ReturnValue(); + } + + +void TEglThreadState::ExecuteGlesCommand(RemoteFunctionCall& aGlesRequestData) + { + CVghwUtils::DriverExecuteCommand(aGlesRequestData.Data()); + iGlesCommandsSinceGetError = ETrue; + iGlesCommandsSinceFlush = ETrue; + iGlesCommandsSinceFinish = ETrue; + } + + +void TEglThreadState::ExecuteGlesFlushCommand() + { + if (iGlesCommandsSinceFlush) + { + RemoteFunctionCallData rfcData; + OpenGlES11RFC glesApiData( rfcData ); + glesApiData.Init(OpenGlES11RFC::EglFlush, RemoteFunctionCallData::EOpRequest); + CVghwUtils::DriverExecuteCommand(glesApiData.Data()); + iGlesCommandsSinceFlush = EFalse; + iGlesCommandsSinceFinish = EFalse; + } + } + + +void TEglThreadState::ExecuteGlesFinishCommand() + { + if (iGlesCommandsSinceFinish) + { + RemoteFunctionCallData rfcData; + OpenGlES11RFC glesApiData( rfcData ); + glesApiData.Init(OpenGlES11RFC::EglFinish, RemoteFunctionCallData::EOpRequest); + CVghwUtils::DriverExecuteCommand(glesApiData.Data()); + iGlesCommandsSinceFinish = EFalse; + } + } + + +// Open VG state +void TEglThreadState::SetVgError(VGErrorCode aVgError) + { + VGHWPANIC_ASSERT_DEBUG( (aVgError >= VG_BAD_HANDLE_ERROR) && (aVgError <= 0x10FF), EVghwPanicBadVgErrorValue); + // for Open VG track the oldest uncleared error + VG_ERROR_PRINT("TEglThreadState::SetVgError error", aVgError); + if ( (iVgError == VG_NO_ERROR) && (aVgError >= VG_BAD_HANDLE_ERROR) && (aVgError <= 0x10FF) ) + { + if (iVgCommandsSinceGetError) + { + iVgError = GetHostVgError(); + VG_ERROR_PRINT("TEglThreadState::SetVgError oldest Host Open VG DLL error", iVgError); + if (iVgError != VG_NO_ERROR) + { + return; + } + } + iVgError = aVgError; + } + } + + +EGLContext TEglThreadState::VgEglContext() + { + return iVgEglContext; + } + + +// Open GL ES thread state +void TEglThreadState::SetGlesError(GLenum aGlesError) + { + VGHWPANIC_ASSERT_DEBUG( (aGlesError >= GL_INVALID_ENUM) && (aGlesError <= 0x05FF), EVghwPanicBadGlesErrorValue); + // for Open GL ES track the oldest uncleared error + GLES_ERROR_PRINT("TEglThreadState::SetGlesError error", aGlesError); + if ( (iGlesError == GL_NO_ERROR) && (aGlesError >= GL_INVALID_ENUM) && (aGlesError <= 0x05FF) ) + { + if (iGlesCommandsSinceGetError) + { + iGlesError = GetHostGlesError(); + GLES_ERROR_PRINT("TEglThreadState::SetGlesError oldest Host Open GL ES DLL error", iGlesError); + if (iGlesError != GL_NO_ERROR) + { + return; + } + } + iGlesError = aGlesError; + } + } + + +EGLContext TEglThreadState::GlesEglContext() + { + return iGlesEglContext; + } + +// ----------------------------------------------------------------------------- +// Use driver to discover base address of the surface memory. +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt CVghwUtils::GetSurfaceBufferBaseAddress( TUint32& aHWAddress ) + { + UTIL_TRACE("CVghwUtils::GetSurfaceBufferBaseAddress"); + if (!iInitialized || !iDriver) + { + UTIL_TRACE("CVghwUtils::GetSurfaceBufferBaseAddress called before initialised VghwUtils: iInitialized=%d, iDriver=0x%x", iInitialized, iDriver); + InitStatics(); + } + VGHWPANIC_ASSERT(iInitialized && iDriver, EVghwPanicGraphicsDriverNotOpen); + return iDriver->GetSurfaceBufferBaseAddress( aHWAddress ); + } + +#ifdef _DEBUG +static void EglErrorPrint(char* aTitle, EGLint aEglError) + { + char* errName = NULL; + switch (aEglError) + { + case EGL_SUCCESS: errName = "EGL_SUCCESS"; break; + case EGL_NOT_INITIALIZED: errName = "EGL_NOT_INITIALIZED"; break; + case EGL_BAD_ACCESS: errName = "EGL_BAD_ACCESS"; break; + case EGL_BAD_ALLOC: errName = "EGL_BAD_ALLOC"; break; + case EGL_BAD_ATTRIBUTE: errName = "EGL_BAD_ATTRIBUTE"; break; + case EGL_BAD_CONFIG: errName = "EGL_BAD_CONFIG"; break; + case EGL_BAD_CONTEXT: errName = "EGL_BAD_CONTEXT"; break; + case EGL_BAD_CURRENT_SURFACE: errName = "EGL_BAD_CURRENT_SURFACE"; break; + case EGL_BAD_DISPLAY: errName = "EGL_BAD_DISPLAY"; break; + case EGL_BAD_MATCH: errName = "EGL_BAD_MATCH"; break; + case EGL_BAD_NATIVE_PIXMAP: errName = "EGL_BAD_NATIVE_PIXMAP"; break; + case EGL_BAD_NATIVE_WINDOW: errName = "EGL_BAD_NATIVE_WINDOW"; break; + case EGL_BAD_PARAMETER: errName = "EGL_BAD_PARAMETER"; break; + case EGL_BAD_SURFACE: errName = "EGL_BAD_SURFACE"; break; + case EGL_CONTEXT_LOST: errName = "EGL_CONTEXT_LOST"; break; + default: break; // Error is from a new version of EGL + } + + if (errName) + { + UTIL_TRACE( " %s=%s (0x%x)", aTitle, errName, aEglError); + } + else + { + UTIL_TRACE( " %s=0x%x", aTitle, aEglError); + } + } + + +static void VgErrorPrint(char* aTitle, VGErrorCode aVgError) + { + char* errName = NULL; + switch (aVgError) + { + case VG_NO_ERROR: errName = "VG_NO_ERROR"; break; + case VG_BAD_HANDLE_ERROR: errName = "VG_BAD_HANDLE_ERROR"; break; + case VG_ILLEGAL_ARGUMENT_ERROR: errName = "VG_ILLEGAL_ARGUMENT_ERROR"; break; + case VG_OUT_OF_MEMORY_ERROR: errName = "VG_OUT_OF_MEMORY_ERROR"; break; + case VG_PATH_CAPABILITY_ERROR: errName = "VG_PATH_CAPABILITY_ERROR"; break; + case VG_UNSUPPORTED_IMAGE_FORMAT_ERROR: errName = "VG_UNSUPPORTED_IMAGE_FORMAT_ERROR"; break; + case VG_UNSUPPORTED_PATH_FORMAT_ERROR: errName = "VG_UNSUPPORTED_PATH_FORMAT_ERROR"; break; + case VG_IMAGE_IN_USE_ERROR: errName = "VG_IMAGE_IN_USE_ERROR"; break; + case VG_NO_CONTEXT_ERROR: errName = "VG_NO_CONTEXT_ERROR"; break; + default: break; // unknown error code from a new version of Open VG + } + + if (errName) + { + UTIL_TRACE( " %s=%s (0x%x)", aTitle, errName, aVgError); + } + else + { + UTIL_TRACE( " %s=0x%x", aTitle, aVgError); + } + } + + +static void GlesErrorPrint(char* aTitle, GLenum aGlesError) + { + char* errName = NULL; + switch (aGlesError) + { + case GL_NO_ERROR: errName = "GL_NO_ERROR"; break; + case GL_INVALID_ENUM: errName = "GL_INVALID_ENUM"; break; + case GL_INVALID_VALUE: errName = "GL_INVALID_VALUE"; break; + case GL_INVALID_OPERATION: errName = "GL_INVALID_OPERATION"; break; + case GL_STACK_OVERFLOW: errName = "GL_STACK_OVERFLOW"; break; + case GL_STACK_UNDERFLOW: errName = "GL_STACK_UNDERFLOW"; break; + case GL_OUT_OF_MEMORY: errName = "GL_OUT_OF_MEMORY"; break; + default: break; // unknown error code from a new version of Open GL ES + } + + if (errName) + { + UTIL_TRACE( " %s=%s (0x%x)", aTitle, errName, aGlesError); + } + else + { + UTIL_TRACE( " %s=0x%x", aTitle, aGlesError); + } + } +#endif + + +// end of file vghwutils.cpp