Merge RCL_3 fixes with latest delivery. NewGraphicsArchitecture
authorsrilekhas <srilekhas@symbian.org>
Tue, 24 Aug 2010 16:17:55 +0100
branchNewGraphicsArchitecture
changeset 157 b042127c80f6
parent 144 314cdf966406 (current diff)
parent 150 57c618273d5c (diff)
child 170 c794569c62b8
Merge RCL_3 fixes with latest delivery.
windowing/windowserver/nga/SERVER/openwfc/cliwin.cpp
--- a/fbs/fontandbitmapserver/bwins/FBSCLI2U.DEF	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/bwins/FBSCLI2U.DEF	Tue Aug 24 16:17:55 2010 +0100
@@ -229,4 +229,19 @@
 	?CreateExtendedBitmap@CFbsBitmap@@QAEHABVTSize@@W4TDisplayMode@@VTUid@@PBXH@Z @ 228 NONAME ; int CFbsBitmap::CreateExtendedBitmap(class TSize const &, enum TDisplayMode, class TUid, void const *, int)
 	?UpdateLinkedTypeface@CFbsTypefaceStore@@QAEHABVCLinkedTypefaceSpecification@@@Z @ 229 NONAME ; int CFbsTypefaceStore::UpdateLinkedTypeface(class CLinkedTypefaceSpecification const &)
 	?GetExtraBuffer@CFbsBitmap@@SAPAVHBufC8@@H@Z @ 230 NONAME ; class HBufC8 * CFbsBitmap::GetExtraBuffer(int)
+	?Rect@RFbsGlyphDataIterator@@QBEABVTRect@@XZ @ 231 NONAME ABSENT ; class TRect const & RFbsGlyphDataIterator::Rect(void) const
+	?Image@RFbsGlyphDataIterator@@QBEABVRSgImage@@XZ @ 232 NONAME ABSENT ; class RSgImage const & RFbsGlyphDataIterator::Image(void) const
+	??0RFbsGlyphMetricsArray@@QAE@XZ @ 233 NONAME ABSENT ; RFbsGlyphMetricsArray::RFbsGlyphMetricsArray(void)
+	?Count@RFbsGlyphMetricsArray@@QBEHXZ @ 234 NONAME ABSENT ; int RFbsGlyphMetricsArray::Count(void) const
+	?Next@RFbsGlyphDataIterator@@QAEHXZ @ 235 NONAME ABSENT ; int RFbsGlyphDataIterator::Next(void)
+	?Metrics@RFbsGlyphDataIterator@@QBEABVTOpenFontCharMetrics@@XZ @ 236 NONAME ABSENT ; class TOpenFontCharMetrics const & RFbsGlyphDataIterator::Metrics(void) const
+	?Close@RFbsGlyphMetricsArray@@QAEXXZ @ 237 NONAME ABSENT ; void RFbsGlyphMetricsArray::Close(void)
+	??0RFbsGlyphDataIterator@@QAE@XZ @ 238 NONAME ABSENT ; RFbsGlyphDataIterator::RFbsGlyphDataIterator(void)
+	??ARFbsGlyphMetricsArray@@QBEABVTOpenFontCharMetrics@@H@Z @ 239 NONAME ABSENT ; class TOpenFontCharMetrics const & RFbsGlyphMetricsArray::operator[](int) const
+	?GlyphCode@RFbsGlyphDataIterator@@QBEIXZ @ 240 NONAME ABSENT ; unsigned int RFbsGlyphDataIterator::GlyphCode(void) const
+	?Close@RFbsGlyphDataIterator@@QAEXXZ @ 241 NONAME ABSENT ; void RFbsGlyphDataIterator::Close(void)
+	?Get@RFbsGlyphMetricsArray@@QAEHAAVCFbsFont@@PBIH@Z @ 242 NONAME ABSENT ; int RFbsGlyphMetricsArray::Get(class CFbsFont &, unsigned int const *, int)
+	?Open@RFbsGlyphDataIterator@@QAEHAAVCFbsFont@@PBIH@Z @ 243 NONAME ABSENT ; int RFbsGlyphDataIterator::Open(class CFbsFont &, unsigned int const *, int)
+	?GetGlyphCacheMetrics@RFbsSession@@QAEHAAVTGlyphCacheMetrics@@@Z @ 244 NONAME ABSENT ; int RFbsSession::GetGlyphCacheMetrics(class TGlyphCacheMetrics &)
 
+
--- a/fbs/fontandbitmapserver/bwins/fbservu.def	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/bwins/fbservu.def	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,5 @@
 EXPORTS
 	?KFbServSharedHeapMaxSize@@3HB @ 1 NONAME ; int const KFbServSharedHeapMaxSize
 	?KFbServWritableDataPagingMode@@3HB @ 2 NONAME ; int const KFbServWritableDataPagingMode
+	?KFbServGlyphAtlasCacheLimit@@3HB @ 3 NONAME ABSENT ; int const KFbServGlyphAtlasCacheLimit
 
--- a/fbs/fontandbitmapserver/eabi/FBSCLI2U.DEF	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/eabi/FBSCLI2U.DEF	Tue Aug 24 16:17:55 2010 +0100
@@ -264,4 +264,20 @@
 	_ZNK10CFbsBitmap8DataSizeEv @ 263 NONAME
 	_ZN17CFbsTypefaceStore20UpdateLinkedTypefaceERK28CLinkedTypefaceSpecification @ 264 NONAME
 	_ZN10CFbsBitmap14GetExtraBufferEi @ 265 NONAME
-
+	_ZN21RFbsGlyphDataIterator4NextEv @ 266 NONAME ABSENT
+	_ZN21RFbsGlyphDataIterator4OpenER8CFbsFontPKji @ 267 NONAME ABSENT
+	_ZN21RFbsGlyphDataIterator5CloseEv @ 268 NONAME ABSENT
+	_ZN21RFbsGlyphDataIteratorC1Ev @ 269 NONAME ABSENT
+	_ZN21RFbsGlyphDataIteratorC2Ev @ 270 NONAME ABSENT
+	_ZN21RFbsGlyphMetricsArray3GetER8CFbsFontPKji @ 271 NONAME ABSENT
+	_ZN21RFbsGlyphMetricsArray5CloseEv @ 272 NONAME ABSENT
+	_ZN21RFbsGlyphMetricsArrayC1Ev @ 273 NONAME ABSENT
+	_ZN21RFbsGlyphMetricsArrayC2Ev @ 274 NONAME ABSENT
+	_ZNK21RFbsGlyphDataIterator4RectEv @ 275 NONAME ABSENT
+	_ZNK21RFbsGlyphDataIterator5ImageEv @ 276 NONAME ABSENT
+	_ZNK21RFbsGlyphDataIterator7MetricsEv @ 277 NONAME ABSENT
+	_ZNK21RFbsGlyphDataIterator9GlyphCodeEv @ 278 NONAME ABSENT
+	_ZNK21RFbsGlyphMetricsArray5CountEv @ 279 NONAME ABSENT
+	_ZNK21RFbsGlyphMetricsArrayixEi @ 280 NONAME ABSENT
+	_ZN11RFbsSession20GetGlyphCacheMetricsER18TGlyphCacheMetrics @ 281 NONAME ABSENT
+	
--- a/fbs/fontandbitmapserver/eabi/fbservu.def	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/eabi/fbservu.def	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,5 @@
 EXPORTS
 	KFbServSharedHeapMaxSize @ 1 NONAME DATA 4
 	KFbServWritableDataPagingMode @ 2 NONAME DATA 4
-
+	KFbServGlyphAtlasCacheLimit @ 3 NONAME ABSENT
+	
--- a/fbs/fontandbitmapserver/group/FBSCLI.MMP	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/group/FBSCLI.MMP	Tue Aug 24 16:17:55 2010 +0100
@@ -28,6 +28,7 @@
 SOURCEPATH      ../sfbs
 
 userinclude     ../inc
+userinclude     ../traces_FBSCLI
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
--- a/fbs/fontandbitmapserver/group/FBSERV.MMP	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/group/FBSERV.MMP	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-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"
@@ -22,7 +22,7 @@
 // Default stack size(8K) is too small and causes stack overflow
 // in the hardware test udeb
 EPOCSTACKSIZE   16384
-EPOCHEAPSIZE    0x10000 0x200000		
+EPOCHEAPSIZE    0x10000 0x400000		
 					
 target          fbserv.exe
 
@@ -35,6 +35,7 @@
 
 userinclude     ../inc
 userinclude     ../sfbs
+userinclude     ../traces_FBSERV
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 OS_LAYER_ESTLIB_SYSTEMINCLUDE
--- a/fbs/fontandbitmapserver/inc/FBS.H	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/inc/FBS.H	Tue Aug 24 16:17:55 2010 +0100
@@ -338,6 +338,8 @@
 	TInt DoLoadFromRom(TUint32* aRomPointer, TInt32 aId, TUint aFileOffset, TBool& aRomPointerValid);
 	TBool LoadShiftedRomBmpL(const TDesC& aFileName,TInt32 aId,TUint aFileOffset);
 	static void DoStoreL(CDirectFileStore* aFileStore,CFbsBitmap* aBitmap,TInt aNumSources,const TDesC* aSources[],TInt32 aSourceIds[]);
+	TInt DuplicateInRom(TInt aBitmapHandle);
+	TInt DuplicateInRam(TInt aBitmapHandle);
 protected:
 	/** WARNING: For internal use ONLY.  Compatibility is not guaranteed in future releases.
 	 */
--- a/fbs/fontandbitmapserver/sfbs/FBSBMP.CPP	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/sfbs/FBSBMP.CPP	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-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"
@@ -25,6 +25,11 @@
 #include "BitwiseBitmap.inl"
 #include "fbsmessage.h"
 #include "bitmapconst.h"
+#include "OstTraceDefinitions.h"
+#include "fbstrace.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "FBSBMPTraces.h"
+#endif
 
 const TInt KMaxPixelSize = KMaxTInt / 4; // Maximum pixel size to avoid some overflow problems
 const TInt KMaxBitmapHandleBufferSize = KNumBytesPerBitmapHandle * 2000; 	// Maximum size of buffer to store all bitmap handles.
@@ -95,6 +100,8 @@
 */
 EXPORT_C void CFbsBitmap::Reset()
 	{
+    FBS_OST(TInt ssh = (iFbs ? iFbs->ServerSessionHandle() : 0);)
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_RESET_ENTRY, "> this=0x%08x; iH=0x%08x; iSH=0x%08x; iSSH=0x%08x", (TUint)this, iHandle, iServerHandle, ssh );)
 	if (iHandle && !(iFlags & EIsRomBitmap))
 		{
 		iFbs->SendCommand(EFbsMessClose, iHandle, Handle());
@@ -114,6 +121,7 @@
 	iUseCount = 0;
 	iHandle = 0;
 	iServerHandle = 0;
+	FBS_OST(OstTrace1( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_RESET_EXIT, "< this=0x%08x", (TUint)this );)
 	}
 	
 /** Tests whether or not the bitmap is read-only.
@@ -254,7 +262,11 @@
 */
 EXPORT_C TInt CFbsBitmap::Create(const TSize& aSizeInPixels,TDisplayMode aDispMode)
 	{
-	return DoCreate(aSizeInPixels,aDispMode,KUidCFbsBitmapCreation);
+    FBS_OST(OstTraceExt4(GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_CREATE_ENTRY, "> this=0x%08x; w=%d; h=%d; dm=%d", (TUint)this, aSizeInPixels.iWidth, aSizeInPixels.iHeight, aDispMode); ) 
+	TInt err = DoCreate(aSizeInPixels,aDispMode,KUidCFbsBitmapCreation);
+    FBS_OST(TInt ssh = (iFbs ? iFbs->ServerSessionHandle() : 0);)
+	FBS_OST(OstTraceExt5(GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_CREATE_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x; iSSH=0x%08x", (TUint)this, err, iHandle, iServerHandle, ssh); )
+    return err;
 	}
 
 TInt CFbsBitmap::DoCreate(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aUid, TInt aDataSize)
@@ -305,7 +317,11 @@
 */
 EXPORT_C TInt CFbsBitmap::CreateHardwareBitmap(const TSize& aSizeInPixels,TDisplayMode aDispMode,TUid aCreatorUid)
 	{
-	return DoCreate(aSizeInPixels,aDispMode,aCreatorUid);
+    FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_CREATEHARDWAREBITMAP_ENTRY, "> this=0x%08x; w=%d; h=%d; dm=%d; uid=0x%08x", (TUint)this, aSizeInPixels.iWidth, aSizeInPixels.iHeight, aDispMode, aCreatorUid.iUid);)
+	TInt err = DoCreate(aSizeInPixels,aDispMode,aCreatorUid);
+    FBS_OST(TInt ssh = (iFbs ? iFbs->ServerSessionHandle() : 0);)
+	FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_CREATEHARDWAREBITMAP_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x; iSSH=0x%08x", (TUint)this, err, iHandle, iServerHandle, ssh);)
+	return err;
 	}
 
 /** Resets the pixel-size of the bitmap.
@@ -406,53 +422,105 @@
 @released
 @see CFbsBitmap::Handle()
 */
-EXPORT_C TInt CFbsBitmap::Duplicate(TInt aBitmapHandle)
-		{
+EXPORT_C TInt CFbsBitmap::Duplicate(TInt aBitmapHandle)	
+    {
+    TInt ret = KErrNone;
+    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_DUPLICATE_ENTRY, "> this=0x%08x; iH=0x%08x;", (TUint)this, aBitmapHandle);)
 	if(!iFbs) 
 		{
-		return(KErrCouldNotConnect);
+		ret = KErrCouldNotConnect;
+		FBS_OST(OstTrace1( TRACE_ERROR, CFBSBITMAP_DUPLICATE_ERROR, "! this=0x%08x; !iFbs", (TUint)this);)
 		}
-	if(!aBitmapHandle) 
-		{
-		return(KErrUnknown);
-		}
-	Reset();
-	TBool isinrom=EFalse;
-	TInt ret=User::IsRomAddress(isinrom,(TAny*)aBitmapHandle);
-	if(ret!=KErrNone) 
+	else if(!aBitmapHandle) 
 		{
-		return(KErrUnknown);
-		}
-	if(isinrom)
-		{
-		if (((CBitwiseBitmap*)aBitmapHandle)->Uid() != KCBitwiseBitmapUid)
-			return(KErrUnknown);
-		iAddressPointer = (CBitwiseBitmap*)aBitmapHandle;
-		iFlags = EIsRomBitmap;
-		iHandle=1;
-		return iFbs->AllocScanLineBuffer(iAddressPointer->iByteWidth + 4);
+		ret = KErrUnknown;
+		FBS_OST(OstTrace1( TRACE_ERROR, CFBSBITMAP_DUPLICATE_ERROR2, "! this=0x%08x; !aBitmapHandle", (TUint)this);)
 		}
-	TPckgBuf<TBmpHandles> b;
-	TIpcArgs args(aBitmapHandle,&b);
-	ret=iFbs->SendCommand(EFbsMessBitmapDuplicate,args);
-	if(ret!=KErrNone) 
-		{
-		return(ret);
-		}
-	iHandle=b().iHandle;
-	iServerHandle=b().iServerHandle;
-	iAddressPointer=(CBitwiseBitmap*)(iFbs->HeapBase()+b().iAddressOffset);
-	if (iAddressPointer->iUid.iUid != KCBitwiseBitmapUid.iUid && iAddressPointer->iUid.iUid != KCBitwiseBitmapHardwareUid.iUid)
-		{
-		iFlags = EIsExtendedBitmap;
-		}
-	ret = iFbs->iHelper->AddBitmap(*this);
-	if (ret != KErrNone)
-		{
-		return ret;
-		}
-	return iFbs->AllocScanLineBuffer(iAddressPointer->iByteWidth+4);
-	}
+    else
+        {
+        TBool isinrom = EFalse;
+        ret = User::IsRomAddress(isinrom, (TAny*)aBitmapHandle);
+        if (ret == KErrNone)
+            {
+            if (isinrom)
+                {
+                ret = DuplicateInRom(aBitmapHandle);
+                FBS_OST_IF(ret != KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_DUPLICATE_ERROR4, "! this=0x%08x; DuplicateInRom() returned %d;", (TUint)this, ret);)
+                }
+            else
+                {
+                ret = DuplicateInRam(aBitmapHandle);
+                FBS_OST_IF(ret != KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_DUPLICATE_ERROR5, "! this=0x%08x; DuplicateInRam() returned %d;", (TUint)this, ret);)
+                }
+            }
+        else 
+            {
+            FBS_OST(OstTraceExt2( TRACE_ERROR, CFBSBITMAP_DUPLICATE_ERROR3, "! this=0x%08x; IsRomAddress() returned %d", (TUint)this, ret);)
+            ret = KErrUnknown;
+            }
+        }
+    FBS_OST(TInt ssh = (iFbs ? iFbs->ServerSessionHandle() : 0);)
+    FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_DUPLICATE_EXIT, "< this=0x%08x; iH=0x%08x; iSH=0x%08x; ret=%d; iSSH=0x%08x", (TUint)this, iHandle, iServerHandle, ret, ssh);)
+	return ret;
+    }
+
+/** Duplicates a bitmap where the bitmap handle refers to a rom bitmap.
+@param aBitmapHandle A valid Rom bitmap handle.
+@return KErrNone on success.
+ */
+TInt CFbsBitmap::DuplicateInRom(TInt aBitmapHandle)
+    {
+    TInt ret = KErrNone;
+    Reset();
+    TUid uid = ((CBitwiseBitmap*)aBitmapHandle)->Uid();
+    if (uid != KCBitwiseBitmapUid)
+        {
+        FBS_OST(OstTraceExt2( TRACE_ERROR, CFBSBITMAP_DUPLICATEINROM_ERROR, "! this=0x%08x; 0x%08x != KCBitwiseBitmapUid", (TUint)this, (TUint)uid.iUid);)
+        ret = KErrUnknown;
+        }
+    else
+        {
+        iAddressPointer = (CBitwiseBitmap*)aBitmapHandle;
+        iFlags = EIsRomBitmap;
+        iHandle=1;
+        ret = iFbs->AllocScanLineBuffer(iAddressPointer->iByteWidth + 4);
+        FBS_OST_IF(ret!=KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_DUPLICATEINROM_ERROR2, "! this=0x%08x; AllocScanLineBuffer() returned %d", (TUint)this, ret);)
+        }
+    return ret;
+    }
+
+/** Duplicates a bitmap where the bitmap handle refers to a ram bitmap
+@param aBitmapHandle A valid Ram bitmap handle.
+@return KErrNone on success.
+ */
+TInt CFbsBitmap::DuplicateInRam(TInt aBitmapHandle)
+    {
+    TInt ret = KErrNone;
+    Reset();
+     
+    TPckgBuf<TBmpHandles> b;
+    TIpcArgs args(aBitmapHandle,&b);
+    ret=iFbs->SendCommand(EFbsMessBitmapDuplicate,args);
+    FBS_OST_IF(ret!=KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_DUPLICATEINRAM_ERROR, "! this=0x%08x; SendCommand(EFbsMessBitmapDuplicate) returned %d", (TUint)this, ret);)
+    if(ret==KErrNone) 
+        {
+        iHandle=b().iHandle;
+        iServerHandle=b().iServerHandle;
+        iAddressPointer=(CBitwiseBitmap*)(iFbs->HeapBase()+b().iAddressOffset);
+        if (iAddressPointer->iUid.iUid != KCBitwiseBitmapUid.iUid && iAddressPointer->iUid.iUid != KCBitwiseBitmapHardwareUid.iUid)
+            {
+            iFlags = EIsExtendedBitmap;
+            }
+        ret = iFbs->iHelper->AddBitmap(*this);
+        FBS_OST_IF(ret!=KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_DUPLICATEINRAM_ERROR2, "! this=0x%08x; AddBitmap() returned %d", (TUint)this, ret);)
+        if (ret == KErrNone)
+            {
+            ret = iFbs->AllocScanLineBuffer(iAddressPointer->iByteWidth+4);
+            FBS_OST_IF(ret!=KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_DUPLICATEINRAM_ERROR3, "! this=0x%08x; AllocScanLineBuffer() returned %d", (TUint)this, ret);)
+            }
+        }
+    return ret;
+    }
 
 /** Loads a specific bitmap from a multi-bitmap file.
 The bitmap may be shared by other font and bitmap server clients.
@@ -467,7 +535,10 @@
 */	
 EXPORT_C TInt CFbsBitmap::Load(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded)
 	{
-	return Load(aFileName,aId,aShareIfLoaded,0);
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD_ENTRY, "> this=0x%08x; file=%S, id=0x%08x; share=%d", (TUint)this, aFileName, aId, aShareIfLoaded);)
+	TInt err = Load(aFileName,aId,aShareIfLoaded,0);
+    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD_EXIT, "< this=0x%08x; err=%d", (TUint)this, err);)
+	return err; 
 	}
 
 /**  Loads a specific bitmap from a multi-bitmap file.
@@ -483,38 +554,50 @@
 */	
 EXPORT_C TInt CFbsBitmap::Load(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset)
 	{
+    TInt err = KErrNone;
+    FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD2_ENTRY, "> this=0x%08x; file=%S, id=0x%08x; share=%d; off=%d", (TUint)this, aFileName, aId, aShareIfLoaded, aFileOffset);)
 	if(!iFbs)
 		{
-		return(KErrCouldNotConnect);
-		}
-	Reset();
-	TUint32* rompointer = NULL;
-	//access using filename has the advantage of using rom address lookup cache
-	IsFileInRom(aFileName, rompointer);
-	TBool romPointerValid;
-	TInt err = DoLoadFromRom(rompointer, aId, aFileOffset, romPointerValid);
-	if(romPointerValid)
-		{
-		return err;
-		}
-	_LIT(KResourcePath, "?:\\Resource\\*");
-	TInt match = aFileName.MatchF(KResourcePath);
-	//if the file is in the resource directory we don't need to check capabilities and the file can just be opened on the server side.
-	if (match == 0)
-		{
-		err = DoLoad(aFileName,aId,aShareIfLoaded,aFileOffset);
+        FBS_OST(OstTrace1( TRACE_ERROR, CFBSBITMAP_LOAD2_ERROR, "! this=0x%08x; !iFbs", (TUint)this);)
+		err = KErrCouldNotConnect;
 		}
 	else
