# HG changeset patch # User Faisal Memon # Date 1282755473 -3600 # Node ID e8ccf068ac7f2d504268997560b51eb54cb43d17 # Parent d8d95053303af7d9f27a47df50dd6cdb38fba82a More progress towards getting the guestvideodriver and dependencies compiling for S3. This check-in does not compile, so don't sync to this changelist. A later changelist will declare when compilation works again. diff -r d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/api/group/bld.inf --- a/guestrendering/guestvideodriver/api/group/bld.inf Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/api/group/bld.inf Wed Aug 25 17:57:53 2010 +0100 @@ -1,21 +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 +// 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 d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/api/group/guestvideodriver.mmp --- a/guestrendering/guestvideodriver/api/group/guestvideodriver.mmp Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/api/group/guestvideodriver.mmp Wed Aug 25 17:57:53 2010 +0100 @@ -1,45 +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 +// 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 d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/api/src/guestvideodriver.cpp --- a/guestrendering/guestvideodriver/api/src/guestvideodriver.cpp Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/api/src/guestvideodriver.cpp Wed Aug 25 17:57:53 2010 +0100 @@ -1,254 +1,254 @@ -// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// Guest Video Driver Implementation - -#include -#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 ); - } - -// ----------------------------------------------------------------------------- -// 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); - } +// 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 ); + } + +// ----------------------------------------------------------------------------- +// 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 d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/ldd/group/bld.inf --- a/guestrendering/guestvideodriver/ldd/group/bld.inf Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/ldd/group/bld.inf Wed Aug 25 17:57:53 2010 +0100 @@ -20,4 +20,4 @@ #ifdef FAISALMEMON_S4_SGIMAGE reqhandlerextension.mmp #endif -// now lets tackle virtualvideohwdevice.mmp +virtualvideohwdevice.mmp diff -r d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp --- a/guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/ldd/group/virtualvideohwdevice.mmp Wed Aug 25 17:57:53 2010 +0100 @@ -1,68 +1,63 @@ -/* -* ============================================================================== -* Name : VirtualVideoHwDevice.mmp -* Part of : aasw / aamm -* Description : Project information file for Graphics Hw LDD. -* Version : %version:7 % -* -* Copyright © 2002-2010 Nokia. All rights reserved. -* This material, including documentation and any related -* computer programs, is protected by copyright controlled by -* Nokia. All rights are reserved. Copying, including -* reproducing, storing, adapting or translating, any -* or all of this material requires the prior written consent of -* Nokia. This material also contains confidential -* information which may not be disclosed to others without the -* prior written consent of Nokia. -* ============================================================================== -*/ - -#include - -TARGET platsimvideohw.ldd -TARGETTYPE ldd - -UID 0 0x20026A2E //- 0x20026A32 -LINKAS platsimvideohw.ldd -VENDORID 0x70000001 -CAPABILITY all - -OS_LAYER_SYSTEMINCLUDE -OS_LAYER_KERNEL_SYSTEMINCLUDE -OS_LAYER_ESTLIB_SYSTEMINCLUDE -USERINCLUDE ../inc -USERINCLUDE ../../commoninc -SYSTEMINCLUDE /epoc32/include/drivers -SYSTEMINCLUDE /epoc32/include/internal - -SOURCEPATH ../src -SOURCE virtualvideohwdevice.cpp -SOURCE virtualvideohwchannel.cpp -SOURCE devicereqhandler.cpp -SOURCE virtualvideohwinterface.cpp - -USERINCLUDE ../../../serialiser/inc -USERINCLUDE ../../../graphicsresourceimplementation/inc - -SOURCEPATH ../../../serialiser/src -SOURCE remotefunctioncall.cpp -SOURCE serializedfunctioncall.cpp -SOURCE eglrfc.cpp -SOURCE openvgrfc.cpp -SOURCE driverrfc.cpp -SOURCE opengles11rfc.cpp - -#if defined(NCP_COMMON_RAPU_FAMILY) -LIBRARY karap.lib -#else -LIBRARY VariantTarget(kanomadik,lib) -#endif // NCP_COMMON_RAPU_FAMILY - -LIBRARY reqhandlerextension.lib -LIBRARY sgextension.lib - -start wins -win32_headers -end -// End of file - +// 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 + +OS_LAYER_SYSTEMINCLUDE +OS_LAYER_KERNEL_SYSTEMINCLUDE +OS_LAYER_ESTLIB_SYSTEMINCLUDE +USERINCLUDE ../inc +USERINCLUDE ../../commoninc +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 d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/ldd/src/devicereqhandler.cpp --- a/guestrendering/guestvideodriver/ldd/src/devicereqhandler.cpp Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/ldd/src/devicereqhandler.cpp Wed Aug 25 17:57:53 2010 +0100 @@ -1,1439 +1,1451 @@ -/* - * ============================================================================= - * Name : devicereqhandler.cpp - * Part of : - * Description : Implementation of the class DDeviceReqHandler. - * Version : %version:6 % - * - * Copyright © 2008-2010 Nokia. All rights reserved. - * This material, including documentation and any related - * computer programs, is protected by copyright controlled by - * Nokia. All rights are reserved. Copying, including - * reproducing, storing, adapting or translating, any - * or all of this material requires the prior written consent of - * Nokia. This material also contains confidential - * information which may not be disclosed to others without the - * prior written consent of Nokia. - * ============================================================================= - */ - - -// INCLUDE FILES -#include -#include -#include -#include - -#include "devicereqhandler.h" -#include "virtualvideohwinterface.h" - -#include "virtualvideotracing.h" - -#include "remotefunctioncall.h" -#include "serializedfunctioncall.h" -#include "driverrfc.h" -#include "openvgrfc.h" //For the opcodes -#include "eglrfc.h" //For the opcodes -#include "opengles11rfc.h" //For the opcodes - - -using namespace PlatsimVideoDriver; - -// LOCAL DATA TYPES -TInt CmpTPbsIds(const TPbSId& a, const TPbSId& b) - { - if( a.iPbuffer == b.iPbuffer ) - return 0; - else - return b.iPbuffer - a.iPbuffer; - } - -TInt CmpTVGIsIds(const TVGISId& a, const TVGISId& b) - { - if( a.iVGImage == b.iVGImage ) - return 0; - else - return b.iVGImage - a.iVGImage; - } -/* - * Copies data from client space to the request buffer during serialisation - */ -class TDataFromClientSpaceCopier: public MDataCopier - { -public: - TDataFromClientSpaceCopier( DThread* aUserThread ): - iUserThread(aUserThread) - { - } - - TInt CopyData( TUint8* aDest, const TUint8* aSource, TUint32 aSize ) - { - memcpy( aDest, aSource, aSize ); - return KErrNone; - } - - TInt CopyVector( TUint8* aDest, const TUint8* aSource, TUint32 aSize ) - { - return Kern::ThreadRawRead( iUserThread, aSource, aDest, aSize ); - } - - DThread* iUserThread; - }; - -/* - * Copies data to client space from the request buffer during deserialisation - */ -class TDataToClientSpaceCopier: public MDataCopier - { -public: - TDataToClientSpaceCopier( DThread* aUserThread ): - iUserThread(aUserThread) - { - } - - TInt CopyData( TUint8* aDest, const TUint8* aSource, TUint32 aSize ) - { - memcpy( aDest, aSource, aSize ); - return KErrNone; - } - - TInt CopyVector( TUint8* aDest, const TUint8* aSource, TUint32 aSize ) - { - return Kern::ThreadRawWrite(iUserThread, aDest, aSource, aSize ); - } - - DThread* iUserThread; - }; - -// LOCAL FUNCTION DEFINITIONS - -// ----------------------------------------------------------------------------- -// ListRemoteFunctionCall -// ----------------------------------------------------------------------------- -// -inline void ListRemoteFunctionCall(RemoteFunctionCallData& call) - { -#if _DEBUG - VVHW_TRACE("RFC: %u %u %u %u %u %u %u", - call.Header().iOpCode, - call.Header().iTransactionId, - call.Header().iProcessId, - call.Header().iThreadId, - call.Header().iParameterCount, - call.Header().iOpType, - call.Header().iReturnValue); - - for ( TInt i = 0; i < call.Header().iParameterCount; i++) - { - RemoteFunctionCallData::TParam param = call.Parameters()[i]; - - TUint32 dir = param.iDir; - TUint32 type = param.iType; - - - if ( RemoteFunctionCallData::TParam::ESimple == param.iType ) - { - TUint32 datatype = param.iSimpleParam.iDataType; - VVHW_TRACE("RFC Simple Param %d: %u %u %u",i, dir, type, datatype ); - } - else if ( RemoteFunctionCallData::TParam::EVector == param.iType ) - { - TUint32 datatype = param.iVectorParam.iDataType; - TUint32 size = param.iVectorParam.iVectorLength; - VVHW_TRACE("RFC Vec Param %d: %u %u %u %u",i, dir, type, datatype, size ); - } - } -#endif // _DEBUG - } - - -// CONSTANTS -const TInt KDfcPriority = 1; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Isr -// Interrupt service routine -// ----------------------------------------------------------------------------- -// -void Isr( TAny* aParam ) - { - DDeviceReqHandler* handler = ( DDeviceReqHandler* )aParam; - Interrupt::Disable( handler->InterruptId() ); - handler->Dfc().Add(); - } - -// ----------------------------------------------------------------------------- -// DfcFunc -// Function to call when HW has an interrupt -// ----------------------------------------------------------------------------- -// -void DfcFunc( TAny* aParam ) - { - DDeviceReqHandler* handler = ( DDeviceReqHandler* )aParam; - handler->ProcessDfc(); - } - -// ============================ MEMBER FUNCTIONS =============================== - - -// ----------------------------------------------------------------------------- -// DDeviceReqHandler::DDeviceReqHandler -// ----------------------------------------------------------------------------- -// -DDeviceReqHandler::DDeviceReqHandler( - DVirtualVideoHwInterface& aHwInterface, - TDfcQue* aQueue) : - iPbufferSgMapOrder ( &CmpTPbsIds ), - iVGImageSgMapOrder ( &CmpTVGIsIds ), - iCurrClientData(NULL), - iInitialized(EFalse), - iHwInterface( aHwInterface ), - iDfc( DfcFunc, (TAny*)this, aQueue, KDfcPriority ), - iInterruptId( 0 ), - iTransactionId( 1 ), - iRequestBuffer( *this, VVI_PARAMETERS_INPUT_MEMORY_SIZE ) - { - iDriverRfcProcessId = 0; - iDriverRfcThreadId = 0; - iOpType = 0; - iOpChainPhase = 0; - iInterruptId = VVI_IRQ; - VVHW_TRACE( "DDeviceReqHandler constructor" ); - VVHW_TRACE( "Called in process/thread %0x / %0x", Kern::CurrentProcess().iId, Kern::CurrentThread().iId ); - TInt err = Interrupt::Bind( iInterruptId, Isr, ( TAny* )this ); - if ( err != KErrNone ) - { - VVHW_TRACE( "Interrupt::Bind Error: %d", err ); - } - err = Interrupt::Enable( iInterruptId ); - if ( err != KErrNone ) - { - Interrupt::Unbind( iInterruptId ); - iInterruptId = 0; - VVHW_TRACE( "Interrupt::Enable Error: %d", err ); - } - iRequestBuffer.InitBuffer(); - //Register this object with the extension - VVHW_TRACE( "DDeviceReqHandler calling ReqHandlerExtension" ); - ReqHandlerExtension::SetReqHandler( this ); - } - -// ----------------------------------------------------------------------------- -// DDeviceReqHandler::~DDeviceReqHandler -// ----------------------------------------------------------------------------- -// -DDeviceReqHandler::~DDeviceReqHandler() - { - for( TInt i=0; i < iClientData.Count(); ++i ) - { - delete iClientData[i]; - } - iClientData.Close(); - Interrupt::Disable( iInterruptId ); - Interrupt::Unbind( iInterruptId ); - iInterruptId = 0; - } - -// ----------------------------------------------------------------------------- -// DDeviceReqHandler::HandleClientShutdown -// ----------------------------------------------------------------------------- -// -TInt DDeviceReqHandler::HandleClientShutdown( TUint aProcessId, TUint aThreadId ) - { - VVHW_TRACE("DDeviceReqHandler::HandleClientShutdown"); - TInt err( KErrNone ); - TAsyncRequest* req = AllocRequest( NULL, NULL, NULL, NULL, TAsyncRequest::ERTDriver ); - - if ( req ) - { - DriverRFC drfc( req->iRemoteFunctionCall ); - drfc.Init( DriverRFC::EDrvClientShutdown, RemoteFunctionCallData::EOpRequest ); - req->iRemoteFunctionCall.SetTransactionId( ++iTransactionId ); - req->iRemoteFunctionCall.SetThreadInformation( aProcessId, aThreadId ); - iPendingRequestRoot.AppendToLast( req ); - TInt ret = ProcessNextPendingRequest(); - while ( KErrNone == ret ) - { - ret = ProcessNextPendingRequest(); - } - } - else - { - err = KErrNoMemory; - } - return err; - } - -// ----------------------------------------------------------------------------- -// DDeviceReqHandler::ProcessNextPendingRequest -// ----------------------------------------------------------------------------- -// -TInt DDeviceReqHandler::ProcessNextPendingRequest() - { - VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest"); - TInt err( KErrNone ); - TAsyncRequest* req = iPendingRequestRoot.iNext; - if ( !req ) - { - VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest !req"); - return KErrUnderflow; - } - //Try to serve the client from here, or do some sgImage specific stuff - TInt mode = InterpretRequest( req ); - switch( mode ) - { - case ENormal: - { - //Nothing, process as normal - break; - } - case EHandled: - { - //Already handled, remove and signal complete - req->RemoveFromList( &iPendingRequestRoot ); - Kern::RequestComplete( req->iAsyncClient, req->iStatus, KErrNone ); - ReleaseRequest( req ); - return KErrNone;//Change to "err" if you add lines above this that may set it to something else - } - case EQueued: - { - //To be removed from the usual queues, but not deleted (released) or completed - req->RemoveFromList( &iPendingRequestRoot ); - return KErrNone; - } - default: - { - break; - } - } - - if ( TAsyncRequest::ERTCommandLoad == req->iCommandLoadRequest ) - { - VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands"); - TInt loaderr( KErrNone ); - TInt len = Kern::ThreadGetDesLength( req->iAsyncClient, req->iA1 ); - - if ( len < 0 ) - { - VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands len < 0"); - return KErrUnderflow;; - } - - if ( !iRequestBuffer.CheckForSpace( len ) ) - { - //Not enough space - VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands No space"); - return KErrNoMemory; - } - - req->RemoveFromList( &iPendingRequestRoot ); - - const TUint32 base( iRequestBuffer.AllocateBytes( len ) ); - - //Next, serialize the call to the HW memory - const TLinAddr paramAddr( iHwInterface.InputParametersAddress() + base ); - - TPtr8 ptr(reinterpret_cast(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" ); - EGLSurface surface( EGL_NO_SURFACE );//The pbuffer surface to sync from, if needed - VGboolean syncNeeded = VG_FALSE; - OpenVgRFC call( aReq->iRemoteFunctionCall ); - TUint64 sgId(NULL); - - if( call.Data().Header().iParameterCount > aSgHandleIndexInReq ) - { - call.GetTUint64( sgId, aSgHandleIndexInReq ); - } - else - { - return;//No sgImage handle appended on the client side, just exit - } - - if( sgId != NULL ) - { - VVHW_TRACE( "DDeviceReqHandler::getVGSyncInOp SgImage-backing VGImage found" ); - DSgResource* resource; - HBuf8* data = OpenSgImageMetaData( sgId, resource ); - if( data ) - { - TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); - - if( !sginfo.iVGImageClean ) - { - //set the sync bit as clean now. - sginfo.iVGImageClean = ETrue; - //Additional info for the host side to use - syncNeeded = VG_TRUE; - surface = sginfo.iPbufferHandle; - } - if( aSetBufferDirty ) - { - sginfo.iPbufferClean = EFalse; - } - resource->SetMetaData( *data ); - delete data;//delete the copy of the metadata descriptor - } - } - if( syncNeeded ) - { - call.AppendParam ( (int)surface ); - } - } - - -void DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult( TAsyncRequest* aReq ) - { - const TUint32 proc_id( aReq->iRemoteFunctionCall.Header().iProcessId ); - const TUint32 thread_id( aReq->iRemoteFunctionCall.Header().iThreadId ); - const TUint32 apicode( aReq->iRemoteFunctionCall.Header().iApiUid ); - const TUint32 opcode( aReq->iRemoteFunctionCall.Header().iOpCode ); - VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult: process/thread id : %d / %d", Kern::CurrentProcess().iId, Kern::CurrentThread().iId ); - VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult: process/thread id : %d / %d API/opcode = %0x/%0x", proc_id, thread_id, apicode, opcode ); - TPerThreadData* data(0); - for( TInt i=0; i < iClientData.Count(); ++i ) - { - if( iClientData[i]->sameThread( proc_id, thread_id )) - { - data = iClientData[i]; - break; - } - } - - switch ( apicode ) - { - case SERIALISED_DRIVER_API_UID: - { - switch( opcode ) - { - case DriverRFC::EDrvCreatePbufferSg: - { - VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult : EDrvCreatePbufferSg" ); - if( iSchedulerInitiatedTransactionData ) - { - ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle = aReq->iRemoteFunctionCall.Header().iReturnValue; - VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult pbuffer=%u", ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle ); - } - TPbSId obj ( ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle, - ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId ); - iPbufferSgMap.InsertInOrder( obj, iPbufferSgMapOrder ); - VVHW_TRACE( "pbuffer creation RequestComplete. Inserted (%u, %u) into sg map. Notify thread %u, request status %u", - ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle, - ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId, - aReq->iAsyncClient, - aReq->iStatus ); - *(aReq->iStatus) = 0;//REquestComplete doesn't work - VVHW_TRACE( "Pbuffer creation RequestComplete" ); - break; - } - case DriverRFC::EDrvCreateVGImageSg: - { - VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult : EDrvCreateVGImageSg" ); - if( iSchedulerInitiatedTransactionData ) - { - ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iVGImageHandle = aReq->iRemoteFunctionCall.Header().iReturnValue; - } - TVGISId obj ( ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iVGImageHandle, - ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId ); - iVGImageSgMap.InsertInOrder( obj, iVGImageSgMapOrder ); - VVHW_TRACE( "pbuffer creation RequestComplete. Inserted (%u, %u) into sg map. Notify thread %u, request status %u", - ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iVGImageHandle, - ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId, - aReq->iAsyncClient, - aReq->iStatus ); - *(aReq->iStatus) = 0;//REquestComplete doesn't work - VVHW_TRACE( "VGImage creation RequestComplete" ); - break; - } - case DriverRFC::EDrvDeleteSgImage: - { - *(aReq->iStatus) = 0; - } - case DriverRFC::EDrvSyncVGImageFromPBuffer: - { - ((TAsyncRequest*)iSchedulerInitiatedTransactionData)->AppendToList( (TAsyncRequest*)(&iPendingRequestRoot) ); - break; - } - default: - { - break; - } - } - } - case SERIALISED_OPENVG_API_UID: - { - switch( opcode ) - { - case OpenVgRFC::EvgGetError: - { - VVHW_TRACE("OpenVgRFC::EvgGetError"); - data->iErrorVG = aReq->iRemoteFunctionCall.Header().iReturnValue; - data->iErrUpdatedVG = EFalse;//TODO: ETrue - break; - } - default:{break;} - } - break; - } - case SERIALISED_EGL_API_UID: - { - switch( opcode ) - { - case EglRFC::EeglGetError: - { - VVHW_TRACE("EglRFC::EeglGetError"); - data->iErrorEGL = aReq->iRemoteFunctionCall.Header().iReturnValue; - data->iErrUpdatedEGL = EFalse;//TODO: ETrue - break; - } - default: - {break;} - } - break; - } - case SERIALISED_OPENGLES_1_1_API_UID: - { - switch( opcode ) - { - case OpenGlES11RFC::EglGetError: - { - VVHW_TRACE("OpenGlES11RFC::EglGetError"); - data->iErrorGLES = aReq->iRemoteFunctionCall.Header().iReturnValue; - data->iErrUpdatedGLES = EFalse;//TODO: ETrue - } - default:{break;} - } - break; - } - default:{break;} - } - - VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult return value: %d", aReq->iRemoteFunctionCall.Header().iReturnValue ); - if( data ) - { - VVHW_TRACE("errors EGL/VG/GLES=%0x/%0x/%0x", data->iErrorEGL, data->iErrorVG, data->iErrorGLES ); - } - //Delete the request object, as it is no longer needed - aReq->iStatus = 0; - aReq->iAsyncClient = 0; - delete aReq; - VVHW_TRACE("DDeviceReqHandle::ConsumeSchedulerInitiatedRequestResult done."); - } - -/** - * DDeviceReqHandler::CreateSgImagePbuffer +/* + * ============================================================================= + * Name : devicereqhandler.cpp + * Part of : + * Description : Implementation of the class DDeviceReqHandler. + * Version : %version:6 % + * + * Copyright © 2008-2010 Nokia. All rights reserved. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia. All rights are reserved. Copying, including + * reproducing, storing, adapting or translating, any + * or all of this material requires the prior written consent of + * Nokia. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia. + * ============================================================================= + */ + + +// INCLUDE FILES +#include +#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" ); + ReqHandlerExtension::SetReqHandler( this ); + } + +// ----------------------------------------------------------------------------- +// DDeviceReqHandler::~DDeviceReqHandler +// ----------------------------------------------------------------------------- +// +DDeviceReqHandler::~DDeviceReqHandler() + { + for( TInt i=0; i < iClientData.Count(); ++i ) + { + delete iClientData[i]; + } + iClientData.Close(); + Interrupt::Disable( iInterruptId ); + Interrupt::Unbind( iInterruptId ); + iInterruptId = 0; + } + +// ----------------------------------------------------------------------------- +// DDeviceReqHandler::HandleClientShutdown +// ----------------------------------------------------------------------------- +// +TInt DDeviceReqHandler::HandleClientShutdown( TUint aProcessId, TUint aThreadId ) + { + VVHW_TRACE("DDeviceReqHandler::HandleClientShutdown"); + TInt err( KErrNone ); + TAsyncRequest* req = AllocRequest( NULL, NULL, NULL, NULL, TAsyncRequest::ERTDriver ); + + if ( req ) + { + DriverRFC drfc( req->iRemoteFunctionCall ); + drfc.Init( DriverRFC::EDrvClientShutdown, RemoteFunctionCallData::EOpRequest ); + req->iRemoteFunctionCall.SetTransactionId( ++iTransactionId ); + req->iRemoteFunctionCall.SetThreadInformation( aProcessId, aThreadId ); + iPendingRequestRoot.AppendToLast( req ); + TInt ret = ProcessNextPendingRequest(); + while ( KErrNone == ret ) + { + ret = ProcessNextPendingRequest(); + } + } + else + { + err = KErrNoMemory; + } + return err; + } + +// ----------------------------------------------------------------------------- +// DDeviceReqHandler::ProcessNextPendingRequest +// ----------------------------------------------------------------------------- +// +TInt DDeviceReqHandler::ProcessNextPendingRequest() + { + VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest"); + TInt err( KErrNone ); + TAsyncRequest* req = iPendingRequestRoot.iNext; + if ( !req ) + { + VVHW_TRACE("DDeviceReqHandler::ProcessNextPendingRequest !req"); + return KErrUnderflow; + } + //Try to serve the client from here, or do some sgImage specific stuff + TInt mode = InterpretRequest( req ); + switch( mode ) + { + case ENormal: + { + //Nothing, process as normal + break; + } + case EHandled: + { + //Already handled, remove and signal complete + req->RemoveFromList( &iPendingRequestRoot ); + Kern::RequestComplete( req->iAsyncClient, req->iStatus, KErrNone ); + ReleaseRequest( req ); + return KErrNone;//Change to "err" if you add lines above this that may set it to something else + } + case EQueued: + { + //To be removed from the usual queues, but not deleted (released) or completed + req->RemoveFromList( &iPendingRequestRoot ); + return KErrNone; + } + default: + { + break; + } + } + + if ( TAsyncRequest::ERTCommandLoad == req->iCommandLoadRequest ) + { + VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands"); + TInt loaderr( KErrNone ); + TInt len = Kern::ThreadGetDesLength( req->iAsyncClient, req->iA1 ); + + if ( len < 0 ) + { + VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands len < 0"); + return KErrUnderflow;; + } + + if ( !iRequestBuffer.CheckForSpace( len ) ) + { + //Not enough space + VVHW_TRACE("DDeviceReqHandler::HandleLoadCommands No space"); + return KErrNoMemory; + } + + req->RemoveFromList( &iPendingRequestRoot ); + + const TUint32 base( iRequestBuffer.AllocateBytes( len ) ); + + //Next, serialize the call to the HW memory + const TLinAddr paramAddr( iHwInterface.InputParametersAddress() + base ); + + TPtr8 ptr(reinterpret_cast(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" ); + EGLSurface surface( EGL_NO_SURFACE );//The pbuffer surface to sync from, if needed + VGboolean syncNeeded = VG_FALSE; + OpenVgRFC call( aReq->iRemoteFunctionCall ); + TUint64 sgId(NULL); + + if( call.Data().Header().iParameterCount > aSgHandleIndexInReq ) + { + call.GetTUint64( sgId, aSgHandleIndexInReq ); + } + else + { + return;//No sgImage handle appended on the client side, just exit + } + +#ifdef FAISALMEMON_S4_SGIMAGE + 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" ); + if( iSchedulerInitiatedTransactionData ) + { + ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle = aReq->iRemoteFunctionCall.Header().iReturnValue; + VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult pbuffer=%u", ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle ); + } + TPbSId obj ( ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle, + ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId ); + iPbufferSgMap.InsertInOrder( obj, iPbufferSgMapOrder ); + VVHW_TRACE( "pbuffer creation RequestComplete. Inserted (%u, %u) into sg map. Notify thread %u, request status %u", + ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iPbufferHandle, + ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId, + aReq->iAsyncClient, + aReq->iStatus ); + *(aReq->iStatus) = 0;//REquestComplete doesn't work + VVHW_TRACE( "Pbuffer creation RequestComplete" ); + break; + } + case DriverRFC::EDrvCreateVGImageSg: + { + VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult : EDrvCreateVGImageSg" ); + if( iSchedulerInitiatedTransactionData ) + { + ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iVGImageHandle = aReq->iRemoteFunctionCall.Header().iReturnValue; + } + TVGISId obj ( ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iVGImageHandle, + ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId ); + iVGImageSgMap.InsertInOrder( obj, iVGImageSgMapOrder ); + VVHW_TRACE( "pbuffer creation RequestComplete. Inserted (%u, %u) into sg map. Notify thread %u, request status %u", + ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iVGImageHandle, + ((TSgImageMetaData*)iSchedulerInitiatedTransactionData)->iSgId, + aReq->iAsyncClient, + aReq->iStatus ); + *(aReq->iStatus) = 0;//REquestComplete doesn't work + VVHW_TRACE( "VGImage creation RequestComplete" ); + break; + } + case DriverRFC::EDrvDeleteSgImage: + { + *(aReq->iStatus) = 0; + } + case DriverRFC::EDrvSyncVGImageFromPBuffer: + { + ((TAsyncRequest*)iSchedulerInitiatedTransactionData)->AppendToList( (TAsyncRequest*)(&iPendingRequestRoot) ); + break; + } + default: + { + break; + } + } + } + case SERIALISED_OPENVG_API_UID: + { + switch( opcode ) + { + case OpenVgRFC::EvgGetError: + { + VVHW_TRACE("OpenVgRFC::EvgGetError"); + data->iErrorVG = aReq->iRemoteFunctionCall.Header().iReturnValue; + data->iErrUpdatedVG = EFalse;//TODO: ETrue + break; + } + default:{break;} + } + break; + } + case SERIALISED_EGL_API_UID: + { + switch( opcode ) + { + case EglRFC::EeglGetError: + { + VVHW_TRACE("EglRFC::EeglGetError"); + data->iErrorEGL = aReq->iRemoteFunctionCall.Header().iReturnValue; + data->iErrUpdatedEGL = EFalse;//TODO: ETrue + break; + } + default: + {break;} + } + break; + } + case SERIALISED_OPENGLES_1_1_API_UID: + { + switch( opcode ) + { + case OpenGlES11RFC::EglGetError: + { + VVHW_TRACE("OpenGlES11RFC::EglGetError"); + data->iErrorGLES = aReq->iRemoteFunctionCall.Header().iReturnValue; + data->iErrUpdatedGLES = EFalse;//TODO: ETrue + } + default:{break;} + } + break; + } + default:{break;} + } + + VVHW_TRACE( "DDeviceReqHandler::ConsumeSchedulerInitiatedRequestResult return value: %d", aReq->iRemoteFunctionCall.Header().iReturnValue ); + if( data ) + { + VVHW_TRACE("errors EGL/VG/GLES=%0x/%0x/%0x", data->iErrorEGL, data->iErrorVG, data->iErrorGLES ); + } + //Delete the request object, as it is no longer needed + aReq->iStatus = 0; + aReq->iAsyncClient = 0; + delete aReq; + VVHW_TRACE("DDeviceReqHandle::ConsumeSchedulerInitiatedRequestResult done."); + } + +/** + * DDeviceReqHandler::CreateSgImagePbuffer * @param aInfo the info - */ -void DDeviceReqHandler::CreateSgImagePbuffer( const TSgImageMetaData& aInfo, TRequestStatus* aStatus, DThread* aThread ) - { - //eglCreatePbufferSurface - // - VVHW_TRACE("DDeviceReqHandler::CreateSgImagePbuffer ->"); - if( !iCurrClientData ) - {return;} - TBool allok = ETrue; - TAsyncRequest* req(0); - TPckg 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; - } - - - - -TInt DDeviceReqHandler::DestroySgImage( const TUint64 aId ) - { - VVHW_TRACE("DDeviceReqHandler::DestroySgImage ->"); - 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 ); - } - VVHW_TRACE("DDeviceReqHandler::DestroySgImage <-"); - return 1; - } - - -DDeviceReqHandler::TRequestMode DDeviceReqHandler::InterpretRequest( TAsyncRequest* aReq ) - { - TRequestMode alreadyProcessed( ENormal );//processed here? The return value - const TUint32 proc_id( aReq->iRemoteFunctionCall.Header().iProcessId ); - const TUint32 thread_id( aReq->iRemoteFunctionCall.Header().iThreadId ); - const TUint32 apicode( aReq->iRemoteFunctionCall.Header().iApiUid ); - const TUint32 opcode( aReq->iRemoteFunctionCall.Header().iOpCode ); - - VVHW_TRACE( "DDeviceReqHandler::InterpretRequest in the process/thread %0x / %0x", Kern::CurrentProcess().iId, Kern::CurrentThread().iId ); - - TBool ErrUpdatedVG = EFalse;//is the error updated during this function call - TBool ErrUpdatedEGL = EFalse;//is the error updated during this function call - TBool ErrUpdatedGLES = EFalse;//is the error updated during this function call - //Get a data object to work with - //(either a previously used client data object, or create a new one) - TPerThreadData* data(NULL); - if( iCurrClientData && - iCurrClientData->sameThread( proc_id, thread_id )) - { - //the same client as previously - data = iCurrClientData; - } - else - { - //Check if this client is already known - for( TInt i=0; i < iClientData.Count(); ++i ) - { - if( iClientData[i]->sameThread( proc_id, thread_id )) - { - data = iClientData[i]; - break; - } - } - if( !data ) - { - data = new TPerThreadData( aReq->iStatus, aReq->iAsyncClient, proc_id, thread_id ); - iClientData.Append( data ); - } - if( iCurrClientData ) - { - VVHW_TRACE( "DDeviceReqHandler::InterpretRequest: SWITCHING CONTEXT: %d / %d -> %d / %d", - iCurrClientData->iProcessId, - iCurrClientData->iThreadId, - proc_id, - thread_id ); - //Some other things need to be done here as well, as per 5.2 in the "Implementing SgImage" design doc - //TODO: currently the context switch does not need to be done on this level - } - //Context switched, or no previous client. Current set to new current. - iCurrClientData = data; - } - //Invariant: "data" and "iCurrClient" are the same and not null after this line - VVHW_TRACE("DDeviceReqHandler::InterpretRequest: number of clients = %d", iClientData.Count() ); - - - iCurrClientData->iCurrApiUid = apicode; - iCurrClientData->iCurrOpCode = opcode; - VVHW_TRACE( "DDeviceReqHandler::InterpretRequest: process/thread id : %d / %d API/opcode = %d/%0x", proc_id, thread_id, apicode, opcode ); - - - switch ( apicode ) - { - case SERIALISED_DRIVER_API_UID: - { - VVHW_TRACE("Driver request (must be a shutdown for %d / %d)", proc_id, thread_id ); - if( opcode == DriverRFC::EDrvClientShutdown ) - { - RemoveClientData( proc_id, thread_id ); - } - break; - } - case SERIALISED_OPENVG_API_UID: - { - VVHW_TRACE("OpenVG request" ); - switch( opcode ) - { - case OpenVgRFC::EvgGetError: - { - break; - } - //We need to catch all the operations that create or access VGImage buffers - case OpenVgRFC::EvgChildImage: - { - VVHW_TRACE("vgChildImage" ); - break; - } - case OpenVgRFC::EvgDestroyImage: - { - VVHW_TRACE("vgDestroyImage" ); - break; - } - case OpenVgRFC::EvgFinish: - { - VVHW_TRACE("vgFinish" ); - //A sync is required if there are any native pixmaps backing surfaces in the current context - break; - } - /* - The sgImage ID is a 64-bit value, it has to be serialised as 2 32-bit values, thus occupying - 2 parameter slots each. The sgImage ID position is thus the second last + last parameters in the - parameter list - */ - case OpenVgRFC::EvgClearImage: - { - VVHW_TRACE("vgClearImage" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 ); - break; - } - case OpenVgRFC::EvgImageSubData: - { - VVHW_TRACE("vgImageSubData" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 ); - break; - } - case OpenVgRFC::EvgGetPixels: - { - VVHW_TRACE("vgGetPixels" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 ); - break; - } - case OpenVgRFC::EvgSetPixels: - { - VVHW_TRACE("vgSetPixels" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 ); - break; - } - case OpenVgRFC::EvgCopyImage: - { - VVHW_TRACE("vgCopyImage" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 ); - break; - } - case OpenVgRFC::EvgDrawImage: - { - VVHW_TRACE("vgDrawImage" ); - break; - } - case OpenVgRFC::EvgColorMatrix: - { - VVHW_TRACE("vgColorMatrix" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src - break; - } - case OpenVgRFC::EvgConvolve: - { - VVHW_TRACE("vgConvolve" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src - break; - } - case OpenVgRFC::EvgSeparableConvolve: - { - VVHW_TRACE("vgSeparableConvolve" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src - break; - } - case OpenVgRFC::EvgGaussianBlur: - { - VVHW_TRACE("vgGaussianBlur" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src - break; - } - case OpenVgRFC::EvgLookup: - { - VVHW_TRACE("vgLookup" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src - break; - } - case OpenVgRFC::EvgLookupSingle: - { - VVHW_TRACE("vgLookupSingle" ); - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-4 );//dst - getVGSyncInOp( aReq, aReq->iRemoteFunctionCall.Header().iParameterCount-2 );//src - break; - } - case OpenVgRFC::EvgPathBounds: - { - VVHW_TRACE("vgPathBounds" ); - break; - } - default: - { - break; - } - } - break; - } - case SERIALISED_EGL_API_UID: - { - VVHW_TRACE("EGL request" ); - switch( opcode ) - { - case EglRFC::EeglMetaSgGetHandles: - { - VVHW_TRACE("EglRFC::EeglMetaSgGetHandles" ); - EglRFC call( aReq->iRemoteFunctionCall ); - TUint64 id(0); - EGLint* handles; - EGLint handles_size; - - call.GetTUint64( id, 0 ); - call.GetEGLintVectorData( handles, handles_size, 2 ); - DSgResource* resource; - VVHW_TRACE("EglRFC::EeglMetaSgGetHandles openSgImageMetaData" ); - HBuf8* data = OpenSgImageMetaData( id, resource ); - if( data && handles_size >= 2 ) - { - TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); - handles[0] = sginfo.iPbufferHandle; - handles[1] = sginfo.iVGImageHandle; - call.SetReturnValue( (int)EGL_TRUE ); - } - else - { - call.SetReturnValue( (int)EGL_FALSE ); - } - alreadyProcessed = EHandled; - break; - } - case EglRFC::EeglCreateContext: - { - //if no share_context specified, pass the sgImage pool context - VVHW_TRACE("eglCreateContext" ); - break; - } - case EglRFC::EeglMakeCurrent: - { - EGLDisplay dpy; - EGLSurface draw; - EGLSurface read; - EGLContext ctx; - EGLint syncRequirement(0);//no sync = 0 - - EglRFC call( aReq->iRemoteFunctionCall ); - call.GetEGLDisplay( dpy, 0 ); - call.GetEGLSurface( draw, 1 ); - call.GetEGLSurface( read, 2 ); - call.GetEGLContext( ctx, 3 ); - VGImage img = 0; - - TPbSId obj ( draw, 0 ); - - TInt sgIdIndex = iPbufferSgMap.FindInOrder( obj, iPbufferSgMapOrder ); - if( sgIdIndex != KErrNotFound ) - { - DSgResource* resource; - HBuf8* data = OpenSgImageMetaData( iPbufferSgMap[sgIdIndex].iSgId, resource ); - if( data ) - { - TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); - - if( !sginfo.iPbufferClean ) - { - img = sginfo.iVGImageHandle; - //sync with the underlying pbuffer surface - syncRequirement = syncRequirement | KSyncDrawSurface; - call.AppendEGLint( img ); - } - delete data; - } - } - obj.iPbuffer = read; - obj.iSgId = 0; - - sgIdIndex = iPbufferSgMap.FindInOrder( obj, iPbufferSgMapOrder ); - if( sgIdIndex != KErrNotFound ) - { - DSgResource* resource; - HBuf8* data = OpenSgImageMetaData( iPbufferSgMap[sgIdIndex].iSgId, resource ); - if( data ) - { - TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); - - if( !sginfo.iPbufferClean ) - { - img = sginfo.iVGImageHandle; - //sync with the underlying pbuffer surface - syncRequirement = syncRequirement | KSyncReadSurface; - } - delete data; - } - } - call.AppendEGLint( syncRequirement ); - call.AppendEGLint( img ); - - VVHW_TRACE("eglMakeCurrent %u", iCurrClientData->iContext ); - break; - } - case EglRFC::EeglMakeCurrentSg: - { - VVHW_TRACE("eglMakeCurrentSg" ); - break; - } - case EglRFC::EeglCreatePixmapSurfaceSg: - { - alreadyProcessed = EHandled;//This will be handled here - - TUint64 sgId; - EglRFC call( aReq->iRemoteFunctionCall ); - call.GetTUint64( sgId, 0 );//get the sgImage id - - DSgResource* resource; - HBuf8* data = OpenSgImageMetaData( sgId, resource ); - if( data ) - { - TSgImageMetaData sginfo (((TPckgBuf*) data)->operator ()()); - resource->SetMetaData( (*data) ); - aReq->iRemoteFunctionCall.SetReturnValue( sginfo.iPbufferHandle ); - delete data; - } - else - { - aReq->iRemoteFunctionCall.SetReturnValue( EGL_NO_SURFACE ); - } - //Find the sgimage's pbuffer surface, then return that - VVHW_TRACE( "EeglCreatePixmapSurfaceSg" ); - break; - } - case EglRFC::EeglCreatePbufferFromClientBuffer: - { - //if a sgImage-backing VGImage handle is passed here, then fail with EGL_BAD_ACCESS - - VVHW_TRACE("eglCreatePbufferFromClientBuffer" ); - break; - } - case EglRFC::EeglGetError: - { - VVHW_TRACE("eglGetError" ); - break; - } - default: - { - break; - } - }//switch opcode (EGL) - - break; - } - case SERIALISED_OPENGLES_1_1_API_UID: - { - VVHW_TRACE("OpenGLES request" ); - switch( opcode ) - { - case OpenGlES11RFC::EglGetError: - { - //Get the GLES error - } - default: - { - break; - } - } - break; - } - default: - { - break; - } - }//switch apicode - //VVHW_TRACE( "DDeviceReqHandler::InterpretRequest: opcode : %d ", data->iCurrOpCode ); - if( iCurrClientData )//This could have been removed, in a call to RemoveClientData - { - iCurrClientData->iErrUpdatedVG = ErrUpdatedVG; - iCurrClientData->iErrUpdatedEGL = ErrUpdatedEGL; - iCurrClientData->iErrUpdatedGLES = ErrUpdatedGLES; - } - return alreadyProcessed; - } - -HBuf8* DDeviceReqHandler::OpenSgImageMetaData( const TUint64 aId, DSgResource*& aResource ) - { - VVHW_TRACE("DDeviceReqHandler::OpenSgImageMetaData 0x%lx", aId ); - aResource = 0; - HBuf8* data(0); - TInt sgOpenErr( KErrNone ); - - sgOpenErr = SgExtension::FindAndOpenResource( aId, aResource );//Open the sgimage resource - VVHW_TRACE(" sgOpenErr %d", sgOpenErr); - if( sgOpenErr == KErrNone ) - { - data = HBuf8::New( aResource->GetMetaDataSize() ); - if( data ) - { - aResource->GetMetaData( (*data) ); - } - } - return data;//If there was a problem, this is zero. Ownership belongs to caller - } + */ +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; + } + + + + +TInt DDeviceReqHandler::DestroySgImage( const TUint64 aId ) + { + VVHW_TRACE("DDeviceReqHandler::DestroySgImage ->"); + TBool allok = ETrue; + TAsyncRequest* req(0); + TPckg res( iOpReturn ); + EGLSurface surface(0); + VGImage image(0); + +#ifdef FAISALMEMON_S4_SGIMAGE + 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; + } + +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 + } diff -r d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/ldd/src/reqhandlerextension.cpp --- a/guestrendering/guestvideodriver/ldd/src/reqhandlerextension.cpp Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/ldd/src/reqhandlerextension.cpp Wed Aug 25 17:57:53 2010 +0100 @@ -1,139 +1,139 @@ -// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// Platsim video driver - request handler extension (a.k.a. Command Scheduler extension) -// - -#include -#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; - } - +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// Platsim video driver - request handler extension (a.k.a. Command Scheduler extension) +// + +#include +#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 d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/ldd/src/virtualvideohwchannel.cpp --- a/guestrendering/guestvideodriver/ldd/src/virtualvideohwchannel.cpp Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/ldd/src/virtualvideohwchannel.cpp Wed Aug 25 17:57:53 2010 +0100 @@ -1,284 +1,284 @@ -/* - * ============================================================================= - * Name : virtualvideohwchannel.cpp - * Part of : - * Description : Implementation of the class DVirtualVideoHwChannel. - * Version : %version:2 % - * - * Copyright © 2002-2010 Nokia. All rights reserved. - * This material, including documentation and any related - * computer programs, is protected by copyright controlled by - * Nokia. All rights are reserved. Copying, including - * reproducing, storing, adapting or translating, any - * or all of this material requires the prior written consent of - * Nokia. This material also contains confidential - * information which may not be disclosed to others without the - * prior written consent of Nokia. - * ============================================================================= - */ - -// INCLUDE FILES -#include -#include - -#include "virtualvideohwchannel.h" -#include "virtualvideohwdeviceinterface.h" -#include "platsimvideodriverprotocol.h" -#include "platsimvideodrivercommon.h" -#include "devicereqhandler.h" -#include "serializedfunctioncall.h" - - -// CONSTANTS -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwChannel::DVirtualVideoHwChannel -// ----------------------------------------------------------------------------- -// -DVirtualVideoHwChannel::DVirtualVideoHwChannel( - MVirtualVideoHwDeviceInterface& aDeviceInterface, - DVirtualVideoHwInterface& aHwInterface, - DDeviceReqHandler& aDeviceReqHandler, - TDfcQue* aQueue ) : - iDeviceInterface( aDeviceInterface ), - iHwInterface( aHwInterface ), - iReqHandler( aDeviceReqHandler ) - { - SetDfcQ( aQueue ); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwChannel::~DVirtualVideoHwChannel -// ----------------------------------------------------------------------------- -// -DVirtualVideoHwChannel::~DVirtualVideoHwChannel() - { - // Enter critical section - NKern::ThreadEnterCS(); - iMsgQ.CompleteAll( KErrAbort ); - // Leave critical section - NKern::ThreadLeaveCS(); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwChannel::Request -// ----------------------------------------------------------------------------- -// -TInt DVirtualVideoHwChannel::Request( TInt aReqNo, TAny *a1, TAny *a2 ) - { - TInt result = DLogicalChannel::Request( aReqNo, a1, a2 ); - return result; - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwChannel::HandleMsg -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwChannel::HandleMsg( TMessageBase* aMsgRequest ) - { - DThread* userThread = aMsgRequest->Client(); - TThreadMessage& msg = *(TThreadMessage*)aMsgRequest; - // Default error condition - TInt err = KErrNone; - - if ( msg.iValue == ECloseMsg ) - { - iReqHandler.HandleClientShutdown( userThread->iOwningProcess->iId, userThread->iId ); - msg.Complete( KErrNone, EFalse ); - return; - } - - if ( msg.iValue < 0 ) - { - TRequestStatus* status = (TRequestStatus*)msg.Ptr0(); - err = DoRequest( userThread, ~msg.iValue, status, msg.Ptr1(), msg.Ptr2() ); - if( err != KErrNone ) - { - Kern::RequestComplete( userThread, status, err ); - } - err = KErrNone; - } - else - { - err = DoControl( userThread, msg.iValue, msg.Ptr0(), msg.Ptr1() ); - } - - msg.Complete( err, ETrue ); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwChannel::DoCreate -// ----------------------------------------------------------------------------- -// -TInt DVirtualVideoHwChannel::DoCreate( TInt /*aUnit*/, const TDesC* /*aInfo*/, const TVersion& aVer ) - { - using namespace PlatsimVideoDriver; - TInt err = KErrNone; - - if ( ! Kern::QueryVersionSupported( - TVersion( - KMajorVer, - KMinorVer, - KBuildVer ), - aVer ) ) - { - return KErrNotSupported; - } - - iMsgQ.Receive(); - return err; - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwChannel::DoRequest -// ----------------------------------------------------------------------------- -// -TInt DVirtualVideoHwChannel::DoRequest( - DThread*& aUserThread, - TInt aReqNo, - TRequestStatus* aStatus, - TAny* a1, - TAny* a2 ) - { - using namespace PlatsimVideoDriver; - - // Default error condition - TInt err = KErrNone; - - switch( aReqNo ) - { - case ERequestExecuteCommand: - { - err = iReqHandler.HandleExecuteAsync( - aUserThread, - aStatus, - a1); - break; - } - case ERequestLoadCommands: - { - err = iReqHandler.HandleLoadCommands( - aUserThread, - aStatus, - a1 ); - break; - } - default: - { - // Other requests are not supported - err = KErrNotSupported; - } - break; - } - return err; - } - - - -TInt DVirtualVideoHwChannel::GetSgImageMetaData(TSgImageMetaData& aSgInfo, const TUint64 aId) - { - VVHW_TRACE("DVirtualVideoHwChannel::OpenSgImageMetaData 0x%lx", aId ); - DSgResource* sgResource = NULL; - TInt metaDataErr = SgExtension::FindAndOpenResource( aId, sgResource );//Open the sgimage resource - - if ( metaDataErr == KErrNone ) - { - TPckgBuf metaDataPckg; - - metaDataErr = sgResource->GetMetaData( metaDataPckg ); - if ( metaDataErr == KErrNone ) - { - aSgInfo = metaDataPckg(); - } - - sgResource->Close(); - } - return metaDataErr; - } - - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwChannel::DoControl -// ----------------------------------------------------------------------------- -// -TInt DVirtualVideoHwChannel::DoControl( - DThread*& aUserThread, - TInt aFunction, - TAny* a1, - TAny* a2 ) - { - using namespace PlatsimVideoDriver; - - // Default error condition - TInt err = KErrNone; - - switch( aFunction ) - { - case ERequestMapAddress: - { - TPckgBuf 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 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; - } - default: - { - // Other functions are not supported - err = KErrNotSupported; - } - break; - } - - return err; - } - +/* + * ============================================================================= + * Name : virtualvideohwchannel.cpp + * Part of : + * Description : Implementation of the class DVirtualVideoHwChannel. + * Version : %version:2 % + * + * Copyright © 2002-2010 Nokia. All rights reserved. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia. All rights are reserved. Copying, including + * reproducing, storing, adapting or translating, any + * or all of this material requires the prior written consent of + * Nokia. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia. + * ============================================================================= + */ + +#include +#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; + } +#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 d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/ldd/src/virtualvideohwdevice.cpp --- a/guestrendering/guestvideodriver/ldd/src/virtualvideohwdevice.cpp Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/ldd/src/virtualvideohwdevice.cpp Wed Aug 25 17:57:53 2010 +0100 @@ -1,169 +1,167 @@ -/* - * ============================================================================= - * Name : virtualvideohwdevice.cpp - * Part of : - * Description : Implementation of the class DVirtualVideoHwDevice. - * Version : %version:3 % - * - * Copyright © 2002-2008 Nokia. All rights reserved. - * This material, including documentation and any related - * computer programs, is protected by copyright controlled by - * Nokia. All rights are reserved. Copying, including - * reproducing, storing, adapting or translating, any - * or all of this material requires the prior written consent of - * Nokia. This material also contains confidential - * information which may not be disclosed to others without the - * prior written consent of Nokia. - * ============================================================================= - */ - - -// INCLUDE FILES -#include -#include - -#include "virtualvideohwdevice.h" -#include "virtualvideohwchannel.h" -#include "platsimvideodriverprotocol.h" -#include "platsimvideodrivercommon.h" -#include "virtualvideohwinterface.h" -#include "devicereqhandler.h" -#include "virtualvideotracing.h" - -const TInt KPriority = 27; // DfcQue0 has same priority - -// a .LDD requires that the first exported function creates the device. By -// returning a concrete DLogicalDevice-derived class, this implements -// polymorphism using a named DLL. -DECLARE_STANDARD_LDD() - { - return new DVirtualVideoHwDevice; - } - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwDevice::DVirtualVideoHwDevice -// ----------------------------------------------------------------------------- -// -DVirtualVideoHwDevice::DVirtualVideoHwDevice() - { - // No need to set iParseMask as we don't have PDD. - // Just set the version. - using namespace PlatsimVideoDriver; - iVersion = TVersion( KMajorVer, KMinorVer, KBuildVer ); - VVHW_TRACE("DVirtualVideoHwDevice::DVirtualVideoHwDevice"); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwDevice::Install -// ----------------------------------------------------------------------------- -// -TInt DVirtualVideoHwDevice::Install() - { - // Our name, used by User::FreeLogicalDevice - TInt err = SetName( &PlatsimVideoDriver::KDeviceName ); - if ( err != KErrNone ) - { - VVHW_TRACE("DVirtualVideoHwDevice::Install SetName %d", err); - return err; - } - - // Enter critical section - NKern::ThreadEnterCS(); - - err = Kern::DfcQCreate( iDfcQ, KPriority, &PlatsimVideoDriver::KDfcThreadName ); - - // Leave critical section - NKern::ThreadLeaveCS(); - - if ( err != KErrNone ) - { - VVHW_TRACE("DVirtualVideoHwDevice::Install Kern::DfcQCreate %d", err); - return err; - } - - iHwInterface = new DVirtualVideoHwInterface; - if ( !iHwInterface ) - { - return KErrNoMemory; - } - - err = iHwInterface->InitRegisterMemory(); - if ( err != KErrNone ) - { - VVHW_TRACE("DVirtualVideoHwDevice::Install InitRegisterMemory %d", err); - return err; - } - - err = iHwInterface->InitParametersInputMemory(); - if ( err != KErrNone ) - { - VVHW_TRACE("DVirtualVideoHwDevice::Install InitParametersInputMemory %d", err); - return err; - } - - err = iHwInterface->InitParametersOutputMemory(); - if ( err != KErrNone ) - { - VVHW_TRACE("DVirtualVideoHwDevice::Install InitParametersOutputMemory %d", err); - return err; - } - - iDeviceReqHandler = new DDeviceReqHandler( *iHwInterface, iDfcQ ); - if ( !iDeviceReqHandler ) - { - return KErrNoMemory; - } - - VVHW_TRACE("DVirtualVideoHwDevice::Install return %d", err); - return err; - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwDevice::~DVirtualVideoHwDevice -// ----------------------------------------------------------------------------- -// -DVirtualVideoHwDevice::~DVirtualVideoHwDevice() - { - delete iDeviceReqHandler; - delete iDfcQ; - delete iHwInterface; - VVHW_TRACE("DVirtualVideoHwDevice:~DVirtualVideoHwDevice"); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwDevice::GetCaps -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwDevice::GetCaps( TDes8& aDes ) const - { - TVersion version; - - // fill it with information - version = iVersion; - - // copy as much of our information as will fit into this descriptor - aDes.Copy( (TUint8*)&version, Min( aDes.MaxLength(), sizeof( version ) ) ); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwDevice::Create -// ----------------------------------------------------------------------------- -// -TInt DVirtualVideoHwDevice::Create( DLogicalChannelBase*& aChannel ) - { - aChannel = NULL; - TInt error = KErrNone; - aChannel = new DVirtualVideoHwChannel( - *this, - *iHwInterface, - *iDeviceReqHandler, - iDfcQ); - - if ( !aChannel ) - { - error = KErrNoMemory; - } - return error; - } +/* + * ============================================================================= + * Name : virtualvideohwdevice.cpp + * Part of : + * Description : Implementation of the class DVirtualVideoHwDevice. + * Version : %version:3 % + * + * Copyright © 2002-2008 Nokia. All rights reserved. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia. All rights are reserved. Copying, including + * reproducing, storing, adapting or translating, any + * or all of this material requires the prior written consent of + * Nokia. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia. + * ============================================================================= + */ + +#include +#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 ); + 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; + } + + 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 d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/ldd/src/virtualvideohwinterface.cpp --- a/guestrendering/guestvideodriver/ldd/src/virtualvideohwinterface.cpp Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/ldd/src/virtualvideohwinterface.cpp Wed Aug 25 17:57:53 2010 +0100 @@ -1,267 +1,267 @@ -/* - * ============================================================================= - * Name : virtualvideohwinterface.cpp - * Part of : - * Description : Implementation file for the class DVirtualVideoHwInterface. - * Version : %version:3 % - * - * Copyright © 2002-2009 Nokia. All rights reserved. - * This material, including documentation and any related - * computer programs, is protected by copyright controlled by - * Nokia. All rights are reserved. Copying, including - * reproducing, storing, adapting or translating, any - * or all of this material requires the prior written consent of - * Nokia. This material also contains confidential - * information which may not be disclosed to others without the - * prior written consent of Nokia. - * ============================================================================= - */ - - -// INCLUDE FILES -#include -#include - -#include "virtualvideointerfaceconstants.h" -#include "virtualvideohwinterface.h" -#include "virtualvideotracing.h" - - -// CONSTANTS - -_LIT( KVirtualVideoHwInterfacePanic, "DVirtualVideoHwInterface" ); - -// ============================ LOCAL DATA TYPES =============================== - -// Register offsets for playback and recording channels -// Note: The orders of these must match the order of enumarations -const TLinAddr KRegisterOffsets[] = - { - VVI_R_ID, - VVI_R_IRQ_ENABLE, - VVI_R_IRQ_STATUS, - VVI_R_COMMAND, - VVI_R_PARAMETER_LOAD, - VVI_R_ERROR, - VVI_R_INPUT_BUFFER_TAIL, - VVI_R_INPUT_BUFFER_HEAD, - VVI_R_INPUT_BUFFER_READ_COUNT, - VVI_R_INPUT_BUFFER_WRITE_COUNT, - VVI_R_INPUT_BUFFER_MAX_TAIL, - VVI_R_REQUEST_ID - }; -#define ASSERT_PANIC(c,p) __ASSERT_DEBUG(c,Kern::PanicCurrentThread(KVirtualVideoHwInterfacePanic,p)); - -// ============================ LOCAL FUNCTIONS ================================ - -// Get register offset for certain register range and register -inline TLinAddr RegisterOffset( DVirtualVideoHwInterface::TRegister aRegister ) - { - return KRegisterOffsets[aRegister]; - } - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::DVirtualVideoHwInterface -// ----------------------------------------------------------------------------- -// -DVirtualVideoHwInterface::DVirtualVideoHwInterface() - { - iInputParametersMemoryChunk = NULL; - iOutputParametersMemoryChunk = NULL; - iRegisterMemoryChunk = NULL; - } - - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::~DVirtualVideoHwInterface -// ----------------------------------------------------------------------------- -// -DVirtualVideoHwInterface::~DVirtualVideoHwInterface() - { - // Enter critical section - NKern::ThreadEnterCS(); - - if ( iInputParametersMemoryChunk ) - { - Kern::ChunkClose( iInputParametersMemoryChunk ); - } - - if ( iOutputParametersMemoryChunk ) - { - Kern::ChunkClose( iOutputParametersMemoryChunk ); - } - - if ( iRegisterMemoryChunk ) - { - Kern::ChunkClose( iRegisterMemoryChunk ); - } - - iInputParametersMemoryChunk = NULL; - iOutputParametersMemoryChunk = NULL; - iRegisterMemoryChunk = NULL; - - // Leave critical section - NKern::ThreadLeaveCS(); - } - -TInt DVirtualVideoHwInterface::InitParametersInputMemory() - { - return InitPhysicalMemory( VVI_PARAMETERS_INPUT_BASE_ADDRESS, - VVI_PARAMETERS_INPUT_MEMORY_SIZE, iInputParametersMemoryChunk, - iInputParametersChunkKernelAddress ); - } - -TInt DVirtualVideoHwInterface::InitParametersOutputMemory() - { - return InitPhysicalMemory( VVI_PARAMETERS_OUTPUT_BASE_ADDRESS, - VVI_PARAMETERS_OUTPUT_MEMORY_SIZE, iOutputParametersMemoryChunk, - iOutputParametersChunkKernelAddress ); - } - -TInt DVirtualVideoHwInterface::InitRegisterMemory() - { - return InitPhysicalMemory( VVI_REGISTERS_BASE_ADDRESS, - VVI_REGISTERS_MEMORY_SIZE, iRegisterMemoryChunk, - iRegisterChunkKernelAddress ); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::InitPhysicalMemory -// ----------------------------------------------------------------------------- -// -TInt DVirtualVideoHwInterface::InitPhysicalMemory( TUint32 aPhysicalAddress, - TInt aMaxSize, DChunk*& aChunk, TLinAddr& aLinAddr ) - { - TInt error = KErrNoMemory; - TChunkCreateInfo info; - info.iType = TChunkCreateInfo::ESharedKernelSingle; - info.iMaxSize = aMaxSize; - info.iMapAttr = EMapAttrFullyBlocking; - info.iOwnsMemory = EFalse; - info.iDestroyedDfc = NULL; - DChunk* chunk = NULL; - TUint32 mapAttr = 0; - TLinAddr chunkKernelAddress = 0; - - // Enter critical section while creating the chunk and commiting memory - NKern::ThreadEnterCS(); - - error = Kern::ChunkCreate( info, chunk, chunkKernelAddress, mapAttr ); - if ( !error ) - { - error = Kern::ChunkCommitPhysical( - chunk, 0, aMaxSize, aPhysicalAddress ); - if ( error ) - { - Kern::ChunkClose( chunk ); - } - else - { - // Physical memory has been successfully committed to chunk - aChunk = chunk; - aLinAddr = chunkKernelAddress; - } - } - chunk = NULL; - - // Leave critical section - NKern::ThreadLeaveCS(); - - VVHW_TRACE("DVirtualVideoHwInterface::InitPhysicalMemory return %d", error); - return error; - } - -// ----------------------------------------------------------------------------- -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::EnableInterrupts -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::EnableInterrupts( TUint32 aInterruptBitField ) - { - SetRegisterValue( ERegIrqEnable, aInterruptBitField ); - } - - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::GetInterruptEnabledState -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::GetInterruptEnabledState( TUint32& aInterruptBitField ) - { - GetRegisterValue( ERegIrqEnable, aInterruptBitField ); - } - - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::GetInterruptStatus -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::GetInterruptStatus( TUint32& aInterruptBitField ) - { - GetRegisterValue( ERegIrqStatus, aInterruptBitField ); - } - - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::ResetInterruptStatus -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::ResetInterruptStatus( TUint32 aInterruptBitField ) - { - SetRegisterValue( ERegIrqStatus, aInterruptBitField ); - } - - -// DVirtualVideoHwInterface::IssueCommand -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::IssueCommand( TUint32 aCommand ) - { - SetRegisterValue( ERegCommand, aCommand ); - } - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::GetRegisterValue -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::GetRegisterValue( - TRegister aRegister, - TUint32& aValue ) - { - if ( iRegisterMemoryChunk ) - { - TLinAddr offset = RegisterOffset( aRegister ); - TUint32* ptr = reinterpret_cast( iRegisterChunkKernelAddress + offset ); - aValue = *ptr; - } - else - { - Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady ); - } - } - - -// ----------------------------------------------------------------------------- -// DVirtualVideoHwInterface::SetRegisterValue -// ----------------------------------------------------------------------------- -// -void DVirtualVideoHwInterface::SetRegisterValue( - TRegister aRegister, - TUint32 aValue ) - { - if ( iRegisterMemoryChunk ) - { - TLinAddr offset = RegisterOffset( aRegister ); - TUint32* ptr = reinterpret_cast( iRegisterChunkKernelAddress + offset ); - *ptr = aValue; - } - else - { - Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady ); - } - } - - -// End of file +/* + * ============================================================================= + * Name : virtualvideohwinterface.cpp + * Part of : + * Description : Implementation file for the class DVirtualVideoHwInterface. + * Version : %version:3 % + * + * Copyright © 2002-2009 Nokia. All rights reserved. + * This material, including documentation and any related + * computer programs, is protected by copyright controlled by + * Nokia. All rights are reserved. Copying, including + * reproducing, storing, adapting or translating, any + * or all of this material requires the prior written consent of + * Nokia. This material also contains confidential + * information which may not be disclosed to others without the + * prior written consent of Nokia. + * ============================================================================= + */ + + +// INCLUDE FILES +#include +#include + +#include +#include +#include + + +// CONSTANTS + +_LIT( KVirtualVideoHwInterfacePanic, "DVirtualVideoHwInterface" ); + +// ============================ LOCAL DATA TYPES =============================== + +// Register offsets for playback and recording channels +// Note: The orders of these must match the order of enumarations +const TLinAddr KRegisterOffsets[] = + { + VVI_R_ID, + VVI_R_IRQ_ENABLE, + VVI_R_IRQ_STATUS, + VVI_R_COMMAND, + VVI_R_PARAMETER_LOAD, + VVI_R_ERROR, + VVI_R_INPUT_BUFFER_TAIL, + VVI_R_INPUT_BUFFER_HEAD, + VVI_R_INPUT_BUFFER_READ_COUNT, + VVI_R_INPUT_BUFFER_WRITE_COUNT, + VVI_R_INPUT_BUFFER_MAX_TAIL, + VVI_R_REQUEST_ID + }; +#define ASSERT_PANIC(c,p) __ASSERT_DEBUG(c,Kern::PanicCurrentThread(KVirtualVideoHwInterfacePanic,p)); + +// ============================ LOCAL FUNCTIONS ================================ + +// Get register offset for certain register range and register +inline TLinAddr RegisterOffset( DVirtualVideoHwInterface::TRegister aRegister ) + { + return KRegisterOffsets[aRegister]; + } + +// ============================ MEMBER FUNCTIONS =============================== + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::DVirtualVideoHwInterface +// ----------------------------------------------------------------------------- +// +DVirtualVideoHwInterface::DVirtualVideoHwInterface() + { + iInputParametersMemoryChunk = NULL; + iOutputParametersMemoryChunk = NULL; + iRegisterMemoryChunk = NULL; + } + + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::~DVirtualVideoHwInterface +// ----------------------------------------------------------------------------- +// +DVirtualVideoHwInterface::~DVirtualVideoHwInterface() + { + // Enter critical section + NKern::ThreadEnterCS(); + + if ( iInputParametersMemoryChunk ) + { + Kern::ChunkClose( iInputParametersMemoryChunk ); + } + + if ( iOutputParametersMemoryChunk ) + { + Kern::ChunkClose( iOutputParametersMemoryChunk ); + } + + if ( iRegisterMemoryChunk ) + { + Kern::ChunkClose( iRegisterMemoryChunk ); + } + + iInputParametersMemoryChunk = NULL; + iOutputParametersMemoryChunk = NULL; + iRegisterMemoryChunk = NULL; + + // Leave critical section + NKern::ThreadLeaveCS(); + } + +TInt DVirtualVideoHwInterface::InitParametersInputMemory() + { + return InitPhysicalMemory( VVI_PARAMETERS_INPUT_BASE_ADDRESS, + VVI_PARAMETERS_INPUT_MEMORY_SIZE, iInputParametersMemoryChunk, + iInputParametersChunkKernelAddress ); + } + +TInt DVirtualVideoHwInterface::InitParametersOutputMemory() + { + return InitPhysicalMemory( VVI_PARAMETERS_OUTPUT_BASE_ADDRESS, + VVI_PARAMETERS_OUTPUT_MEMORY_SIZE, iOutputParametersMemoryChunk, + iOutputParametersChunkKernelAddress ); + } + +TInt DVirtualVideoHwInterface::InitRegisterMemory() + { + return InitPhysicalMemory( VVI_REGISTERS_BASE_ADDRESS, + VVI_REGISTERS_MEMORY_SIZE, iRegisterMemoryChunk, + iRegisterChunkKernelAddress ); + } + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::InitPhysicalMemory +// ----------------------------------------------------------------------------- +// +TInt DVirtualVideoHwInterface::InitPhysicalMemory( TUint32 aPhysicalAddress, + TInt aMaxSize, DChunk*& aChunk, TLinAddr& aLinAddr ) + { + TInt error = KErrNoMemory; + TChunkCreateInfo info; + info.iType = TChunkCreateInfo::ESharedKernelSingle; + info.iMaxSize = aMaxSize; + info.iMapAttr = EMapAttrFullyBlocking; + info.iOwnsMemory = EFalse; + info.iDestroyedDfc = NULL; + DChunk* chunk = NULL; + TUint32 mapAttr = 0; + TLinAddr chunkKernelAddress = 0; + + // Enter critical section while creating the chunk and commiting memory + NKern::ThreadEnterCS(); + + error = Kern::ChunkCreate( info, chunk, chunkKernelAddress, mapAttr ); + if ( !error ) + { + error = Kern::ChunkCommitPhysical( + chunk, 0, aMaxSize, aPhysicalAddress ); + if ( error ) + { + Kern::ChunkClose( chunk ); + } + else + { + // Physical memory has been successfully committed to chunk + aChunk = chunk; + aLinAddr = chunkKernelAddress; + } + } + chunk = NULL; + + // Leave critical section + NKern::ThreadLeaveCS(); + + VVHW_TRACE("DVirtualVideoHwInterface::InitPhysicalMemory return %d", error); + return error; + } + +// ----------------------------------------------------------------------------- +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::EnableInterrupts +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::EnableInterrupts( TUint32 aInterruptBitField ) + { + SetRegisterValue( ERegIrqEnable, aInterruptBitField ); + } + + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::GetInterruptEnabledState +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::GetInterruptEnabledState( TUint32& aInterruptBitField ) + { + GetRegisterValue( ERegIrqEnable, aInterruptBitField ); + } + + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::GetInterruptStatus +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::GetInterruptStatus( TUint32& aInterruptBitField ) + { + GetRegisterValue( ERegIrqStatus, aInterruptBitField ); + } + + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::ResetInterruptStatus +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::ResetInterruptStatus( TUint32 aInterruptBitField ) + { + SetRegisterValue( ERegIrqStatus, aInterruptBitField ); + } + + +// DVirtualVideoHwInterface::IssueCommand +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::IssueCommand( TUint32 aCommand ) + { + SetRegisterValue( ERegCommand, aCommand ); + } + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::GetRegisterValue +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::GetRegisterValue( + TRegister aRegister, + TUint32& aValue ) + { + if ( iRegisterMemoryChunk ) + { + TLinAddr offset = RegisterOffset( aRegister ); + TUint32* ptr = reinterpret_cast( iRegisterChunkKernelAddress + offset ); + aValue = *ptr; + } + else + { + Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady ); + } + } + + +// ----------------------------------------------------------------------------- +// DVirtualVideoHwInterface::SetRegisterValue +// ----------------------------------------------------------------------------- +// +void DVirtualVideoHwInterface::SetRegisterValue( + TRegister aRegister, + TUint32 aValue ) + { + if ( iRegisterMemoryChunk ) + { + TLinAddr offset = RegisterOffset( aRegister ); + TUint32* ptr = reinterpret_cast( iRegisterChunkKernelAddress + offset ); + *ptr = aValue; + } + else + { + Kern::PanicCurrentThread( KVirtualVideoHwInterfacePanic, KErrNotReady ); + } + } + + +// End of file diff -r d8d95053303a -r e8ccf068ac7f guestrendering/guestvideodriver/rom/guestvideodriver.iby --- a/guestrendering/guestvideodriver/rom/guestvideodriver.iby Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/guestvideodriver/rom/guestvideodriver.iby Wed Aug 25 17:57:53 2010 +0100 @@ -1,27 +1,27 @@ -// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -// All rights reserved. -// This component and the accompanying materials are made available -// under the terms of "Eclipse Public License v1.0" -// which accompanies this distribution, and is available -// at the URL "http://www.eclipse.org/legal/epl-v10.html". -// -// Initial Contributors: -// Nokia Corporation - initial contribution. -// -// Contributors: -// -// Description: -// ROM IBY file for Guest Video Driver - -#ifndef GUESTVIDEODRIVER_IBY -#define GUESTVIDEODRIVER_IBY - - -file=ABI_DIR\BUILD_DIR\guestvideohwapi.dll SHARED_LIB_DIR\guestvideohwapi.dll - -extension[VARID]=KERNEL_DIR\BUILD_DIR\reqhandlerextension.dll \sys\bin\reqhandlerextension.dll -device[VARID]=KERNEL_DIR\BUILD_DIR\guestvideohw.ldd \sys\bin\guestvideohw.ldd - -#endif // GUESTVIDEODRIVER_IBY - -// End of File +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// ROM IBY file for Guest Video Driver + +#ifndef GUESTVIDEODRIVER_IBY +#define GUESTVIDEODRIVER_IBY + + +file=ABI_DIR\BUILD_DIR\guestvideohwapi.dll SHARED_LIB_DIR\guestvideohwapi.dll + +extension[VARID]=KERNEL_DIR\BUILD_DIR\reqhandlerextension.dll \sys\bin\reqhandlerextension.dll +device[VARID]=KERNEL_DIR\BUILD_DIR\guestvideohw.ldd \sys\bin\guestvideohw.ldd + +#endif // GUESTVIDEODRIVER_IBY + +// End of File diff -r d8d95053303a -r e8ccf068ac7f guestrendering/vghwserialiser/eabi/vghwserialiseru.def --- a/guestrendering/vghwserialiser/eabi/vghwserialiseru.def Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/vghwserialiser/eabi/vghwserialiseru.def Wed Aug 25 17:57:53 2010 +0100 @@ -1,28 +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 - +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 d8d95053303a -r e8ccf068ac7f guestrendering/vghwserialiser/group/vghwserialiser.mmp --- a/guestrendering/vghwserialiser/group/vghwserialiser.mmp Fri Aug 20 18:02:40 2010 +0100 +++ b/guestrendering/vghwserialiser/group/vghwserialiser.mmp Wed Aug 25 17:57:53 2010 +0100 @@ -1,39 +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 +// 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