Revision: 201029 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 11:11:18 +0300
branchRCL_3
changeset 150 57c618273d5c
parent 149 e375a7921169
child 157 b042127c80f6
child 163 bbf46f59e123
Revision: 201029 Kit: 201033
fbs/fontandbitmapserver/group/FBSCLI.MMP
fbs/fontandbitmapserver/group/FBSERV.MMP
fbs/fontandbitmapserver/inc/FBS.H
fbs/fontandbitmapserver/sfbs/FBSBMP.CPP
fbs/fontandbitmapserver/sfbs/FBSCLI.CPP
fbs/fontandbitmapserver/sfbs/SESSION.CPP
fbs/fontandbitmapserver/sfbs/fbstrace.h
fbs/fontandbitmapserver/traces_FBSCLI/OstTraceDefinitions.h
fbs/fontandbitmapserver/traces_FBSCLI/fixed_id.definitions
fbs/fontandbitmapserver/traces_FBSERV/OstTraceDefinitions.h
fbs/fontandbitmapserver/traces_FBSERV/fixed_id.definitions
fbs/fontandbitmapserver/utils/fbsbitmap_memory.pl
fbs/fontandbitmapserver/utils/fbsgroup.py
fbs/fontandbitmapserver/utils/fbsresource_count.pl
fbs/fontandbitmapserver/utils/threadname.py
graphicstest/graphicstestharness/automation/h4/roms.wdp.tb92.txt
windowing/windowserver/nga/CLIENT/RGC.CPP
windowing/windowserver/nga/SERVER/EVENT.CPP
windowing/windowserver/nga/SERVER/EVENT.H
windowing/windowserver/nga/SERVER/POINTER.CPP
windowing/windowserver/nga/SERVER/openwfc/cliwin.cpp
windowing/windowserver/nga/SERVER/pointer.h
--- a/fbs/fontandbitmapserver/group/FBSCLI.MMP	Thu Jul 15 20:08:02 2010 +0300
+++ b/fbs/fontandbitmapserver/group/FBSCLI.MMP	Thu Aug 19 11:11:18 2010 +0300
@@ -28,6 +28,7 @@
 SOURCEPATH      ../sfbs
 
 userinclude     ../inc
+userinclude     ../traces_FBSCLI
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
--- a/fbs/fontandbitmapserver/group/FBSERV.MMP	Thu Jul 15 20:08:02 2010 +0300
+++ b/fbs/fontandbitmapserver/group/FBSERV.MMP	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Jul 15 20:08:02 2010 +0300
+++ b/fbs/fontandbitmapserver/inc/FBS.H	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Jul 15 20:08:02 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/FBSBMP.CPP	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Jul 15 20:08:02 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/FBSCLI.CPP	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Jul 15 20:08:02 2010 +0300
+++ b/fbs/fontandbitmapserver/sfbs/SESSION.CPP	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Aug 19 11:11:18 2010 +0300
@@ -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.wdp.tb92.txt	Thu Jul 15 20:08:02 2010 +0300
+++ b/graphicstest/graphicstestharness/automation/h4/roms.wdp.tb92.txt	Thu Aug 19 11:11:18 2010 +0300
@@ -7,7 +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\ws_test.ini,\epoc32\data\z\system\data\wsini_pointershift.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_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/windowing/windowserver/nga/CLIENT/RGC.CPP	Thu Jul 15 20:08:02 2010 +0300
+++ b/windowing/windowserver/nga/CLIENT/RGC.CPP	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Jul 15 20:08:02 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/EVENT.CPP	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Jul 15 20:08:02 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/EVENT.H	Thu Aug 19 11:11:18 2010 +0300
@@ -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	Thu Jul 15 20:08:02 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/POINTER.CPP	Thu Aug 19 11:11:18 2010 +0300
@@ -532,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);
 			}
 		}
@@ -861,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)
 		{
@@ -1012,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);
@@ -1399,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)
@@ -1407,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;
 		}
@@ -1415,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;
 		}
 	}
--- a/windowing/windowserver/nga/SERVER/openwfc/cliwin.cpp	Thu Jul 15 20:08:02 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/openwfc/cliwin.cpp	Thu Aug 19 11:11:18 2010 +0300
@@ -33,6 +33,7 @@
 #include "EVENT.H"
 #include "backedupwindow.h"
 #include "redrawmsgwindow.h"
+#include "ANIM.H"
 #include "windowelementset.h"
 
 
@@ -552,7 +553,13 @@
 		MWsWindowTreeObserver* windowTreeObserver = Screen()->WindowTreeObserver();
 		if (windowTreeObserver)
 			{
-			windowTreeObserver->NodeExtentChanged(*this, FullRect());
+			TRect rect = FullRect();
+			windowTreeObserver->NodeExtentChanged(*this, rect);
+			
+			for (CWsAnim* anim = iAnimList; anim; anim = anim->Next())
+				{
+				windowTreeObserver->NodeExtentChanged(*anim, rect);
+				}
 			}
 		}
 	}
--- a/windowing/windowserver/nga/SERVER/pointer.h	Thu Jul 15 20:08:02 2010 +0300
+++ b/windowing/windowserver/nga/SERVER/pointer.h	Thu Aug 19 11:11:18 2010 +0300
@@ -42,6 +42,7 @@
 
 class TWsPointer : public CWsPointerTimer::MPointerTimerCallback
 	{
+friend class TWindowServerEvent;
 	enum {EPointerUpdateGapInMicroSeconds=50000};
 	enum TPointerState
 		{