-		{
-		RFile file;
-		err = file.Open(iFbs->FileServer(),aFileName,EFileShareReadersOnly);
-		if (err!=KErrNone)
-			{
-			return err;
-			}
-		err = DoLoad(file,aId,aShareIfLoaded,aFileOffset);
-		file.Close();
-		}
+	    {
+        Reset();
+        TUint32* rompointer = NULL;
+        //access using filename has the advantage of using rom address lookup cache
+        IsFileInRom(aFileName, rompointer);
+        TBool romPointerValid;
+        err = DoLoadFromRom(rompointer, aId, aFileOffset, romPointerValid);
+        if(romPointerValid)
+            {
+            FBS_OST(OstTrace1( TRACE_ERROR, CFBSBITMAP_LOAD2_ERROR2, "! this=0x%08x; romPointerValid", (TUint)this);)
+            err = KErrCouldNotConnect;
+            }
+        else
+            {
+            _LIT(KResourcePath, "?:\\Resource\\*");
+            TInt match = aFileName.MatchF(KResourcePath);
+            //if the file is in the resource directory we don't need to check capabilities and the file can just be opened on the server side.
+            if (match == 0)
+                {
+                err = DoLoad(aFileName,aId,aShareIfLoaded,aFileOffset);
+                FBS_OST_IF(err!=KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_LOAD2_ERROR3, "! this=0x%08x; DoLoad returned %d", (TUint)this, err);)
+                }
+            else
+                {
+                RFile file;
+                err = file.Open(iFbs->FileServer(),aFileName,EFileShareReadersOnly);
+                if (err==KErrNone)
+                    {
+                    err = DoLoad(file,aId,aShareIfLoaded,aFileOffset);
+                    FBS_OST_IF(err!=KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_LOAD2_ERROR4, "! this=0x%08x; DoLoad returned %d", (TUint)this, err);)
+                    }
+                file.Close();
+                }
+            }
+	    }
+    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD2_EXIT, "< this=0x%08x; err=%d", (TUint)this, err);)
 	return err;
 	}
 
@@ -532,7 +615,10 @@
 */	
 EXPORT_C TInt CFbsBitmap::LoadAndCompress(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded)
     {	
-    return LoadAndCompress(aFileName, aId, aShareIfLoaded, 0);
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS_ENTRY, "> this=0x%08x; file=%S; id=0x%08x; share=%d", (TUint)this, aFileName, aId, aShareIfLoaded);)
+    TInt ret = LoadAndCompress(aFileName, aId, aShareIfLoaded, 0);
+    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS_EXIT, "< this=0x%08x; err=%d", (TUint)this, ret);)
+    return ret;
 	}
 
 /** Loads and compresses a specific bitmap from a multi-bitmap file.
@@ -549,12 +635,15 @@
 @released
 */	
 EXPORT_C TInt CFbsBitmap::LoadAndCompress(const TDesC& aFileName,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset)
-    {	
+    {
+    FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS2_ENTRY, "> this=0x%08x; file=%S, id=0x%08x; share=%d; off=%d", (TUint)this, aFileName, aId, aShareIfLoaded, aFileOffset);)
 	TInt err = Load(aFileName,aId,aShareIfLoaded,aFileOffset);
 	if (err == KErrNone)
 		{
 		err = !(iFlags & EIsRomBitmap) ? Compress() : KErrAccessDenied;
+		FBS_OST_IF(err!=KErrNone, OstTraceExt3( TRACE_ERROR, CFBSBITMAP_LOADANDCOMPRESS2_ERROR, "! this=0x%08x; iFlags=0x%08x; err=%d", (TUint)this, (TUint)iFlags, err);)
 		}
+	FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS2_EXIT, "< this=0x%08x; err=%d", (TUint)this, err);)
 	return err;
 	}
 
@@ -1151,7 +1240,7 @@
 	CBitwiseBitmap* bitmap = CleanAddress();
 	if (bitmap==NULL)
 		{
-			return EFalse;
+		return EFalse;
 		}	
 	return bitmap->IsCompressedInRAM();
 	}
@@ -1250,10 +1339,16 @@
 */
 EXPORT_C void CFbsBitmap::BeginDataAccess() const
 	{
-	if (!iHandle)
-		return;
-	(void)CleanAddress();	//called for side-effect to make sure bitmap reference is current. Should be low overhead.
-	const_cast<CFbsBitmap*>(this)->iUseCount++;
+    FBS_OST_VERBOSE(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_BEGINDATAACCESS_ENTRY, "> this=0x%08x;", (TUint)this););
+	FBS_OST_IF(!iHandle, OstTrace1(TRACE_ERROR, CFBSBITMAP_BEGINDATAACCESS_ERROR, "! this=0x%08x; !iHandle", (TUint)this););
+	
+	if (iHandle)
+	    {
+        (void)CleanAddress();	//called for side-effect to make sure bitmap reference is current. Should be low overhead.
+        const_cast<CFbsBitmap*>(this)->iUseCount++;
+	    }
+    
+	FBS_OST_VERBOSE(OstTraceExt2(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_BEGINDATAACCESS_EXIT, "< this=0x%08x; iUseCount=%d;", (TUint)this, const_cast<CFbsBitmap*>(this)->iUseCount);)
 	}
 
 /** Marks the end of direct access to the bitmap data.
@@ -1271,11 +1366,17 @@
 */
 EXPORT_C void CFbsBitmap::EndDataAccess(TBool aReadOnly) const
 	{
-	if (!iHandle)
-		return;
-	const_cast<CFbsBitmap*>(this)->iUseCount--;
-	if (!aReadOnly && !(iFlags & EIsReadOnlyBitmapMask))
-		User::LockedInc(iAddressPointer->Extra()->iTouchCount);
+    FBS_OST_VERBOSE(OstTraceExt2(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_ENDDATAACCESS_ENTRY, "> this=0x%08x; aReadOnly=%d;", (TUint)this, (TUint)aReadOnly);)
+    FBS_OST_IF(!iHandle, OstTrace1(TRACE_ERROR, CFBSBITMAP_ENDDATAACCESS_ERROR, "! this=0x%08x; !iHandle", (TUint)this););
+    if (iHandle)
+        {
+        const_cast<CFbsBitmap*>(this)->iUseCount--;
+        if (!aReadOnly && !(iFlags & EIsReadOnlyBitmapMask))
+            {
+            User::LockedInc(iAddressPointer->Extra()->iTouchCount);
+            }
+        }
+    FBS_OST_VERBOSE(OstTraceExt2(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_ENDDATAACCESS_EXIT, "< this=0x%08x; iUseCount=%d;", (TUint)this, const_cast<CFbsBitmap*>(this)->iUseCount);)
 	}
 
 /** Locks the global bitmap heap.
@@ -1299,12 +1400,12 @@
 */
 EXPORT_C void CFbsBitmap::LockHeap(TBool /*aAlways*/) const
 	{
+    FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_LOCKHEAP_ENTRY, "> this=0x%08x;", (TUint)this);)
 	BeginDataAccess();
 #ifdef SYMBIAN_DEBUG_FBS_LOCKHEAP
 	//These debug checks now refer to the cleaned data address
-	if (!iHandle)
-		return;
-	if (!(iFlags & EIsRomBitmap)) // can't do anything with ROM bitmaps
+    FBS_OST_IF(!iHandle, OstTrace1(TRACE_ERROR, CFBSBITMAP_LOCKHEAP_ERROR, "! this=0x%08x; !iHandle", (TUint)this););
+	if (iHandle && !(iFlags & EIsRomBitmap)) // can't do anything with ROM bitmaps
 		{
 		TThreadId threadId = RThread().Id();
 		iFbs->iHelper->iDebugMutex.Wait();
@@ -1318,6 +1419,7 @@
 		iFbs->iHelper->iDebugMutex.Signal();
 		}
 #endif
+	FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_LOCKHEAP_EXIT, "< this=0x%08x;", (TUint)this);)
 	}
 
 /** Unlocks the global heap. 
@@ -1332,21 +1434,25 @@
 */
 EXPORT_C void CFbsBitmap::UnlockHeap(TBool /*aAlways*/) const
 	{
+    FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_UNLOCKHEAP_ENTRY, "> this=0x%08x;", (TUint)this);)
+    FBS_OST_IF(!iHandle, OstTrace1(TRACE_ERROR, CFBSBITMAP_UNLOCKHEAP_ERROR, "! this=0x%08x; !iHandle", (TUint)this););
+	if (iHandle)
+	    {
 #ifdef SYMBIAN_DEBUG_FBS_LOCKHEAP
-	if (!iHandle)
-		return;
-	if (!(iFlags & EIsRomBitmap)) // can't do anything with ROM bitmaps
-		{
-		TThreadId threadId = RThread().Id();
-		iFbs->iHelper->iDebugMutex.Wait();
-		__ASSERT_ALWAYS(iAddressPointer->Extra()->iLockCount > 0, Panic(EFbsPanicBadHeapLock));
-		__ASSERT_ALWAYS(iAddressPointer->Extra()->iThreadId == threadId, Panic(EFbsPanicBadHeapLock));
-		if (--iAddressPointer->Extra()->iLockCount == 0)
-			iAddressPointer->Extra()->iThreadId = TThreadId(KNullThreadId);
-		iFbs->iHelper->iDebugMutex.Signal();
-		}
+	    if (!(iFlags & EIsRomBitmap)) // can't do anything with ROM bitmaps
+            {
+            TThreadId threadId = RThread().Id();
+            iFbs->iHelper->iDebugMutex.Wait();
+            __ASSERT_ALWAYS(iAddressPointer->Extra()->iLockCount > 0, Panic(EFbsPanicBadHeapLock));
+            __ASSERT_ALWAYS(iAddressPointer->Extra()->iThreadId == threadId, Panic(EFbsPanicBadHeapLock));
+            if (--iAddressPointer->Extra()->iLockCount == 0)
+                iAddressPointer->Extra()->iThreadId = TThreadId(KNullThreadId);
+            iFbs->iHelper->iDebugMutex.Signal();
+            }
 #endif
-	EndDataAccess();
+	    EndDataAccess();
+	    }
+	FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_UNLOCKHEAP_EXIT, "< this=0x%08x;", (TUint)this);)
 	}
 
 /** Locks the global bitmap heap, leaving on the clean-up stack a pointer
@@ -1362,14 +1468,18 @@
 */
 EXPORT_C void CFbsBitmap::LockHeapLC(TBool /*aAlways*/) const
 	{
-	LockHeap();
+    FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_LOCKHEAPLC_ENTRY, "> this=0x%08x;", (TUint)this);)
+    LockHeap();
 	TCleanupItem cleanitem(CFbsBitmap::UnlockHeap, (TAny*)this);
 	CleanupStack::PushL(cleanitem);
+	FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_LOCKHEAPLC_EXIT, "< this=0x%08x;", (TUint)this);)
 	}
 
 EXPORT_C void CFbsBitmap::UnlockHeap(TAny* aFbsBitmap)
 	{
-	((CFbsBitmap*)aFbsBitmap)->UnlockHeap();
+    FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_UNLOCKHEAP2_ENTRY, "> bitmap=0x%08x;", (TUint)aFbsBitmap);)
+    ((CFbsBitmap*)aFbsBitmap)->UnlockHeap();
+    FBS_OST(OstTrace0(GRAPHICS_CONTROL_FUNCTIONS, CFBSBITMAP_UNLOCKHEAP2_EXIT, "<");)
 	}
 
 /** Tests whether the bitmap is volatile.
@@ -1398,7 +1508,7 @@
 EXPORT_C TInt CFbsBitmap::TouchCount() const
 	{
 	if (!iHandle || (iFlags & EIsReadOnlyBitmapMask))
-			return 0; // A read-only bitmap can never be touched.
+		return 0; // A read-only bitmap can never be touched.
 	return CleanAddress()->Extra()->iTouchCount;
 	}
 
@@ -1723,7 +1833,12 @@
 */	
 EXPORT_C TInt CFbsBitmap::Load(RFile& aFile,TInt32 aId/*=0*/,TBool aShareIfLoaded/*=ETrue*/)
 	{
-	return Load(aFile,aId,aShareIfLoaded,0);
+    FBS_OST(TFullName fileName;)
+    FBS_OST(aFile.FullName(fileName);)
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD3_ENTRY, "> this=0x%08x; file=%S; id=0x%08x; share=%d", (TUint)this, fileName, aId, aShareIfLoaded);)
+	TInt ret = Load(aFile,aId,aShareIfLoaded,0);
+    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD3_EXIT, "< this=0x%08x, ret=%d", (TUint)this, ret);) 
+	return ret;
 	}
 
 /** Loads a specific bitmap from an opened multi-bitmap file handle.
@@ -1739,19 +1854,29 @@
 */	
 EXPORT_C TInt CFbsBitmap::Load(RFile& aFile,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset)
 	{
+    TInt err = KErrNone;
+    FBS_OST(TFullName fileName;)
+    FBS_OST(aFile.FullName(fileName);)
+    FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD4_ENTRY, "> this=0x%08x; file=%S; id=0x%08x; share=%d; off=%d", (TUint)this, fileName, aId, aShareIfLoaded, aFileOffset);)
 	if (!iFbs)
 		{
-		return(KErrCouldNotConnect);
+        FBS_OST(OstTrace1( TRACE_ERROR, CFBSBITMAP_LOAD4_ERROR, "! this=0x%08x; !iFbs", (TUint)this);)
+		err = KErrCouldNotConnect;
 		}
-	Reset();
-	TUint32* rompointer;
-	IsFileInRom(aFile,rompointer);
-	TBool romPointerValid;
-	TInt err = DoLoadFromRom(rompointer, aId, aFileOffset, romPointerValid);
-	if (!romPointerValid)
-		{
-		err = DoLoad(aFile,aId,aShareIfLoaded,aFileOffset);
-		}
+	else
+	    {
+        Reset();
+        TUint32* rompointer;
+        IsFileInRom(aFile,rompointer);
+        TBool romPointerValid;
+        err = DoLoadFromRom(rompointer, aId, aFileOffset, romPointerValid);
+        if (!romPointerValid)
+            {
+            err = DoLoad(aFile,aId,aShareIfLoaded,aFileOffset);
+            FBS_OST_IF(err!=KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_LOAD4_ERROR2, "! this=0x%08x; DoLoad() returned %d", (TUint)this, err);)
+            }
+	    }
+	FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOAD4_EXIT, "< this=0x%08x; err=%d", (TUint)this, err);)
 	return err;
 	}
 
@@ -1769,7 +1894,12 @@
 */	
 EXPORT_C TInt CFbsBitmap::LoadAndCompress(RFile& aFile,TInt32 aId/*=0*/,TBool aShareIfLoaded/*=ETrue*/)
 	{
-	return LoadAndCompress(aFile,aId,aShareIfLoaded,0);
+    FBS_OST(TFullName fileName;)
+    FBS_OST(aFile.FullName(fileName);)
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS3_ENTRY, "> this=0x%08x; file=%S; id=0x%08x; share=%d", (TUint)this, fileName, aId, aShareIfLoaded);)      
+	TInt ret = LoadAndCompress(aFile,aId,aShareIfLoaded,0);
+    FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS3_EXIT, "< this=0x%08x; ret=%d", (TUint)this, ret);)
+    return ret;
 	}
 
 /** Loads and compresses a specific bitmap from an opened multi-bitmap file handle.
@@ -1787,11 +1917,24 @@
 */	
 EXPORT_C TInt CFbsBitmap::LoadAndCompress(RFile& aFile,TInt32 aId,TBool aShareIfLoaded,TUint aFileOffset)
 	{
+    FBS_OST(TFullName fileName;)
+    FBS_OST(aFile.FullName(fileName);)
+    FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS4_ENTRY, "> this=0x%08x; file=%S; id=0x%08x; share=%d", (TUint)this, fileName, aId, aShareIfLoaded);)
 	TInt err = Load(aFile,aId,aShareIfLoaded,aFileOffset);
 	if (err == KErrNone)
 		{
-		err = !(iFlags & EIsRomBitmap) ? Compress() : KErrAccessDenied;
+        if (!(iFlags & EIsRomBitmap))
+            {
+            err = Compress();
+            FBS_OST_IF(err!=KErrNone, OstTraceExt2( TRACE_ERROR, CFBSBITMAP_LOADANDCOMPRESS4_ERROR, "! this=0x%08x; Compress() returned %d", (TUint)this, err);)
+            }
+        else
+            {
+            err = KErrAccessDenied;
+            FBS_OST(OstTraceExt2( TRACE_ERROR, CFBSBITMAP_LOADANDCOMPRESS4_ERROR2, "! this=0x%08x; Cannot compress bitmap in ROM; iFlags=0x%08x", (TUint)this, (TUint)iFlags);)
+            }
 		}
+	FBS_OST(OstTraceExt2( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_LOADANDCOMPRESS4_EXIT, "< this=0x%08x; err=%d", (TUint)this, err);)
 	return err;
 	}
 
@@ -1908,15 +2051,22 @@
 */
 EXPORT_C TInt CFbsBitmap::CreateExtendedBitmap(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aType, const TAny* aData, TInt aDataSize)
 	{
+    TInt err;
+    FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_CREATEEXTENDEDBITMAP_ENTRY, "> this=0x%08x; w=%d; h=%d; dm=%d; type=0x%08x", (TUint)this, aSizeInPixels.iWidth, aSizeInPixels.iHeight, aDispMode, aType.iUid);)
 	if (!aData || aDataSize == 0)
 		{
-		return KErrArgument;
+        FBS_OST(OstTrace1( TRACE_ERROR, CFBSBITMAP_CREATEEXTENDEDBITMAP_ERROR, "! this=0x%08x; (!aData || aDataSize == 0)", (TUint)this);)
+		err = KErrArgument;
 		}
-	TInt err = DoCreate(aSizeInPixels, aDispMode, aType, aDataSize);
-	if (err == KErrNone)
-		{
-		Mem::Copy(iFbs->iLargeBitmapChunk.Base() + iAddressPointer->iDataOffset, aData, aDataSize);
-		}
+	else
+	    {
+        err = DoCreate(aSizeInPixels, aDispMode, aType, aDataSize);
+        if (err == KErrNone)
+            {
+            Mem::Copy(iFbs->iLargeBitmapChunk.Base() + iAddressPointer->iDataOffset, aData, aDataSize);
+            }
+	    }
+	FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_CREATEEXTENDEDBITMAP_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x", (TUint)this, err, iHandle, iServerHandle);)
 	return err;
 	}
 
@@ -1960,19 +2110,26 @@
 */
 EXPORT_C TInt CFbsBitmap::CreateExtendedBitmap(const TSize& aSizeInPixels, TDisplayMode aDispMode, TUid aType, TInt aDataSize, MFbsExtendedBitmapInitializer& aInitializer)
 	{
+    TInt err; 
+    FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_CREATEEXTENDEDBITMAP2_ENTRY, "> this=0x%08x; w=%d; h=%d; dm=%d; type=0x%08x;", (TUint)this, aSizeInPixels.iWidth, aSizeInPixels.iHeight, aDispMode, aType.iUid);)
 	if (aDataSize == 0)
 		{
-		return KErrArgument;
+        FBS_OST(OstTrace1( TRACE_ERROR, CFBSBITMAP_CREATEEXTENDEDBITMAP2_ERROR, "! this=0x%08x; aDataSize == 0", (TUint)this);)
+		err = KErrArgument;
 		}
-	TInt err = DoCreate(aSizeInPixels, aDispMode, aType, aDataSize);
-	if (err == KErrNone)
-		{
-		err = aInitializer.InitExtendedBitmap(iFbs->iLargeBitmapChunk.Base() + iAddressPointer->iDataOffset, aDataSize);
-		if (err != KErrNone)
-			{
-			Reset();
-			}
-		}
+	else
+	    {
+        err = DoCreate(aSizeInPixels, aDispMode, aType, aDataSize);
+        if (err == KErrNone)
+            {
+            err = aInitializer.InitExtendedBitmap(iFbs->iLargeBitmapChunk.Base() + iAddressPointer->iDataOffset, aDataSize);
+            if (err != KErrNone)
+                {
+                Reset();
+                }
+            }
+	    }
+	FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS, CFBSBITMAP_CREATEEXTENDEDBITMAP2_EXIT, "< this=0x%08x; err=%d; iH=0x%08x; iSH=0x%08x", (TUint)this, err, iHandle, iServerHandle);)
 	return err;
 	}
 
--- a/fbs/fontandbitmapserver/sfbs/FBSCLI.CPP	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/sfbs/FBSCLI.CPP	Tue Aug 24 16:17:55 2010 +0100
@@ -21,6 +21,12 @@
 #include "BackGroundCompression.h"
 #include <shapeinfo.h>
 #include <graphics/shaperparams.h>
+#include "OstTraceDefinitions.h"
+#include "fbstrace.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "FBSCLITraces.h"
+#endif
+
 
 /** Helper function for converting a pointer to an offset from the passed
 heap base. Use OffsetToPointer() to convert the returned offset back to a
@@ -210,6 +216,7 @@
 		iIx->Remove(localhandle);
 		iResourceCount--;
 		aMessage.Complete(KErrNone);
+		FBS_OST(OstTraceExt3( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_SERVICEL_INFO, "# Server resource destroyed; iSSH=0x%08x; rc=%d; iH=0x%08x;", iSessionHandle, iResourceCount, localhandle);)
 #ifdef _DEBUG
 		iRet=KErrNone;
 #endif				
@@ -399,6 +406,7 @@
 
 	// success
 	iResourceCount++;
+    FBS_OST(OstTraceExt3( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_HANDLEMESGFONTDUPLICATE_INFO, "# Server font duplicated; iSSH=0x%08x; rc=%d; iH=0x%08x;", iSessionHandle, iResourceCount, localhandle);)
 	return KErrNone;
 	}
 
@@ -488,6 +496,7 @@
 		}
 	// success
 	iResourceCount++;
+	FBS_OST(OstTraceExt3( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_COPYFONTINFOINTORETURNMESSAGE_INFO, "# Server font duplicated; iSSH=0x%08x; rc=%d; iH=0x%08x;", iSessionHandle, iResourceCount, localhandle);)
 	return KErrNone;
 	}
 
@@ -971,6 +980,7 @@
 			bmpptr->Close();
 			break;
 			}
+		
 		bmpSpec.iHandle=localhandle;
 		bmpSpec.iServerHandle = bmpptr->Handle();
 		bmpSpec.iAddressOffset=TInt(bmpptr->Address())-TopLevelStore()->HeapBase();
@@ -982,6 +992,7 @@
 			return;
 			}
 		iResourceCount++;
+		FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO, "# Server bitmap created; iSSH=0x%08x; rc=%d; iH=0x%08x; iSH=0x%08x; bytes=%d;", iSessionHandle, iResourceCount, bmpSpec.iHandle, bmpSpec.iServerHandle, bmpptr->Address()->DataStride() * bmpSpec.iSizeInPixels.iHeight);)		
 		break;
 		}
 
@@ -1089,6 +1100,7 @@
 			return;
 			}
 		iResourceCount++;
+        FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO2, "# Server bitmap loaded; iSSH=0x%08x; rc=%d; iH=0x%08x; iSH=0x%08x; bytes=%d;", iSessionHandle, iResourceCount, handlebuffer().iHandle, handlebuffer().iServerHandle, bmpptr->Address()->DataStride() * bmpptr->Address()->SizeInPixels().iHeight);)
 		break;
 		}
 	case EFbsMessBitmapResize:
@@ -1158,6 +1170,7 @@
 			aMessage.Panic(KFBSERVPanicCategory, ret);
 			return;
 			}
+        FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO4, "# Server bitmap resized; iSSH=0x%08x; iOldH=0x%08x; iNewH=0x%08x; iNewSH=0x%08x; newbytes=%d;", iSessionHandle, localhandle, newlocalhandle, newbmpptr->Handle(), newbmpptr->Address()->DataStride() * newsize.iHeight);)
 		break;
 		}
 	case EFbsMessBitmapDuplicate:
@@ -1192,6 +1205,7 @@
 			return;
 			}
 		iResourceCount++;
+        FBS_OST(OstTraceExt5( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO3, "# Server bitmap duplicated; iSSH=0x%08x; rc=%d; iH=0x%08x; iSH=0x%08x; bytes=%d;", iSessionHandle, iResourceCount, handlebuffer().iHandle, handlebuffer().iServerHandle, bmpptr->Address()->DataStride() * bmpptr->Address()->SizeInPixels().iHeight);)
 		break;
 		}
 	case EFbsMessBitmapCompress:
@@ -1253,6 +1267,7 @@
 			aMessage.Panic(KFBSERVPanicCategory, ret);
 			return;
 			}
+        FBS_OST(OstTraceExt4( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO5, "# Server bitmap compressed; iSSH=0x%08x; iOldH=0x%08x; iNewH=0x%08x; iNewSH=0x%08x;", (TUint)iSessionHandle, localhandle, newlocalhandle, handlebuffer().iServerHandle);)
 		break;
 		}
 	case EFbsMessBitmapBgCompress:
@@ -1320,6 +1335,7 @@
 			aMessage.Panic(KFBSERVPanicCategory, ret);
 			return;
 			}
+		FBS_OST(OstTraceExt3( GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, CFBCLIENT_PROCBITMAPMESSAGE_INFO6, "# Server bitmap cleaned; iSSH=0x%08x; iOldH=0x%08x; iNewH=0x%08x;", iSessionHandle, localhandle, cleanlocalhandle);)
 		break;
 		}
 	case EFbsGetAllBitmapHandles:
--- a/fbs/fontandbitmapserver/sfbs/SESSION.CPP	Fri Aug 06 17:05:55 2010 +0100
+++ b/fbs/fontandbitmapserver/sfbs/SESSION.CPP	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-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"
@@ -20,6 +20,12 @@
 #include "FbsRalc.h"
 #include "fbshelper.h"
 #include "fbsmessage.h"
+#include "OstTraceDefinitions.h"
+#include "fbstrace.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "SESSIONTraces.h"
+#endif
+
 
 GLDEF_C void Panic(TFbsPanic aPanic)
 	{
@@ -90,16 +96,33 @@
 */
 EXPORT_C TInt RFbsSession::Connect(RFs& aFileServer)
 	{
+    TInt ret = KErrNone;
 	RFbsSession* thisptr = (RFbsSession*)Dll::Tls();
+	FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, RFBSSESSION_CONNECT_ENTRY, "> this=0x%08x;", (TUint)thisptr);)
 	if(thisptr)
 		{
 		thisptr->iConnections++;
-		return KErrNone;
+		FBS_OST(OstTraceExt2(GRAPHICS_CONTROL_SEMANTICS, RFBSSESSION_CONNECT_INFO, "# Connected to existing session; this=0x%08x; iConnections=%d;", (TInt)thisptr, thisptr->iConnections);)
 		}
-	TInt ret = RFbsSession::DoAlloc(thisptr);
-	if(ret!=KErrNone)
-		return ret;
-	return thisptr->DoConnect(aFileServer);
+	else
+	    {
+        ret = RFbsSession::DoAlloc(thisptr);
+        if(ret!=KErrNone)
+            {
+            FBS_OST(OstTrace1(TRACE_ERROR, RFBSSESSION_CONNECT_ERROR, "! DoAlloc returned %d", ret);)
+            }
+        else
+            {
+            ret = thisptr->DoConnect(aFileServer);
+            if(ret!=KErrNone)
+                {
+                FBS_OST(OstTraceExt2(TRACE_ERROR, RFBSSESSION_CONNECT_ERROR2, "! this=0x%08x; DoConnect returned %d", (TInt)thisptr, ret);)
+                }
+            }
+	    }
+	
+	FBS_OST(OstTraceExt2(GRAPHICS_CONTROL_FUNCTIONS, RFBSSESSION_CONNECT_EXIT, "< this=0x%08x; ret=%d", (TUint)thisptr, ret);)
+	return ret; 
 	}
 
 /** Creates a session with the Font and Bitmap server.
@@ -110,22 +133,40 @@
 */
 EXPORT_C TInt RFbsSession::Connect()
 	{
+    TInt ret = KErrNone;
 	RFbsSession* thisptr = (RFbsSession*)Dll::Tls();
+	FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, RFBSSESSION_CONNECT2_ENTRY, "> this=0x%08x;", (TUint)thisptr);)
 	if(thisptr)
 		{
 		thisptr->iConnections++;
-		return KErrNone;
+	    FBS_OST(OstTraceExt2(GRAPHICS_CONTROL_SEMANTICS, RFBSSESSION_CONNECT2_INFO, "# Connected to existing session; this=0x%08x; iConnections=%d;", (TInt)thisptr, thisptr->iConnections);)
 		}
-	TInt ret = RFbsSession::DoAlloc(thisptr);
-	if (ret!=KErrNone)
-		return ret;
-	ret = thisptr->iFileServer.Connect();
-	if(ret!=KErrNone)
-		{
-		thisptr->Disconnect();
-		return ret;
-		}
-	return thisptr->DoConnect(thisptr->iFileServer);
+	else
+	    {
+        TInt ret = RFbsSession::DoAlloc(thisptr);
+        if (ret!=KErrNone)
+            {
+            FBS_OST(OstTrace1(TRACE_ERROR, RFBSSESSION_CONNECT2_ERROR, "! DoAlloc returned %d", ret);)
+            goto end;
+            }
+            
+        ret = thisptr->iFileServer.Connect();
+        if(ret!=KErrNone)
+            {
+            thisptr->Disconnect();
+            FBS_OST(OstTraceExt2(TRACE_ERROR, RFBSSESSION_CONNECT2_ERROR2, "! this=0x%08x; RFs::Connect() returned %d", (TInt)thisptr, ret);)
+            goto end;
+            }
+        
+        ret = thisptr->DoConnect(thisptr->iFileServer);
+        if(ret!=KErrNone)
+            {
+            FBS_OST(OstTraceExt2(TRACE_ERROR, RFBSSESSION_CONNECT2_ERROR3, "! this=0x%08x; DoConnect returned %d", (TInt)thisptr, ret);)
+            }
+	    }
+end:
+	FBS_OST(OstTraceExt2(GRAPHICS_CONTROL_FUNCTIONS, RFBSSESSION_CONNECT2_EXIT, "< this=0x%08x; ret=%d", (TUint)thisptr, ret);)
+	return ret;
 	}
 
 /** Closes the session with the Font and Bitmap server. 
@@ -135,35 +176,41 @@
 EXPORT_C void RFbsSession::Disconnect()
 	{
 	RFbsSession* thisptr=(RFbsSession*)Dll::Tls();
-	if(thisptr==NULL) return;
-	if(thisptr->iConnections>0)
-		{
-		thisptr->iCallBack.iPtr=NULL;
-		thisptr->iCallBack.CallBack();
-		// Destructor of CFbsSessionHelper may call SendCommand to cancel an
-		// outstanding request, therefore destruction must be done before
-		// iConnections is 0 to avoid an assertion going off.
-		if(thisptr->iConnections==1)
-			{
-			delete thisptr->iHelper;
-			}
-		thisptr->iConnections--;
-		}
-	if(thisptr->iConnections==0)
-		{
-		thisptr->iSharedChunk.Close();
-		thisptr->iLargeBitmapChunk.Close();
-		// Call close on the iFileServer regardless of whether this session owns it: 
-		// if we don't own it, close will do nothing if there are still open files, 
-		// so always calling close introduces extra safety
-		thisptr->iFileServer.Close();
-		delete thisptr->iRomFileAddrCache; 
-		delete thisptr->iScanLineBuffer;
-		delete thisptr->iDecompressionBuffer;
-		thisptr->Close();
-		delete thisptr;
-		Dll::FreeTls();
-		}
+    FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, RFBSSESSION_DISCONNECT_ENTRY, "> this=0x%08x;", (TUint)thisptr);)
+	if(thisptr)
+	    {
+        TInt tempServerSessionHandle = thisptr->ServerSessionHandle();
+        if(thisptr->iConnections>0)
+            {
+            thisptr->iCallBack.iPtr=NULL;
+            thisptr->iCallBack.CallBack();
+            // Destructor of CFbsSessionHelper may call SendCommand to cancel an
+            // outstanding request, therefore destruction must be done before
+            // iConnections is 0 to avoid an assertion going off.
+            if(thisptr->iConnections==1)
+                {
+                delete thisptr->iHelper;
+                }
+            thisptr->iConnections--;
+            }
+        if(thisptr->iConnections==0)
+            {
+            thisptr->iSharedChunk.Close();
+            thisptr->iLargeBitmapChunk.Close();
+            // Call close on the iFileServer regardless of whether this session owns it: 
+            // if we don't own it, close will do nothing if there are still open files, 
+            // so always calling close introduces extra safety
+            thisptr->iFileServer.Close();
+            delete thisptr->iRomFileAddrCache; 
+            delete thisptr->iScanLineBuffer;
+            delete thisptr->iDecompressionBuffer;
+            thisptr->Close();
+            delete thisptr;
+            Dll::FreeTls();	
+            }
+        FBS_OST(OstTraceExt3(GRAPHICS_CONTROL_SEMANTICS, RFBSSESSION_DISCONNECT_INFO, "# Disconnected from session; this=0x%08x; iConnections=%d; iSSH=0x%08x", (TInt)thisptr, thisptr->iConnections, tempServerSessionHandle);)
+	    }
+	FBS_OST(OstTrace1(GRAPHICS_CONTROL_FUNCTIONS, RFBSSESSION_DISCONNECT_EXIT2, "< this=0x%08x;", (TUint)thisptr);)
 	}
 
 /**  Gets the current Font and Bitmap server session.
@@ -355,11 +402,14 @@
 		return KErrNoMemory;
 		}
 	iHelper->iServerSessionHandle = serverAssignedHandle;
+	
 	ret = iLargeBitmapChunk.OpenGlobal(KFBSERVLargeChunkName,EFalse);
 	if(ret!=KErrNone) 
 		Panic(EFbsPanicChunkError);
 	
 	iSpare = (TUint32*)&aFileServer;
+	
+    FBS_OST(OstTraceExt2(GRAPHICS_CONTROL_SEMANTICS, RFBSSESSION_DOCONNECT_INFO, "# New FBS Session created; this=0x%08x; iSSH=0x%08x;", (TInt)this, serverAssignedHandle);)
 	return KErrNone;
 	}
 	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/sfbs/fbstrace.h	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,39 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+#ifndef FBSTRACE_H_
+#define FBSTRACE_H_
+
+#ifdef  GRAPHICS_TRACE
+#  define FBS_OST(x) GRAPHICS_TRACE(x)
+#  define FBS_OST_IF(arg, x) if(arg){GRAPHICS_TRACE(x)}
+#else
+#  ifdef _DEBUG
+#    define FBS_OST(x) x
+#    define FBS_OST_IF(arg, x) if(arg){FBS_OST(x)}
+#  else
+#    define FBS_OST(x)
+#    define FBS_OST_IF(arg, x)
+#  endif
+#endif
+
+#ifdef FBS_VERBOSE
+#  define FBS_OST_VERBOSE(x) FBS_OST(x)
+#  define FBS_OST_VERBOSE_IF(arg, x) FBS_OST_IF(arg, x)
+#else
+#  define FBS_OST_VERBOSE(x)
+#  define FBS_OST_VERBOSE_IF(arg, x)
+#endif
+
+#endif /* FBSTRACE_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/traces_FBSCLI/OstTraceDefinitions.h	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <OpenSystemTrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/traces_FBSCLI/fixed_id.definitions	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,92 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]GRAPHICS_CONTROL_FUNCTIONS=0x42
+[GROUP]GRAPHICS_CONTROL_SEMANTICS=0x44
+[GROUP]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS=0x40
+[GROUP]TRACE_ERROR=0x41
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_BEGINDATAACCESS_ENTRY=0x1
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_BEGINDATAACCESS_EXIT=0x2
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_ENDDATAACCESS_ENTRY=0x3
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_ENDDATAACCESS_EXIT=0x4
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_LOCKHEAPLC_ENTRY=0xb
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_LOCKHEAPLC_EXIT=0xc
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_LOCKHEAP_ENTRY=0x5
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_LOCKHEAP_EXIT=0x7
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_UNLOCKHEAP2_ENTRY=0xd
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_UNLOCKHEAP2_EXIT=0xe
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_UNLOCKHEAP_ENTRY=0x8
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_UNLOCKHEAP_EXIT=0xa
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_RFBSSESSION_CONNECT2_ENTRY=0x11
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_RFBSSESSION_CONNECT2_EXIT=0x12
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_RFBSSESSION_CONNECT_ENTRY=0xf
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_RFBSSESSION_CONNECT_EXIT=0x10
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_RFBSSESSION_DISCONNECT_ENTRY=0x13
+[TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_RFBSSESSION_DISCONNECT_EXIT2=0x15
+[TRACE]GRAPHICS_CONTROL_SEMANTICS[0x44]_RFBSSESSION_CONNECT2_INFO=0x2
+[TRACE]GRAPHICS_CONTROL_SEMANTICS[0x44]_RFBSSESSION_CONNECT_INFO=0x1
+[TRACE]GRAPHICS_CONTROL_SEMANTICS[0x44]_RFBSSESSION_DISCONNECT_INFO=0x3
+[TRACE]GRAPHICS_CONTROL_SEMANTICS[0x44]_RFBSSESSION_DOCONNECT_INFO=0x4
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_CREATEEXTENDEDBITMAP2_ENTRY=0x1a
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_CREATEEXTENDEDBITMAP2_EXIT=0x1b
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_CREATEEXTENDEDBITMAP_ENTRY=0x18
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_CREATEEXTENDEDBITMAP_EXIT=0x19
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_CREATEHARDWAREBITMAP_ENTRY=0x5
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_CREATEHARDWAREBITMAP_EXIT=0x6
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_CREATE_ENTRY=0x3
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_CREATE_EXIT=0x4
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_DUPLICATE_ENTRY=0x7
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_DUPLICATE_EXIT=0x1c
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOAD2_ENTRY=0xa
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOAD2_EXIT=0xb
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOAD3_ENTRY=0x10
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOAD3_EXIT=0x11
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOAD4_ENTRY=0x12
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOAD4_EXIT=0x13
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOADANDCOMPRESS2_ENTRY=0xe
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOADANDCOMPRESS2_EXIT=0xf
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOADANDCOMPRESS3_ENTRY=0x14
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOADANDCOMPRESS3_EXIT=0x15
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOADANDCOMPRESS4_ENTRY=0x16
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOADANDCOMPRESS4_EXIT=0x17
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOADANDCOMPRESS_ENTRY=0xc
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOADANDCOMPRESS_EXIT=0xd
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOAD_ENTRY=0x8
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_LOAD_EXIT=0x9
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_RESET_ENTRY=0x1
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS[0x40]_CFBSBITMAP_RESET_EXIT=0x2
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_BEGINDATAACCESS_ERROR=0x10
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_CREATEEXTENDEDBITMAP2_ERROR=0x18
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_CREATEEXTENDEDBITMAP_ERROR=0x17
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATEINRAM_ERROR=0x8
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATEINRAM_ERROR2=0x9
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATEINRAM_ERROR3=0xa
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATEINROM_ERROR=0x6
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATEINROM_ERROR2=0x7
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATE_ERROR=0x1
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATE_ERROR2=0x2
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATE_ERROR3=0x5
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATE_ERROR4=0x3
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_DUPLICATE_ERROR5=0x4
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_ENDDATAACCESS_ERROR=0x11
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_LOAD2_ERROR=0xb
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_LOAD2_ERROR2=0xc
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_LOAD2_ERROR3=0xd
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_LOAD2_ERROR4=0xe
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_LOAD4_ERROR=0x14
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_LOAD4_ERROR2=0x15
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_LOADANDCOMPRESS2_ERROR=0xf
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_LOADANDCOMPRESS4_ERROR=0x16
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_LOCKHEAP_ERROR=0x12
+[TRACE]TRACE_ERROR[0x41]_CFBSBITMAP_UNLOCKHEAP_ERROR=0x13
+[TRACE]TRACE_ERROR[0x41]_RFBSSESSION_CONNECT2_ERROR=0x1b
+[TRACE]TRACE_ERROR[0x41]_RFBSSESSION_CONNECT2_ERROR2=0x1c
+[TRACE]TRACE_ERROR[0x41]_RFBSSESSION_CONNECT2_ERROR3=0x1d
+[TRACE]TRACE_ERROR[0x41]_RFBSSESSION_CONNECT_ERROR=0x19
+[TRACE]TRACE_ERROR[0x41]_RFBSSESSION_CONNECT_ERROR2=0x1a
+[[OBSOLETE]][GROUP]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS=0x43
+[[OBSOLETE]][TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_LOCKHEAP_EXIT2=0x6
+[[OBSOLETE]][TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_CFBSBITMAP_UNLOCKHEAP_EXIT2=0x9
+[[OBSOLETE]][TRACE]GRAPHICS_CONTROL_FUNCTIONS[0x42]_RFBSSESSION_DISCONNECT_EXIT=0x14
+[[OBSOLETE]][TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x43]_RFBSSESSION_CONNECT2_INFO=0x2
+[[OBSOLETE]][TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x43]_RFBSSESSION_CONNECT_INFO=0x1
+[[OBSOLETE]][TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x43]_RFBSSESSION_DISCONNECT_INFO=0x3
+[[OBSOLETE]][TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x43]_RFBSSESSION_DOCONNECT_INFO=0x4
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/traces_FBSERV/OstTraceDefinitions.h	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,7 @@
+#ifndef __OSTTRACEDEFINITIONS_H__
+#define __OSTTRACEDEFINITIONS_H__
+// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler
+// REMOVE BEFORE CHECK-IN TO VERSION CONTROL
+//#define OST_TRACE_COMPILER_IN_USE
+#include <OpenSystemTrace.h>
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/traces_FBSERV/fixed_id.definitions	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,11 @@
+#Fixed group and trace id definitions. If this file is removed, the identifiers are rebuilt.
+[GROUP]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS=0x40
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x40]_CFBCLIENT_COPYFONTINFOINTORETURNMESSAGE_INFO=0x3
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x40]_CFBCLIENT_HANDLEMESGFONTDUPLICATE_INFO=0x2
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x40]_CFBCLIENT_PROCBITMAPMESSAGE_INFO=0x4
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x40]_CFBCLIENT_PROCBITMAPMESSAGE_INFO2=0x5
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x40]_CFBCLIENT_PROCBITMAPMESSAGE_INFO3=0x7
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x40]_CFBCLIENT_PROCBITMAPMESSAGE_INFO4=0x6
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x40]_CFBCLIENT_PROCBITMAPMESSAGE_INFO5=0x8
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x40]_CFBCLIENT_PROCBITMAPMESSAGE_INFO6=0x9
+[TRACE]GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS[0x40]_CFBCLIENT_SERVICEL_INFO=0x1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/utils/fbsbitmap_memory.pl	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,318 @@
+#!/usr/local/bin/perl
+#
+# 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:
+#  This script parses trace data produced by OST from FBS, using the the FBSCLI, 
+#  FBSERV and Symbian BTrace Hooks OST dictionaries, to produce a CSV output of
+#  the amount of bitmap memory used per-thread over a user-definable time
+#  granularity, since the start of the trace.
+# 
+#  To use, enable SYMBIAN_KERNEL_THREAD_IDENTIFICATION trace group in Symbian
+#  BTrace Hooks OST dictionary, GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS in FBSERV
+#  OST dictionary, and GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, 
+#  GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS and GRAPHICS_CONTROL_FUNCTIONS in
+#  FBSCLI OST dictionary. Once tracing is gathered, save trace output as ascii 
+#  and run this script against it. The resulting file can then be imported into
+#  a spreadsheet application to be visually processed.
+#  
+#  KNOWN DEFECTS:
+#  Once the log time goes beyond midnight, snapshots will stop being taken.
+#
+
+use strict;
+
+# Sanity checking of the command line parameters...
+if ($#ARGV == -1 || $ARGV[0] eq "help" || $ARGV[0] eq "/?")
+{
+   print "\nusage: $0 filename [-h]\n";
+   print "where\n";
+   print " -h : Specifies the heartbeat in millisecs (default=10000)\n";
+   exit;
+}
+
+
+## Modifiable constants...
+my $CSV_DELIMITER = ',';
+
+# Time after start to take first snapshot, in millisecs
+my $firstHeartBeatTimeMS = 1000;
+
+# Default heartbeat in millisecs if none specified.
+my $heartBeatMS = 10000;
+
+
+##
+## Internal structures...
+##
+my $heartBeatCount = 0;
+my $nextHeartBeatMS = -1;
+
+# A hash of thread names to the amount of bitmap memory they 
+# have used since the start of the trace.
+my %bmpMemoryPerThread = ();
+
+# A hash of bitmaps fully qualified by the session they belong to,
+# and their local handle (because bitmaps can have the same local
+# handle in different threads), mapped to their size in bytes.
+my %bmpMemoryByServerHandle = ();
+
+# Hash of FbsSessions to thread IDs.
+my %SessionThreadMap = ();
+
+# Array of the above hashes, one hash per heartbeat.
+my @arrayOfSnapshots;
+
+# Hashes of thread and process names to IDs.
+my %ThreadNames;
+my %ProcessNames;
+
+
+##
+## Command line options parsing...
+## First arg is assumed to be the filename.
+##
+for my $i (1..$#ARGV)
+{
+   my $cma = $ARGV[$i];
+   if ($cma =~ m/-h(\d*)/)
+   {
+      $heartBeatMS = $1;
+   }
+   else
+   {
+      print "Unrecognised parameter: $cma , ignoring...\n";
+   }
+}
+
+## Read from the file.
+## Read the log into an array line by line.
+my $TRACE_FILENAME = $ARGV[0];
+open(INPUT_FILE, $TRACE_FILENAME) or die $!;
+my @traceLines = <INPUT_FILE>;
+
+
+##
+## Parse each line sequentially...
+##
+foreach my $line (@traceLines)
+{
+   my $timeFromMidnightMS;
+
+   ## 
+   ## If this line is about a new process, make a note of the name and the
+   ## associated process id, so that FbsSessions can be mapped to their 
+   ## thread by name.
+   ##
+   if ($line =~ /^.*Thread:Process name assigned;NThread:(.*);DProcess:(.*);Name:(.*)$/i)
+   {
+      my $threadId  = $1;
+      my $processId = $2;
+      my $processName = $3;
+      $ProcessNames{$processId} = $processName ;
+   }
+
+   ## 
+   ## If this line is about a new process, make a note of the name and the
+   ## associated process id, so that FbsSessions can be mapped to their 
+   ## thread by name when the csv is generated.
+   ##
+   if (($line =~ /^.*Thread:Thread created;NThread:(.*);DProcess:(.*);Name:(.*)$/i) ||
+      ($line =~ /^.*Thread:Thread name assigned;NThread:(.*);DProcess:(.*);Name:(.*)$/i))
+      {
+      my $threadId  = $1;
+      my $processId = $2;
+      my $threadName = $3;
+      my $fullThreadName = $ProcessNames{$processId} . ":" . $threadName;
+      $ThreadNames{$threadId} = $fullThreadName;
+   }
+
+   ##
+   ## Determine timestamp. If this time is beyond the heartbeat, 
+   ## take a snapshot and 
+   ##
+   if ($line =~ /^(\d\d):(\d\d):(\d\d)\.(\d{3})/)
+   {
+      $timeFromMidnightMS = ((($1 * 3600) + ($2 * 60) + $3) * 1000) + $4;
+      # Set up the time for the first snapshot.
+      if ($nextHeartBeatMS == -1) 
+      {
+         $nextHeartBeatMS = $timeFromMidnightMS + $firstHeartBeatTimeMS;
+      }
+   }
+
+   ##
+   ## If heartbeat reached, take snapshot of bmp memory per thread
+   ## and set next heartbeat time.
+   ##
+   while ($timeFromMidnightMS >= $nextHeartBeatMS)
+   {
+      $nextHeartBeatMS += $heartBeatMS;
+      # take a snapshot of the current bitmap memory usage per thread
+      while ((my $thread, my $bmpMemory) = each(%bmpMemoryPerThread))
+      {
+           $arrayOfSnapshots[$heartBeatCount]{$thread} = $bmpMemory;
+      }
+      $heartBeatCount++;
+   }
+
+   ## FBS Client-side traces.
+   if ($line =~ m/\tFBSCLI: /)
+   {
+      ##
+      ## If this line is an FBSCLI trace, and it contains iSSH then
+      ## it gives a chance to map a client thread ID to a session handle.
+      ## 
+      if ( $line =~ m/iSSH=(\w*);.*Thread ID:(.*)$/)
+      {
+         my $ServerSessionHandle = $1;
+         my $thread = $2;
+         if ($thread ne "0x00000000")
+         {
+            $SessionThreadMap{$ServerSessionHandle} = $thread;
+         }
+      }
+   }
+
+   ## 
+   ## FBS Server-side traces.
+   ##
+   if ($line =~ m/\tFBSERV: /)
+   {
+      ## The line must have a s= parameter to be useful - the session server handle.
+      ## Any FBSERV line without this is not considered for parsing.
+      if ($line =~ m/; iSSH=(\w*);/)
+      {
+         my $FbsSessionHandle = $1;
+         my $thread = "Unknown Thread [Session=$FbsSessionHandle]";
+         if (defined($SessionThreadMap{$FbsSessionHandle}))
+         {
+            $thread = $SessionThreadMap{$FbsSessionHandle};
+         }
+         if ($line =~ m/# Server resource destroyed; .*iH=(\w*);/)
+         {
+            my $bmpHandle = $1;
+            my $bmpIdentifier = "$FbsSessionHandle:$bmpHandle";
+            if (defined($bmpMemoryByServerHandle{$bmpIdentifier}))
+            {
+               $bmpMemoryPerThread{$thread} -= $bmpMemoryByServerHandle{$bmpIdentifier};
+               delete $bmpMemoryByServerHandle{$bmpIdentifier};
+            }
+         }
+         if ($line =~ m/# Server bitmap resized; .*iOldH=(\w*); iNewH=(\w*); newbytes=(\d*);/)
+         {
+            # When a bitmap is resized, the amount of memory held by the bitmap may change
+            # and the bitmap localhandle will change.
+            my $oldBmpHandle = $1;
+            my $newBmpHandle = $2;
+            my $newBmpBytes = $3;
+            my $oldBmpIdentifier = "$FbsSessionHandle:$oldBmpHandle";
+            my $newBmpIdentifier = "$FbsSessionHandle:$newBmpHandle";
+            if (defined($bmpMemoryByServerHandle{$oldBmpIdentifier}))
+            {
+               $bmpMemoryPerThread{$thread} -= $bmpMemoryByServerHandle{$oldBmpIdentifier};
+               delete $bmpMemoryByServerHandle{$oldBmpIdentifier};
+            }
+            $bmpMemoryPerThread{$thread} += $newBmpBytes;
+            $bmpMemoryByServerHandle{$newBmpIdentifier} = $newBmpBytes;           
+         }
+         elsif ($line =~ m/#.*iOldH=(\w*); iNewH=(\w*);/)
+         {
+            # When a bitmap is compressed, cleaned or resized, the bitmap local handle changes
+            my $oldBmpHandle = $1;
+            my $newBmpHandle = $2;
+            my $oldBmpIdentifier = "$FbsSessionHandle:$oldBmpHandle";
+            my $newBmpIdentifier = "$FbsSessionHandle:$newBmpHandle";
+            if (defined($bmpMemoryByServerHandle{$oldBmpIdentifier}))
+            {
+               my $bytes = $bmpMemoryByServerHandle{$oldBmpIdentifier};
+               delete $bmpMemoryByServerHandle{$oldBmpIdentifier};
+               $bmpMemoryByServerHandle{$newBmpIdentifier} = $bytes;
+            }
+         }
+         elsif ($line =~ m/#.*iH=(\w*);.*bytes=(\d+);/)
+         {
+            # Duplication of a bitmap typically. When a bitmap is duplicated,
+            # the memory is 'owned' by all threads that duplicate it.
+            my $bmpHandle = $1;
+            my $bmpBytes = $2;
+            my $bmpIdentifier = "$FbsSessionHandle:$bmpHandle";
+            $bmpMemoryPerThread{$thread} += $bmpBytes;
+            $bmpMemoryByServerHandle{$bmpIdentifier} = $bmpBytes;
+         }
+      }
+   }
+}
+
+close (INPUT_FILE);
+
+
+##
+## Make a map of unique threads across all snapshots
+## This is so only one occurrence of each thread will appear
+## in the csv file.
+##
+my %uniqueThreads = ();
+for my $i (0..$#arrayOfSnapshots)
+{
+   for my $thread (keys %{$arrayOfSnapshots[$i]})
+   {
+      $uniqueThreads{$thread} = 1;
+   }
+}
+
+##
+## Start writing to file.
+## First row, which contains the heartbeat number column headings...
+##
+my $OUTPUT_FILENAME = sprintf("%s.csv", $TRACE_FILENAME);
+open(OUTPUT_FILE,">$OUTPUT_FILENAME") or die $!;
+print OUTPUT_FILE "Session$CSV_DELIMITER";
+for my $i (0..$heartBeatCount)
+{
+    print OUTPUT_FILE "$i$CSV_DELIMITER";
+}
+
+##
+## For each subsequent row, print the first thread and the
+## memory at each snapshot...
+##
+print OUTPUT_FILE "\n";
+while ((my $thread, my $dummy) = each(%uniqueThreads))
+{
+    # Resolve the thread to its full name...
+    print OUTPUT_FILE "$thread";
+    if (defined($ThreadNames{$thread}) )
+    {
+       my $threadName = $ThreadNames{$thread};
+       print OUTPUT_FILE ":$threadName";
+    }
+    print OUTPUT_FILE "$CSV_DELIMITER";
+
+    # print the memory use per thread, for each snapshot...
+    for my $i (0..$#arrayOfSnapshots)
+    {
+       my %snapshot = %{$arrayOfSnapshots[$i]};
+       while ((my $snapshotThread, my $bmpMemory) = each(%snapshot))
+       {
+           if ($snapshotThread eq $thread) 
+           {
+              print OUTPUT_FILE "$bmpMemory";
+           }
+       }
+       print OUTPUT_FILE "$CSV_DELIMITER";
+    }
+    print OUTPUT_FILE "\n";
+}
+close (OUTPUT_FILE);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/utils/fbsgroup.py	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,76 @@
+# 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:
+# Groups an ASCII TracViewer trace by the contents of a named parameter. 	
+#
+
+import fileinput, string, re, sys, threadname
+
+# Utility function to group a list by a given regular expression.
+# returns a dictionary indexed by parameter 1 of the passed in pattern.
+def groupby(pattern, data):
+	r = {}
+	for entry in data:
+		matched = re.search(pattern, entry)
+		if matched:
+			r.setdefault(matched.group(1), []).append(entry)
+	return r
+
+# Show the usage if the parameters are not as expected
+if len(sys.argv) != 3:
+	print "Usage: fbsgroup <param|-t> <input>"
+	print "Where:"
+	print "<param> is a parameter to group by. (-t groups by thread id)"
+	print "<input> is the ASCII TraceViewer file to be parsed"
+	sys.exit(1)
+
+if sys.argv[1] == "-t":
+	pattern = "(Thread ID:0x.*$)"
+else:
+	pattern = "("+sys.argv[1]+"=*\w*);+"
+	
+del sys.argv[1]
+
+# Add thread names to the raw trace
+rawinput = threadname.addnames(fileinput.input())
+
+# Group by the parameter supplied on the command line...
+results = groupby(pattern, rawinput)
+
+for group, entries in results.items():
+		print '\n'+group
+		
+		# Show a count of the number of CFbsBitmap::xxx function calls
+		functions = groupby("(CFbsBitmap::\S+:)", entries)
+		for name, function in functions.items():
+			print "\t%s %s" % (name, len(function))
+		
+		# Show a count of the number of CFbClient::xxx function calls	
+		functions = groupby("(CFbClient::\S+:)", entries)
+		for name, function in functions.items():
+			print "\t%s %s" % (name, len(function))
+		
+		# Show a count of the number of RFbsSession::xxx function calls	
+		functions = groupby("(RFbsSession::\S+:)", entries)
+		for name, function in functions.items():
+			print "\t%s %s" % (name, len(function))
+		
+		# Show the matching entries for this group
+		for entry in entries:
+			print "\t%s" % entry.strip()
+
+		
+
+		
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/utils/fbsresource_count.pl	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,270 @@
+#!/usr/local/bin/perl
+#
+# 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:
+#  This script parses trace data produced by OST from FBS, using the the FBSCLI, 
+#  FBSERV and Symbian BTrace Hooks OST dictionaries, to produce a CSV output of
+#  the amount of FBS resources used per-thread over a user-definable time
+#  granularity, since the start of the trace.
+# 
+#  To use, enable SYMBIAN_KERNEL_THREAD_IDENTIFICATION trace group in Symbian
+#  BTrace Hooks OST dictionary, GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS in FBSERV
+#  OST dictionary, and GRAPHICS_RESOURCE_MANAGEMENT_SEMANTICS, 
+#  GRAPHICS_RESOURCE_MANAGEMENT_FUNCTIONS and GRAPHICS_CONTROL_FUNCTIONS in
+#  FBSCLI OST dictionary. Once tracing is gathered, save trace output as ascii 
+#  and run this script against it. The resulting file can then be imported into
+#  a spreadsheet application to be visually processed.
+#  
+#  KNOWN DEFECTS:
+#  Once the log time goes beyond midnight, snapshots will stop being taken.
+#
+
+use strict;
+
+# Sanity checking of the command line parameters...
+if ($#ARGV == -1 || $ARGV[0] eq "help" || $ARGV[0] eq "/?")
+{
+   print "\nusage: $0 filename [-h]\n";
+   print "where\n";
+   print " -h : Specifies the heartbeat in millisecs (default=10000)\n";
+   exit;
+}
+
+
+## Modifiable constants...
+my $CSV_DELIMITER = ',';
+
+# Time after start to take first snapshot, in millisecs
+my $firstHeartBeatTimeMS = 1000;
+
+# Default heartbeat in millisecs if none specified.
+my $heartBeatMS = 10000;
+
+
+##
+## Internal structures...
+##
+my $heartBeatCount = 0;
+my $nextHeartBeatMS = -1;
+
+# Hash of FbsSessions to thread IDs.
+my %SessionThreadMap = ();
+
+# A hash of thread names to the fbs resource count.
+my %fbsResourcesPerThread = ();
+
+# Array of the above hashes, one hash per heartbeat.
+my @arrayOfSnapshots;
+
+# Hashes of thread and process names to IDs.
+my %ThreadNames;
+my %ProcessNames;
+
+
+##
+## Command line options parsing...
+## First arg is assumed to be the filename.
+##
+for my $i (1..$#ARGV)
+{
+   my $cma = $ARGV[$i];
+   if ($cma =~ m/-h(\d*)/)
+   {
+      $heartBeatMS = $1;
+   }
+   else
+   {
+      print "Unrecognised parameter: $cma , ignoring...\n";
+   }
+}
+
+## Read from the file.
+## Read the log into an array line by line.
+my $TRACE_FILENAME = $ARGV[0];
+open(INPUT_FILE, $TRACE_FILENAME) or die $!;
+my @traceLines = <INPUT_FILE>;
+
+
+##
+## Parse each line sequentially...
+##
+foreach my $line (@traceLines)
+{
+   my $timeFromMidnightMS;
+
+   ## 
+   ## If this line is about a new process, make a note of the name and the
+   ## associated process id, so that FbsSessions can be mapped to their 
+   ## thread by name.
+   ##
+   if ($line =~ /^.*Thread:Process name assigned;NThread:(.*);DProcess:(.*);Name:(.*)$/i)
+   {
+      my $threadId  = $1;
+      my $processId = $2;
+      my $processName = $3;
+      $ProcessNames{$processId} = $processName ;
+   }
+
+   ## 
+   ## If this line is about a new process, make a note of the name and the
+   ## associated process id, so that FbsSessions can be mapped to their 
+   ## thread by name when the csv is generated.
+   ##
+   if (($line =~ /^.*Thread:Thread created;NThread:(.*);DProcess:(.*);Name:(.*)$/i) ||
+      ($line =~ /^.*Thread:Thread name assigned;NThread:(.*);DProcess:(.*);Name:(.*)$/i))
+      {
+      my $threadId  = $1;
+      my $processId = $2;
+      my $threadName = $3;
+      my $fullThreadName = $ProcessNames{$processId} . ":" . $threadName;
+      $ThreadNames{$threadId} = $fullThreadName;
+   }
+
+   ##
+   ## Determine timestamp. If this time is beyond the heartbeat, 
+   ## take a snapshot and 
+   ##
+   if ($line =~ /^(\d\d):(\d\d):(\d\d)\.(\d{3})/)
+   {
+      $timeFromMidnightMS = ((($1 * 3600) + ($2 * 60) + $3) * 1000) + $4;
+      # Set up the time for the first snapshot.
+      if ($nextHeartBeatMS == -1) 
+      {
+         $nextHeartBeatMS = $timeFromMidnightMS + $firstHeartBeatTimeMS;
+      }
+   }
+
+   ##
+   ## If heartbeat reached, take snapshot of bmp memory per thread
+   ## and set next heartbeat time.
+   ##
+   while ($timeFromMidnightMS >= $nextHeartBeatMS)
+   {
+      $nextHeartBeatMS += $heartBeatMS;
+      # take a snapshot of the current bitmap memory usage per thread
+      while ((my $thread, my $fbsResourceCount) = each(%fbsResourcesPerThread))
+      {
+           $arrayOfSnapshots[$heartBeatCount]{$thread} = $fbsResourceCount;
+      }
+      $heartBeatCount++;
+   }
+
+   ## FBS Client-side traces.
+   if ($line =~ m/\tFBSCLI: /)
+   {
+      ##
+      ## If this line is an FBSCLI trace, and it contains iSSH then
+      ## it gives a chance to map a client thread ID to a session handle.
+      ## 
+      if ( $line =~ m/iSSH=(\w*);.*Thread ID:(.*)$/)
+      {
+         my $ServerSessionHandle = $1;
+         my $thread = $2;
+         if ($thread ne "0x00000000")
+         {
+            $SessionThreadMap{$ServerSessionHandle} = $thread;
+         }
+      }
+   }
+
+   ## 
+   ## FBS Server-side traces.
+   ##
+   if ($line =~ m/\tFBSERV: /)
+   {
+      ## The line must have a s= parameter to be useful - the session server handle.
+      ## Any FBSERV line without this is not considered for parsing.
+      if ($line =~ m/; iSSH=(\w*);/)
+      {
+         my $FbsSessionHandle = $1;
+         my $thread = "Unknown Thread [Session=$FbsSessionHandle]";
+         if (defined($SessionThreadMap{$FbsSessionHandle}))
+         {
+            $thread = $SessionThreadMap{$FbsSessionHandle};
+         }
+         if ($line =~ m/; rc=(\d+);/)
+         {
+            my $resourceCount = $1;
+            if ($resourceCount == 0)
+            { 
+               $resourceCount = '';
+            }
+            $fbsResourcesPerThread{$thread} = $resourceCount;
+         }
+      }
+   }
+}
+
+close (INPUT_FILE);
+
+
+##
+## Make a map of unique threads across all snapshots
+## This is so only one occurrence of each thread will appear
+## in the csv file.
+##
+my %uniqueThreads = ();
+for my $i (0..$#arrayOfSnapshots)
+{
+   for my $thread (keys %{$arrayOfSnapshots[$i]})
+   {
+      $uniqueThreads{$thread} = 1;
+   }
+}
+
+##
+## Start writing to file.
+## First row, which contains the heartbeat number column headings...
+##
+my $OUTPUT_FILENAME = sprintf("%s.csv", $TRACE_FILENAME);
+open(OUTPUT_FILE,">$OUTPUT_FILENAME") or die $!;
+print OUTPUT_FILE "Session$CSV_DELIMITER";
+for my $i (0..$heartBeatCount)
+{
+    print OUTPUT_FILE "$i$CSV_DELIMITER";
+}
+
+##
+## For each subsequent row, print the first thread and the
+## memory at each snapshot...
+##
+print OUTPUT_FILE "\n";
+while ((my $thread, my $dummy) = each(%uniqueThreads))
+{
+    # Resolve the thread to its full name...
+    print OUTPUT_FILE "$thread";
+    if (defined($ThreadNames{$thread}) )
+    {
+       my $threadName = $ThreadNames{$thread};
+       print OUTPUT_FILE ":$threadName";
+    }
+    print OUTPUT_FILE "$CSV_DELIMITER";
+
+    # print the memory use per thread, for each snapshot...
+    for my $i (0..$#arrayOfSnapshots)
+    {
+       my %snapshot = %{$arrayOfSnapshots[$i]};
+       while ((my $snapshotThread, my $fbsResourceCount) = each(%snapshot))
+       {
+           if ($snapshotThread eq $thread) 
+           {
+              print OUTPUT_FILE "$fbsResourceCount";
+           }
+       }
+       print OUTPUT_FILE "$CSV_DELIMITER";
+    }
+    print OUTPUT_FILE "\n";
+}
+close (OUTPUT_FILE);
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fbs/fontandbitmapserver/utils/threadname.py	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,76 @@
+# 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:
+# Utility function to append thread names where the Thread Id maps to a known thread/process name.
+
+import re
+
+# Takes as input list <data> which contains OST traces from the SYMBIAN_KERNEL_THREAD_IDENTIFICATION trace group in Symbian
+# BTrace Hooks OST dictionary. Returns a list with the same content as <data> with thread names appended.
+def addnames(data):
+	result = []
+	processNames = {}
+	threadNames = {}
+	rthreadIds = {}
+	
+	for line in data:		
+		pattern = "^.*Thread:Process name assigned;NThread:(.*);DProcess:(.*);Name:(.*)$"
+		matched = re.search(pattern, line)
+		if matched:
+			processNames[matched.group(2)] = matched.group(3)	
+			
+		pattern = "^.*Thread:Thread created;NThread:(.*);DProcess:(.*);Name:(.*)$"
+		matched = re.search(pattern, line)
+		if matched:
+			threadNames[matched.group(1)] = processNames[matched.group(2)]+":"+matched.group(3)
+		
+		pattern = "^.*Thread:Thread name assigned;NThread:(.*);DProcess:(.*);Name:(.*)$"
+		matched = re.search(pattern, line)
+		if matched:
+			threadNames[matched.group(1)] = processNames[matched.group(2)]+":"+matched.group(3)
+
+		pattern = "^.*Thread:Thread ID assigned;NThread:(.*);DProcess:(.*);RThread ID:(\d*)$"
+		matched = re.search(pattern, line)
+		if matched:
+			rthreadIds[matched.group(3)] = matched.group(1)
+			
+		pattern = "(^.*Thread ID:)(\w*)(.*)$"
+		matched = re.search(pattern, line)
+		if matched:
+			threadId = matched.group(2)
+			if threadNames.has_key(threadId):
+				line = matched.group(1)+threadId+":"+threadNames[threadId]+matched.group(3)
+	
+		pattern = "(^.*clientThreadId )(\w*)(.*)$"
+		matched = re.search(pattern, line)
+		if matched:
+			rthreadIdHex = matched.group(2)
+			rthreadId = hex(rthreadIdHex)
+			if rthreadIds.has_key(rthreadId):
+				threadId = rthreadIds[rthreadId]
+				threadName = threadNames[threadId]
+				line = matched.group(1)+rthreadId+":"+threadName+matched.group(3)
+				
+		pattern = "(^.*threadId )(\w*)(.*)$"
+		matched = re.search(pattern, line)
+		if matched:
+			rthreadIdHex = matched.group(2)
+			rthreadId = hex(rthreadIdHex)
+			if rthreadIds.has_key(rthreadId):
+				threadId = rthreadIds[rthreadId]
+				threadName = threadNames[threadId]
+				line = matched.group(1)+rthreadId+":"+threadName+matched.group(3)
+				
+		result.append(line)
+				
+	return result
\ No newline at end of file
--- a/graphicstest/graphicstestharness/automation/h4/roms.tb92.txt	Fri Aug 06 17:05:55 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h4/roms.tb92.txt	Tue Aug 24 16:17:55 2010 +0100
@@ -7,6 +7,7 @@
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby openvgtest.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics3_armv5_dpdef','Graphics Test ROM (3) - OpenVG DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_03.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby supplieropenvgtest.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics3a_armv5_dpdef','Graphics Test ROM (3a) - OpenVG tests requiring USB/Memory Card support DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_03a.txt' ,'')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec wserv.oby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics4_armv5_dpdef','Graphics Test ROM (4) - WServ DP Default','\epoc32\data\z\system\data\ws_test.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04.txt','')
+RomAndAutoRom('armv5','h4hrp pagedrom techview platsec wserv.oby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics4yshifting_armv5_dpdef','Graphics Test ROM (YShifting) - Linear reduction of YOffset DP Default','\epoc32\data\z\system\data\wsini_pointershift.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04a.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec wserv.oby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics4ct_armv5_dpdef','Graphics Test ROM (4ct) - WServ Change Tracking DP Default','\epoc32\data\z\system\data\ws_test_changetracking.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04ct.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby te_uibench.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_graphics5a_armv5_dpdef','Graphics Test ROM (5a) - UIBench DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_05a.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby internaltestfonts.iby te_outlineshadow.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','h4hrp_graphics5b_armv5_dpdef','Graphics Test ROM (5b) - UIBench - Outline Shadow DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_05b.txt','')
--- a/graphicstest/graphicstestharness/automation/h4/roms.wdp.tb92.txt	Fri Aug 06 17:05:55 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h4/roms.wdp.tb92.txt	Tue Aug 24 16:17:55 2010 +0100
@@ -7,6 +7,7 @@
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby openvgtest.iby dptestcons.oby','-DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -D_SSMSTARTUPMODE=5 -DWITH_FLEXIBLE_MM -D_INTERNAL_MMC -DUSE_DATA_PAGING','h4hrp_graphics3_armv5_wdp','Graphics Test ROM (3) - OpenVG WDP','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_03.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby supplieropenvgtest.iby dptestcons.oby','-DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -D_SSMSTARTUPMODE=5 -DWITH_FLEXIBLE_MM -D_INTERNAL_MMC -DUSE_DATA_PAGING','h4hrp_graphics3a_armv5_wdp','Graphics Test ROM (3a) - OpenVG tests requiring USB/Memory Card support WDP','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_03a.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec wserv.oby dptestcons.oby','-DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -D_SSMSTARTUPMODE=5 -DWITH_FLEXIBLE_MM -D_INTERNAL_MMC -DUSE_DATA_PAGING','h4hrp_graphics4_armv5_wdp','Graphics Test ROM (4) - WServ WDP','\epoc32\data\z\system\data\ws_test.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04.txt','')
+RomAndAutoRom('armv5','h4hrp pagedrom techview platsec wserv.oby dptestcons.oby','-DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -D_SSMSTARTUPMODE=5 -DWITH_FLEXIBLE_MM -D_INTERNAL_MMC -DUSE_DATA_PAGING','h4hrp_graphics4yshifting_armv5_wdp','Graphics Test ROM (YShifting) - Linear reduction of YOffset WDP','\epoc32\data\z\system\data\wsini_pointershift.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04a.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec wserv.oby dptestcons.oby','-DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -D_SSMSTARTUPMODE=5 -DWITH_FLEXIBLE_MM -D_INTERNAL_MMC -DUSE_DATA_PAGING','h4hrp_graphics4ct_armv5_wdp','Graphics Test ROM (4ct) - WServ Change Tracking WDP','\epoc32\data\z\system\data\ws_test_changetracking.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_04ct.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby te_uibench.iby internaltestfonts.iby dptestcons.oby','-DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>" -D_SSMSTARTUPMODE=5 -DWITH_FLEXIBLE_MM -D_INTERNAL_MMC -DUSE_DATA_PAGING','h4hrp_graphics5a_armv5_wdp','Graphics Test ROM (5a) - UIBench WDP','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_05a.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby internaltestfonts.iby te_outlineshadow.iby dptestcons.oby','-DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE -D_SSMSTARTUPMODE=5 -DWITH_FLEXIBLE_MM -D_INTERNAL_MMC -DUSE_DATA_PAGING','h4hrp_graphics5b_armv5_wdp','Graphics Test ROM (5b) - UIBench - Outline Shadow WDP','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_05b.txt','')
--- a/graphicstest/graphicstestharness/automation/h4/runroms.tb92.cmd	Fri Aug 06 17:05:55 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h4/runroms.tb92.cmd	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 rem All rights reserved.
 rem This component and the accompanying materials are made available
 rem under the terms of "Eclipse Public License v1.0"
@@ -22,6 +22,7 @@
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics3_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics3a_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 3600 --sendFiles "stress_tests,stress_tests;functional_tests,functional_tests" --retrieveFiles "functional_results_copy/test_results,functional_results/test_results;functional_tests,functional_results/functional_tests;stress_results_copy/test_results,stress_results/test_results"
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics4_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
+call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics4yshifting_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics4ct_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics5a_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics5b_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
--- a/graphicstest/graphicstestharness/automation/h4/runroms.wdp.tb92.cmd	Fri Aug 06 17:05:55 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h4/runroms.wdp.tb92.cmd	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 rem All rights reserved.
 rem This component and the accompanying materials are made available
 rem under the terms of "Eclipse Public License v1.0"
@@ -22,6 +22,7 @@
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics3_armv5_wdp_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics3a_armv5_wdp_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 3600 --sendFiles "stress_tests,stress_tests;functional_tests,functional_tests" --retrieveFiles "functional_results_copy/test_results,functional_results/test_results;functional_tests,functional_results/functional_tests;stress_results_copy/test_results,stress_results/test_results"
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics4_armv5_wdp_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400 --timeout 240
+call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics4yshifting_armv5_wdp_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400 --timeout 240
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics4ct_armv5_wdp_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400 --timeout 240
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics5a_armv5_wdp_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/h4hrp_graphics5b_armv5_wdp_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/graphicstestharness/automation/h4/tests_04a.txt	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,21 @@
+# tests_04a.txt
+# 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: Used for YOffset tests 
+
+#
+# program,log,commdb,script,timeout,release,pre cmd,post cmd
+
+# Wserv
+TESTEXECUTE, \logs\testexecute\wstest_t_pointershifttest_nga.htm,	, z:\wstest\wstest_t_pointershifttest_nga.script,       600
+# program,log,commdb,script,timeout,release,pre cmd,post cmd
--- a/graphicstest/graphicstestharness/automation/h6/roms.tb92.txt	Fri Aug 06 17:05:55 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h6/roms.tb92.txt	Tue Aug 24 16:17:55 2010 +0100
@@ -7,6 +7,7 @@
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby openvgtest.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','34xx_sdp_graphics3_armv5_dpdef','Graphics Test ROM (3) - OpenVG DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_03.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby supplieropenvgtest.iby graphics_screencomparison.iby graphics_imagecomparison.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','34xx_sdp_graphics3a_armv5_dpdef','Graphics Test ROM (3a) - OpenVG tests requiring USB/Memory Card support DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_03a.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec wserv.oby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','34xx_sdp_graphics4_armv5_dpdef','Graphics Test ROM (4) - WServ DP Default','\epoc32\data\z\system\data\ws_test.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_04.txt','')
+RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec wserv.oby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','34xx_sdp_graphics4yshifting_armv5_dpdef','Graphics Test ROM (YShifting) - Linear reduction of YOffset DP Default','\epoc32\data\z\system\data\wsini_pointershift.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_04a.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec wserv.oby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','34xx_sdp_graphics4ct_armv5_dpdef','Graphics Test ROM (4ct) - WServ Change Tracking DP Default','\epoc32\data\z\system\data\wservu_om_h6_changetracking.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_04ct.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby te_uibench.iby internaltestfonts.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','34xx_sdp_graphics5a_armv5_dpdef','Graphics Test ROM (5a) - UIBench DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_05a.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby internaltestfonts.iby te_outlineshadow.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','34xx_sdp_graphics5b_armv5_dpdef','Graphics Test ROM (5b) - UIBench - Outline Shadow DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_05b.txt','')
--- a/graphicstest/graphicstestharness/automation/h6/runroms.tb92.cmd	Fri Aug 06 17:05:55 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h6/runroms.tb92.cmd	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 rem All rights reserved.
 rem This component and the accompanying materials are made available
 rem under the terms of "Eclipse Public License v1.0"
@@ -22,6 +22,7 @@
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/34xx_sdp_graphics3_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/34xx_sdp_graphics3a_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 3600 --sendFiles "stress_tests,stress_tests;functional_tests,functional_tests" --retrieveFiles "functional_results_copy/test_results,functional_results/test_results;functional_tests,functional_results/functional_tests;stress_results_copy/test_results,stress_results/test_results"
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/34xx_sdp_graphics4_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 3600
+call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/34xx_sdp_graphics4yshifting_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 3600
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/34xx_sdp_graphics4ct_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 3600
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/34xx_sdp_graphics5a_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/34xx_sdp_graphics5b_armv5_dpdef_auto" --nandLoader %1 --resource %2 --jobId %3 --listenTimeout 2400
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/graphicstestharness/automation/h6/tests_04a.txt	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,21 @@
+# tests_04a.txt
+# Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+# 
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# 
+# Contributors:
+# 
+# Description:Used for YOffset tests
+
+#
+# program,log,commdb,script,timeout,release,pre cmd,post cmd
+
+# Wserv
+TESTEXECUTE, \logs\testexecute\wstest_t_pointershifttest_nga.htm,	, z:\wstest\wstest_t_pointershifttest_nga.script,       600
+# program,log,commdb,script,timeout,release,pre cmd,post cmd
\ No newline at end of file
--- a/graphicstest/graphicstestharness/automation/ne1/roms.tb92.txt	Fri Aug 06 17:05:55 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/ne1/roms.tb92.txt	Tue Aug 24 16:17:55 2010 +0100
@@ -5,6 +5,7 @@
 RomAndAutoRom('armv5','naviengine techview platsec graphics_test2.iby internaltestfonts.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','naviengine_graphics2_armv5','Graphics Test ROM (2)','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_02.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec graphics_testharness.iby openvgtest.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','naviengine_graphics3_armv5','Graphics Test ROM (3) - OpenVG','\epoc32\data\z\graphics\wsini_integ_norotation.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_03.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec wserv.oby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','naviengine_graphics4_armv5','Graphics Test ROM (4) - WServ','\epoc32\data\z\system\data\ws_test_singlescreen.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_04.txt','')
+RomAndAutoRom('armv5','naviengine techview platsec wserv.oby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','naviengine_graphics4yshifting_armv5','Graphics Test ROM (YShifting) - Linear reduction of YOffset','\epoc32\data\z\system\data\wsini_pointershift.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_04a.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec wserv.oby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','naviengine_graphics4ct_armv5','Graphics Test ROM (4ct) - WServ Change Tracking','\epoc32\data\z\system\data\wservu_om_singlescreen_changetracking.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_04ct.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec graphics_testharness.iby te_uibench.iby internaltestfonts.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','naviengine_graphics5a_armv5','Graphics Test ROM (5a) - UIBench','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_05a.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec graphics_testharness.iby internaltestfonts.iby te_outlineshadow.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','naviengine_graphics5b_armv5','Graphics Test ROM (5b) - UIBench - Outline Shadow','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_05b.txt','')
--- a/graphicstest/graphicstestharness/automation/ne1/runroms.tb92.cmd	Fri Aug 06 17:05:55 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/ne1/runroms.tb92.cmd	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
 rem All rights reserved.
 rem This component and the accompanying materials are made available
 rem under the terms of "Eclipse Public License v1.0"
@@ -20,6 +20,7 @@
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/naviengine_graphics2_armv5_auto" --nandLoader %1 --resource %2 --jobId %3 --timeout 120 --listenTimeout 2400 --transferMode serial
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/naviengine_graphics3_armv5_auto" --nandLoader %1 --resource %2 --jobId %3 --timeout 60 --listenTimeout 2400 --transferMode serial
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/naviengine_graphics4_armv5_auto" --nandLoader %1 --resource %2 --jobId %3 --timeout 120 --listenTimeout 2400 --transferMode serial
+call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/naviengine_graphics4yshifting_auto" --nandLoader %1 --resource %2 --jobId %3 --timeout 120 --listenTimeout 2400 --transferMode serial
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/naviengine_graphics4ct_armv5_auto" --nandLoader %1 --resource %2 --jobId %3 --timeout 120 --listenTimeout 2400 --transferMode serial
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/naviengine_graphics5a_armv5_auto" --nandLoader %1 --resource %2 --jobId %3 --timeout 240 --listenTimeout 2400 --transferMode serial
 call ec-perl w:\scripts\rom\runrom.pl --romDirectory "roms/naviengine_graphics5b_armv5_auto" --nandLoader %1 --resource %2 --jobId %3 --timeout 60 --listenTimeout 2400 --transferMode serial
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicstest/graphicstestharness/automation/ne1/tests_04a.txt	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,20 @@
+# tests_04a.txt
+# Copyright (c) 1995-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: Used for YOffset tests
+#
+# program,log,commdb,script,timeout,release,pre cmd,post cmd
+
+# Wserv
+TESTEXECUTE, \logs\testexecute\wstest_t_pointershifttest_nga.htm,	, z:\wstest\wstest_t_pointershifttest_nga.script,       600
+# program,log,commdb,script,timeout,release,pre cmd,post cmd
\ No newline at end of file
--- a/graphicstest/graphicstestharness/automation/winscw/tests.tb92.txt	Fri Aug 06 17:05:55 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/winscw/tests.tb92.txt	Tue Aug 24 16:17:55 2010 +0100
@@ -225,6 +225,9 @@
 TESTEXECUTE, C:\logs\testexecute\graphics-wserv-screenconstruct-scrmodes.htm,			, z:\wstest\screenconstruct\graphics-wserv-screenconstruct-scrmodes.script, 300,  , z\wstest\screenconstruct\tscreenconstruct.bat install scrmodes, z\wstest\screenconstruct\tscreenconstruct.bat uninstall
 TESTEXECUTE, C:\logs\testexecute\wservstresstest.htm,		, z:\wstest\wservstresstest.script, 4200
 
+# DevCR SIMR-7TBHYR tests and defect fix ou1cimx1#435306 Gradual reduction of Yoffset in wserv for better UI experinece
+TESTEXECUTE, C:\logs\testexecute\wstest_t_pointershifttest_nga.htm, , z:\wstest\wstest_t_pointershifttest_nga.script, 8000, ,z\wstest\wspointershifttest_run.bat install, z\wstest\wspointershifttest_run.bat uninstall
+
 # PREQ2102 tests
 TESTEXECUTE, C:\logs\testexecute\tdisplayconfiguration.htm, 	, z:\commonheadertest\tdisplayconfiguration.script, 600
 
--- a/windowing/windowserver/SERVER/openwfc/panics.h	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/SERVER/openwfc/panics.h	Tue Aug 24 16:17:55 2010 +0100
@@ -160,7 +160,7 @@
 	EWsPanicUnexpectedBitmapHandleInArray = 125,     //Bitmap handle in array with no matching bitmap object in bitmap ref array
 	EWsPanicBitmapNotFound = 126,           //Failed to find a bitmap in the bitmap ref array
 	EWsPanicInvalidRotation = 127,			//Invalid rotation used
-	EWsPanicInvalidPointerOffset = 128,      //The pointer offset value in wsini.ini is invalid.
+	EWsPanicInvalidPointerOffset = 128,//NOT USED	//The pointer offset value in wsini.ini is invalid.
 	EWsPanicArrayInsertFailed = 129,	//Array insert failed.           
 	EWsPanicCompleteNullMessage = 130,		//RMessage2 is NULL prior to calling Complete().
 	};
--- a/windowing/windowserver/group/openwfc/BLD.INF	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/group/openwfc/BLD.INF	Tue Aug 24 16:17:55 2010 +0100
@@ -382,6 +382,7 @@
 ../../test/scripts/wspointershifttest_run.bat				z:/wstest/wspointershifttest_run.bat
 ../../test/scripts/epoc_pointershift.ini					z:/wstest/epoc_pointershift.ini
 ../../group/wsini_pointershift_wins.ini					z:/wstest/wsini_pointershift_wins.ini
+../../group/wsini_pointershift.ini				/epoc32/data/z/system/data/wsini_pointershift.ini
 
 #endif // SYMBIAN_BUILD_GCE
 
Binary file windowing/windowserver/group/wsini_pointershift.ini has changed
Binary file windowing/windowserver/group/wsini_pointershift_wins.ini has changed
--- a/windowing/windowserver/inc/Graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/inc/Graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H	Tue Aug 24 16:17:55 2010 +0100
@@ -849,7 +849,11 @@
 		EAlphaChannelTransparencyEnabled,
 		/** True if a clipping rect should be applied when drawing a standard text cursor, false otherwise.
 		The default value is false. */
-		ECursorClipRectSet
+		ECursorClipRectSet,
+		/** Implicitly defaults to true. Will remain true as long as the application's primary screendevice 
+		is in the same orientation as the device. This information is only given for top-windows, 
+		i.e. children of group-windows, and only when wsini.ini is configured with SIZE_MODE > 0. */
+		EScreenDeviceValid
 		};
 	/**
 	 This enum encapsulates the set of non-boolean attribute changes that can be observed
--- a/windowing/windowserver/nga/CLIENT/RGC.CPP	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/nga/CLIENT/RGC.CPP	Tue Aug 24 16:17:55 2010 +0100
@@ -1420,6 +1420,7 @@
 	{
 	iPimpl->WriteAnyPendingStateChanges();
 	TWsGcCmdDrawText printText(aPos,aBuf.Length());
+    __ASSERT_ALWAYS(((aBuf.Size()+sizeof(printText))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected));    
 	WriteTextCommand(&printText,sizeof(printText),aBuf,EWsGcOpDrawText,EWsGcOpDrawTextPtr);
 	}
 
@@ -1452,17 +1453,20 @@
 		if (aHoriz==ELeft && aLeftMrg==0)
 			{
 			TWsGcCmdBoxTextOptimised1 boxTextOpt1(aBox,aBaselineOffset,aBuf.Length());
+			__ASSERT_ALWAYS(((aBuf.Size()+sizeof(boxTextOpt1))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 			Write(&boxTextOpt1,sizeof(boxTextOpt1),aBuf.Ptr(),aBuf.Size(),EWsGcOpDrawBoxTextOptimised1);
 			}
 		else
 			{
 			TWsGcCmdBoxTextOptimised2 boxTextOpt2(aBox,aBaselineOffset,aHoriz,aLeftMrg,aBuf.Length());
+			__ASSERT_ALWAYS(((aBuf.Size()+sizeof(boxTextOpt2))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 			Write(&boxTextOpt2,sizeof(boxTextOpt2),aBuf.Ptr(),aBuf.Size(),EWsGcOpDrawBoxTextOptimised2);
 			}
 		}
 	else
 		{
 		TWsGcCmdBoxText boxText(aBox,aBaselineOffset,aHoriz,aLeftMrg,aBuf.Length(),iPimpl->iFont->TextWidthInPixels(aBuf));
+		__ASSERT_ALWAYS(((aBuf.Size()+sizeof(boxText))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 		WriteTextCommand(&boxText,sizeof(boxText),aBuf,EWsGcOpDrawBoxText,EWsGcOpDrawBoxTextPtr);
 		}
 	}
@@ -1471,6 +1475,7 @@
 	{
 	iPimpl->WriteAnyPendingStateChanges();
 	TWsGcCmdDrawTextInContext printTextInContext(aPos,aBuf.Length(),aParam->iStart,aParam->iEnd);
+	__ASSERT_ALWAYS(((aBuf.Size()+sizeof(printTextInContext))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 	WriteTextCommand(&printTextInContext,sizeof(printTextInContext),aBuf,EWsGcOpDrawTextInContext,EWsGcOpDrawTextInContextPtr);
 	return KErrNone;
 	}
@@ -1483,17 +1488,20 @@
 		if (aHoriz==ELeft && aLeftMrg==0)
 			{
 			TWsGcCmdBoxTextInContextOptimised1 boxTextOpt1(aBox,aBaselineOffset,aBuf.Length(),aParam->iStart,aParam->iEnd);
+			__ASSERT_ALWAYS(((aBuf.Size()+sizeof(boxTextOpt1))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 			Write(&boxTextOpt1,sizeof(boxTextOpt1),aBuf.Ptr(),aBuf.Size(),EWsGcOpDrawBoxTextInContextOptimised1);
 			}
 		else
 			{
 			TWsGcCmdBoxTextInContextOptimised2 boxTextOpt2(aBox,aBaselineOffset,aHoriz,aLeftMrg,aBuf.Length(),aParam->iStart,aParam->iEnd);
+			__ASSERT_ALWAYS(((aBuf.Size()+sizeof(boxTextOpt2))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 			Write(&boxTextOpt2,sizeof(boxTextOpt2),aBuf.Ptr(),aBuf.Size(),EWsGcOpDrawBoxTextInContextOptimised2);
 			}
 		}
 	else
 		{
 		TWsGcCmdBoxTextInContext boxText(aBox,aBaselineOffset,aHoriz,aLeftMrg,aBuf.Length(),iPimpl->iFont->TextWidthInPixels(aBuf),aParam->iStart,aParam->iEnd);
+		__ASSERT_ALWAYS(((aBuf.Size()+sizeof(boxText))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 		WriteTextCommand(&boxText,sizeof(boxText),aBuf,EWsGcOpDrawBoxTextInContext,EWsGcOpDrawBoxTextInContextPtr);
 		}
 	return KErrNone;
@@ -1509,6 +1517,7 @@
 	{
 	iPimpl->WriteAnyPendingStateChanges();
 	TWsGcCmdDrawTextVertical printText(aPos,aText.Length(),aUp);
+	__ASSERT_ALWAYS(((aText.Size()+sizeof(printText))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 	WriteTextCommand(&printText,sizeof(printText),aText,EWsGcOpDrawTextVertical,EWsGcOpDrawTextVerticalPtr);
 	}
 
@@ -1535,6 +1544,7 @@
 	boxText.margin=aMargin;
 	boxText.length=aText.Length();
 	boxText.width=iPimpl->iFont->TextWidthInPixels(aText);
+	__ASSERT_ALWAYS(((aText.Size()+sizeof(boxText))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 	WriteTextCommand(&boxText,sizeof(boxText),aText,EWsGcOpDrawBoxTextVertical,EWsGcOpDrawBoxTextVerticalPtr);
 	}
 
@@ -1542,6 +1552,7 @@
 	{
 	iPimpl->WriteAnyPendingStateChanges();
 	TWsGcCmdDrawTextInContextVertical printText(aPos,aText.Length(),aUp,aParam->iStart,aParam->iEnd);
+	__ASSERT_ALWAYS(((aText.Size()+sizeof(printText))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 	WriteTextCommand(&printText,sizeof(printText),aText,EWsGcOpDrawTextInContextVertical,EWsGcOpDrawTextInContextVerticalPtr);
 	return KErrNone;
 	}
@@ -1558,6 +1569,7 @@
 	boxText.width=iPimpl->iFont->TextWidthInPixels(aText);
 	boxText.start = aParam->iStart;
 	boxText.end = aParam->iEnd;
+	__ASSERT_ALWAYS(((aText.Size()+sizeof(boxText))<=EClientBufferMaxSize),Panic(EW32PanicSizeNotExpected)); 
 	WriteTextCommand(&boxText,sizeof(boxText),aText,EWsGcOpDrawBoxTextInContextVertical,EWsGcOpDrawBoxTextInContextVerticalPtr);
 	return KErrNone;
 	}
--- a/windowing/windowserver/nga/SERVER/EVENT.CPP	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/EVENT.CPP	Tue Aug 24 16:17:55 2010 +0100
@@ -182,6 +182,10 @@
 TBool CKeyboardRepeat::iAlternateRepeatExists=EFalse;
 CWsCaptureLongKey* CKeyboardRepeat::iLongCapture=NULL;
 
+TTimeIntervalMicroSeconds TWindowServerEvent::iPauseInterval;
+TTime TWindowServerEvent::iPauseStartTime;
+TInt TWindowServerEvent::iConfigationPauseTime = 0;
+
 
 void TWindowServerEvent::DeleteHotKeys()
 	{
@@ -241,6 +245,9 @@
 	iEventHandlers=RArray<TRawEventHandler>(2);
 	iNotificationHandlers=new(ELeave) CArrayFixFlat<SNotificationHandler>(2);
 	iDrawerHandlers = new(ELeave) RArray<TDrawerHandler>(4);
+	iPauseInterval = TTimeIntervalMicroSeconds(0);
+   _LIT(KWSERVIniFileVarEventsPauseAfterRotation,"SUPPRESSEVENTSTIMEAFTERROTATION");
+    WsIniFile->FindVar(KWSERVIniFileVarEventsPauseAfterRotation,iConfigationPauseTime);
 	}
 
 void TWindowServerEvent::LinkHotKey(CWsHotKey *aWsHotKey)
@@ -326,6 +333,9 @@
 #else
 	iEventHandlers.AppendL(TRawEventHandler(aEventHandler, aAdvancedPointersEnabled));	//Shouldn't leave
 #endif
+#ifdef LOG_WSERV_EVENTS
+	RDebug::Printf("{EVNT}TWindowServerEvent::AddEventHandler Added Handler = %d Advanced Pointers Enabled = %d", iEventHandlers.Count(),aAdvancedPointersEnabled);
+#endif
 	}
 
 void TWindowServerEvent::RemoveEventHandler(const MEventHandler *aEventHandler)
@@ -336,6 +346,9 @@
 		{
 		if (iEventHandlers[ii].iEventHandler==aEventHandler)
 			{
+#ifdef LOG_WSERV_EVENTS
+		    RDebug::Printf("{EVNT}TWindowServerEvent::RemoveEventHandler Removed Handler = %d",ii);
+#endif
 			if (iEventHandlerCount>0)  
 				{
 				iBinaryFlags |= ERemovedEventHandlerWhileProcessingRawEvents;
@@ -937,16 +950,62 @@
 		}
 	}
 
+/*
+ Pause in processing all raw pointer and key events (except processing by anim's dll plug-ins).
+ All events will be ignored except for anim's dll plug-ins.
+ Pause prevents pointer events to come to wrong windows due to screen width and size changes. 
+ @param aPauseInterval - the pause interval in microseconds.
+*/
+void TWindowServerEvent::PauseProcessRawEvents(TInt aPauseInterval)
+    {
+    iPauseInterval = TTimeIntervalMicroSeconds(aPauseInterval);
+    iPauseStartTime.UniversalTime();
+#ifdef LOG_WSERV_EVENTS
+     RDebug::Printf("{EVNT}TWindowServerEvent::PauseProcessRawEvents aPauseInterval = %d",aPauseInterval);
+#endif
+    }
+
 void TWindowServerEvent::ProcessRawEvent(const TRawEvent& aRawEvent)
 //
 // Event has completed.
 //
 	{
+    TBool pauseProcessEvents = EFalse;
+    //Check if the pause in processing all raw pointer and key events was set.
+    if(iPauseInterval.Int64() > 0)
+        {
+        TTime current;
+        current.UniversalTime();
+        TTimeIntervalMicroSeconds interval = current.MicroSecondsFrom(
+                iPauseStartTime);
+        if ((interval.Int64() > iPauseInterval.Int64()) || (interval.Int64() < 0))
+            {
+            iPauseInterval = TTimeIntervalMicroSeconds(0);
+            }
+        else
+            {
+            // Set flag ignore of processing all raw events (except processing by anim's dll plug-ins)
+            // All events will be ignored except for anim's dll plug-ins.
+            pauseProcessEvents = ETrue;
+            }
+        }
+
+#ifdef LOG_WSERV_EVENTS
+    if(pauseProcessEvents)
+        RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent Processing of Raw Event - DISABLED");
+    else
+        RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent Processing of Raw Event - ENABLED");
+#endif
+    
 	TRawEvent::TType eventType = aRawEvent.Type();
 	TBool isPointerEvent = TWsPointer::IsPointerEventType(eventType);
 	if (isPointerEvent)
 		{
-		TWsPointer::UpdatePrimaryPointer(aRawEvent);
+#ifdef LOG_WSERV_EVENTS
+        RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent EventType = 0x0%X PointerNumber = %d PrimaryPointerNumber = %d XY(%d,%d)", 
+                aRawEvent.Type(),aRawEvent.PointerNumber(),TWsPointer::PrimaryPointer(),aRawEvent.Pos().iX,aRawEvent.Pos().iY); 
+#endif
+        TWsPointer::UpdatePrimaryPointer(aRawEvent);
 		}
 	TInt count=iEventHandlers.Count();
 	TInt ii;
@@ -966,6 +1025,9 @@
 				SendEventToKeyClick(aRawEvent);
 				}
 			eventHandled = ETrue;
+#ifdef LOG_WSERV_EVENTS
+            RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent Event Consumed by Handler No = %d Advanced Pointers Enabled = %d",ii,handler.iAdvancedPointersEnabled);
+#endif
 			break;
 			}
 		}
@@ -980,14 +1042,44 @@
 				}
 			}
 		}
-	if (eventHandled)
+	if ((eventHandled)||(pauseProcessEvents))
 		{
 		if (isPointerEvent)
-			{
-			TWsPointer::RollbackPrimaryPointer();
+			{ 
+              //Prevention of the phone pointer event "dead lock". 
+              TPointerEvent::TType type;
+              TBool handled = ETrue;
+              GetPointerEvent(type, aRawEvent, handled);
+              switch(type)
+                  {
+                  case TPointerEvent::EButton1Down:
+                  case TPointerEvent::EButton2Down:
+                  case TPointerEvent::EButton3Down:
+                      TWsPointer::iPointers[aRawEvent.PointerNumber()].iState = TWsPointer::EPointerStateDown;
+                      break;
+                  case TPointerEvent::EButton1Up:
+                  case TPointerEvent::EButton2Up:
+                  case TPointerEvent::EButton3Up:
+                      TWsPointer::iPointers[aRawEvent.PointerNumber()].iState = TWsPointer::EPointerStateUp;
+                      break;
+                  case TPointerEvent::EOutOfRange:
+                      TWsPointer::iPointers[aRawEvent.PointerNumber()].iState = TWsPointer::EPointerStateOutOfRange;
+                      break;
+                      default:
+                      break;
+                  }
+#ifdef LOG_WSERV_EVENTS
+            RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent Pointer Number= %d  State = %x XY(%d,%d)",TWsPointer::iPointers[0].iNumber,TWsPointer::iPointers[0].iState,TWsPointer::iPointers[0].iPos.iX,TWsPointer::iPointers[0].iPos.iY);
+            RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent Pointer Number= %d  State = %x XY(%d,%d)",TWsPointer::iPointers[1].iNumber,TWsPointer::iPointers[1].iState,TWsPointer::iPointers[1].iPos.iX,TWsPointer::iPointers[1].iPos.iY);
+#endif
 			}
+#ifdef LOG_WSERV_EVENTS
+		if(pauseProcessEvents)
+		    RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent Further Processing of Raw Event - IGNORED");
+#endif
 		return;
 		}
+	
 	switch(eventType)
 		{
 		case TRawEvent::ERedraw:
@@ -1112,6 +1204,10 @@
 		default:
 			break;
 		}
+#ifdef LOG_WSERV_EVENTS
+    RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent Pointer Number= %d  State = %x XY(%d,%d)",TWsPointer::iPointers[0].iNumber,TWsPointer::iPointers[0].iState,TWsPointer::iPointers[0].iPos.iX,TWsPointer::iPointers[0].iPos.iY);
+    RDebug::Printf("{EVNT}TWindowServerEvent::ProcessRawEvent Pointer Number= %d  State = %x XY(%d,%d)",TWsPointer::iPointers[1].iNumber,TWsPointer::iPointers[1].iState,TWsPointer::iPointers[1].iPos.iX,TWsPointer::iPointers[1].iPos.iY);
+#endif
 	}
 
 void TWindowServerEvent::ProcessKeyEvent(const TKeyEvent &aKeyEvent,TInt aRepeats)
--- a/windowing/windowserver/nga/SERVER/EVENT.H	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/EVENT.H	Tue Aug 24 16:17:55 2010 +0100
@@ -38,7 +38,7 @@
 class CScreen;
 class DWsScreenDevice;
 
-const TInt KRetryInitialDelay = 100000; //0.01 second
+const TInt KRetryInitialDelay = 100000; //0.1 second
 
 struct TEventRequestItem
 	{
@@ -222,6 +222,9 @@
 	static void NotifyScreenDrawingEvent(const TRegion* aRegion);
 	static void NotifyScreenDrawingEvent(const TRect& aRect);
 	static inline const CRawEventReceiver* EventReceiver() {return iEventReceiver;}
+	static void PauseProcessRawEvents(TInt aPauseInterval);
+	static inline TInt GetConfigationPauseTime();
+	
 private:
 	class TRawEventHandler
 		{
@@ -260,6 +263,14 @@
 	static RArray<TWsEventHandler> iWsEventHandlers;
 	static TUint32 iBinaryFlags;
 	static TInt iEventHandlerCount;
+
+	// For supporting a pause in processing raw events after rotation.
+	// Pause in processing all raw pointer and key events (except processing by anim's dll plug-ins).
+	// All events will be ignored except for anim's dll plug-ins.
+	static TTimeIntervalMicroSeconds iPauseInterval;
+	static TTime iPauseStartTime;
+	 // Filled from wsini.ini  , example:  SUPPRESSEVENTSTIMEAFTERROTATION   700000 //(0.7sec) 
+	static TInt iConfigationPauseTime;
 	};
 
 
@@ -307,5 +318,7 @@
 	{iScreenDeviceChangedQueue.RemoveFromEventRequestListL(aWindow);}
 inline TInt TWindowServerEvent::GetStoredModifierState()
 	{return(iModifierState);}
+inline TInt TWindowServerEvent::GetConfigationPauseTime()
+    {return(iConfigationPauseTime);}
 
 #endif
--- a/windowing/windowserver/nga/SERVER/POINTER.CPP	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/POINTER.CPP	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-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"
@@ -53,7 +53,9 @@
 CWsPointerBuffer*  CWsPointerBuffer::iCurrentBuffer=NULL;
 CCirBuf<TPoint>*   CWsPointerBuffer::iPointerBuffer=NULL;
 TSglQue<CWsPointerBuffer> CWsPointerBuffer::iList(_FOFF(CWsPointerBuffer,iQue));
-TInt                TWsPointer::iYOffset;
+TInt                TWsPointer::iYOffsetTop;
+TInt                TWsPointer::iYOffsetBottom;
+TInt                TWsPointer::iYOffsetMax;
 #if defined(__WINS__)
 TBool               TWsPointer::iEmulatorRotatePointerCoords;
 #endif
@@ -62,17 +64,20 @@
 
 void TWsPointer::InitStaticsL()
 	{
-	//This iYOffset setting is specific for capacitive touch screens, where user's finger is the pointer device.
+	//This iYOffsetTop setting is specific for capacitive touch screens, where user's finger is the pointer device.
 	//This is typically used so that the pointer event location is more inline with where the user perceives their 
 	//finger to be on the screen (for example, due to refraction and the relatively large touch area of a finger).
-	iYOffset = 0;
-    _LIT( KWSERVIniFileVarYShifting, "YSHIFTING");
-    TBool fetchingSucceeded = WsIniFile->FindVar(KWSERVIniFileVarYShifting, iYOffset);
-    WS_ASSERT_ALWAYS(iYOffset>=0, EWsPanicInvalidPointerOffset);
-    if ( !fetchingSucceeded )
-       {
-       iYOffset = 0;
-       }
+	//The logic used here is to use Yoffset value such that it is max the finger is at the top and keeps on reducing
+	//when the finger input is moved towards bottom of the screen
+	iYOffsetTop = 0;
+	iYOffsetBottom = 0;
+	iYOffsetMax = 0;
+    _LIT( KWSERVIniFileVarYShiftingTop, "YSHIFTINGTOP");
+    _LIT( KWSERVIniFileVarYShiftingBottom, "YSHIFTINGBOTTOM");
+    _LIT( KWSERVIniFileVarYShiftingMax, "YSHIFTINGMAX");
+    WsIniFile->FindVar(KWSERVIniFileVarYShiftingTop, iYOffsetTop);
+    WsIniFile->FindVar(KWSERVIniFileVarYShiftingBottom, iYOffsetBottom);
+    WsIniFile->FindVar(KWSERVIniFileVarYShiftingMax, iYOffsetMax);
 
 #if defined(__WINS__)    
 	//An emulator may or may not deploy a renderchain or displaydriver that supports rotated drawing.
@@ -527,6 +532,9 @@
 					break;
 				default:;
 				}
+#ifdef LOG_WSERV_EVENTS
+			RDebug::Printf("{EVNT}TWsPointer::QueuePointerEvent After adding event to clientqueue Event State %d ", iState);
+#endif
 			queue->QueueEvent(aEvent,priority);
 			}
 		}
@@ -856,6 +864,11 @@
 	ReLogCurrentWindow(pointerEvent.iPosition,parPos,aForceInGroup);
 	pointerEvent.iParentPosition=parPos;
 	
+	
+#ifdef LOG_WSERV_EVENTS
+	RDebug::Printf("{EVNT}TWsPointer::ProcessEvent Event send to this window %U", reinterpret_cast<TUint32>(iCurrentWindow));
+	RDebug::Printf("{EVNT}TWsPointer::ProcessEvent EventType %d and Event State %d ", eventType, iState);
+#endif
 	// update state
 	switch(eventType)
 		{
@@ -1007,6 +1020,10 @@
 	{
 	if (iState != EPointerStateOutOfRange)
 		{
+#ifdef LOG_WSERV_EVENTS
+       RDebug::Printf("{EVNT}TWsPointer::ProcessOutOfRangeEvent Pointer Number = %d, iState =%d ", iNumber, iState); 
+#endif
+
 		// OutOfRange event generated by driver doesn't contain correct coordinates,
 		// we update them from last state in order to deliver event to the proper window.
 		SendEnterExitEvent(EEventPointerExit);
@@ -1394,7 +1411,13 @@
 	
 	TRawEvent::TType type=aRawEvent.Type();
 	TInt pointerNumber = aRawEvent.PointerNumber();
-
+    
+#ifdef LOG_WSERV_EVENTS
+	RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer Current Primary pointer = %d",iPrimaryPointer);
+	RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer Pointer Number= %d  State = %x XY(%d,%d)",iPointers[0].iNumber,iPointers[0].iState,iPointers[0].iPos.iX,iPointers[0].iPos.iY);
+    RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer Pointer Number= %d  State = %x XY(%d,%d)",iPointers[1].iNumber,iPointers[1].iState,iPointers[1].iPos.iX,iPointers[1].iPos.iY);
+#endif
+	
 	// If primary pointer is out of range, then the first pointer that will 
 	// start being detected (come back in range) will become primary.
 	if (iPointers[iPrimaryPointer].iState == EPointerStateOutOfRange)
@@ -1402,6 +1425,9 @@
 		if (type != TRawEvent::EPointer3DOutOfRange && iPointers[pointerNumber].iState == EPointerStateOutOfRange)
 			{
 			iPrimaryPointer = pointerNumber;
+#ifdef LOG_WSERV_EVENTS
+	        RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer New Primary pointer(case OutRange) = %d",iPrimaryPointer);
+#endif
 			}
 		return;
 		}
@@ -1410,8 +1436,11 @@
 	// is not down, then the pointer which has sent EButton1Down becomes primary.
 	if (type == TRawEvent::EButton1Down && 
 		iPointers[iPrimaryPointer].iState != EPointerStateDown)
-		{
+		{ 
 		iPrimaryPointer = pointerNumber;
+#ifdef LOG_WSERV_EVENTS
+        RDebug::Printf("{EVNT}TWsPointer::UpdatePrimaryPointer New Primary pointer(case ButtonDown) = %d",iPrimaryPointer);
+#endif
 		return;
 		}
 	}
@@ -1526,19 +1555,40 @@
 will shift all pointer events by a specified Y displacement.
 
 @param aY Current y coordinate pointer position.
- 
- */
+*/
 void TWsPointer::ShiftYCoordinate(TInt& aY)
     {
-    WS_ASSERT_DEBUG(iYOffset>=0, EWsPanicInvalidPointerOffset);
-    if (aY >= iYOffset)
-        {
-        aY -=iYOffset;
-        }
-    else
-        {
-        aY=0;
-        }
+	// If iYOffsetMax is zero or both topOffset and bottomOffset is zero then return without doing anything
+	if (!iYOffsetMax || !(iYOffsetTop || iYOffsetBottom))
+		return;
+	
+	if (aY >= iYOffsetMax )	
+		{
+		CScreen* screen=iRootWindow->Screen();
+		TInt displayHeight = screen->SizeInPixels().iHeight;
+
+		// Gradual reduction of Yoffset depending upon the aY value
+		TInt offset = iYOffsetTop + iYOffsetBottom - ( iYOffsetTop * 
+				aY / displayHeight );
+		
+		if ( offset > iYOffsetMax )
+			{
+			offset = iYOffsetMax;
+			}
+		aY -=offset;
+		
+		// As the pixels are zero counted, digitiser would send a pointer with co-ordinates 
+		// from 0 to 239 or 0 to 639, if hieght of the screen was 240 or 640.
+		// And here we are calulating the Yvalue so it cannot be more than 239 or 639 
+		if ( aY > (displayHeight-1) )
+			{
+			aY = displayHeight-1;
+			}
+		}
+	else
+		{
+		aY = 0;
+		}
     }
 //
 CWsPointerTimer::CWsPointerTimer(MPointerTimerCallback& aPointerTimerCallback)
--- a/windowing/windowserver/nga/SERVER/openwfc/WINDOW.CPP	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/openwfc/WINDOW.CPP	Tue Aug 24 16:17:55 2010 +0100
@@ -674,6 +674,11 @@
 		aWindowTreeObserver.FlagChanged(*this, MWsWindowTreeObserver::ENonFading, ETrue); 
 		}
 	
+	if(IsTopClientWindow() && (iFlags&EFlagScreenDeviceInvalid) )
+		{
+		aWindowTreeObserver.FlagChanged(*this, MWsWindowTreeObserver::EScreenDeviceValid, EFalse);
+		}
+	
 	if(iAnimList)
 		iAnimList->SendState(aWindowTreeObserver);
 	
--- a/windowing/windowserver/nga/SERVER/pointer.h	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/pointer.h	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -42,6 +42,7 @@
 
 class TWsPointer : public CWsPointerTimer::MPointerTimerCallback
 	{
+friend class TWindowServerEvent;
 	enum {EPointerUpdateGapInMicroSeconds=50000};
 	enum TPointerState
 		{
@@ -229,7 +230,10 @@
 	static TInt iExitHighPressureThreshold;
 	
 	/** Used to offset the y pointer */
-	static TInt iYOffset;
+	/** upgraded to use dynamic value */
+	static TInt iYOffsetTop;
+	static TInt iYOffsetBottom;
+	static TInt iYOffsetMax;
 	
 #if defined(__WINS__)
 	/** Tell whether to rotate pointer coords in _WINS_ builds */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/tauto/tptroffset.cpp	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,484 @@
+// 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:
+// YShifting, Wserv gradual reduction of YOffset test code
+// 
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Symbian test code 
+*/
+
+#include "PARSEINIDATA.H"
+#include "tptroffset.h"
+#include <e32cmn.h>
+#include <hal.h>
+
+//#define FAILLOG 1			// Uncomment this code to get detailed log
+
+//CTPointerOffsetBuffer
+CTPointerOffsetBuffer::CTPointerOffsetBuffer(RWsSession *aWs, CTPointerOffsetTest *aTest, CTPointerOffsetClient* aClient) 
+	: CTEvent(aWs), iTest(aTest), iClient(aClient)
+	{
+	}
+
+CTPointerOffsetBuffer::~CTPointerOffsetBuffer()
+	{
+	}
+
+void CTPointerOffsetBuffer::ConstructL()
+	{
+	CTEventBase::Construct();
+	iEventBuffer.SetLengthL(EEventBufferSize);
+	}
+
+void CTPointerOffsetBuffer::AddExpectedEvent(TWsEvent &aEvent)
+	{
+	iEventBuffer.Add(&aEvent);
+	}
+
+TInt CTPointerOffsetBuffer::EventsRemaining()
+	{
+	return iEventBuffer.Count();
+	}
+
+
+// Main function which gets the event, checks with the event in buffer
+// Then calls function NextSetOfEventsL for running other tests of a particualar test case
+void CTPointerOffsetBuffer::doRunL()
+	{
+	// Get the event from wserv
+	TWsEvent wsEvent;
+	iWs->GetEvent(wsEvent);
+
+	TWsEvent expectedEvent;
+	TInt wsType=wsEvent.Type();
+	
+	// if this is called accidentally
+	TInt count=iEventBuffer.Count();
+	if (count==0 && wsType==EEventFocusGained)
+		{
+		goto End;
+		}
+
+	iEventBuffer.Remove(&expectedEvent);
+	iEventCount++;
+	
+#if defined(FAILLOG)	
+	TLogMessageText logText;
+	_LIT(KEventCountCheck, "Checking event number = %d");
+	logText.Format(KEventCountCheck, iEventCount);
+	iTest->LOG_MESSAGE(logText);
+	_LIT(KEventType, "Actual Event type from Wserv = %d Expected Event Type = %d ");
+	logText.Format(KEventType, wsEvent.Type(), expectedEvent.Type());
+	iTest->LOG_MESSAGE(logText);
+#endif
+	
+	TestL(wsEvent.Type() == expectedEvent.Type());
+	
+#if defined(FAILLOG)
+	_LIT(KEventHandle, "Actual Window Handle from Wserv = %d Expected Window Handle = %d ");
+	logText.Format(KEventHandle, wsEvent.Handle(), expectedEvent.Handle());
+	iTest->LOG_MESSAGE(logText);
+#endif    
+	TestL(wsEvent.Handle() == expectedEvent.Handle());
+	
+	TAdvancedPointerEvent *expectedPointerEvent = expectedEvent.Pointer();
+    TAdvancedPointerEvent *actualPointerEvent = wsEvent.Pointer();
+    
+    if (wsType == EEventPointer)
+    	{
+#if defined(FAILLOG)
+		_LIT(KPointerType, "Actual PointerType from Wserv = %d Expected PointerType = %d ");
+		logText.Format(KPointerType, actualPointerEvent->iType, expectedPointerEvent->iType);
+		iTest->LOG_MESSAGE(logText);
+#endif
+		TestL(actualPointerEvent->iType == expectedPointerEvent->iType);
+		
+#if defined(FAILLOG)
+		_LIT(KPointerPosition, "Actual PointerPosition from Wserv = (%d, %d) Expected PointerPosition = (%d, %d) ");
+		logText.Format(KPointerPosition, actualPointerEvent->iPosition.iX, actualPointerEvent->iPosition.iY, expectedPointerEvent->iPosition.iX, expectedPointerEvent->iPosition.iY);
+		iTest->LOG_MESSAGE(logText);
+#endif
+		TestL(actualPointerEvent->iPosition == expectedPointerEvent->iPosition);
+		
+#if defined(FAILLOG)
+		_LIT(KPointerNumber, "Actual PointerNumber from Wserv = %d Expected PointerNumber = %d ");
+		logText.Format(KPointerNumber, actualPointerEvent->PointerNumber(), expectedPointerEvent->PointerNumber());
+		iTest->LOG_MESSAGE(logText);
+#endif		
+		TestL(actualPointerEvent->PointerNumber() == expectedPointerEvent->PointerNumber());
+    	}
+	
+End:
+	// Call NextSetOfEvents() when all the events have been checked
+	if (iEventBuffer.Count()==0)	
+		{
+		iTest->NextSetOfEventsL();		// Cannot Leave
+		}
+	}
+
+void CTPointerOffsetBuffer::TestL(TInt aTest)
+	{
+	if (!aTest)
+		{
+		iTest->Failed();
+		User::Leave(ETestFailed);
+		}
+	}
+
+//CTPointerOffsetClient
+CTPointerOffsetClient::CTPointerOffsetClient(CTPointerOffsetTest *aTest) 
+	: iTest(aTest)
+	{
+	}
+
+CTPointerOffsetClient::~CTPointerOffsetClient()
+	{
+	delete iWin;
+	}
+
+void CTPointerOffsetClient::ConstructL()
+	{
+	CTClient::ConstructL();
+	
+	// Create a group window and assign it iGroup
+	iGroup = new(ELeave) CTWindowGroup(this);
+	iGroup->ConstructL();
+	
+	iWinSize = iScreen->SizeInPixels();
+	iWinPos = TPoint();
+	
+	// Create window for this client so that events can come to this client
+	iWin=new(ELeave) CTBlankWindow();
+	iWin->ConstructL(*iGroup);
+	iWin->SetExt(iWinPos, iWinSize);
+	iWin->SetColor(KRgbRed);
+	iWin->BaseWin()->EnableAdvancedPointers();
+	iWin->Activate();
+	iWs.Flush();
+	}
+
+void CTPointerOffsetClient::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle)
+	{
+	TWsEvent ptrEvent;
+	ptrEvent.SetType(EEventPointer);
+	ptrEvent.Pointer()->iParentPosition = aPos;
+	ptrEvent.Pointer()->iType = aType;
+	ptrEvent.Pointer()->iPosition = aPos;
+	ptrEvent.SetPointerNumber(aPointerNumber);
+	if (!aHandle)
+		ptrEvent.SetHandle((TUint)iWin);
+	else
+		ptrEvent.SetHandle(aHandle);
+
+	static_cast<CTPointerOffsetBuffer*>(iEventHandler)->AddExpectedEvent(ptrEvent);
+	}
+
+void CTPointerOffsetClient::AddExpectedWsEvent(TEventCode aType, TInt /*aPointerNumber*/, TUint aHandle)
+	{
+	TWsEvent ptrEvent;
+	ptrEvent.SetType(aType);
+	if (!aHandle)
+		ptrEvent.SetHandle((TUint)iGroup);
+	else
+		ptrEvent.SetHandle(aHandle);
+	static_cast<CTPointerOffsetBuffer*>(iEventHandler)->AddExpectedEvent(ptrEvent);
+	}
+
+// Create and store CTPointerOffsetBuffer in iEventHandler
+void CTPointerOffsetClient::ConstructEventHandlerL()
+	{
+	CTPointerOffsetBuffer* eventBufferAndHandler = new(ELeave) CTPointerOffsetBuffer(&iWs, iTest, this);
+	eventBufferAndHandler->ConstructL();
+	iEventHandler = eventBufferAndHandler;
+	}
+
+//CTPointerOffsetTest
+CTPointerOffsetTest::CTPointerOffsetTest(CTestStep* aStep)
+	: CTWsGraphicsBase(aStep)
+	{
+	}
+
+CTPointerOffsetTest::~CTPointerOffsetTest()
+	{
+	delete iPointerOffsetClient;
+	}
+
+void CTPointerOffsetTest::ConstructL()
+	{
+	// If YOffsetValues are not defined in wsini file then just return without doing anything
+    _LIT(KWsIniFile, "z:\\system\\data\\wsini.ini");
+    CIniData* iniData = CIniData::NewL(KWsIniFile, ' ');
+    _LIT( KWsiniYShiftingTop, "YSHIFTINGTOP");
+    if (iniData->FindVar(KWsiniYShiftingTop, iYOffsetTop) == EFalse)
+    	goto FAIL;
+    _LIT( KWsiniYShiftingBottom, "YSHIFTINGBOTTOM");
+    if (iniData->FindVar(KWsiniYShiftingBottom, iYOffsetBottom) == EFalse)
+    	goto FAIL;
+    _LIT( KWsiniYShiftingMax, "YSHIFTINGMAX");
+    if (iniData->FindVar(KWsiniYShiftingMax, iYOffsetMax) == EFalse)
+    	goto FAIL;
+    delete iniData;
+    
+    if (!iYOffsetTop || !iYOffsetBottom || !iYOffsetMax)
+    	{
+FAIL:	
+		delete iniData;
+		TLogMessageText logText1;
+		_LIT(KWrongHALConfig, "Y Offset values are incorrect. \n");
+		logText1.Append(KWrongHALConfig);
+		LOG_MESSAGE(logText1);
+		TEST(EFalse);
+		User::Leave(KErrArgument);
+    	}
+    iPhysicalScreenSize = TheClient->iScreen->SizeInPixels();
+    
+    // If we fail to get the maxpointernumber then just test with single pointer
+	TInt ret = HAL::Get(HALData::EPointerMaxPointers, iMaxPointerNumbers);
+	if (ret != KErrNone || iMaxPointerNumbers < 2 || iMaxPointerNumbers > 8)
+		{
+		iMaxPointerNumbers = 1;
+		}
+	}
+
+// Common function for all tests
+// Important point to remember is that this function should not leave when running tests
+void CTPointerOffsetTest::NextSetOfEventsL()
+	{
+	// For each test case calls its respective tests
+	switch (iTest->iState)
+		{
+	case 0:
+		TestYOffsetValues();
+		break;
+	case 1:
+		TestYOffsetValues();	
+		break;
+	default:
+		AutoPanic(EAutoPanicWrongTest);
+		}
+	}
+
+void CTPointerOffsetTest::SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TUint8 aPointerNumber)
+	{
+	TRawEvent rawEvent;
+	rawEvent.Set(aType, aX, aY, 0, aPointerNumber);
+	UserSvr::AddEvent(rawEvent);
+	}
+
+void CTPointerOffsetTest::AddExpectedPointerEvent(TPointerEvent::TType aType, TInt aX, TInt aY, TUint8 aPointerNumber, TUint aHandle)
+	{
+	iPointerOffsetClient->AddExpectedPointerEvent(aType, TPoint(aX, aY), aPointerNumber, aHandle);
+	}
+
+void CTPointerOffsetTest::AddExpectedWsEvent(TEventCode aType, TInt aPointerNumber, TUint aHandle)
+	{
+	iPointerOffsetClient->AddExpectedWsEvent(aType, aPointerNumber, aHandle);
+	}
+
+// If any of the Tests fails, bring the wserv in a consistent state for other test to run, 
+// stop ActiveScheduler and display some logs where the fail occured.
+void CTPointerOffsetTest::Failed()
+	{
+	// Display the test case number, subtest case number and number of events left in the buffer which can be used to
+	// find out which event actually caused the failure when any test fails
+	TLogMessageText logText1;
+	_LIT(KEventsAdded, "Test case number %d Sub test case number %d Events remaining in the buffer %d \n");
+	logText1.AppendFormat(KEventsAdded, iTest->iState, iEventSet, iPointerOffsetClient->EventBuffer()->EventsRemaining());
+	LOG_MESSAGE(logText1);
+	RDebug::Printf("Test case number %d Sub test case number %d Events remaining in the buffer %d \n", iTest->iState, iEventSet, iPointerOffsetClient->EventBuffer()->EventsRemaining());
+
+	CActiveScheduler::Stop();
+	iFailed=ETrue;
+	}
+
+// Get YValue after applying YOffset using iYOffsetTop, iYOffsetBottom and iYOffsetMax variables.
+// Depending upon the Y poistion of input, yOffset is gradually reduced from top of the screen to 
+// bottom of the screen.
+TInt CTPointerOffsetTest::GetShiftedYValue(TInt aY)
+	{
+	if (!iYOffsetTop || !iYOffsetMax || !iYOffsetBottom)
+		return aY;
+	
+	TInt offset = 0;
+	TInt returnValue = aY;
+	TInt displayHeight = TheClient->iScreen->SizeInPixels().iHeight;
+	if (aY >= iYOffsetMax)
+		{
+		// Gradual reduction of Yoffset depending upon the aY value
+		offset = iYOffsetTop + iYOffsetBottom - (iYOffsetTop * aY / displayHeight );
+		if ( offset > iYOffsetMax )
+			{
+			offset = iYOffsetMax;
+			}
+		returnValue -= offset; 
+		if (returnValue > (displayHeight-1))
+			{
+			returnValue = displayHeight-1; 
+			}
+		}
+	else
+		{
+		returnValue = 0;
+		}
+	
+	return returnValue;
+	}
+
+// Common function for all test cases
+void CTPointerOffsetTest::RunTestsL()
+	{
+	// Create CTPointerOffsetClient for each test case and call NextSetOfEventsL()
+	iPointerOffsetClient = new(ELeave) CTPointerOffsetClient(this);
+	iPointerOffsetClient->SetScreenNumber(iTest->iScreenNumber);
+	iPointerOffsetClient->ConstructL();
+	
+	iEventSet=0;
+
+	TRAPD(err, NextSetOfEventsL());
+	if (err != KErrNone)
+		{
+		iFailed = ETrue;
+		}
+
+	// Start nested activescheduler if it is not failed
+	if (!iFailed)
+		{
+		CActiveScheduler::Start();
+		}
+
+	TInt eventsRem = iPointerOffsetClient->EventBuffer()->EventsRemaining();
+	if (eventsRem > 0)
+		{
+		iFailed=ETrue;
+		}
+	
+	delete iPointerOffsetClient;
+	iPointerOffsetClient = NULL;
+	}
+
+// This function is called by TestExecute Framework, through which all the testcases are run
+void CTPointerOffsetTest::RunTestCaseL(TInt /*aCurTestCase*/)
+	{
+	_LIT(KTest0, "PointerOffset tests");
+	_LIT(KTest1, "PointerOffset tests for other pointer");
+	
+	switch(iTest->iState)
+		{
+	case 0:
+		iTest->LogSubTest(KTest0);
+		iPointerNumber = 0;
+		RunTestsL();
+		break;
+	case 1:
+		if (iMaxPointerNumbers == 1)
+			{
+			TestComplete();
+			}
+		else
+			{
+			iTest->LogSubTest(KTest1);
+			iPointerNumber = iMaxPointerNumbers-1;
+			RunTestsL();
+			}
+		break;
+	case 2:
+		// Keep this code in last case statement for main test completion 
+		TestComplete();
+		break;
+	default:
+		AutoPanic(EAutoPanicWrongTest);
+		}
+
+	// 
+	if (iFailed)
+		{
+		TEST(EFalse);
+		iFailed=EFalse;
+		}
+	++iTest->iState;
+	}
+
+
+void CTPointerOffsetTest::TestYOffsetValues()
+	{
+	TLogMessageText logText;
+	_LIT(KSet, "Offset tests number : %d of 5");
+	logText.AppendFormat(KSet, iEventSet);
+	LOG_MESSAGE(logText);
+	
+	TPoint simulatedPos(iPhysicalScreenSize.iWidth/2, iPhysicalScreenSize.iHeight/2);
+	TPoint expectedPos(simulatedPos);
+	switch(iEventSet++)
+		{
+		case 0:
+			// Test any point which has Y value less than YOffsetMax, where Y position would be 0
+			simulatedPos.iY = iYOffsetMax - 1;
+			SimulatePointerEvent(TRawEvent::EButton1Down, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+			SimulatePointerEvent(TRawEvent::EButton1Up, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+
+			expectedPos.iY = 0;
+			AddExpectedWsEvent(EEventFocusGained);
+			AddExpectedPointerEvent(TPointerEvent::EButton1Down, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			AddExpectedPointerEvent(TPointerEvent::EButton1Up, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			break;
+		case 1:
+			// Test any point which has Y value just over YOffsetMax
+			simulatedPos.iY = iYOffsetMax + 1;
+			SimulatePointerEvent(TRawEvent::EButton1Down, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+			SimulatePointerEvent(TRawEvent::EButton1Up, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+			
+			expectedPos.iY = GetShiftedYValue(simulatedPos.iY); 
+			AddExpectedPointerEvent(TPointerEvent::EButton1Down, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			AddExpectedPointerEvent(TPointerEvent::EButton1Up, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			break;
+		case 2:
+			// Test any point which has Y value middle of the screen
+			SimulatePointerEvent(TRawEvent::EButton1Down, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+			SimulatePointerEvent(TRawEvent::EButton1Up, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+			
+			expectedPos.iY = GetShiftedYValue(simulatedPos.iY); 
+			AddExpectedPointerEvent(TPointerEvent::EButton1Down, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			AddExpectedPointerEvent(TPointerEvent::EButton1Up, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			break;
+		case 3:
+			// Test any point which has Y value less than bottommost of the screen
+			simulatedPos.iY = iPhysicalScreenSize.iHeight - 10;
+			SimulatePointerEvent(TRawEvent::EButton1Down, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+			SimulatePointerEvent(TRawEvent::EButton1Up, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+			
+			expectedPos.iY = GetShiftedYValue(simulatedPos.iY); 
+			AddExpectedPointerEvent(TPointerEvent::EButton1Down, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			AddExpectedPointerEvent(TPointerEvent::EButton1Up, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			break;
+		case 4:
+			// Test any point which has Y value at bottom of the screen
+			// As pixels are zero counted and so it cannot be >= iPhysicalScreenSize.iHeight 
+			simulatedPos.iY = iPhysicalScreenSize.iHeight-1;
+			SimulatePointerEvent(TRawEvent::EButton1Down, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+			SimulatePointerEvent(TRawEvent::EButton1Up, simulatedPos.iX, simulatedPos.iY, iPointerNumber);
+			
+			expectedPos.iY = GetShiftedYValue(simulatedPos.iY); 
+			AddExpectedPointerEvent(TPointerEvent::EButton1Down, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			AddExpectedPointerEvent(TPointerEvent::EButton1Up, expectedPos.iX, expectedPos.iY, iPointerNumber);
+			break;
+		default:
+			CActiveScheduler::Stop();
+		}
+	}
+// Macro which is used for construction of CTPointerOffsetTestStep object
+// and also used to call CreateTestL() which creates CTPointerOffsetTest and CTestBase objects
+__WS_CONSTRUCT_STEP__(PointerOffsetTest)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/tauto/tptroffset.h	Tue Aug 24 16:17:55 2010 +0100
@@ -0,0 +1,155 @@
+// 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:
+//
+
+/**
+ @file
+ @test
+ @internalComponent - Internal Symbian test code
+ */ 
+
+#ifndef TPTROFFSET_H_
+#define TPTROFFSET_H_
+
+#include <e32std.h>
+#include <e32cmn.h>
+#include "w32std.h"
+#include "../tlib/testbase.h"
+#include "AUTO.H"
+#include "AUTODLL.H"
+#include "TGraphicsHarness.h"
+
+
+class CTPointerOffsetTest;
+class CTPointerOffsetClient;
+
+/*
+ * CTEvent derived class which acts as eventhandler and eventbuffer 
+ * Stores the events in buffer, which is used for comparing events received from wserv.
+ */ 
+class CTPointerOffsetBuffer : public CTEvent
+	{
+	enum {EEventBufferSize=40};
+public:
+	CTPointerOffsetBuffer(RWsSession *aWs, CTPointerOffsetTest *aTest, CTPointerOffsetClient* aClient);
+	~CTPointerOffsetBuffer();
+	void ConstructL();
+	void AddExpectedEvent(TWsEvent &aEvent);
+	TInt EventsRemaining();
+	void SetEventCount(TInt aCount) {iEventCount = aCount;}
+
+protected:
+	// Pure virtual from CTEventBase
+	void doRunL();
+private:
+	void TestL(TInt aTest);
+
+private:
+	CCirBuf<TWsEvent> iEventBuffer;
+	CTPointerOffsetTest* iTest;
+	TInt iEventCount;
+	CTPointerOffsetClient* iClient;
+	};
+
+/* 
+ * CTClient derived class which gives Wserv client environment 
+ * i,e iWs, iScreen, iGc, iGroup, iEventHandler etc...
+ * Owns CTPointerOffsetBuffer and stores in iEventhandler of its base class
+ * Accepts the event from test class and passes them on to buffer class
+ */ 
+class CTPointerOffsetClient : public CTClient
+	{
+public:
+	CTPointerOffsetClient(CTPointerOffsetTest *aTest);
+	~CTPointerOffsetClient();
+	void ConstructL();
+	
+	inline CTBlankWindow* Win() { return iWin; }
+	inline CTPointerOffsetBuffer* EventBuffer() {return static_cast<CTPointerOffsetBuffer*>(iEventHandler);}
+	
+	void AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle = 0);
+	void AddExpectedWsEvent(TEventCode aType, TInt aPointerNumber = 0, TUint aHandle = 0);
+
+	// Virtual from CTClient
+	void ConstructEventHandlerL();
+	
+private:
+	CTPointerOffsetTest* iTest;
+	TSize iWinSize;
+	TPoint iWinPos;
+	CTBlankWindow* iWin;
+	};
+
+
+/*
+ * CTWsGraphicsBase derived class which implements RunTestCaseL pure virtual.
+ * Runs all the testcases for pointer events which have offset.
+ * For each test case it creates CTPointerOffsetClient object and creates a nested activescheduler
+ * Calls NextSetOfEventsL() which in turn calls respective tests depending upon the testcase number
+ * For each test, simulate the events and adds the same to CTPointerOffsetBuffer
+ * When all the tests for a particular testcase completes, stops activescheduler.
+ * Repeats the same for all testcases
+ */ 
+class CTPointerOffsetTest : public CTWsGraphicsBase
+	{
+public:
+	CTPointerOffsetTest(CTestStep* aStep);
+	~CTPointerOffsetTest();
+	void ConstructL();
+	void NextSetOfEventsL();
+	void Failed();
+	
+	// Function for simulating events, which use UserSvr::AddEvent
+	void SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TUint8 aPointerNumber);
+	
+	// Function for adding event, calls the client's AddExpectedPointer
+	void AddExpectedPointerEvent(TPointerEvent::TType aType, TInt aX, TInt aY, TUint8 aPointerNumber, TUint aHandle = 0);
+	void AddExpectedWsEvent(TEventCode aType, TInt aPointerNumber = 0, TUint aHandle = 0);
+	
+	// Supplementary function for tests
+	TInt GetShiftedYValue(TInt aY);
+	
+	// All tests function can come here
+	void TestYOffsetValues();
+	
+protected:
+	void RunTestCaseL(TInt aCurTestCase);
+private:
+	void RunTestsL();
+private:
+	TInt iYOffsetTop;
+	TInt iYOffsetBottom;
+	TInt iYOffsetMax;	
+	
+	TInt iEventSet;			// Set of events for one particular test case
+	TBool iFailed;
+	TSize iPhysicalScreenSize;
+	TInt iPointerNumber;
+	TInt iMaxPointerNumbers;
+	
+	CTPointerOffsetClient *iPointerOffsetClient;
+	};
+
+class CTPointerOffsetTestStep : public CTGraphicsStep
+	{
+public:
+	CTPointerOffsetTestStep();
+protected:
+	//from CTGraphicsStep
+	virtual CTGraphicsBase* CreateTestL();
+	};
+
+_LIT(KTPointerOffsetTestStep, "TPointerOffsetTest");
+
+#endif /*TPTROFFSET_H_*/
--- a/windowing/windowserver/test/TAutoServer/TAutoServer.cpp	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/test/TAutoServer/TAutoServer.cpp	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -85,6 +85,7 @@
 #include "tmultiptrevent.h"
 #include "tdrawresource.h"
 #include "twindowsizecache.h"
+#include "tptroffset.h"
 
 /* Path to the script
 z:\GraphicsTest\gditest.script
@@ -336,6 +337,8 @@
 		testStep = new CTDrawResourceStep();
     else if(aStepName == KTWindowSizeCacheTestStep)
         testStep = new CTWindowSizeCacheTestStep();
+    else if(aStepName == KTPointerOffsetTestStep)
+        testStep = new CTPointerOffsetTestStep();
 #endif
 	return testStep;
 	}
--- a/windowing/windowserver/test/TAutoServer/openwfc/TAutoServer_nga.mmp	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/test/TAutoServer/openwfc/TAutoServer_nga.mmp	Tue Aug 24 16:17:55 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -102,6 +102,8 @@
 SOURCE	      tmultiptrevent.cpp
 SOURCE	      tdrawresource.cpp
 SOURCE	      twindowsizecache.cpp
+SOURCE	      tptroffset.cpp
+
 
 //Required to test CommamdBuffer::Play using MWsGraphicsContext in tgc
 SOURCE        directgdigcwrapper.cpp
--- a/windowing/windowserver/test/scripts/wstest_t_pointershifttest_nga.script	Fri Aug 06 17:05:55 2010 +0100
+++ b/windowing/windowserver/test/scripts/wstest_t_pointershifttest_nga.script	Tue Aug 24 16:17:55 2010 +0100
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2009-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"
@@ -14,24 +14,24 @@
 // Description: 
 //
 
-PRINT Run WServ NGA pointer event tests on screen 0
+PRINT Run WServ YShifting pointer offset test on screen 0
 
 LOAD_SUITE tautoserver_nga
 
 PRINT Run Final WServ pointer shift tests on screen 0
 DELAY 5000
 //!@SYMTestCaseID			graphics-wserv-CR2052-0001
-//!@SYMPREQ					CR2052
-//!@SYMTestCaseDesc			Test pointer event positions for offset YSHIFTING in wsini.ini			
-//!@SYMTestActions			Simulate the pointer click events in various positions/rotations. A keyword YSHIFTING with a value greater than 0 should required to test the pointer offset. 
-//!							Add those event in event queue and retrieve the positions from the event queue for verification
+//!@SYMPREQ				CR2052
+//!@SYMTestCaseDesc			Test pointer event positions for offset YSHIFTINGTOP, YSHIFTINGBOTTOM and YSHIFTINGMAX values in wsini.ini			
+//!@SYMTestActions			Simulate the pointer click events in various positions on the screen. The above keywords with a value other than 0 
+//!					is required to test the pointer offset. Add those event in event queue and retrieve the positions from the event queue for verification.
+//!					Repeat the above tests for different pointer number.
 //!@SYMTestStatus			Implemented
 //!@SYMTestPriority			2
-//!@SYMTestExpectedResults	Simlated pointer position and expected pointer positions should match.  
+//!@SYMTestExpectedResults		Simlated pointer position and expected pointer positions should match.  
 //!@SYMTestType				CT
 
-RUN_TEST_STEP 1500 tautoserver_nga TEventTest
-RUN_TEST_STEP 200 tautoserver_nga TMultiPtrEventTest
+RUN_TEST_STEP 1500 tautoserver_nga TPointerOffsetTest