Merge. CompilerCompatibility
authorStefan Karlsson <stefan.karlsson@nokia.com>
Thu, 08 Apr 2010 12:06:20 +0100
branchCompilerCompatibility
changeset 31 8d23fe8ae91b
parent 30 30f62d96b898 (current diff)
parent 28 c0155353733c (diff)
child 32 11eb4ca57dad
Merge.
fbs/fontandbitmapserver/group/fbscli_fmm.mmp
fbs/fontandbitmapserver/group/fbserv_fmm.mmp
fbs/fontandbitmapserver/tfbs/tfbsmultithread.h
--- a/egl/eglswitch/src/eglswitch.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/eglswitch/src/eglswitch.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -44,10 +44,16 @@
 FARPROC vector[MAX_ORDINAL+1];		// 1 additional entry: vector[0] to set the initialised state
 
 
+#ifdef _DEBUG
 void Stop(char* aErrorMessage)
+#else
+void Stop(char* /*aErrorMessage*/)
+#endif
 	{
 	int err = GetLastError();
+#ifdef _DEBUG
 	RDebug::Printf("%S, (last error = %i)", aErrorMessage, err);
+#endif
 	_asm int 3;
 	}
 
@@ -71,14 +77,13 @@
 		{
 		Stop("... has too few exported functions");
 		}
-
-	// next position should be empty
+	
+  // next position should be empty
 	address = GetProcAddress(aDll, (LPCSTR)(MAX_ORDINAL+2));
 	if (address != NULL)
 		{
 		Stop("... has too many exported functions");
 		}
-	
 	// Set initialised
 	vector[0] = (FARPROC)1;	
 	}
@@ -102,8 +107,10 @@
 		library = "libegl_nongce.dll";
 		}
 
+#ifdef _DEBUG
 	RDebug::Printf("Redirecting libEGL.dll to \"%s\" ...\n", library);
-	
+#endif
+  	
 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
 	// try to load selected DLL
 	HINSTANCE instance = LoadLibraryA(library);
@@ -116,7 +123,9 @@
 	else
 		{
 		fill_vector(instance);
+#ifdef _DEBUG
 		RDebug::Printf("... DLL loaded successfully");
+#endif
 		}
 	}
 
--- a/egl/egltest/bwins/egltestcommonu.def	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/bwins/egltestcommonu.def	Thu Apr 08 12:06:20 2010 +0100
@@ -4,87 +4,87 @@
 	?eglCreateImageKhrL@CTestEglSession@@QAEHHHHPAVRSgImage@@PBH@Z @ 3 NONAME ; int CTestEglSession::eglCreateImageKhrL(int, int, int, class RSgImage *, int const *)
 	?SwapChannels@CTestEglSession@@QAEXAAK@Z @ 4 NONAME ; void CTestEglSession::SwapChannels(unsigned long &)
 	??0TSgImageInfoOpenVgTarget@@QAE@XZ @ 5 NONAME ; TSgImageInfoOpenVgTarget::TSgImageInfoOpenVgTarget(void)
-	?CreateWindowSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHAAVRWindow@@HH@Z @ 6 NONAME ; void CTestEglSession::CreateWindowSurfaceAndMakeCurrentL(int, class RWindow &, int, int)
-	??1TSgImageInfoOpenVgImage@@QAE@XZ @ 7 NONAME ; TSgImageInfoOpenVgImage::~TSgImageInfoOpenVgImage(void)
-	?GetDisplayL@CEglTestStep@@IAEXXZ @ 8 NONAME ; void CEglTestStep::GetDisplayL(void)
-	?NewL@CTestEglSession@@SAPAV1@AAVCTestExecuteLogger@@AAHH@Z @ 9 NONAME ; class CTestEglSession * CTestEglSession::NewL(class CTestExecuteLogger &, int &, int)
-	?CheckImageDataL@CTestEglSession@@QAEXPAVCFbsBitmap@@@Z @ 10 NONAME ; void CTestEglSession::CheckImageDataL(class CFbsBitmap *)
-	?doProcessFunctionL@CEglTestStep@@MAEXH@Z @ 11 NONAME ; void CEglTestStep::doProcessFunctionL(int)
-	?CheckExpectedErrorL@CTestEglSession@@QAEXH@Z @ 12 NONAME ; void CTestEglSession::CheckExpectedErrorL(int)
-	?CheckVgDrawingL@CTestEglSession@@QAEXW4VGImageFormat@@PBVCFbsBitmap@@@Z @ 13 NONAME ; void CTestEglSession::CheckVgDrawingL(enum VGImageFormat, class CFbsBitmap const *)
-	?VgFormatToDisplayMode@EglTestConversion@@SA?AW4TDisplayMode@@W4VGImageFormat@@@Z @ 14 NONAME ; enum TDisplayMode EglTestConversion::VgFormatToDisplayMode(enum VGImageFormat)
-	?CreateReferenceMaskedBitmapL@CTestEglSession@@QAEPAVCFbsBitmap@@W4TDisplayMode@@ABVTRgb@@PBV2@@Z @ 15 NONAME ; class CFbsBitmap * CTestEglSession::CreateReferenceMaskedBitmapL(enum TDisplayMode, class TRgb const &, class CFbsBitmap const *)
-	?CreatePixmapSurfaceAndMakeCurrentAndMatchL@CTestEglSession@@QAEXABVTSize@@W4TDisplayMode@@HH@Z @ 16 NONAME ; void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentAndMatchL(class TSize const &, enum TDisplayMode, int, int)
-	?doTestStepPostambleL@CEglTestStep@@UAE?AW4TVerdict@@XZ @ 17 NONAME ; enum TVerdict CEglTestStep::doTestStepPostambleL(void)
-	?FetchProcEglDestroyImageKhr@CTestEglSession@@QAEHXZ @ 18 NONAME ; int CTestEglSession::FetchProcEglDestroyImageKhr(void)
-	??1CEglTestCommonIniSettings@@UAE@XZ @ 19 NONAME ; CEglTestCommonIniSettings::~CEglTestCommonIniSettings(void)
-	?Surface@CTestEglSession@@QBEHXZ @ 20 NONAME ; int CTestEglSession::Surface(void) const
-	?ConstructWindowL@CEglTestStep@@IAEXAAVRWindow@@ABVTRect@@@Z @ 21 NONAME ; void CEglTestStep::ConstructWindowL(class RWindow &, class TRect const &)
-	?NativeFbsBitmap@CTestEglSession@@QAEPAVCFbsBitmap@@XZ @ 22 NONAME ; class CFbsBitmap * CTestEglSession::NativeFbsBitmap(void)
-	?GetMatchType@@YA?AW4TEglConfigMatchType@@HW4TEglConfigMatchRule@@@Z @ 23 NONAME ; enum TEglConfigMatchType GetMatchType(int, enum TEglConfigMatchRule)
-	?GetConfigExactMatchL@CTestEglSession@@QAEHW4TEglTestConfig@@W4TEglConfigMatchRule@@@Z @ 24 NONAME ; int CTestEglSession::GetConfigExactMatchL(enum TEglTestConfig, enum TEglConfigMatchRule)
-	??0TSgImageInfoTest@@QAE@W4TUidPixelFormat@@VTSize@@@Z @ 25 NONAME ; TSgImageInfoTest::TSgImageInfoTest(enum TUidPixelFormat, class TSize)
-	?InitializeL@CTestEglSession@@QAEXH@Z @ 26 NONAME ; void CTestEglSession::InitializeL(int)
-	?CreateReferenceBitmapL@CTestEglSession@@QAEPAVCFbsBitmap@@W4TDisplayMode@@ABVTRgb@@@Z @ 27 NONAME ; class CFbsBitmap * CTestEglSession::CreateReferenceBitmapL(enum TDisplayMode, class TRgb const &)
-	?CreatePixmapSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHABVTSize@@W4TDisplayMode@@HH@Z @ 28 NONAME ; void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentL(int, class TSize const &, enum TDisplayMode, int, int)
-	??1TSgImageInfoOpenVgTarget@@QAE@XZ @ 29 NONAME ; TSgImageInfoOpenVgTarget::~TSgImageInfoOpenVgTarget(void)
-	?CreateEglSessionL@CEglTestStep@@QAEXH@Z @ 30 NONAME ; void CEglTestStep::CreateEglSessionL(int)
-	?CheckNeededExtensionL@CTestEglSession@@QAEHHABVTDesC16@@@Z @ 31 NONAME ; int CTestEglSession::CheckNeededExtensionL(int, class TDesC16 const &)
-	?TryUsePixmapRSgImageL@CTestEglSession@@QAEXXZ @ 32 NONAME ; void CTestEglSession::TryUsePixmapRSgImageL(void)
-	?TryUsePixmapCFbsBitmapOpenGlesL@CTestEglSession@@QAEXHABVTSize@@W4TDisplayMode@@H@Z @ 33 NONAME ; void CTestEglSession::TryUsePixmapCFbsBitmapOpenGlesL(int, class TSize const &, enum TDisplayMode, int)
-	?vgCreateImageTargetKHR@CTestEglSession@@QAEKH@Z @ 34 NONAME ; unsigned long CTestEglSession::vgCreateImageTargetKHR(int)
-	?DrawOpenGLesL@CTestEglSession@@QAEXXZ @ 35 NONAME ; void CTestEglSession::DrawOpenGLesL(void)
-	?CreateBitmap@CTestEglSession@@QAEHPAVCFbsBitmap@@ABVTSize@@W4TDisplayMode@@@Z @ 36 NONAME ; int CTestEglSession::CreateBitmap(class CFbsBitmap *, class TSize const &, enum TDisplayMode)
-	?doProcessFunctionL@CEglTestStep@@MAEXHABVTSgDrawableId@@@Z @ 37 NONAME ; void CEglTestStep::doProcessFunctionL(int, class TSgDrawableId const &)
-	?PixelsMatch@CTestEglSession@@QAEHABVTRgb@@0H@Z @ 38 NONAME ; int CTestEglSession::PixelsMatch(class TRgb const &, class TRgb const &, int)
-	?SetExpectedError@CTestEglSession@@QAEXH@Z @ 39 NONAME ; void CTestEglSession::SetExpectedError(int)
-	?CreateReferenceBitmapL@CTestEglSession@@QAEPAVCFbsBitmap@@W4TDisplayMode@@@Z @ 40 NONAME ; class CFbsBitmap * CTestEglSession::CreateReferenceBitmapL(enum TDisplayMode)
-	?VgFormatToWindowSurfaceFormat@EglTestConversion@@SA?AW4TEglTestConfig@@W4VGImageFormat@@@Z @ 41 NONAME ; enum TEglTestConfig EglTestConversion::VgFormatToWindowSurfaceFormat(enum VGImageFormat)
-	??0CEglTestStep@@IAE@XZ @ 42 NONAME ; CEglTestStep::CEglTestStep(void)
-	?NativeSgImage@CTestEglSession@@QAEAAVRSgImage@@XZ @ 43 NONAME ; class RSgImage & CTestEglSession::NativeSgImage(void)
-	?IsACompatibleConfig@CTestEglSession@@QAEHHAAVRSgImage@@H@Z @ 44 NONAME ; int CTestEglSession::IsACompatibleConfig(int, class RSgImage &, int)
-	?CheckImageDataVgL@CTestEglSession@@QAEXW4VGImageFormat@@@Z @ 45 NONAME ; void CTestEglSession::CheckImageDataVgL(enum VGImageFormat)
-	?ResetSurfaceAndContextSgImageL@CTestEglSession@@QAEXXZ @ 46 NONAME ; void CTestEglSession::ResetSurfaceAndContextSgImageL(void)
-	?PixelFormatToVgFormat@EglTestConversion@@SA?AW4VGImageFormat@@W4TUidPixelFormat@@@Z @ 47 NONAME ; enum VGImageFormat EglTestConversion::PixelFormatToVgFormat(enum TUidPixelFormat)
-	??0TSgImageInfoOpenVgImage@@QAE@W4TUidPixelFormat@@VTSize@@@Z @ 48 NONAME ; TSgImageInfoOpenVgImage::TSgImageInfoOpenVgImage(enum TUidPixelFormat, class TSize)
-	?CheckForExtensionL@CEglTestStep@@IAEHHABVTDesC16@@@Z @ 49 NONAME ; int CEglTestStep::CheckForExtensionL(int, class TDesC16 const &)
-	?Rendezvous@CEglTestStep@@IAEXH@Z @ 50 NONAME ; void CEglTestStep::Rendezvous(int)
-	?OpenWsSessionL@CEglTestStep@@IAEXH@Z @ 51 NONAME ; void CEglTestStep::OpenWsSessionL(int)
-	?TryUsePixmapRSgImageOpenGlesL@CTestEglSession@@QAEHHABVTSgImageInfo@@W4TResourceCloseRule@1@H@Z @ 52 NONAME ; int CTestEglSession::TryUsePixmapRSgImageOpenGlesL(int, class TSgImageInfo const &, enum CTestEglSession::TResourceCloseRule, int)
-	?eglCreateImageKhrL@CTestEglSession@@QAEHHHHAAVCFbsBitmap@@PBH@Z @ 53 NONAME ; int CTestEglSession::eglCreateImageKhrL(int, int, int, class CFbsBitmap &, int const *)
-	?VgFormatToSgPixelFormat@EglTestConversion@@SA?AW4TUidPixelFormat@@W4VGImageFormat@@@Z @ 54 NONAME ; enum TUidPixelFormat EglTestConversion::VgFormatToSgPixelFormat(enum VGImageFormat)
-	?NewLC@CEglTestCommonIniSettings@@SAPAV1@XZ @ 55 NONAME ; class CEglTestCommonIniSettings * CEglTestCommonIniSettings::NewLC(void)
-	?doThreadFunctionL@CEglTestStep@@MAEXH@Z @ 56 NONAME ; void CEglTestStep::doThreadFunctionL(int)
-	?TerminateDisplayL@CTestEglSession@@QAEXXZ @ 57 NONAME ; void CTestEglSession::TerminateDisplayL(void)
-	?PrintVGImageFormat@CEglTestStep@@IAEXW4VGImageFormat@@@Z @ 58 NONAME ; void CEglTestStep::PrintVGImageFormat(enum VGImageFormat)
-	?ConvertColor@CTestEglSession@@SAXABVTRgb@@PAM@Z @ 59 NONAME ; void CTestEglSession::ConvertColor(class TRgb const &, float *)
-	?DrawOpenVgL@CTestEglSession@@QAEXXZ @ 60 NONAME ; void CTestEglSession::DrawOpenVgL(void)
-	?doThreadFunctionL@CEglTestStep@@MAEXHABVTSgDrawableId@@@Z @ 61 NONAME ; void CEglTestStep::doThreadFunctionL(int, class TSgDrawableId const &)
-	?CloseFbsSession@CTestEglSession@@QAEXXZ @ 62 NONAME ; void CTestEglSession::CloseFbsSession(void)
-	?GetImageSize@CEglTestCommonIniSettings@@QAE?AVTSize@@ABVTDesC16@@@Z @ 63 NONAME ; class TSize CEglTestCommonIniSettings::GetImageSize(class TDesC16 const &)
-	?PrintUsedPixelConfiguration@CEglTestStep@@IAEXXZ @ 64 NONAME ; void CEglTestStep::PrintUsedPixelConfiguration(void)
-	?NewLC@CTestEglSession@@SAPAV1@AAVCTestExecuteLogger@@AAHH@Z @ 65 NONAME ; class CTestEglSession * CTestEglSession::NewLC(class CTestExecuteLogger &, int &, int)
-	?GetPixelFormatFromEglConfigL@CTestEglSession@@QAEPBVTMapEglConfigToPixelFormat@@H@Z @ 66 NONAME ; class TMapEglConfigToPixelFormat const * CTestEglSession::GetPixelFormatFromEglConfigL(int)
-	?TryUsePixmapCFbsBitmapOpenVgL@CTestEglSession@@QAEXHABVTSize@@W4TDisplayMode@@@Z @ 67 NONAME ; void CTestEglSession::TryUsePixmapCFbsBitmapOpenVgL(int, class TSize const &, enum TDisplayMode)
-	?CreatePixmapSurfaceAndMakeCurrentAndMatchL@CTestEglSession@@QAEXABVTSgImageInfo@@W4TResourceCloseRule@1@HH@Z @ 68 NONAME ; void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentAndMatchL(class TSgImageInfo const &, enum CTestEglSession::TResourceCloseRule, int, int)
-	?BytePerPixel@EglTestConversion@@SAHW4TUidPixelFormat@@@Z @ 69 NONAME ; int EglTestConversion::BytePerPixel(enum TUidPixelFormat)
-	?CheckImageDataGLesL@CTestEglSession@@QAEXXZ @ 70 NONAME ; void CTestEglSession::CheckImageDataGLesL(void)
-	?CreatePixmapSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHABVTSgImageInfo@@W4TResourceCloseRule@1@HH@Z @ 71 NONAME ; void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentL(int, class TSgImageInfo const &, enum CTestEglSession::TResourceCloseRule, int, int)
-	?VgFormatToPBufferSurfaceFormat@EglTestConversion@@SA?AW4TEglTestConfig@@W4VGImageFormat@@@Z @ 72 NONAME ; enum TEglTestConfig EglTestConversion::VgFormatToPBufferSurfaceFormat(enum VGImageFormat)
-	?TryUsePixmapRSgImageOpenVgL@CTestEglSession@@QAEHHABVTSgImageInfo@@W4TResourceCloseRule@1@@Z @ 73 NONAME ; int CTestEglSession::TryUsePixmapRSgImageOpenVgL(int, class TSgImageInfo const &, enum CTestEglSession::TResourceCloseRule)
-	?CloseWsSession@CEglTestStep@@IAEXXZ @ 74 NONAME ; void CEglTestStep::CloseWsSession(void)
-	??0TSgImageInfoTest@@QAE@XZ @ 75 NONAME ; TSgImageInfoTest::TSgImageInfoTest(void)
-	??1CEglTestStep@@UAE@XZ @ 76 NONAME ; CEglTestStep::~CEglTestStep(void)
-	?Test_MultiThreadL@CEglTestStep@@IAEXHH@Z @ 77 NONAME ; void CEglTestStep::Test_MultiThreadL(int, int)
-	?PartialInitialiseL@CEglTestStep@@QAEXABVTDesC16@@@Z @ 78 NONAME ; void CEglTestStep::PartialInitialiseL(class TDesC16 const &)
-	?CreatePbufferSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHABVTSize@@HH@Z @ 79 NONAME ; void CTestEglSession::CreatePbufferSurfaceAndMakeCurrentL(int, class TSize const &, int, int)
-	?Test_MultiProcessL@CEglTestStep@@IAEXABVTDesC16@@H0ABV?$RArray@VTSgDrawableId@@@@@Z @ 80 NONAME ; void CEglTestStep::Test_MultiProcessL(class TDesC16 const &, int, class TDesC16 const &, class RArray<class TSgDrawableId> const &)
-	?IsOpenVGSupported@CTestEglSession@@QAEHXZ @ 81 NONAME ; int CTestEglSession::IsOpenVGSupported(void)
-	?NewL@CEglTestCommonIniSettings@@SAPAV1@XZ @ 82 NONAME ; class CEglTestCommonIniSettings * CEglTestCommonIniSettings::NewL(void)
-	?PrintPixelFormat@CEglTestStep@@IAEXW4TUidPixelFormat@@@Z @ 83 NONAME ; void CEglTestStep::PrintPixelFormat(enum TUidPixelFormat)
-	?CheckExpectedError@CTestEglSession@@QAEHH@Z @ 84 NONAME ; int CTestEglSession::CheckExpectedError(int)
-	?GetVgFormat@CEglTestCommonIniSettings@@QAE?AW4VGImageFormat@@ABVTDesC16@@H@Z @ 85 NONAME ; enum VGImageFormat CEglTestCommonIniSettings::GetVgFormat(class TDesC16 const &, int)
-	?CleanupSurfaceFbsBitmapL@CTestEglSession@@QAEXXZ @ 86 NONAME ; void CTestEglSession::CleanupSurfaceFbsBitmapL(void)
+	??1TSgImageInfoOpenVgImage@@QAE@XZ @ 6 NONAME ; TSgImageInfoOpenVgImage::~TSgImageInfoOpenVgImage(void)
+	?GetDisplayL@CEglTestStep@@IAEXXZ @ 7 NONAME ; void CEglTestStep::GetDisplayL(void)
+	?NewL@CTestEglSession@@SAPAV1@AAVCTestExecuteLogger@@AAHH@Z @ 8 NONAME ; class CTestEglSession * CTestEglSession::NewL(class CTestExecuteLogger &, int &, int)
+	?CheckImageDataL@CTestEglSession@@QAEXPAVCFbsBitmap@@@Z @ 9 NONAME ; void CTestEglSession::CheckImageDataL(class CFbsBitmap *)
+	?doProcessFunctionL@CEglTestStep@@MAEXH@Z @ 10 NONAME ; void CEglTestStep::doProcessFunctionL(int)
+	?CheckExpectedErrorL@CTestEglSession@@QAEXH@Z @ 11 NONAME ; void CTestEglSession::CheckExpectedErrorL(int)
+	?CheckVgDrawingL@CTestEglSession@@QAEXW4VGImageFormat@@PBVCFbsBitmap@@@Z @ 12 NONAME ; void CTestEglSession::CheckVgDrawingL(enum VGImageFormat, class CFbsBitmap const *)
+	?VgFormatToDisplayMode@EglTestConversion@@SA?AW4TDisplayMode@@W4VGImageFormat@@@Z @ 13 NONAME ; enum TDisplayMode EglTestConversion::VgFormatToDisplayMode(enum VGImageFormat)
+	?CreateReferenceMaskedBitmapL@CTestEglSession@@QAEPAVCFbsBitmap@@W4TDisplayMode@@ABVTRgb@@PBV2@@Z @ 14 NONAME ; class CFbsBitmap * CTestEglSession::CreateReferenceMaskedBitmapL(enum TDisplayMode, class TRgb const &, class CFbsBitmap const *)
+	?CreatePixmapSurfaceAndMakeCurrentAndMatchL@CTestEglSession@@QAEXABVTSize@@W4TDisplayMode@@HH@Z @ 15 NONAME ; void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentAndMatchL(class TSize const &, enum TDisplayMode, int, int)
+	?doTestStepPostambleL@CEglTestStep@@UAE?AW4TVerdict@@XZ @ 16 NONAME ; enum TVerdict CEglTestStep::doTestStepPostambleL(void)
+	?FetchProcEglDestroyImageKhr@CTestEglSession@@QAEHXZ @ 17 NONAME ; int CTestEglSession::FetchProcEglDestroyImageKhr(void)
+	??1CEglTestCommonIniSettings@@UAE@XZ @ 18 NONAME ; CEglTestCommonIniSettings::~CEglTestCommonIniSettings(void)
+	?Surface@CTestEglSession@@QBEHXZ @ 19 NONAME ; int CTestEglSession::Surface(void) const
+	?ConstructWindowL@CEglTestStep@@IAEXAAVRWindow@@ABVTRect@@@Z @ 20 NONAME ; void CEglTestStep::ConstructWindowL(class RWindow &, class TRect const &)
+	?NativeFbsBitmap@CTestEglSession@@QAEPAVCFbsBitmap@@XZ @ 21 NONAME ; class CFbsBitmap * CTestEglSession::NativeFbsBitmap(void)
+	?GetMatchType@@YA?AW4TEglConfigMatchType@@HW4TEglConfigMatchRule@@@Z @ 22 NONAME ; enum TEglConfigMatchType GetMatchType(int, enum TEglConfigMatchRule)
+	?GetConfigExactMatchL@CTestEglSession@@QAEHW4TEglTestConfig@@W4TEglConfigMatchRule@@@Z @ 23 NONAME ; int CTestEglSession::GetConfigExactMatchL(enum TEglTestConfig, enum TEglConfigMatchRule)
+	??0TSgImageInfoTest@@QAE@W4TUidPixelFormat@@VTSize@@@Z @ 24 NONAME ; TSgImageInfoTest::TSgImageInfoTest(enum TUidPixelFormat, class TSize)
+	?InitializeL@CTestEglSession@@QAEXH@Z @ 25 NONAME ; void CTestEglSession::InitializeL(int)
+	?CreateReferenceBitmapL@CTestEglSession@@QAEPAVCFbsBitmap@@W4TDisplayMode@@ABVTRgb@@@Z @ 26 NONAME ; class CFbsBitmap * CTestEglSession::CreateReferenceBitmapL(enum TDisplayMode, class TRgb const &)
+	?CreatePixmapSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHABVTSize@@W4TDisplayMode@@HH@Z @ 27 NONAME ; void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentL(int, class TSize const &, enum TDisplayMode, int, int)
+	??1TSgImageInfoOpenVgTarget@@QAE@XZ @ 28 NONAME ; TSgImageInfoOpenVgTarget::~TSgImageInfoOpenVgTarget(void)
+	?CreateEglSessionL@CEglTestStep@@QAEXH@Z @ 29 NONAME ; void CEglTestStep::CreateEglSessionL(int)
+	?CheckNeededExtensionL@CTestEglSession@@QAEHHABVTDesC16@@@Z @ 30 NONAME ; int CTestEglSession::CheckNeededExtensionL(int, class TDesC16 const &)
+	?TryUsePixmapRSgImageL@CTestEglSession@@QAEXXZ @ 31 NONAME ; void CTestEglSession::TryUsePixmapRSgImageL(void)
+	?TryUsePixmapCFbsBitmapOpenGlesL@CTestEglSession@@QAEXHABVTSize@@W4TDisplayMode@@H@Z @ 32 NONAME ; void CTestEglSession::TryUsePixmapCFbsBitmapOpenGlesL(int, class TSize const &, enum TDisplayMode, int)
+	?vgCreateImageTargetKHR@CTestEglSession@@QAEKH@Z @ 33 NONAME ; unsigned long CTestEglSession::vgCreateImageTargetKHR(int)
+	?DrawOpenGLesL@CTestEglSession@@QAEXXZ @ 34 NONAME ; void CTestEglSession::DrawOpenGLesL(void)
+	?CreateBitmap@CTestEglSession@@QAEHPAVCFbsBitmap@@ABVTSize@@W4TDisplayMode@@@Z @ 35 NONAME ; int CTestEglSession::CreateBitmap(class CFbsBitmap *, class TSize const &, enum TDisplayMode)
+	?doProcessFunctionL@CEglTestStep@@MAEXHABVTSgDrawableId@@@Z @ 36 NONAME ; void CEglTestStep::doProcessFunctionL(int, class TSgDrawableId const &)
+	?PixelsMatch@CTestEglSession@@QAEHABVTRgb@@0H@Z @ 37 NONAME ; int CTestEglSession::PixelsMatch(class TRgb const &, class TRgb const &, int)
+	?SetExpectedError@CTestEglSession@@QAEXH@Z @ 38 NONAME ; void CTestEglSession::SetExpectedError(int)
+	?CreateReferenceBitmapL@CTestEglSession@@QAEPAVCFbsBitmap@@W4TDisplayMode@@@Z @ 39 NONAME ; class CFbsBitmap * CTestEglSession::CreateReferenceBitmapL(enum TDisplayMode)
+	?VgFormatToWindowSurfaceFormat@EglTestConversion@@SA?AW4TEglTestConfig@@W4VGImageFormat@@@Z @ 40 NONAME ; enum TEglTestConfig EglTestConversion::VgFormatToWindowSurfaceFormat(enum VGImageFormat)
+	??0CEglTestStep@@IAE@XZ @ 41 NONAME ; CEglTestStep::CEglTestStep(void)
+	?NativeSgImage@CTestEglSession@@QAEAAVRSgImage@@XZ @ 42 NONAME ; class RSgImage & CTestEglSession::NativeSgImage(void)
+	?IsACompatibleConfig@CTestEglSession@@QAEHHAAVRSgImage@@H@Z @ 43 NONAME ; int CTestEglSession::IsACompatibleConfig(int, class RSgImage &, int)
+	?CheckImageDataVgL@CTestEglSession@@QAEXW4VGImageFormat@@@Z @ 44 NONAME ; void CTestEglSession::CheckImageDataVgL(enum VGImageFormat)
+	?ResetSurfaceAndContextSgImageL@CTestEglSession@@QAEXXZ @ 45 NONAME ; void CTestEglSession::ResetSurfaceAndContextSgImageL(void)
+	?PixelFormatToVgFormat@EglTestConversion@@SA?AW4VGImageFormat@@W4TUidPixelFormat@@@Z @ 46 NONAME ; enum VGImageFormat EglTestConversion::PixelFormatToVgFormat(enum TUidPixelFormat)
+	??0TSgImageInfoOpenVgImage@@QAE@W4TUidPixelFormat@@VTSize@@@Z @ 47 NONAME ; TSgImageInfoOpenVgImage::TSgImageInfoOpenVgImage(enum TUidPixelFormat, class TSize)
+	?CheckForExtensionL@CEglTestStep@@IAEHHABVTDesC16@@@Z @ 48 NONAME ; int CEglTestStep::CheckForExtensionL(int, class TDesC16 const &)
+	?Rendezvous@CEglTestStep@@IAEXH@Z @ 49 NONAME ; void CEglTestStep::Rendezvous(int)
+	?OpenWsSessionL@CEglTestStep@@IAEXH@Z @ 50 NONAME ; void CEglTestStep::OpenWsSessionL(int)
+	?TryUsePixmapRSgImageOpenGlesL@CTestEglSession@@QAEHHABVTSgImageInfo@@W4TResourceCloseRule@1@H@Z @ 51 NONAME ; int CTestEglSession::TryUsePixmapRSgImageOpenGlesL(int, class TSgImageInfo const &, enum CTestEglSession::TResourceCloseRule, int)
+	?eglCreateImageKhrL@CTestEglSession@@QAEHHHHAAVCFbsBitmap@@PBH@Z @ 52 NONAME ; int CTestEglSession::eglCreateImageKhrL(int, int, int, class CFbsBitmap &, int const *)
+	?VgFormatToSgPixelFormat@EglTestConversion@@SA?AW4TUidPixelFormat@@W4VGImageFormat@@@Z @ 53 NONAME ; enum TUidPixelFormat EglTestConversion::VgFormatToSgPixelFormat(enum VGImageFormat)
+	?NewLC@CEglTestCommonIniSettings@@SAPAV1@XZ @ 54 NONAME ; class CEglTestCommonIniSettings * CEglTestCommonIniSettings::NewLC(void)
+	?doThreadFunctionL@CEglTestStep@@MAEXH@Z @ 55 NONAME ; void CEglTestStep::doThreadFunctionL(int)
+	?TerminateDisplayL@CTestEglSession@@QAEXXZ @ 56 NONAME ; void CTestEglSession::TerminateDisplayL(void)
+	?PrintVGImageFormat@CEglTestStep@@IAEXW4VGImageFormat@@@Z @ 57 NONAME ; void CEglTestStep::PrintVGImageFormat(enum VGImageFormat)
+	?ConvertColor@CTestEglSession@@SAXABVTRgb@@PAM@Z @ 58 NONAME ; void CTestEglSession::ConvertColor(class TRgb const &, float *)
+	?DrawOpenVgL@CTestEglSession@@QAEXXZ @ 59 NONAME ; void CTestEglSession::DrawOpenVgL(void)
+	?doThreadFunctionL@CEglTestStep@@MAEXHABVTSgDrawableId@@@Z @ 60 NONAME ; void CEglTestStep::doThreadFunctionL(int, class TSgDrawableId const &)
+	?CloseFbsSession@CTestEglSession@@QAEXXZ @ 61 NONAME ; void CTestEglSession::CloseFbsSession(void)
+	?GetImageSize@CEglTestCommonIniSettings@@QAE?AVTSize@@ABVTDesC16@@@Z @ 62 NONAME ; class TSize CEglTestCommonIniSettings::GetImageSize(class TDesC16 const &)
+	?PrintUsedPixelConfiguration@CEglTestStep@@IAEXXZ @ 63 NONAME ; void CEglTestStep::PrintUsedPixelConfiguration(void)
+	?NewLC@CTestEglSession@@SAPAV1@AAVCTestExecuteLogger@@AAHH@Z @ 64 NONAME ; class CTestEglSession * CTestEglSession::NewLC(class CTestExecuteLogger &, int &, int)
+	?GetPixelFormatFromEglConfigL@CTestEglSession@@QAEPBVTMapEglConfigToPixelFormat@@H@Z @ 65 NONAME ; class TMapEglConfigToPixelFormat const * CTestEglSession::GetPixelFormatFromEglConfigL(int)
+	?TryUsePixmapCFbsBitmapOpenVgL@CTestEglSession@@QAEXHABVTSize@@W4TDisplayMode@@@Z @ 66 NONAME ; void CTestEglSession::TryUsePixmapCFbsBitmapOpenVgL(int, class TSize const &, enum TDisplayMode)
+	?CreatePixmapSurfaceAndMakeCurrentAndMatchL@CTestEglSession@@QAEXABVTSgImageInfo@@W4TResourceCloseRule@1@HH@Z @ 67 NONAME ; void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentAndMatchL(class TSgImageInfo const &, enum CTestEglSession::TResourceCloseRule, int, int)
+	?BytePerPixel@EglTestConversion@@SAHW4TUidPixelFormat@@@Z @ 68 NONAME ; int EglTestConversion::BytePerPixel(enum TUidPixelFormat)
+	?CheckImageDataGLesL@CTestEglSession@@QAEXXZ @ 69 NONAME ; void CTestEglSession::CheckImageDataGLesL(void)
+	?CreatePixmapSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHABVTSgImageInfo@@W4TResourceCloseRule@1@HH@Z @ 70 NONAME ; void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentL(int, class TSgImageInfo const &, enum CTestEglSession::TResourceCloseRule, int, int)
+	?VgFormatToPBufferSurfaceFormat@EglTestConversion@@SA?AW4TEglTestConfig@@W4VGImageFormat@@@Z @ 71 NONAME ; enum TEglTestConfig EglTestConversion::VgFormatToPBufferSurfaceFormat(enum VGImageFormat)
+	?TryUsePixmapRSgImageOpenVgL@CTestEglSession@@QAEHHABVTSgImageInfo@@W4TResourceCloseRule@1@@Z @ 72 NONAME ; int CTestEglSession::TryUsePixmapRSgImageOpenVgL(int, class TSgImageInfo const &, enum CTestEglSession::TResourceCloseRule)
+	?CloseWsSession@CEglTestStep@@IAEXXZ @ 73 NONAME ; void CEglTestStep::CloseWsSession(void)
+	??0TSgImageInfoTest@@QAE@XZ @ 74 NONAME ; TSgImageInfoTest::TSgImageInfoTest(void)
+	??1CEglTestStep@@UAE@XZ @ 75 NONAME ; CEglTestStep::~CEglTestStep(void)
+	?Test_MultiThreadL@CEglTestStep@@IAEXHH@Z @ 76 NONAME ; void CEglTestStep::Test_MultiThreadL(int, int)
+	?PartialInitialiseL@CEglTestStep@@QAEXABVTDesC16@@@Z @ 77 NONAME ; void CEglTestStep::PartialInitialiseL(class TDesC16 const &)
+	?CreatePbufferSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHABVTSize@@HH@Z @ 78 NONAME ; void CTestEglSession::CreatePbufferSurfaceAndMakeCurrentL(int, class TSize const &, int, int)
+	?Test_MultiProcessL@CEglTestStep@@IAEXABVTDesC16@@H0ABV?$RArray@VTSgDrawableId@@@@@Z @ 79 NONAME ; void CEglTestStep::Test_MultiProcessL(class TDesC16 const &, int, class TDesC16 const &, class RArray<class TSgDrawableId> const &)
+	?IsOpenVGSupported@CTestEglSession@@QAEHXZ @ 80 NONAME ; int CTestEglSession::IsOpenVGSupported(void)
+	?NewL@CEglTestCommonIniSettings@@SAPAV1@XZ @ 81 NONAME ; class CEglTestCommonIniSettings * CEglTestCommonIniSettings::NewL(void)
+	?PrintPixelFormat@CEglTestStep@@IAEXW4TUidPixelFormat@@@Z @ 82 NONAME ; void CEglTestStep::PrintPixelFormat(enum TUidPixelFormat)
+	?CheckExpectedError@CTestEglSession@@QAEHH@Z @ 83 NONAME ; int CTestEglSession::CheckExpectedError(int)
+	?GetVgFormat@CEglTestCommonIniSettings@@QAE?AW4VGImageFormat@@ABVTDesC16@@H@Z @ 84 NONAME ; enum VGImageFormat CEglTestCommonIniSettings::GetVgFormat(class TDesC16 const &, int)
+	?CleanupSurfaceFbsBitmapL@CTestEglSession@@QAEXXZ @ 85 NONAME ; void CTestEglSession::CleanupSurfaceFbsBitmapL(void)
+	?CreateWindowSurfaceAndMakeCurrentL@CTestEglSession@@QAEXHAAVRWindow@@HHH@Z @ 86 NONAME ; void CTestEglSession::CreateWindowSurfaceAndMakeCurrentL(int, class RWindow &, int, int, int)
 	?CloseSgDriver@CTestEglSession@@QAEXXZ @ 87 NONAME ; void CTestEglSession::CloseSgDriver(void)
 	?doTestStepPreambleL@CEglTestStep@@UAE?AW4TVerdict@@XZ @ 88 NONAME ; enum TVerdict CEglTestStep::doTestStepPreambleL(void)
 	??0CTestEglSession@@IAE@AAVCTestExecuteLogger@@AAHH@Z @ 89 NONAME ; CTestEglSession::CTestEglSession(class CTestExecuteLogger &, int &, int)
@@ -116,4 +116,7 @@
 	?GetNumberOfFormats@CEglTestCommonIniSettings@@QAEHABVTDesC16@@@Z @ 115 NONAME ; int CEglTestCommonIniSettings::GetNumberOfFormats(class TDesC16 const &)
 	?Test_MultiProcessL@CEglTestStep@@IAEXABVTDesC16@@H0ABVTSgDrawableId@@@Z @ 116 NONAME ; void CEglTestStep::Test_MultiProcessL(class TDesC16 const &, int, class TDesC16 const &, class TSgDrawableId const &)
 	?PixelFormatToDisplayMode@EglTestConversion@@SA?AW4TDisplayMode@@W4TUidPixelFormat@@@Z @ 117 NONAME ; enum TDisplayMode EglTestConversion::PixelFormatToDisplayMode(enum TUidPixelFormat)
+	?GetThresholdGPUUsedMemory@CEglTestCommonIniSettings@@QAEHABVTDesC16@@@Z @ 118 NONAME ; int CEglTestCommonIniSettings::GetThresholdGPUUsedMemory(class TDesC16 const &)
+	?GetThresholdLastIteration@CEglTestCommonIniSettings@@QAEHABVTDesC16@@@Z @ 119 NONAME ; int CEglTestCommonIniSettings::GetThresholdLastIteration(class TDesC16 const &)
+	?GetWindowSize@CEglTestCommonIniSettings@@QAE?AVTSize@@ABVTDesC16@@@Z @ 120 NONAME ; class TSize CEglTestCommonIniSettings::GetWindowSize(class TDesC16 const &)
 
--- a/egl/egltest/eabi/egltestcommonu.def	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/eabi/egltestcommonu.def	Thu Apr 08 12:06:20 2010 +0100
@@ -82,7 +82,7 @@
 	_ZN15CTestEglSession31TryUsePixmapCFbsBitmapOpenGlesLEiRK5TSize12TDisplayModei @ 81 NONAME
 	_ZN15CTestEglSession34CreatePixmapSurfaceAndMakeCurrentLEiRK12TSgImageInfoNS_18TResourceCloseRuleEii @ 82 NONAME
 	_ZN15CTestEglSession34CreatePixmapSurfaceAndMakeCurrentLEiRK5TSize12TDisplayModeii @ 83 NONAME
-	_ZN15CTestEglSession34CreateWindowSurfaceAndMakeCurrentLEiR7RWindowii @ 84 NONAME
+	_ZN15CTestEglSession34CreateWindowSurfaceAndMakeCurrentLEiR7RWindowiii @ 84 NONAME
 	_ZN15CTestEglSession35CreatePbufferSurfaceAndMakeCurrentLEiRK5TSizeii @ 85 NONAME
 	_ZN15CTestEglSession42CreatePixmapSurfaceAndMakeCurrentAndMatchLERK12TSgImageInfoNS_18TResourceCloseRuleEii @ 86 NONAME
 	_ZN15CTestEglSession42CreatePixmapSurfaceAndMakeCurrentAndMatchLERK5TSize12TDisplayModeii @ 87 NONAME
@@ -135,4 +135,7 @@
 	_ZTI15CTestEglSession @ 134 NONAME
 	_ZTV12CEglTestStep @ 135 NONAME
 	_ZTV15CTestEglSession @ 136 NONAME
+	_ZN25CEglTestCommonIniSettings13GetWindowSizeERK7TDesC16 @ 137 NONAME
+	_ZN25CEglTestCommonIniSettings25GetThresholdGPUUsedMemoryERK7TDesC16 @ 138 NONAME
+	_ZN25CEglTestCommonIniSettings25GetThresholdLastIterationERK7TDesC16 @ 139 NONAME
 
--- a/egl/egltest/group/egltest.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/group/egltest.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -85,6 +85,7 @@
 LIBRARY                 graphicsscreencomparison.lib
 LIBRARY                 egltestcommon.lib
 LIBRARY                 tprofiler.lib
+LIBRARY                 estor.lib
 
 DEFFILE                 egltest.def
 
--- a/egl/egltest/group/egltestcommonprocess.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/group/egltestcommonprocess.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -33,4 +33,6 @@
 LIBRARY                 libEGL.lib
 LIBRARY                 egltestcommon.lib
 
+CAPABILITY PowerMgmt
+
 SMPSAFE
--- a/egl/egltest/group/egltestserver.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/group/egltestserver.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -24,7 +24,7 @@
 UID 			0x1000007a 0xA000E61B
 VENDORID                0x70000001
 
-CAPABILITY 		none
+CAPABILITY 		PowerMgmt
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
--- a/egl/egltest/inc/egltest_benchmark_sgimage.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/inc/egltest_benchmark_sgimage.h	Thu Apr 08 12:06:20 2010 +0100
@@ -63,6 +63,9 @@
 public: 
     // from CTestStep
     TVerdict doTestStepL();
+protected:
+    // from CEglTestStep
+    void doProcessFunctionL(TInt aIdx);
     };
 
 #endif // __EGLTEST_BENCHMARK_SGIMAGE_H__
--- a/egl/egltest/inc/egltest_image_multiprocess.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/inc/egltest_image_multiprocess.h	Thu Apr 08 12:06:20 2010 +0100
@@ -129,17 +129,6 @@
     void doProcessFunctionL(TInt aIdx);
     };
 
-_LIT(KEGL_Image_Multi_Process_VgImage_ProcessTerminate2, "EGL_Image_Multi_Process_VgImage_ProcessTerminate2");
-NONSHARABLE_CLASS(CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate2) : public CEglTestStep
-    {
-public:
-	// from CTestStep
-	TVerdict doTestStepL();
-protected:
-    // from CEglTestStep
-    void doProcessFunctionL(TInt aIdx);
-    };
-
 _LIT(KEGL_Image_Multi_Process_VgImage_ProcessTerminateNegative, "EGL_Image_Multi_Process_VgImage_ProcessTerminateNegative");
 NONSHARABLE_CLASS(CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminateNegative) : public CEglTestStep
     {
--- a/egl/egltest/inc/egltestcommoninisettings.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/inc/egltestcommoninisettings.h	Thu Apr 08 12:06:20 2010 +0100
@@ -66,6 +66,10 @@
 	IMPORT_C TInt GetNumberOfFormats(const TDesC& aSectioName);
     IMPORT_C TInt GetNumberOfIterations(const TDesC& aSectioName);
     IMPORT_C TSize GetImageSize(const TDesC& aSectioName); 
+    IMPORT_C TInt GetThresholdGPUUsedMemory(const TDesC& aSectioName);
+    IMPORT_C TInt GetThresholdLastIteration(const TDesC& aSectioName);
+    IMPORT_C TSize GetWindowSize(const TDesC& aSectioName); 
+    
 private:
 	void ConstructL();
 private:
--- a/egl/egltest/inc/egltestcommonprocess.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/inc/egltestcommonprocess.h	Thu Apr 08 12:06:20 2010 +0100
@@ -46,7 +46,8 @@
 	EProcSlotMsgQueueSgId,
 	EProcSlotMsgQueueProcId,
 	EProcSlotSourceFormat,
-	EProcSlotSurfaceFormat
+	EProcSlotSurfaceFormat,
+	EProcSlotCustomClientParam //data that could be sent from client to main process. Concrete implementation will need to specify the format
 	};
 
 class EglTestCommonProcess
--- a/egl/egltest/inc/egltestcommonsession.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/inc/egltestcommonsession.h	Thu Apr 08 12:06:20 2010 +0100
@@ -104,9 +104,9 @@
 	//
 	//Compound functions that construct surface 
 	//
-	IMPORT_C void CreateWindowSurfaceAndMakeCurrentL(EGLConfig aConfig, RWindow& aWindow, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);	
+	IMPORT_C void CreateWindowSurfaceAndMakeCurrentL(EGLConfig aConfig, RWindow& aWindow, TBool aVgAlphaFormatPre = EFalse, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);	
 	IMPORT_C void CreatePixmapSurfaceAndMakeCurrentAndMatchL(const TSgImageInfo& aImageInfo, TResourceCloseRule aResourceCloseRule, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);
-	IMPORT_C void CreatePixmapSurfaceAndMakeCurrentAndMatchL(const TSize& aSize, TDisplayMode displayMode, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);
+	IMPORT_C void CreatePixmapSurfaceAndMakeCurrentAndMatchL(const TSize& aSize, TDisplayMode aDisplayMode, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);
     IMPORT_C void CreatePbufferSurfaceAndMakeCurrentL(EGLConfig aConfig, const TSize& aSize, EGLenum aBindAPI = EGL_OPENVG_API, TInt aRenderVersionNumber = 1);
 
     //
--- a/egl/egltest/inc/egltestcommonstep.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/inc/egltestcommonstep.h	Thu Apr 08 12:06:20 2010 +0100
@@ -21,6 +21,7 @@
 #ifndef EGLTESTCOMMONSTEP_H
 #define EGLTESTCOMMONSTEP_H
 
+#include <e32msgqueue.h>
 #include <EGL/egl.h>
 #include <VG/openvg.h>
 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
@@ -40,6 +41,10 @@
 
 class RWindow;
 
+struct TEglStepMessageBuffer
+    {
+    TInt iBuf[64];
+    };
 
 /**
 Abstract base class for Egl test steps
@@ -120,6 +125,7 @@
 	IMPORT_C void GetDisplayL();
 	IMPORT_C void TerminateDisplayL();	
 
+	virtual void ReceiveMessageFromClient(RMsgQueue<TEglStepMessageBuffer>& /*aMessageQueueClientProcParam*/) {}
 protected:
 	// Session object as required for most tests
 	CTestEglSession* 	iEglSess;
--- a/egl/egltest/scripts/egltest_settings.ini	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/scripts/egltest_settings.ini	Thu Apr 08 12:06:20 2010 +0100
@@ -38,10 +38,10 @@
 NumIterations=1000
 
 [Benchmark]
-NumIterations = 400 // Needs to be set with care. Making this value bigger may cause an allocation failure 
-                    // on the emulator, it fails to create SgImage at some point.
+NumIterations = 300 // Needs to be set with care. Making this value greater may cause an allocation failure.
+                    // On the emulator, it fails to create SgImage at some point.
                     // Hardware will have their own limitations which also need to be considered.
 ImageWidth = 50 // width of RSgImage
-ImageHeight = 50 // height if RSgImage
+ImageHeight = 50 // height of RSgImage
 NumFormats = 1
 Format0 = EUidPixelFormatARGB_8888_PRE
--- a/egl/egltest/scripts/egltest_t_benchmark_sgimage.script	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/scripts/egltest_t_benchmark_sgimage.script	Thu Apr 08 12:06:20 2010 +0100
@@ -20,4 +20,4 @@
 
 RUN_TEST_STEP 100 egltestserver Benchmark_CreateCloseImage
 RUN_TEST_STEP 100 egltestserver Benchmark_Multi_Process_CreateCloseImage
-RUN_TEST_STEP 100 egltestserver Benchmark_DrawImage
+RUN_TEST_STEP 300 egltestserver Benchmark_DrawImage
--- a/egl/egltest/scripts/egltest_t_image_multiprocess.script	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/scripts/egltest_t_image_multiprocess.script	Thu Apr 08 12:06:20 2010 +0100
@@ -32,7 +32,6 @@
 RUN_TEST_STEP 100 egltestserver EGL_Image_Multi_Process_ThemeServer
 
 RUN_TEST_STEP 100 egltestserver EGL_Image_Multi_Process_VgImage_ProcessTerminate
-RUN_TEST_STEP 100 egltestserver EGL_Image_Multi_Process_VgImage_ProcessTerminate2
 RUN_TEST_STEP 100 egltestserver EGL_Image_Multi_Process_VgImage_ProcessTerminateNegative
 RUN_TEST_STEP 100 egltestserver EGL_Image_Multi_Process_VgImage_ReadWrite
 
--- a/egl/egltest/scripts/egltest_t_syncobject.script	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/scripts/egltest_t_syncobject.script	Thu Apr 08 12:06:20 2010 +0100
@@ -17,22 +17,22 @@
 PRINT Run EGL Sync Object tests excluding WaitFlush test which requires OpenVG and OpenGL ES
 LOAD_SUITE egltestserver
 
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_GetProcAddress 						z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_CreateDestroy 						z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_WaitSignal 							z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_WaitSignal2 						z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_WaitDelete 							z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_WaitWithTimeoutExpired 				z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_SignalBeforeTimeoutExpired 			z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_DeleteBeforeTimeoutExpired 			z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Multithread_SignalBeforeTimeout 	z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Multithread_SignalAfterTimeout 		z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Multithread_WaitOnTwoSyncObject 	z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Wait_TestMode 						z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Multithread_Deletion 				z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Stress 								z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Terminate 							z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Positive_TerminateBeforeTimeoutExpired 		z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Negative_WrongParameters 					z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Negative_SignalImpl 							z:\egltest\egltest_settings.ini
-RUN_TEST_STEP 100 egltestserver SyncObject_Negative_OOM 								z:\egltest\egltest_settings.ini
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_GetProcAddress 						z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_CreateDestroy 						z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_WaitSignal 							z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_WaitSignal2 						z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_WaitDelete 							z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_WaitWithTimeoutExpired 				z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_SignalBeforeTimeoutExpired 			z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_DeleteBeforeTimeoutExpired 			z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Multithread_SignalBeforeTimeout 	z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Multithread_SignalAfterTimeout 		z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Multithread_WaitOnTwoSyncObject 	z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Wait_TestMode 						z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Multithread_Deletion 				z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Stress 								z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_Terminate 							z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Positive_TerminateBeforeTimeoutExpired 		z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Negative_WrongParameters 					z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Negative_SignalImpl 							z:\egltest\egltest_settings.ini	SyncObject
+RUN_TEST_STEP 100 egltestserver SyncObject_Negative_OOM 								z:\egltest\egltest_settings.ini	SyncObject
--- a/egl/egltest/src/egltest_benchmark_sgimage.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltest_benchmark_sgimage.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -36,6 +36,13 @@
 
 _LIT(KBenchmarkSection, "Benchmark");
 
+#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
+const TInt KBenchmarkDrawImageThreshold = 5; //semi-arbitrary number which signifies deviation in percentage between min and max number of image drawing
+#endif
+
+
+#define ENABLE_BENCHMARK_VERBOSE_LOGGING    1
+
 //data will be used to cleanup VgImages if leaving occurs
 NONSHARABLE_CLASS(CVgImageDeleteData) : public CBase
     {
@@ -163,7 +170,7 @@
     return CEglTestStep::doTestStepPostambleL();
     }
 
-//-------
+
 
 /**
 @SYMTestCaseID GRAPHICS-EGL-0434
@@ -270,9 +277,6 @@
 
 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 	INFO_PRINTF1(_L("CEglTest_Benchmark_CreateCloseImage can only be run with SgImage-Lite"));
-	RecordTestResultL();
-	CloseTMSGraphicsStep();
-	return TestStepResult();
 #else
     TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KVG_KHR_EGL_image | KEGL_KHR_image_pixmap);
     if(!ret)
@@ -487,10 +491,10 @@
     CleanupStack::PopAndDestroy(3, vgImageDeleteData);  // vgImageDeleteData, sgImageData, eglImageDeleteData  
     
     CleanAll();
+#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
     RecordTestResultL();
     CloseTMSGraphicsStep();
     return TestStepResult();
-#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
     }
 
 /**
@@ -569,9 +573,6 @@
 
 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 	INFO_PRINTF1(_L("CEglTest_Benchmark_Multi_Process_CreateCloseImage can only be run with SgImage-Lite"));
-	RecordTestResultL();
-	CloseTMSGraphicsStep();
-	return TestStepResult();
 #else
     TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KVG_KHR_EGL_image | KEGL_KHR_image_pixmap);
     if(!ret)
@@ -585,10 +586,10 @@
     // launch 2 processes
     Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
     
+#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
     RecordTestResultL();
     CloseTMSGraphicsStep();
     return TestStepResult();
-#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
     }
 
 void CEglTest_Benchmark_Multi_Process_CreateCloseImage::doProcessFunctionL(TInt aIdx)
@@ -764,7 +765,12 @@
 @SYMPREQ 2637
 
 @SYMTestCaseDesc
-    Performance test - Drawing VGImage
+    Performance test - Drawing of VGImage
+
+@SYMTestPurpose             
+Compare the relative speed of drawing a regular pre-existing VGImage with the 
+speed of mapping in a VGImage (starting with a drawable id) and then drawing that.
+
 @SYMTestActions
 Environmental settings:
 •   Image Size: w50 h50
@@ -772,195 +778,327 @@
 •   Pixel format ESgPixelFormatARGB_8888_PRE
 •   Number of benchmark iteration: N (may vary depending on hardware capacity)
 
-Creating regular VGImage
-Init EGL, create context and surface
-For i = 0 to N
-    Create VGImage[i] with size: 50x50 and format:  VG_sARGB_8888_PRE
-    SetSubData for VGImage[i] 
-End loop
-
-Draw VGImage
-For i = N to 0
-    Start timer
-    Draw VGImage[i]
-    Stop timer and record time
-End loop
-Record average time of drawing VGImage
-
-Closing regular VGImage
-For i = N to 0
-    Destroy VGImage[i]
-End loop
-
-Creating VGImage from initialized RSgImage
+From the main test process:
+Spawn two processes A and B
+From process A:
 Open RSgDriver
 Construct TSgImageInfo object with
 •   Size: 50x50
 •   PixelFormat: ESgPixelFormatARGB_8888_PRE
 •   Usage: ESgUsageBitOpenVgImage;
 
-For i = N to 0
-    Create RSgImage[i] with arguments TSgImageInfo with initialized data which were supplied to regular VGImage 
-    Create an EGLImage[i] from the RSgImage[i]
-    Create a VGImage[i] from the EGLImage[i]
+Creation of the RSgImages:
+For i = 0 to N
+      Form pixel data in such way that there will be a mixture of opaque and transparent pixels.     
+      At least one coordinate of the opaque pixel will be unique for any iteration.
+      Creating RSgImage with initialized data, size: 50x50 and format:  VG_sARGB_8888_PRE. 
+      Send RSgImage drawableID to process B
+End loop
+Close all RSgImages after they will have been opened in process B
+Close RSgDriver after process B finishes with benchmark measurement.
+
+From process B:
+
+For i = 0 to N
+     Receive and store drawableID[i] from process A
+End loop
+
+Init EGL, create context and pixmap surface. Make the surface current.
+Creating regular VGImage:
+For i = 0 to N
+    Create VGImage[i] with size: 50x50 and format:  VG_sARGB_8888_PRE
+    SetSubData for VGImage[i] with the same data which were supplied on RSgImage creation
 End loop
 
-Draw VGImage which is based on RSgImage
-For i = N to 0
+Draw regular VGImage:
+For j = 0 to 4
     Start timer
-    Draw VGImage[i]
+    For i = N to 0
+        Draw VGImage[i]
+    End loop i
     Stop timer and record time
-End loop
-Record average time of drawing VGImage
+End loop j
+Complete all outstanding requests on the current context (vgFinish)
+Record max, min, average drawing time of VGImage
+Check that deviation between max and min time doesn’t exceed 5% (max – min / mean) < 0.05
+
+Destroy all regular VGImages
 
+Open RSgDriver
+Mapping in VGImage from initialized RSgImage and perform drawing:
+For j = 0 to 4
+    Start timer
+    For i = N to 0
+        Open RSgImage[i] with drawableID[i]
+        Create an EGLImage[i] from the RSgImage[i]
+        Create a VGImage[i] from the EGLImage[i]
+        Draw VGImage[i]
+    End loop i
+    Complete all outstanding requests on the current context (vgFinish)
+    Stop timer and record time
+End loop j
+Record max, min, average mapping and drawing time of VGImage
+Check that deviation between max and min time doesn’t exceed 5% (max – min / mean) < 0.05
+
+Destroy context, surface
 Close all VGImages, EGLImages and RSgImages
+Terminate Egl environment
 Close RSgDriver
 
 @SYMTestExpectedResults
 The creation of RSgImage, EGLImage and VGImage must return no error. 
-The average drawing time of regular VGImage and VGImage with underlying RSgImage is 
-made available in an easy-to-use format for further analysis and comparison.
+The drawing speed of regular VGImage and mapping VGImage (starting from drawable id) 
+with following draw is made available in an easy-to-use format for further analysis and 
+comparison.
 */
 TVerdict CEglTest_Benchmark_DrawImage::doTestStepL()
     {
     SetTestStepID(_L("GRAPHICS-EGL-0436"));
+    SetTestStepName(KBenchmark_DrawImage);
     INFO_PRINTF1(_L("CEglTest_Benchmark_DrawImage::doTestStepL"));
 
 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
     INFO_PRINTF1(_L("CEglTest_Benchmark_DrawImage can only be run with SgImage-Lite"));
+#else
+    TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KVG_KHR_EGL_image | KEGL_KHR_image_pixmap);
+    if(ret)
+        {
+        // launch 2 processes
+        Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
+        }
+#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
+
     RecordTestResultL();
     CloseTMSGraphicsStep();
     return TestStepResult();
-#else
-    TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KVG_KHR_EGL_image | KEGL_KHR_image_pixmap);
-    if(!ret)
-        {
-        // The extension is not supported
-        RecordTestResultL();
-        CloseTMSGraphicsStep();
-        return TestStepResult();
-        }
- 
-    ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
+    }
+
+void CEglTest_Benchmark_DrawImage::doProcessFunctionL(TInt aIdx)
+    {
+#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
     GetDisplayL();
-    CreateEglSessionL();
-    iEglSess->InitializeL();
+    CreateEglSessionL(aIdx);
+    iEglSess->InitializeL();    
     iEglSess->OpenSgDriverL();
- //----create pixmap and make context curent
+
     TSgImageInfo imageInfo;
-    imageInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface;
+    imageInfo.iUsage = ESgUsageBitOpenVgImage;
     imageInfo.iPixelFormat = iPixelFormat;
     imageInfo.iSizeInPixels = iImageSize;
-    //create a dummy surface and context for the purpose of enabling use of VG
-    iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo, CTestEglSession::EResourceCloseSgImageLate);
-
-    const TInt KDataStride = iImageSize.iWidth * EglTestConversion::BytePerPixel(iPixelFormat);
-    const TInt KDataSizeInByte = KDataStride *  iImageSize.iHeight;
-    TInt* data = new (ELeave) TInt[KDataSizeInByte];
-    User::LeaveIfNull(data);
-    CleanupStack::PushL(data);
+    RArray<TSgDrawableId> sgIdImageList; 
     
-    Mem::Fill(data, KDataSizeInByte / 2, 0xff);
-    Mem::FillZ(data + KDataSizeInByte / 2, KDataSizeInByte / 2);
-
-    //Creating regular VGImages
-    //Create an array of VGImages and push them into cleanup stack
-    //vgImageDeleteData takes ownership of the VGImages array. 
-    //If leaving occurs or this object is destroyed from the cleanup stack 
-    //it will delete all images and then the array
-    VGImageFormat vgPixelFormat = EglTestConversion::PixelFormatToVgFormat(iPixelFormat);
-    VGImage* vgImages = NULL;
-    CVgImageDeleteData* vgImageDeleteData = new (ELeave) CVgImageDeleteData(vgImages, iNumIterations);
-    CleanupStack::PushL(vgImageDeleteData);    
-    vgImages = new (ELeave)VGImage[iNumIterations];
-    for(TInt count=iNumIterations - 1; count >= 0; --count)
-        {
-        //we will use VG_IMAGE_QUALITY_NONANTIALIASED flag to avoid OpenVG making the quality improvements
-        //at the expense of performance (for instance to create an extra buffer) 
-        vgImages[count] = vgCreateImage(vgPixelFormat, iImageSize.iWidth, iImageSize.iHeight, VG_IMAGE_QUALITY_NONANTIALIASED);
-        ASSERT_VG_TRUE(vgImages[count] !=  VG_INVALID_HANDLE);
-        
-        vgImageSubData(vgImages[count],
-                data, KDataStride,
-                vgPixelFormat,
-                0, 0, iImageSize.iWidth, iImageSize.iHeight);
-        ASSERT_VG_ERROR(VG_NO_ERROR);
-        }
-    
-    //--------- start profiling
-    iProfiler->InitResults();
-    for(TInt count=iNumIterations - 1; count >= 0; --count)
-        {
-        vgDrawImage(vgImages[count]);
-#ifdef ENABLE_CHECKING_WHILST_PROFILING
-        ASSERT_VG_ERROR(VG_NO_ERROR);
-#endif            
-        iProfiler->MarkResultSetL();
-        }
-    iProfiler->ResultsAnalysis(_L("Drawing regular VGImage"), 0, EglTestConversion::PixelFormatToDisplayMode(iPixelFormat), EglTestConversion::PixelFormatToDisplayMode(iPixelFormat), iNumIterations);   
-    //--------- stop profiling
-    
-    //destroy vgImages
-    for(TInt count=iNumIterations - 1; count >= 0; --count)
-        {
-        vgDestroyImage(vgImages[count]);
-        ASSERT_VG_ERROR(VG_NO_ERROR);
-        vgImages[count]=VG_INVALID_HANDLE;
-        }
-    
+    const TInt KNumAttempt = 5;
+    const TInt KNumImagesToDraw = iNumIterations;
     //Create an array of SgImages and push them into cleanup stack
     //sgImageData takes ownership of the SgImages array. 
     //If leaving occurs or this object is destroyed from the cleanup stack 
     //it will delete all images and then the array
-    imageInfo.iUsage = ESgUsageBitOpenVgImage;
     RSgImage* sgImages = NULL;
-    CSgImageDeleteData* sgImageData = new (ELeave)CSgImageDeleteData(sgImages, iNumIterations);
+    CSgImageDeleteData* sgImageData = new (ELeave)CSgImageDeleteData(sgImages, KNumImagesToDraw);
     CleanupStack::PushL(sgImageData);    
-    sgImages = new (ELeave) RSgImage[iNumIterations];
+    sgImages = new (ELeave) RSgImage[KNumImagesToDraw];
+    
+    // the message queue will be used to pass image IDs across process boundary
+    RMsgQueue<TSgDrawableId> messageQueue;
+    User::LeaveIfError(messageQueue.Open(EProcSlotMsgQueueSgId, EOwnerProcess));
+    CleanupClosePushL(messageQueue);
+
+    //create  iNumIterations * KNumAttempt number of SgImages in one process and send them over to the second process
+    INFO_PRINTF3(_L("Process %d, Start sending %d SgImage IDs to other process..."), aIdx, iNumIterations);
+    if(aIdx == 0)
+        {
+        TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(KDefaultSourceFormat);
+        for(TInt index=0; index < KNumImagesToDraw; ++index)
+            {
+            CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, iImageSize, index);
+            CleanupStack::PushL(bitmap);
+            ASSERT_EQUALS(sgImages[index].Create(imageInfo, bitmap->DataAddress(),bitmap->DataStride()), KErrNone);
+            messageQueue.SendBlocking(sgImages[index].Id());
+            CleanupStack::PopAndDestroy(bitmap);
+            }
+        }
+    else if(aIdx == 1)
+        {
+        for(TInt index=0; index < KNumImagesToDraw; ++index)
+            {
+            TSgDrawableId sgImageId;
+            messageQueue.ReceiveBlocking(sgImageId);
+            sgIdImageList.AppendL(sgImageId);
+            }
+        }
+    CleanupStack::PopAndDestroy(&messageQueue);
+    INFO_PRINTF3(_L("Process %d, Finish sending %d SgImage IDs to other process..."), aIdx, iNumIterations);
+    //We expect to reach this point from both processes simultaneously 
+    //this is because ReceiveBlocking/SendBlocking are synchronous
     
-    //Create an array of EglImages and push them into cleanup stack
-    //eglImageDeleteData takes ownership of the EglImages array. 
-    //If leaving occurs or this object is destroyed from the cleanup stack 
-    //it will delete all images and then the array
-    EGLImageKHR* eglImages = NULL;
-    CEglImageDeleteData* eglImageDeleteData = new (ELeave)CEglImageDeleteData(*this, eglImages, iDisplay, iNumIterations); 
-    CleanupStack::PushL(eglImageDeleteData);    
-    eglImages = new (ELeave) EGLImageKHR[iNumIterations];
-    
-    //Creating VGImage from initialized RSgImage
-    for(TInt count=iNumIterations-1; count >= 0; --count)
+    if(aIdx == 1)
         {
-        const TInt res = sgImages[count].Create(imageInfo, data, KDataStride);
-        TESTL(res == KErrNone);
-        TESTL(!sgImages[count].IsNull());
+        imageInfo.iUsage = ESgUsageBitOpenVgImage | ESgUsageBitOpenVgSurface;
+        //create a dummy surface and context for the purpose of enabling use of VG
+        iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo, CTestEglSession::EResourceCloseSgImageLate);
 
-        eglImages[count]= iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImages[count],const_cast<EGLint *> (KEglImageAttribsPreservedTrue));
-        ASSERT_EGL_TRUE(eglImages[count] != EGL_NO_IMAGE_KHR)
+        //Creating regular VGImages
+        //Create an array of VGImages and push them into cleanup stack
+        //vgImageDeleteData takes ownership of the VGImages array. 
+        //If leaving occurs or this object is destroyed from the cleanup stack 
+        //it will delete all images and then the array
+        VGImageFormat vgPixelFormat = EglTestConversion::PixelFormatToVgFormat(iPixelFormat);
+        VGImage* vgImages = NULL;
+        CVgImageDeleteData* vgImageDeleteData = new (ELeave) CVgImageDeleteData(vgImages, KNumImagesToDraw);
+        CleanupStack::PushL(vgImageDeleteData);    
+        vgImages = new (ELeave)VGImage[KNumImagesToDraw];
+        for(TInt index=KNumImagesToDraw - 1; index >= 0; --index)
+            {
+            //we will use VG_IMAGE_QUALITY_NONANTIALIASED flag to avoid OpenVG making the quality improvements
+            //at the expense of performance (for instance to create an extra buffer) 
+            vgImages[index] = vgCreateImage(vgPixelFormat, iImageSize.iWidth, iImageSize.iHeight, VG_IMAGE_QUALITY_NONANTIALIASED);
+            ASSERT_VG_TRUE(vgImages[index] !=  VG_INVALID_HANDLE);
+            
+            TDisplayMode bitmapMode = EglTestConversion::VgFormatToDisplayMode(EglTestConversion::PixelFormatToVgFormat(iPixelFormat));
+            CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, iImageSize, index);
+            CleanupStack::PushL(bitmap);
+            // Add pixel data to the VGImage reference from the bitmap reference. 
+            // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
+            TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress());
+            TInt stride = bitmap->DataStride();
+            address += (iImageSize.iHeight - 1) * stride;
+            vgImageSubData(vgImages[index], address, -stride, 
+                    KDefaultSurfaceFormat, 0,0, iImageSize.iWidth, iImageSize.iHeight);
+            ASSERT_VG_ERROR(VG_NO_ERROR);
+            CleanupStack::PopAndDestroy(bitmap);
+            }
+#ifdef ENABLE_BENCHMARK_VERBOSE_LOGGING
+        iProfiler->SetStoreResultInTimingOrder(ETrue);
+#endif        
+        //--------- start profiling
+        INFO_PRINTF1(_L("Profiling of drawing of the regular VG image"));
+        iProfiler->InitResults();
+        for(TInt count = KNumAttempt - 1; count >= 0; --count)
+            {
+            for(TInt index=iNumIterations - 1; index >= 0; --index)
+                {
+                vgDrawImage(vgImages[index]);
+#ifdef ENABLE_CHECKING_WHILST_PROFILING
+                ASSERT_VG_ERROR(VG_NO_ERROR);
+#endif            
+                }
+            vgFinish();
+#ifdef ENABLE_CHECKING_WHILST_PROFILING
+            ASSERT_VG_ERROR(VG_NO_ERROR);
+#endif            
+            iProfiler->MarkResultSetL();
+            }
+        iProfiler->ResultsAnalysis(_L("Drawing of the regular VGImages"), 0, EglTestConversion::PixelFormatToDisplayMode(iPixelFormat), EglTestConversion::PixelFormatToDisplayMode(iPixelFormat), KNumAttempt);   
+#ifdef ENABLE_BENCHMARK_VERBOSE_LOGGING
+        iProfiler->ShowResultArrayInTimingOrder();
+        
+        const TInt KDeviationRegular = ((((TReal)(iProfiler->TimeMax())) - iProfiler->TimeMin()) / (TReal)(iProfiler->Mean())) * 100;
+        INFO_PRINTF3(_L("Deviation in percentage between min and max number of images drawing ((TimeMax - TimeMin) / Mean * 100): %d, threshold: %d "), KDeviationRegular, KBenchmarkDrawImageThreshold);
+        if(KDeviationRegular > KBenchmarkDrawImageThreshold)
+            {
+            //unfortunatelly EGL test framework currently ignores the error because this is a spawned process, and not 
+            // the main cteststep process. We could leave, but that would be too harsh in this situation
+            WARN_PRINTF1(_L("***The deviation has exceeded threshold, the number of iteration needs to be increased!!!"));
+            }
+#endif        
+        //--------- stop profiling
+        
+        //destroy vgImages
+        for(TInt index=0; index < KNumImagesToDraw; index++)
+            {
+            vgDestroyImage(vgImages[index]);
+            vgImages[index]=VG_INVALID_HANDLE;
+            ASSERT_VG_ERROR(VG_NO_ERROR);
+            }
+        
+        //Create an array of EglImages and push them into cleanup stack
+        //eglImageDeleteData takes ownership of the EglImages array. 
+        //If leaving occurs or this object is destroyed from the cleanup stack 
+        //it will delete all images and then the array
+        EGLImageKHR* eglImages = NULL;
+        CEglImageDeleteData* eglImageDeleteData = new (ELeave)CEglImageDeleteData(*this, eglImages, iDisplay, KNumImagesToDraw); 
+        CleanupStack::PushL(eglImageDeleteData);    
+        eglImages = new (ELeave) EGLImageKHR[KNumImagesToDraw];
+        
+        //---------------start profiling
+        INFO_PRINTF1(_L("Profiling of mapping in and drawing of the VG images with underlying RSgImage"));
+        iProfiler->InitResults();
+        for(TInt count = KNumAttempt - 1; count >= 0; --count)
+            {//we will run KNumAttemt times in a row and check that the set of results is consistent, 
+            // i.e. deviation between max and min time doesn't exceed KBenchmarkDrawImageThreshold percentage
+         
+            for(TInt index=iNumIterations - 1; index >= 0; --index)
+                {
+#ifdef ENABLE_CHECKING_WHILST_PROFILING
+                const TInt res = sgImages[index].Open(sgIdImageList[index]);
+                TESTL(res == KErrNone);
+                TESTL(!sgImages[index].IsNull());
+                eglImages[index]= iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImages[index],const_cast<EGLint *> (KEglImageAttribsPreservedTrue));
+                ASSERT_EGL_TRUE(eglImages[index] != EGL_NO_IMAGE_KHR)
+                vgImages[index] = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImages[index]);
+                ASSERT_VG_TRUE(vgImages[index] != VG_INVALID_HANDLE);
+                vgDrawImage(vgImages[index]);
+                ASSERT_VG_ERROR(VG_NO_ERROR);
+#else                
+                const TInt res = sgImages[index].Open(sgIdImageList[index]);
+                eglImages[index]= iEglSess->eglCreateImageKhrL(iDisplay,EGL_NO_CONTEXT,EGL_NATIVE_PIXMAP_KHR,&sgImages[index],const_cast<EGLint *> (KEglImageAttribsPreservedTrue));
+                vgImages[index] = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImages[index]);
+                vgDrawImage(vgImages[index]);
+                
+#endif //ENABLE_CHECKING_WHILST_PROFILING
+                }
+            vgFinish();
+#ifdef ENABLE_CHECKING_WHILST_PROFILING
+            ASSERT_VG_ERROR(VG_NO_ERROR);
+#endif            
+            iProfiler->MarkResultSetAndSuspendL(); //mark the end of the iteration. The timer will not be resumed yet 
+            
+            // Clean Sg/Vg/Egl images. 
+            // This is to ensure that expanding of the images will not impact measurement
+            for(TInt index=iNumIterations - 1; index >= 0; --index)
+                {
+                sgImages[index].Close();
+                vgDestroyImage(vgImages[index]);
+                vgImages[index] = VG_INVALID_HANDLE;
+                iEglSess->DestroyEGLImage( iDisplay, eglImages[index]);
+                eglImages[index] = EGL_NO_IMAGE_KHR;
+                }
+            
+            iProfiler->StartTimer();
+            }
+        //----------------stop profiling
 
-        vgImages[count] = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImages[count]);
-        ASSERT_VG_TRUE(vgImages[count] != VG_INVALID_HANDLE);
+        const TInt KDeviation = ((((TReal)(iProfiler->TimeMax())) - iProfiler->TimeMin()) / (TReal)(iProfiler->Mean())) * 100;
+        INFO_PRINTF3(_L("Deviation in percentage between min and max number of images drawing ((TimeMax - TimeMin) / Mean * 100): %d, threshold: %d "), KDeviation, KBenchmarkDrawImageThreshold);
+        if(KDeviation > KBenchmarkDrawImageThreshold)
+            {
+			//unfortunatelly EGL test framework currently ignores the error because this is a spawned process, and not 
+			// the main cteststep process. We could leave, but that would be too harsh in this situation
+			WARN_PRINTF1(_L("***The deviation has exceeded threshold, the number of iteration needs to be increased!!!"));
+            }
+        
+        iProfiler->ResultsAnalysis(_L("Drawing VGImages with underlying RSgImage"), 0, EglTestConversion::PixelFormatToDisplayMode(iPixelFormat), EglTestConversion::PixelFormatToDisplayMode(iPixelFormat), KNumAttempt);
+#ifdef ENABLE_BENCHMARK_VERBOSE_LOGGING
+        iProfiler->ShowResultArrayInTimingOrder();
+#endif        
+        sgIdImageList.Reset();
         }
     
-    //---------------start profiling
-    iProfiler->InitResults();
-    for(TInt count=iNumIterations - 1; count >= 0; --count)
+    //Introduce synchronization point here to make sure that RSgImages are not closed from the 
+    //first process while the second one is busy with benchmark measurement
+    Rendezvous(aIdx);
+    if(aIdx == 0)
         {
-        vgDrawImage(vgImages[count]);
-#ifdef ENABLE_CHECKING_WHILST_PROFILING
-        ASSERT_VG_ERROR(VG_NO_ERROR);
-#endif            
-        iProfiler->MarkResultSetL();
+        //Destroying VGImage/EGLImage/RSgImages
+        //no need to profile as we have already done this before
+        CleanupStack::PopAndDestroy(sgImageData);  // sgImageData  
         }
-    iProfiler->ResultsAnalysis(_L("Drawing VGImage with underlying RSgImage "), 0, EglTestConversion::PixelFormatToDisplayMode(iPixelFormat), EglTestConversion::PixelFormatToDisplayMode(iPixelFormat), iNumIterations);   
-    //----------------stop profiling
-    
-    //Destroying VGImage/EGLImage/RSgImages
-    //no need to profile as we have already done this before
-    CleanupStack::PopAndDestroy(4, data);  // data, vgImageDeleteData, sgImageData, eglImageDeleteData  
-    
+    else
+        {
+        //Destroying VGImage/EGLImage/RSgImages
+        //no need to profile as we have already done this before
+        CleanupStack::PopAndDestroy(3, sgImageData);  // sgImageData, vgImageDeleteData, eglImageDeleteData
+        }
     CleanAll();
-    RecordTestResultL();
-    CloseTMSGraphicsStep();
-    return TestStepResult();
 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
     }
--- a/egl/egltest/src/egltest_general.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltest_general.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -107,9 +107,8 @@
 		INFO_PRINTF1(_L("Dumping OpenVG strings"));
 
 		// OpenVG needs a current VG context before it will allow the call to vgGetString
-		TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(KDefaultSurfaceFormat);
-		TSgImageInfoOpenVgTarget imageInfo = TSgImageInfoOpenVgTarget(pixelFormat, KPixmapSize);
-		eglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo,CTestEglSession::EResourceCloseSgImageEarly, EGL_OPENVG_API);
+        EGLConfig currentConfig = eglSess->GetConfigExactMatchL(EPBufferAttribsColor64K);
+        eglSess->CreatePbufferSurfaceAndMakeCurrentL(currentConfig, KPixmapSize, EGL_OPENVG_API);
 
 		TPtrC8 ptrVgVendor((const TText8 *)vgGetString(VG_VENDOR));
 		DumpString(_L("VG_VENDOR"), ptrVgVendor);
@@ -133,9 +132,8 @@
 		INFO_PRINTF1(_L("Dumping OpenGLES strings"));
 
 		// OpenGLES needs a current GLES context before it will allow the call to glGetString
-		TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(KDefaultSurfaceFormat);
-		TSgImageInfoOpenVgTarget imageInfo = TSgImageInfoOpenVgTarget(pixelFormat, KPixmapSize);
-		eglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo,CTestEglSession::EResourceCloseSgImageEarly, EGL_OPENGL_ES_API);
+        EGLConfig currentConfig = eglSess->GetConfigExactMatchL(EPBufferAttribsColor64K);
+        eglSess->CreatePbufferSurfaceAndMakeCurrentL(currentConfig, KPixmapSize, EGL_OPENGL_ES_API);
 
 		TPtrC8 ptrGlesVendor((const TText8 *)glGetString(GL_VENDOR));
 		DumpString(_L("GL_VENDOR"), ptrGlesVendor);
@@ -201,7 +199,7 @@
 	INFO_PRINTF1(_L("CEglTest_QueryString_Extensions::doTestStepL"));
 
 	TInt numExtensions=0;
-	if (!GetIntFromConfig(KSectionQueryExtensions, KKeyCountExtensionsEGL, numExtensions))
+	if (!GetIntFromConfig(ConfigSection(), KKeyCountExtensionsEGL, numExtensions))
 		{
 		ERR_PRINTF2(_L("Cannot find key '%S' in INI file"), &KKeyCountExtensionsEGL);
 		User::Leave(KErrArgument);
@@ -213,7 +211,7 @@
 	for(TInt i=0; i<numExtensions; i++)
 		{
 		bufExtensionNameKey.Format(KKeyExtensionEGLX, i);
-		if (!GetStringFromConfig(KSectionQueryExtensions, bufExtensionNameKey, ptrExtensionNameValue16))
+		if (!GetStringFromConfig(ConfigSection(), bufExtensionNameKey, ptrExtensionNameValue16))
 			{
 			ERR_PRINTF2(_L("Cannot find key '%S' in INI file"), &bufExtensionNameKey);
 			User::Leave(KErrArgument);
@@ -223,7 +221,7 @@
 		}
 
 	numExtensions=0;
-	if (!GetIntFromConfig(KSectionQueryExtensions, KKeyCountExtensionsVG, numExtensions))
+	if (!GetIntFromConfig(ConfigSection(), KKeyCountExtensionsVG, numExtensions))
 		{
 		ERR_PRINTF2(_L("Cannot find key '%S' in INI file"), &KKeyCountExtensionsVG);
 		User::Leave(KErrArgument);
--- a/egl/egltest/src/egltest_geterroranddisplay.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltest_geterroranddisplay.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -963,7 +963,7 @@
     TEST(eglGetError() == EGL_SUCCESS);
     
     // launch 100 threads.
-    Test_MultiThreadL(100, EFalse);
+    Test_MultiThreadL(100, ETrue);
     
     INFO_PRINTF1(_L("Calling eglTerminate from main thread"));
     TEST_EGL_ERROR(eglTerminate(iDisplay), EGL_SUCCESS);
--- a/egl/egltest/src/egltest_image_multiprocess.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltest_image_multiprocess.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -107,7 +107,7 @@
 
 	// destroy sgImage
 	CleanupStack::PopAndDestroy(2, bitmap);
-	
+
 	// clean everything
 	CleanAll();
 	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_Sibling_Basic::doTestStepL"));
@@ -117,7 +117,7 @@
 	}
 
 void CEglTest_EGL_Image_Multi_Process_Sibling_Basic::doProcessFunctionL(TInt aIdx,const TSgDrawableId& aSgId)
-	{	
+	{
 	INFO_PRINTF2(_L("CEglTest_EGL_Image_Multi_Process_Sibling_Basic::doProcessFunctionL, Process %d"),aIdx);
 	GetDisplayL();
 	CreateEglSessionL(aIdx);
@@ -127,12 +127,12 @@
 	RSgImage sgImageFromId;
 	CleanupClosePushL(sgImageFromId);
 	ASSERT_EQUALS(sgImageFromId.Open(aSgId),KErrNone);
-	
+
 	INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx);
 	EGLImageKHR eglImage = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImageFromId, KEglImageAttribsPreservedTrue);
 	ASSERT_EGL_TRUE(eglImage != EGL_NO_IMAGE_KHR);
 	CleanupStack::PopAndDestroy(&sgImageFromId);
-	
+
 	INFO_PRINTF2(_L("Process %d, EGLImage successfully created, now destroying it"),aIdx);
 	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImage));
 
@@ -155,7 +155,7 @@
 
 @SYMTestActions
 Run two processes that independently perform the same actions detailed below.
-This test will check for the “VG_KHR_EGL_image” extension, if it is not 
+This test will check for the “VG_KHR_EGL_image” extension, if it is not
 supported on this platform then the test will return immediately without failure.
 Create and fully construct an RSgImage object
 •	Set the iUsage bits to ESgUsageBitOpenVgImage
@@ -166,21 +166,21 @@
 Check that eglCreateImageKHR() does NOT return EGL_NO_IMAGE_KHR
 Use vgCreateEGLImageTargetKHR() to construct a VGImage object from the EGLImage.
 •	Check for errors (VGInvalidHandle is not returned)
-Create a second RSgImage, and use it to create a pixmap surface that is 
+Create a second RSgImage, and use it to create a pixmap surface that is
 compatible as a target for the VGImage to be drawn to.
 •	Set the iUsage bit to ESgUsageBitOpenVgSurface
 •	Use the same pixel format as the RSgImage above.
-Now that a eglContext and an OpenVG context have been created, use the 
-OpenVG API vgClearImage to clear to a chosen colour the VGImage previously 
+Now that a eglContext and an OpenVG context have been created, use the
+OpenVG API vgClearImage to clear to a chosen colour the VGImage previously
 returned by eglCreateImageKHR.
-Use OpenVG to draw the just drawn VGImage to the pixmap surface currently 
+Use OpenVG to draw the just drawn VGImage to the pixmap surface currently
 linked to the context.
 Call eglWaitClient() to finish the above drawing instructions synchronously.
 Destroy the original image data
 •	Pass the VGImage into vgDestroyImage()
 •	Pass the EGLImage into eglDestroyImageKHR()
 •	Close the first RSgImage
-•	Check that the pixmap surface contains expected pixel values using 
+•	Check that the pixmap surface contains expected pixel values using
 OpenVG APIs, vgReadPixels.
 Close the second RSgImage and destroy the pixmap surface
 Check for memory and handle leaks
@@ -194,7 +194,7 @@
 	SetTestStepID(_L("GRAPHICS-EGL-0161"));
 	SetTestStepName(KEGL_Image_Multi_Process_Parallel);
 	INFO_PRINTF1(_L("Enter: CEglTest_EGL_Image_Multi_Process_Parallel::doTestStepL"));
-	
+
 	TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
 	if(!ret)
 		{
@@ -206,8 +206,8 @@
 
 	// launch 2 processes
 	Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
-	
-	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_Parallel::doTestStepL"));	
+
+	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_Parallel::doTestStepL"));
 	RecordTestResultL();
 	CloseTMSGraphicsStep();
 	return TestStepResult();
@@ -218,7 +218,7 @@
 	INFO_PRINTF2(_L("CEglTest_EGL_Image_Multi_Process_Parallel::doProcessFunctionL, Process %d"),aIdx);
 	GetDisplayL();
 	CreateEglSessionL(aIdx);
-	iEglSess->InitializeL();	
+	iEglSess->InitializeL();
 	iEglSess->OpenSgDriverL();
 
 	// create a reference bitmap (we give index 3 for example, as there's only 1 image in this test case)
@@ -238,7 +238,7 @@
 	ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR);
 	CleanupStack::PopAndDestroy(&rSgImageLocal); 	//transferring ownership of the buffer to the EGLImage
 	CleanupStack::PopAndDestroy(bitmap);
-	
+
 	INFO_PRINTF2(_L("Process %d, Creating a Surface and a Context bound to OpenVG"),aIdx);
 	TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(KDefaultSurfaceFormat);
 	TSgImageInfoOpenVgTarget imageInfo2 = TSgImageInfoOpenVgTarget(pixelFormat, KImageSize);
@@ -265,7 +265,7 @@
 	iEglSess->CheckVgDrawingL(KDefaultSurfaceFormat, refBitmap);
 	CleanupStack::PopAndDestroy(refBitmap);
 	INFO_PRINTF2(_L("Drawing successful, Process %d"),aIdx);
-	
+
 	// cleanup
 	CleanAll();
 	}
@@ -344,10 +344,10 @@
 	// destroy sgImage
 	CleanupStack::PopAndDestroy(&sgImage);
 	CleanupStack::PopAndDestroy(bitmap);
-	
+
 	// clean everything
 	CleanAll();
-	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_Sibling_CheckContents::doTestStepL"));	
+	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_Sibling_CheckContents::doTestStepL"));
     RecordTestResultL();
 	CloseTMSGraphicsStep();
 	return TestStepResult();
@@ -364,28 +364,28 @@
 	RSgImage sgImageFromId;
 	CleanupClosePushL(sgImageFromId);
 	ASSERT_EQUALS(sgImageFromId.Open(aSgId),KErrNone);
-	
+
 	INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx);
 	EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImageFromId, KEglImageAttribsPreservedTrue);
 	ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR);
 	CleanupStack::PopAndDestroy(&sgImageFromId);
-	
+
 	INFO_PRINTF2(_L("Process %d, Creating a Surface and a Context bound to OpenVG"),aIdx);
 	TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(KDefaultSurfaceFormat);
 	TSgImageInfoOpenVgTarget imageInfo = TSgImageInfoOpenVgTarget(pixelFormat, KImageSize);
 	// Create a pixmap surface matching the native image pixel format
 	iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo,CTestEglSession::EResourceCloseSgImageEarly);
-	
+
 	INFO_PRINTF2(_L("Process %d, Creating one VGImage from the EGLImage"),aIdx);
 	VGImage vgImageLocal = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImageLocal);
 	ASSERT_VG_TRUE(vgImageLocal != VG_INVALID_HANDLE);
 	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImageLocal));
-	
+
 	if(aIdx == 0)
 		{
 		TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(KDefaultSourceFormat);
 		CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KImageSize, 4);
-    	// Add pixel data to the VGImage reference from the bitmap reference. 
+    	// Add pixel data to the VGImage reference from the bitmap reference.
         // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
 		TSize bitmapSize = bitmap->SizeInPixels();
     	TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress());
@@ -397,10 +397,10 @@
 		ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
 		eglWaitClient();
 		}
-	
+
 	// Wait for both processes to reach this point (process 0 will have updated the VGImage)
 	Rendezvous(aIdx);
-	
+
 	if(aIdx == 1)
 		{
 		INFO_PRINTF2(_L("Process %d, Drawing the VGImage to the current surface"),aIdx);
@@ -472,7 +472,7 @@
 	// launch 2 processes
 	Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
 
-    INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_Source::doTestStepL"));   
+    INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_Source::doTestStepL"));
     RecordTestResultL();
     CloseTMSGraphicsStep();
     return TestStepResult();
@@ -483,7 +483,7 @@
     INFO_PRINTF2(_L("CEglTest_EGL_Image_Multi_Process_VgImage_Source::doProcessFunctionL, Process %d"),aIdx);
 	GetDisplayL();
 	CreateEglSessionL(aIdx);
-	iEglSess->InitializeL();	
+	iEglSess->InitializeL();
 	iEglSess->OpenSgDriverL();
 
     RMsgQueue<TSgDrawableId> messageQueue;
@@ -506,7 +506,7 @@
 #endif
     	ASSERT_EQUALS(rSgImageLocal.Create(imageInfo,bitmap->DataAddress(),bitmap->DataStride()), KErrNone);
         CleanupStack::PopAndDestroy(bitmap);
- 
+
         INFO_PRINTF2(_L("Process %d, Sending SgImage ID to other process..."), aIdx);
         messageQueue.SendBlocking(rSgImageLocal.Id());
         }
@@ -560,7 +560,7 @@
         INFO_PRINTF2(_L("Process %d, Changing contents of the VGImage"),aIdx);
         TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(KDefaultSourceFormat);
         CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KImageSize, 4);
-        // Add pixel data to the VGImage reference from the bitmap reference. 
+        // Add pixel data to the VGImage reference from the bitmap reference.
         // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
         TSize bitmapSize = bitmap->SizeInPixels();
     	TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress());
@@ -575,7 +575,7 @@
 
 	// Wait for both processes to reach this point (process 0 will have updated the VGImage)
 	Rendezvous(aIdx);
-    
+
 	if(aIdx == 1)
 		{
         INFO_PRINTF2(_L("Drawing the VGImage to the current surface after changing contents of the VGImage, Process %d"),aIdx);
@@ -649,7 +649,7 @@
 	// launch 2 processes
  	Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
 
-	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_DrawAfterTerminate::doTestStepL"));   
+	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_DrawAfterTerminate::doTestStepL"));
     RecordTestResultL();
     CloseTMSGraphicsStep();
     return TestStepResult();
@@ -666,7 +666,7 @@
     RMsgQueue<TSgDrawableId> messageQueue;
     User::LeaveIfError(messageQueue.Open(EProcSlotMsgQueueSgId, EOwnerProcess));
     CleanupClosePushL(messageQueue);
-    
+
     RSgImage rSgImageLocal;
     if(aIdx == 0)
         {
@@ -683,7 +683,7 @@
 #endif
     	ASSERT_EQUALS(rSgImageLocal.Create(imageInfo,bitmap->DataAddress(),bitmap->DataStride()), KErrNone);
         CleanupStack::PopAndDestroy(bitmap);
- 
+
         INFO_PRINTF2(_L("Process %d, Sending SgImage ID to other process..."), aIdx);
         messageQueue.SendBlocking(rSgImageLocal.Id());
         }
@@ -694,7 +694,7 @@
         messageQueue.ReceiveBlocking(sgImageId);
         ASSERT_EQUALS(rSgImageLocal.Open(sgImageId),KErrNone);
         }
-    
+
 	INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx);
 	CleanupClosePushL(rSgImageLocal);
 	EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue);
@@ -711,7 +711,7 @@
 	VGImage vgImageLocal = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImageLocal);
 	ASSERT_VG_TRUE(vgImageLocal != VG_INVALID_HANDLE);
 	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImageLocal));
-    
+
     if(aIdx == 1)
         {
         INFO_PRINTF2(_L("Process %d, Drawing the VGImage to the current surface before changing contents of the VGImage"),aIdx);
@@ -719,7 +719,7 @@
     	vgSetPixels(0, 0, vgImageLocal, 0, 0, KImageSize.iWidth, KImageSize.iHeight);
     	ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
     	eglWaitClient();
-    	
+
 
     	// we can now compare the VgImage to the one we expect before we apply any change to it
 		TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(KDefaultSourceFormat);
@@ -738,7 +738,7 @@
         INFO_PRINTF2(_L("Process %d, Changing contents of the VGImage"),aIdx);
         TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(KDefaultSourceFormat);
         CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KImageSize, 2);
-    	// Add pixel data to the VGImage reference from the bitmap reference. 
+    	// Add pixel data to the VGImage reference from the bitmap reference.
         // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
 		TSize bitmapSize = bitmap->SizeInPixels();
     	TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress());
@@ -758,7 +758,7 @@
 
 	// Wait for both processes to reach this point
     Rendezvous(aIdx);
-    
+
     if(aIdx == 1)
         {
         INFO_PRINTF2(_L("Drawing the VGImage to the current surface after changing contents of the VGImage, Process %d"),aIdx);
@@ -805,18 +805,18 @@
 •	EUidPixelFormatA_8  (source only)
 - Note that when using EUidPixelFormatA_8 as a source, the reference bitmap display mode used is EGray256,
   This is to enable using the reference bitmap as an alpha mask.
-- Spawn N client processes. During the process launching, pass to each process single drawable ID from the SgImages. 
-  In order to define which SgImage needs to be passed to the particular process, there will be following 
+- Spawn N client processes. During the process launching, pass to each process single drawable ID from the SgImages.
+  In order to define which SgImage needs to be passed to the particular process, there will be following
   formula applied: J = P Mod (M), where J is the sequence number of the image, P is the particular process number.
 From processes 1 to N:
 - Open SgImage by using TSgDrawableId, obtained from the SgImage which was passed from the process A.
-- Using EGL extension, create EGLImage specifying as EGLClientBuffer SgImage which was created on 
+- Using EGL extension, create EGLImage specifying as EGLClientBuffer SgImage which was created on
   previous step,  EGL_NATIVE_PIXMAP_KHR as a target and EGL_IMAGE_PRESERVED_KHR as an attribute
-- Using VG extension, create VG image based on EGLImage from the previous step. 
+- Using VG extension, create VG image based on EGLImage from the previous step.
 - Close Sg and EGL images
-- Create second SgImage with the same size and pixel format as first SgImage and usage flag is set to ESgUsageBitOpenVgSurface. 
-- Create off-screen pixmap surface with underlining second SgImage and make it current for the drawing context. 
-- Draw VGImage to the off-screen surface (note that when using EUidPixelFormatA_8 as a source, the 
+- Create second SgImage with the same size and pixel format as first SgImage and usage flag is set to ESgUsageBitOpenVgSurface.
+- Create off-screen pixmap surface with underlining second SgImage and make it current for the drawing context.
+- Draw VGImage to the off-screen surface (note that when using EUidPixelFormatA_8 as a source, the
   reference bitmap is used as an alpha mask).
 - Draw VGImage to the off-screen surface.
 - Retrieve surface data (see vgReadPixels() API)
@@ -824,7 +824,7 @@
 @SYMTestExpectedResults
 Creation of all drawable  resources have been completed without errors.
 Image data obtained in client processes 1-N matches to the data which have been uploaded to the SgImages buffer from
-process A. Reference counting works correctly and keeps VG image alive although bound Sg and EGL images have been destroyed. 
+process A. Reference counting works correctly and keeps VG image alive although bound Sg and EGL images have been destroyed.
 When all resources are closed, resource count maintained by RSgDriver extension is zero in all processes.
 */
 TVerdict CEglTest_EGL_Image_Multi_Process_FontServer_Upfront::doTestStepL()
@@ -868,7 +868,7 @@
 			// A_8 related tests are only performed for SgImage-Lite
 			if (iSourceFormat == EUidPixelFormatA_8)
 				continue;
-#endif	
+#endif
 			doTestPartialStepL();
 			}
 		}
@@ -913,8 +913,8 @@
 		}
 
 	INFO_PRINTF2(_L("MAIN PROCESS: About to launch %d processes..."), KNumProcesses);
-	Test_MultiProcessL(KEglTestStepDllName, KNumProcesses, TestStepName(), sgIdList); //the function will guarantee that all images will be opened before it returns 
-    CleanupStack::PopAndDestroy(2 * KNumImages + 1, &sgIdList); // KNumImages SgImages, KNumImages bitmaps, sgIdList  
+	Test_MultiProcessL(KEglTestStepDllName, KNumProcesses, TestStepName(), sgIdList); //the function will guarantee that all images will be opened before it returns
+    CleanupStack::PopAndDestroy(2 * KNumImages + 1, &sgIdList); // KNumImages SgImages, KNumImages bitmaps, sgIdList
 	INFO_PRINTF2(_L("MAIN PROCESS: All %d launched processes have completed!"), KNumProcesses);
 
 	CleanAll();
@@ -955,9 +955,9 @@
 	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImage));
 
 	// At this point we draw the VGImage created from the SgImage to the current surface.
-	//	# if the source is a A_8, the VGImage acts as a mask and the target surface must contain 
+	//	# if the source is a A_8, the VGImage acts as a mask and the target surface must contain
 	//		as a result the pen colour set above blended with the mask
-	//	# otherwise, drawing the VGImage is just a simple copy via vgSetPixels (no blending required) 
+	//	# otherwise, drawing the VGImage is just a simple copy via vgSetPixels (no blending required)
 	INFO_PRINTF1(_L("Copying the VGImage to the surface"));
 	if (iSourceFormat == EUidPixelFormatA_8)
 		{
@@ -975,7 +975,7 @@
 		VGuint fillColor = 0x008000ff; // opaque dark green
 		vgSetColor(fillPaint, fillColor);
 		ASSERT_EGL_TRUE(vgGetError() == VG_NO_ERROR);
-		
+
 		vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_STENCIL);
 		vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
 		vgDrawImage(vgImage);
@@ -996,7 +996,7 @@
 	//    a) a reference bitmap needs to be cleared to black (same colour as the surface was cleared to)
 	//    b) a Pen bitmap, that we clear to dark green (same colour as the fillPaint used to draw to the surface)
 	//    c) a mask bitmap, which is the reference bitmap used to create the SgImage
-	//  # otherwise, the surface must contain the same pixels as the bitmap used to create the SgImage 
+	//  # otherwise, the surface must contain the same pixels as the bitmap used to create the SgImage
 	if (iSourceFormat == EUidPixelFormatA_8)
 		{
 		TDisplayMode maskMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
@@ -1009,7 +1009,7 @@
 
 		CFbsBitmap* refBitmap = iEglSess->CreateReferenceMaskedBitmapL(refbitmapMode, KRgbDarkGreen, mask);
 		CleanupStack::PushL(refBitmap);
-		
+
 		// compare the obtained reference bitmap with the surface drawn
 		iEglSess->CheckVgDrawingL(iSurfaceFormat, refBitmap);
 		CleanupStack::PopAndDestroy(2, mask); //mask, refBitmap
@@ -1051,29 +1051,29 @@
 •	EUidPixelFormatRGB_565
 •	EUidPixelFormatXRGB_8888
 •	EUidPixelFormatARGB_8888_PRE
-- Using EGL extension, create M EGLImage(s), specifying as EGLClientBuffer SgImage(s) which were created on 
+- Using EGL extension, create M EGLImage(s), specifying as EGLClientBuffer SgImage(s) which were created on
   first step and EGL_NATIVE_PIXMAP_KHR as a target
 - Using VG extension, create VG images based on EGLImage(s) from the previous step
 - Close Sg and EGL Images
-- Populate data in VGImages (see vgImageSubData(..) API), there will be different data uploaded for each VGImage 
-- Spawn N client processes. During the process launching, pass to each process single drawable ID from the SgImages. 
-  In order to define which SgImage(s) needs to be passed to the particular processes, there will be following 
+- Populate data in VGImages (see vgImageSubData(..) API), there will be different data uploaded for each VGImage
+- Spawn N client processes. During the process launching, pass to each process single drawable ID from the SgImages.
+  In order to define which SgImage(s) needs to be passed to the particular processes, there will be following
   formula applied: J = P Mod (M), where J is the sequence number of the image, P is the particular process number.
 From processes 1 to N:
 - Open SgImage by using TSgDrawableId, obtained from the SgImage which was passed from the process A.
-- Using EGL extension, create EGLImage specifying as EGLClientBuffer SgImage which was created on previous step,  
+- Using EGL extension, create EGLImage specifying as EGLClientBuffer SgImage which was created on previous step,
   EGL_NATIVE_PIXMAP_KHR as a target and EGL_IMAGE_PRESERVED_KHR as an attribute
-- Using VG extension, create VG image based on EGLImage from the previous step. 
+- Using VG extension, create VG image based on EGLImage from the previous step.
 - Close Sg and EGL images
-- Create second SgImage with the same size and pixel format as first SgImage and usage flag is set to ESgUsageBitOpenVgSurface. 
-- Create off-screen pixmap surface with underlining second SgImage and make it current for the drawing context. 
+- Create second SgImage with the same size and pixel format as first SgImage and usage flag is set to ESgUsageBitOpenVgSurface.
+- Create off-screen pixmap surface with underlining second SgImage and make it current for the drawing context.
 - Draw VGImage to the off-screen surface.
 - Retrieve surface data (see vgReadPixels() API)
 
 @SYMTestExpectedResults
 Creation of all drawable  resources have been completed without errors.
-Image data obtained in client processes 1-N matches to the data which have been uploaded to the SgImages buffer from 
-process A. Reference counting works correctly and keep VG image alive although bound Sg and EGL images have been closed. 
+Image data obtained in client processes 1-N matches to the data which have been uploaded to the SgImages buffer from
+process A. Reference counting works correctly and keep VG image alive although bound Sg and EGL images have been closed.
 When all resources are closed, resource count maintained by RSgDriver extension is zero in all processes.
 */
 TVerdict CEglTest_EGL_Image_Multi_Process_FontServer_Deferred::doTestStepL()
@@ -1108,7 +1108,7 @@
 		// A_8 related tests are only performed for SgImage-Lite
 		if (iSourceFormat == EUidPixelFormatA_8)
 			continue;
-#endif	
+#endif
 		doTestPartialStepL();
 		}
 
@@ -1122,7 +1122,7 @@
 	{
 	INFO_PRINTF1(_L("CEglTest_EGL_Image_Multi_Process_FontServer_Deferred::doTestPartialStepL"));
 	PrintUsedPixelConfiguration();
-	
+
 	// Create display object
 	ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
 	GetDisplayL();
@@ -1137,7 +1137,7 @@
 #else
     imageInfo.iUsage = ESgUsageOpenVgImage | ESgUsageOpenVgTarget;
    	imageInfo.iShareable = ETrue;
-#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE	
+#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 	// Create a pixmap surface matching the given pixel format
 	iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo,CTestEglSession::EResourceCloseSgImageEarly);
 
@@ -1153,16 +1153,16 @@
         CleanupClosePushL(sgImages[i]);
 		ASSERT_EQUALS(sgIdList.Insert(sgImages[i].Id(),i), KErrNone);
 
-		EGLImageKHR eglImage = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImages[i], KEglImageAttribsPreservedTrue);	
+		EGLImageKHR eglImage = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImages[i], KEglImageAttribsPreservedTrue);
 		ASSERT_EGL_TRUE(eglImage != EGL_NO_IMAGE_KHR);
-		
+
 		VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImage);
 		ASSERT_VG_TRUE(vgImage != VG_INVALID_HANDLE);
 		ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImage));
 
 		TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
         CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KImageSize, i);
-    	// Add pixel data to the VGImage reference from the bitmap reference. 
+    	// Add pixel data to the VGImage reference from the bitmap reference.
         // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
 		TSize bitmapSize = bitmap->SizeInPixels();
     	TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress());
@@ -1196,7 +1196,7 @@
 	//Retrieve source formats for the launched process from the process parameters.
 	User::LeaveIfError(User::GetTIntParameter(EProcSlotSourceFormat, reinterpret_cast<TInt&>(iSourceFormat)));
 	User::LeaveIfError(User::GetTIntParameter(EProcSlotSurfaceFormat, reinterpret_cast<TInt&>(iSurfaceFormat)));
-	
+
 	RSgImage sgImageFromId;
 	CleanupClosePushL(sgImageFromId);
 	ASSERT_EQUALS(sgImageFromId.Open(aSgId), KErrNone);
@@ -1218,9 +1218,9 @@
 	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImage));
 
 	// At this point we draw the VGImage created from the SgImage to the current surface.
-	//	# if the source is a A_8, the VGImage acts as a mask and the target surface must contain 
+	//	# if the source is a A_8, the VGImage acts as a mask and the target surface must contain
 	//		as a result the pen colour set above blended with the mask
-	//	# otherwise, drawing the VGImage is just a simple copy via vgSetPixels (no blending required) 
+	//	# otherwise, drawing the VGImage is just a simple copy via vgSetPixels (no blending required)
 	INFO_PRINTF1(_L("Copying the VGImage to the surface"));
 	if (iSourceFormat == EUidPixelFormatA_8)
 		{
@@ -1238,7 +1238,7 @@
 		VGuint fillColor = 0x008000ff; // opaque dark green
 		vgSetColor(fillPaint, fillColor);
 		ASSERT_EGL_TRUE(vgGetError() == VG_NO_ERROR);
-		
+
 		vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_STENCIL);
 		vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
 		vgDrawImage(vgImage);
@@ -1259,7 +1259,7 @@
 	//    a) a reference bitmap needs to be cleared to black (same colour as the surface was cleared to)
 	//    b) a Pen bitmap, that we clear to dark green (same colour as the fillPaint used to draw to the surface)
 	//    c) a mask bitmap, which is the reference bitmap used to create the SgImage
-	//  # otherwise, the surface must contain the same pixels as the bitmap used to create the SgImage 
+	//  # otherwise, the surface must contain the same pixels as the bitmap used to create the SgImage
 	if (iSourceFormat == EUidPixelFormatA_8)
 		{
 		TDisplayMode maskMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
@@ -1272,7 +1272,7 @@
 
 		CFbsBitmap* refBitmap = iEglSess->CreateReferenceMaskedBitmapL(refbitmapMode, KRgbDarkGreen, mask);
 		CleanupStack::PushL(refBitmap);
-		
+
 		// compare the obtained reference bitmap with the surface drawn
 		iEglSess->CheckVgDrawingL(iSurfaceFormat, refBitmap);
 		CleanupStack::PopAndDestroy(2, mask); //mask, refBitmap
@@ -1314,37 +1314,37 @@
 •	EUidPixelFormatRGB_565
 •	EUidPixelFormatXRGB_8888
 •	EUidPixelFormatARGB_8888_PRE
-- Choose egl config, supplying as a native pixmap type in attribute (flag EGL_MATCH_NATIVE_PIXMAP) the SgImages which 
+- Choose egl config, supplying as a native pixmap type in attribute (flag EGL_MATCH_NATIVE_PIXMAP) the SgImages which
   were created on the previous step. The EGL_RENDERABLE_TYPE of the config attributes must include EGL_OPENVG_BIT.
-- Create M pixmap surfaces based on SgImages from the first step. The surface is created with EGL_ALPHA_FORMAT_PRE 
+- Create M pixmap surfaces based on SgImages from the first step. The surface is created with EGL_ALPHA_FORMAT_PRE
   flag supplied in attribute list if the underlining SgImage was of type ESgPixelFormatARGB_8888_PRE.
 - In iteration from 1 to M perform three following steps:
 	1. Make the pixmap surface current (see eglMakeCurrent(.) API)
-	2. Draw something to the current surface, for instance, clear the whole area with color and then draw a 
-	   few graphics primitives. The drawing needs to be unique for each surface and complicated enough to 
+	2. Draw something to the current surface, for instance, clear the whole area with color and then draw a
+	   few graphics primitives. The drawing needs to be unique for each surface and complicated enough to
 	   ensure that bit comparison will reveal any mismatch
 	3. Make no surface current
 - Close all pixmap surfaces
-- Spawn N client processes. During the process launching, pass to each process single drawable ID from the SgImages. 
-  In order to define which SgImage(s) needs to be passed to the particular processes, there will be following 
+- Spawn N client processes. During the process launching, pass to each process single drawable ID from the SgImages.
+  In order to define which SgImage(s) needs to be passed to the particular processes, there will be following
   formula applied: J = P Mod (M), where J is the sequence number of the image, P is the particular process number.
 From processes 1 to N:
 - Open SgImage by TSgDrawableId obtained from the SgImage which was passed from the process A.
-- Using EGL extension, create EGLImage specifying as EGLClientBuffer SgImage which was opened on the previous 
+- Using EGL extension, create EGLImage specifying as EGLClientBuffer SgImage which was opened on the previous
   step,  EGL_NATIVE_PIXMAP_KHR as a target and EGL_IMAGE_PRESERVED_KHR as an attribute
 - Using VG extension, create VG image based on EGLImage from the previous step.
 - Close both Sg and EGL images
-- Create second SgImage with the same size and pixel format as first SgImage and usage flag is set to ESgUsageBitOpenVgSurface. 
-- Create off-screen pixmap surface with underlining second SgImage and make it current for the drawing context. 
+- Create second SgImage with the same size and pixel format as first SgImage and usage flag is set to ESgUsageBitOpenVgSurface.
+- Create off-screen pixmap surface with underlining second SgImage and make it current for the drawing context.
 - Draw VGImage to the off-screen surface.
 - Retrieve surface data (see vgReadPixels() API)
 
 @SYMTestExpectedResults
-Creation of all drawable resources has been completed without errors. 
-On return eglChooseConfig() must return EGL_OPENVG_BIT in config attribute list (actual attributes should 
+Creation of all drawable resources has been completed without errors.
+On return eglChooseConfig() must return EGL_OPENVG_BIT in config attribute list (actual attributes should
 be retrieved via call to eglGetConfigAttrib()).
 Image data obtained in client processes 1 - N matches to the pixmap surface which was drawn in the process A.
-Reference counting works correctly and keep VG image alive although bound Sg and EGL images have been closed. 
+Reference counting works correctly and keep VG image alive although bound Sg and EGL images have been closed.
 When all resources are closed, resource count maintained by RSgDriver extension is zero in all processes.
 */
 TVerdict CEglTest_EGL_Image_Multi_Process_ThemeServer::doTestStepL()
@@ -1379,7 +1379,7 @@
 		// A_8 related tests are only performed for SgImage-Lite
 		if (iSourceFormat == EUidPixelFormatA_8)
 			continue;
-#endif	
+#endif
 		doTestPartialStepL();
 		}
 
@@ -1393,7 +1393,7 @@
 	{
 	INFO_PRINTF1(_L("CEglTest_EGL_Image_Multi_Process_ThemeServer::doTestPartialStepL"));
 	PrintUsedPixelConfiguration();
-	
+
 	// Create display object
 	ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
 	GetDisplayL();
@@ -1416,22 +1416,22 @@
 #else
 		imageInfo.iUsage = ESgUsageOpenVgImage | ESgUsageOpenVgTarget;
     	imageInfo.iShareable = ETrue;
-#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE   
+#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 
 		ASSERT_EQUALS(sgImages[i].Create(imageInfo, NULL, NULL), KErrNone);
 	    CleanupClosePushL(sgImages[i]);
 		ASSERT_EQUALS(sgIdList.Insert(sgImages[i].Id(),i), KErrNone);
-		
+
 		INFO_PRINTF1(_L("Calling sequence - eglBindAPI(EGL_OPENVG_API) - eglCreatePixmapSurface - eglCreateContext - eglMakeCurrent"));
 	    ASSERT_EGL_TRUE(eglBindAPI(EGL_OPENVG_API));
 
-    	const EGLint KAttrib_list_image_pre[] = {   EGL_MATCH_NATIVE_PIXMAP,	reinterpret_cast<EGLint>(&sgImages[i]), 
+    	const EGLint KAttrib_list_image_pre[] = {   EGL_MATCH_NATIVE_PIXMAP,	reinterpret_cast<EGLint>(&sgImages[i]),
 													EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
-													EGL_SURFACE_TYPE, EGL_PIXMAP_BIT | EGL_VG_ALPHA_FORMAT_PRE_BIT, 
+													EGL_SURFACE_TYPE, EGL_PIXMAP_BIT | EGL_VG_ALPHA_FORMAT_PRE_BIT,
 													EGL_NONE };
     	const EGLint KAttrib_list_image_nonpre[] = {EGL_MATCH_NATIVE_PIXMAP,	reinterpret_cast<EGLint>(&sgImages[i]),
 													EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
-													EGL_SURFACE_TYPE, EGL_PIXMAP_BIT, 
+													EGL_SURFACE_TYPE, EGL_PIXMAP_BIT,
 													EGL_NONE };
 		EGLConfig currentConfig;
 		EGLint numconfigs =0;
@@ -1514,9 +1514,9 @@
 	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImage));
 
 	// At this point we draw the VGImage created from the SgImage to the current surface.
-	//	# if the source is a A_8, the VGImage acts as a mask and the target surface must contain 
+	//	# if the source is a A_8, the VGImage acts as a mask and the target surface must contain
 	//		as a result the pen colour set above blended with the mask
-	//	# otherwise, drawing the VGImage is just a simple copy via vgSetPixels (no blending required) 
+	//	# otherwise, drawing the VGImage is just a simple copy via vgSetPixels (no blending required)
 	INFO_PRINTF1(_L("Copying the VGImage to the surface"));
 	if (iSourceFormat == EUidPixelFormatA_8)
 		{
@@ -1534,7 +1534,7 @@
 		VGuint fillColor = 0x008000ff; // opaque dark green
 		vgSetColor(fillPaint, fillColor);
 		ASSERT_EGL_TRUE(vgGetError() == VG_NO_ERROR);
-		
+
 		vgSeti(VG_IMAGE_MODE, VG_DRAW_IMAGE_STENCIL);
 		vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
 		vgDrawImage(vgImage);
@@ -1555,7 +1555,7 @@
 	//    a) a reference bitmap needs to be cleared to black (same colour as the surface was cleared to)
 	//    b) a Pen bitmap, that we clear to dark green (same colour as the fillPaint used to draw to the surface)
 	//    c) a mask bitmap, which is the reference bitmap used to create the SgImage
-	//  # otherwise, the surface must contain the same pixels as the bitmap used to create the SgImage 
+	//  # otherwise, the surface must contain the same pixels as the bitmap used to create the SgImage
 	if (iSourceFormat == EUidPixelFormatA_8)
 		{
 		TDisplayMode maskMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
@@ -1568,7 +1568,7 @@
 
 		CFbsBitmap* refBitmap = iEglSess->CreateReferenceMaskedBitmapL(refbitmapMode, KRgbDarkGreen, mask);
 		CleanupStack::PushL(refBitmap);
-		
+
 		// compare the obtained reference bitmap with the surface drawn
 		iEglSess->CheckVgDrawingL(iSurfaceFormat, refBitmap);
 		CleanupStack::PopAndDestroy(2, mask); //mask, refBitmap
@@ -1593,7 +1593,7 @@
 
 
 /**
-@SYMTestCaseID GRAPHICS-EGL-0428
+@SYMTestCaseID GRAPHICS-EGL-0430
 
 @SYMTestPriority 1
 
@@ -1609,36 +1609,39 @@
 Run two processes that independently perform the actions detailed below.
 * From Process A
 	Open the RSgDriver
-	Create an RSgImage
-	Signal (by semaphore or otherwise) to process A, passing the drawable ID to it
+	Create an RSgImage passing an initialised bitmap
+	Signal (by semaphore or otherwise) to process B, passing the drawable ID to it
 
 * From Process B:
 	Open the RSgDriver
 	Using the drawable ID, open the RSgImage
+	Close the RSgImage
+	Re-open the RSgImage
+
+* From Process A:
+	Unexpectedly terminate process A without performing any explicit clean-up
+
+* From Process B:
+	Wait for Process A to be killed:
 	Create an EGLImage from the RSgImage
 	Create a VGImage from the EGLImage
 	Close the RSgImage
 	Close the EGLImage
 	Create an off-screen surface
-
-* From Process A:
-	Unexpectedly terminate process A without performing any explicit clean-up
-
-* From Process B:
-	Wait for Process A to be killed
-	Populate the VGImage with data
-	Copy the VGImage to the off-screen surface
-	Close the off-screen surface
+	Draw VGImage to the off-screen surface
+	Read the pixel data and verify that it matches the data populated by process A
+	Destroy the off-screen surface
 	Close the VGImage
 	Close the RSgDriver
+	Exit
 
 @SYMTestExpectedResults
-Process B should be able to populate the VGImage with data and copy it to the off-screen surface. 
+Process B should be able to populate the VGImage with data and copy it to the off-screen surface
 All allocated image memory should be freed
 */
 TVerdict CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate::doTestStepL()
     {
-    SetTestStepID(_L("GRAPHICS-EGL-0428"));
+    SetTestStepID(_L("GRAPHICS-EGL-0430"));
 	SetTestStepName(KEGL_Image_Multi_Process_VgImage_ProcessTerminate);
     INFO_PRINTF1(_L("Enter: CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate::doTestStepL"));
 
@@ -1655,9 +1658,9 @@
 	PrintUsedPixelConfiguration();
 
 	// launch 2 processes
-	Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
+ 	Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
 
-	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate::doTestStepL"));   
+	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate::doTestStepL"));
     RecordTestResultL();
     CloseTMSGraphicsStep();
     return TestStepResult();
@@ -1684,216 +1687,14 @@
     RMsgQueue<TProcessId> messageQueueProcId;
     User::LeaveIfError(messageQueueProcId.Open(EProcSlotMsgQueueProcId, EOwnerProcess));
     CleanupClosePushL(messageQueueProcId);
-    
+
     RProcess process;
     CleanupClosePushL(process);
 	TRequestStatus status;
 
-    RSgImage rSgImageLocal;
-    EGLImageKHR eglImageLocal = EGL_NO_IMAGE_KHR;
-    VGImage vgImageLocal = VG_INVALID_HANDLE;
-    if(aIdx == 0)
-        {
-    	// Create an RSgImage
-    	INFO_PRINTF2(_L("Process %d, Creating a RSgImage"),aIdx);
-    	TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KImageSize);
-#ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
-    	imageInfo.iShareable = ETrue;
-    	imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
-#endif    	
-    	ASSERT_EQUALS(rSgImageLocal.Create(imageInfo, NULL, NULL), KErrNone);
- 
-        INFO_PRINTF2(_L("Process %d, Sending SgImage ID to other process..."), aIdx);
-        messageQueueSgId.SendBlocking(rSgImageLocal.Id());
-
-        // Sending Process ID to other process... so that the other process can identify when this one dies.
-        messageQueueProcId.SendBlocking(RProcess().Id());
-        }
-    else if(aIdx == 1)
-        {
-        INFO_PRINTF2(_L("Process %d: Receiving SgImage ID from other process..."), aIdx);
-        TSgDrawableId sgImageId;
-        messageQueueSgId.ReceiveBlocking(sgImageId);
-    	ASSERT_EQUALS(rSgImageLocal.Open(sgImageId),KErrNone);
-
-        // Also receiving RProcess ID from other process to be able to identify when it dies
-        TProcessId procId;
-        messageQueueProcId.ReceiveBlocking(procId);
-        process.Open(procId);
-        process.Logon(status);
-
-        INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx);
-    	CleanupClosePushL(rSgImageLocal);
-    	eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue);
-    	ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR);
-    	CleanupStack::PopAndDestroy(&rSgImageLocal); 	//transferring ownership of the buffer to the EGLImage
- 
-    	INFO_PRINTF2(_L("Creating a Surface and a Context bound to OpenVG, Process %d"),aIdx);
-    	TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
-    	TSgImageInfoOpenVgTarget imageInfo = TSgImageInfoOpenVgTarget(pixelFormat, KImageSize);
-    	// Create a pixmap surface matching the native image pixel format
-    	iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo,CTestEglSession::EResourceCloseSgImageEarly);
-
-    	INFO_PRINTF2(_L("Process %d, Creating one VGImage from the EGLImage"),aIdx);
-    	vgImageLocal = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImageLocal);
-    	ASSERT_VG_TRUE(vgImageLocal != VG_INVALID_HANDLE);
-    	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImageLocal));
-        }
-    
-	// Wait for both processes to reach this point
-    Rendezvous(aIdx);
-
-    if(aIdx == 0)
-    	{
-    	// simulate this process being killed
-    	// note that we terminate with reason=0 (otherwise the egl test framework would think it's an error)
-       	INFO_PRINTF2(_L("Process %d, Simulate the process is being killed!"),aIdx);
-    	RProcess().Terminate(KErrNone);
-    	
-    	// this line is unreachable
-    	ASSERT(0);
-    	}
-    else if(aIdx == 1)
-        {
-        // first wait for the other process to finish
-        User::WaitForRequest(status);
-        ASSERT_EQUALS(status.Int(), KErrNone);
-
-        INFO_PRINTF2(_L("Process %d, Populate contents of the VGImage"),aIdx);
-        TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
-        CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KImageSize, 3);
-		CleanupStack::PushL(bitmap);
-		// Add pixel data to the VGImage reference from the bitmap reference. 
-        // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
-		TSize bitmapSize = bitmap->SizeInPixels();
-    	TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress());
-    	TInt stride = bitmap->DataStride();
-    	address += (bitmapSize.iHeight - 1) * stride;
-        vgImageSubData(vgImageLocal, address, -stride, iSurfaceFormat, 0,0, bitmapSize.iWidth, bitmapSize.iHeight);
-    	ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
-    	eglWaitClient();
-
-        INFO_PRINTF2(_L("Process %d, Drawing the VGImage to the current surface before changing contents of the VGImage"),aIdx);
-        // Copy the source VGImage to the surface
-    	vgSetPixels(0, 0, vgImageLocal, 0, 0, KImageSize.iWidth, KImageSize.iHeight);
-    	ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
-    	eglWaitClient();
-    	
-    	// we can now compare the VgImage to the one we expect
-		iEglSess->CheckVgDrawingL(iSurfaceFormat, bitmap);
-		CleanupStack::PopAndDestroy(bitmap);
-		INFO_PRINTF2(_L("Process %d, Drawing successful"),aIdx);
-
-		// cleanup
-		vgDestroyImage(vgImageLocal);
-    	ASSERT_TRUE(vgGetError() == VG_NO_ERROR);
-        }
-    
-    //cleanup and finish
-	CleanupStack::PopAndDestroy(3, &messageQueueSgId); //messageQueueSgId, messageQueueProcId, process
-	CleanAll();
-    }
-
-
-/**
-@SYMTestCaseID GRAPHICS-EGL-0430
-
-@SYMTestPriority 1
-
-@SYMPREQ 2637
-
-@SYMTestCaseDesc
-Functional test - Killing the RSgImage creating process
-
-@SYMTestPurpose
-To verify correct operation of RSgImage sharing across processes when the creating process is killed
-
-@SYMTestActions
-Run two processes that independently perform the actions detailed below.
-* From Process A
-	Open the RSgDriver
-	Create an RSgImage
-	Signal (by semaphore or otherwise) to process B, passing the drawable ID to it
-	
-* From Process B:
-	Open the RSgDriver
-	Using the drawable ID, open the RSgImage	
-	Close the RSgImage
-	Re-open the RSgImage
-
-* From Process A:
-	Unexpectedly terminate process A without performing any explicit clean-up
-
-* From Process B:
-	Wait for Process A to be killed:
-	Create an EGLImage from the RSgImage
-	Create a VGImage from the EGLImage
-	Close the RSgImage
-	Close the EGLImage
-	Create an off-screen surface
-	Populate the VGImage with data
-	Draw VGImage to the off-screen surface
-	Destroy the off-screen surface
-	Close the VGImage
-	Close the RSgDriver
-	Exit
-
-@SYMTestExpectedResults
-Process B should be able to populate the VGImage with data and copy it to the off-screen surface
-All allocated image memory should be freed
-*/
-TVerdict CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate2::doTestStepL()
-    {
-    SetTestStepID(_L("GRAPHICS-EGL-0430"));
-	SetTestStepName(KEGL_Image_Multi_Process_VgImage_ProcessTerminate2);
-    INFO_PRINTF1(_L("Enter: CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate2::doTestStepL"));
-
-	TBool ret = CheckForExtensionL(KEGL_RSgimage | KEGL_KHR_image_base | KEGL_KHR_image_pixmap | KVG_KHR_EGL_image);
-	if(!ret)
-		{
-		// The extension is not supported
-		RecordTestResultL();
-		CloseTMSGraphicsStep();
-		return TestStepResult();
-		}
-
-	// This test is performed for default pixel format
-	PrintUsedPixelConfiguration();
-
-	// launch 2 processes
- 	Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
-
-	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate2::doTestStepL"));   
-    RecordTestResultL();
-    CloseTMSGraphicsStep();
-    return TestStepResult();
-    }
-
-void CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate2::doProcessFunctionL(TInt aIdx)
-    {
-    INFO_PRINTF2(_L("CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate2::doProcessFunctionL, Process %d"),aIdx);
-    GetDisplayL();
-    CreateEglSessionL(aIdx);
-    iEglSess->InitializeL();
-    iEglSess->OpenSgDriverL();
-
-	//Retrieve source formats for the launched process from the process parameters.
-	User::LeaveIfError(User::GetTIntParameter(EProcSlotSourceFormat, reinterpret_cast<TInt&>(iSourceFormat)));
-	User::LeaveIfError(User::GetTIntParameter(EProcSlotSurfaceFormat, reinterpret_cast<TInt&>(iSurfaceFormat)));
-
-	//create the queue to send/receive SgImage ID between processes
-	RMsgQueue<TSgDrawableId> messageQueueSgId;
-    User::LeaveIfError(messageQueueSgId.Open(EProcSlotMsgQueueSgId, EOwnerProcess));
-    CleanupClosePushL(messageQueueSgId);
-
-	//create the queue to send/receive Process ID between processes
-    RMsgQueue<TProcessId> messageQueueProcId;
-    User::LeaveIfError(messageQueueProcId.Open(EProcSlotMsgQueueProcId, EOwnerProcess));
-    CleanupClosePushL(messageQueueProcId);
-    
-    RProcess process;
-    CleanupClosePushL(process);
-	TRequestStatus status;
+	TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
+	CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KImageSize, 6);
+	CleanupStack::PushL(bitmap);
 
 	RSgImage rSgImageLocal;
     if(aIdx == 0)
@@ -1905,8 +1706,8 @@
     	imageInfo.iShareable = ETrue;
     	imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
 #endif
-    	ASSERT_EQUALS(rSgImageLocal.Create(imageInfo,NULL, NULL), KErrNone);
- 
+    	ASSERT_EQUALS(rSgImageLocal.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
+
         INFO_PRINTF2(_L("Process %d, Sending SgImage ID to other process..."), aIdx);
         messageQueueSgId.SendBlocking(rSgImageLocal.Id());
 
@@ -1930,7 +1731,7 @@
     	rSgImageLocal.Close();
     	ASSERT_EQUALS(rSgImageLocal.Open(sgImageId),KErrNone);
         }
-    
+
 	// Wait for both processes to reach this point
     Rendezvous(aIdx);
 
@@ -1940,7 +1741,7 @@
     	// note that we terminate with reason=0 (otherwise the egl test framework would think it's an error)
        	INFO_PRINTF2(_L("Process %d, Simulate the process is being killed!"),aIdx);
     	RProcess().Terminate(KErrNone);
-    	
+
     	// this line is unreachable
     	ASSERT(0);
     	}
@@ -1949,13 +1750,13 @@
         // first wait for the other process to finish
         User::WaitForRequest(status);
         ASSERT_EQUALS(status.Int(), KErrNone);
-       
+
         INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx);
     	CleanupClosePushL(rSgImageLocal);
         EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue);
     	ASSERT_EGL_TRUE(eglImageLocal != EGL_NO_IMAGE_KHR);
     	CleanupStack::PopAndDestroy(&rSgImageLocal); 	//transferring ownership of the buffer to the EGLImage
- 
+
     	INFO_PRINTF2(_L("Creating a Surface and a Context bound to OpenVG, Process %d"),aIdx);
     	TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(iSurfaceFormat);
     	TSgImageInfoOpenVgTarget imageInfo = TSgImageInfoOpenVgTarget(pixelFormat, KImageSize);
@@ -1967,38 +1768,23 @@
     	ASSERT_VG_TRUE(vgImageLocal != VG_INVALID_HANDLE);
     	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImageLocal));
 
-    	INFO_PRINTF2(_L("Process %d, Populate contents of the VGImage"),aIdx);
-        TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
-        CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KImageSize, 3);
-		CleanupStack::PushL(bitmap);
-		// Add pixel data to the VGImage reference from the bitmap reference. 
-        // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
-		TSize bitmapSize = bitmap->SizeInPixels();
-    	TUint8* address = reinterpret_cast<TUint8*>(bitmap->DataAddress());
-    	TInt stride = bitmap->DataStride();
-    	address += (bitmapSize.iHeight - 1) * stride;
-        vgImageSubData(vgImageLocal, address, -stride, iSurfaceFormat, 0,0, bitmapSize.iWidth, bitmapSize.iHeight);
-    	ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
-    	eglWaitClient();
-
         INFO_PRINTF2(_L("Process %d, Drawing the VGImage to the current surface before changing contents of the VGImage"),aIdx);
         // Copy the source VGImage to the surface
     	vgSetPixels(0, 0, vgImageLocal, 0, 0, KImageSize.iWidth, KImageSize.iHeight);
     	ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
     	eglWaitClient();
-    	
+
     	// we can now compare the VgImage to the one we expect
 		iEglSess->CheckVgDrawingL(iSurfaceFormat, bitmap);
-		CleanupStack::PopAndDestroy(bitmap);
 		INFO_PRINTF2(_L("Process %d, Drawing successful"),aIdx);
 
 		// cleanup
 		vgDestroyImage(vgImageLocal);
     	ASSERT_TRUE(vgGetError() == VG_NO_ERROR);
         }
-    
+
     //cleanup and finish
-	CleanupStack::PopAndDestroy(3, &messageQueueSgId); //messageQueueSgId, messageQueueProcId, process
+	CleanupStack::PopAndDestroy(4, &messageQueueSgId); //messageQueueSgId, messageQueueProcId, process, bitmap
 	CleanAll();
     }
 
@@ -2028,7 +1814,7 @@
 
 * From Process A:
 	Unexpectedly terminate process A without performing any explicit clean-up
-	
+
 * From Process B:
 	Wait for Process A to be killed:
 	Using the drawable ID, attempt to open the RSgImage
@@ -2036,7 +1822,7 @@
 	Exit
 
 @SYMTestExpectedResults
-Process B should be unable to open the RSgImage and the call to Open() should return error code KErrNotFound.  
+Process B should be unable to open the RSgImage and the call to Open() should return error code KErrNotFound.
 All allocated image memory should be freed
 */
 TVerdict CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminateNegative::doTestStepL()
@@ -2060,7 +1846,7 @@
 	// launch 2 processes
 	Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
 
-	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminateNegative::doTestStepL"));   
+	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminateNegative::doTestStepL"));
     RecordTestResultL();
     CloseTMSGraphicsStep();
     return TestStepResult();
@@ -2087,7 +1873,7 @@
     RMsgQueue<TProcessId> messageQueueProcId;
     User::LeaveIfError(messageQueueProcId.Open(EProcSlotMsgQueueProcId, EOwnerProcess));
     CleanupClosePushL(messageQueueProcId);
-    
+
     RProcess process;
     CleanupClosePushL(process);
 	TRequestStatus status;
@@ -2104,7 +1890,7 @@
     	imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
 #endif
     	ASSERT_EQUALS(rSgImageLocal.Create(imageInfo,NULL, NULL), KErrNone);
- 
+
         INFO_PRINTF2(_L("Process %d, Sending SgImage ID to other process..."), aIdx);
         messageQueueSgId.SendBlocking(rSgImageLocal.Id());
 
@@ -2133,7 +1919,7 @@
     	// note that we terminate with reason=0 (otherwise the egl test framework would think it's an error)
        	INFO_PRINTF2(_L("Process %d, Simulate the process is being killed!"),aIdx);
     	RProcess().Terminate(KErrNone);
-    	
+
     	// this line is unreachable
     	ASSERT(0);
     	}
@@ -2145,13 +1931,13 @@
 
         // NOTE: We can't guarante when the kernel will have completed the cleanup. This process
         //	could have been notified that the other process has terminated but this does not guarantee
-        //	that all handles to the process have been released. 
+        //	that all handles to the process have been released.
         //	This is not generally a problem in single processor hardware, but can be a problem in dual
         //	processor hardware (ie, NaviEngine) where one processor could be cleaning up the terminated
         //	process, the other processor could already be issuing the notification to the waiting process
         //	Not much we can do other than adding a small delay to ensure this...
         User::After(1*1000*1000); // 1 second
-        
+
         // we're expecting it to fail with the appropriate error
         TInt ret = rSgImageLocal.Open(sgImageId);
 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
@@ -2177,7 +1963,7 @@
 @SYMPREQ 2637
 
 @SYMTestCaseDesc
-Functional test - Simultaneous reading and writing of simulated glyphs. 
+Functional test - Simultaneous reading and writing of simulated glyphs.
 The rectangular area of RSgImage will be divided into the following section:
 	 -----------
     ¦ 0 ¦ 1 ¦ 2 ¦
@@ -2190,7 +1976,7 @@
 It is obvoious that each sub-section will therefore be of 30x30:
 
 @SYMTestPurpose
-To determine that the system can cope with simultaneous 
+To determine that the system can cope with simultaneous
 reading and writing from/to area within RSgImage without corrupting each other.
 
 @SYMTestActions
@@ -2214,7 +2000,7 @@
 			Signal client process that section[i] can be read
 			Repeat until client process signal read complete
 				Shade sections surrounding section[i] to other colors e.g. when i=1, 
-				surrounding sections are section 4, 5 and 2 
+				surrounding sections are section 0, 2 and 4 
 				End loop
 			End loop
 
@@ -2231,7 +2017,7 @@
 Close the VGImage and RSgImage driver
 
 @SYMTestExpectedResults
-The content of each section read by client process should match the content written by Process A. 
+The content of each section read by client process should match the content written by Process A.
 All image memory should be freed
 */
 TVerdict CEglTest_EGL_Image_Multi_Process_VgImage_ReadWrite::doTestStepL()
@@ -2258,7 +2044,7 @@
 	// launch 2 processes
 	Test_MultiProcessL(KEglTestStepDllName, 2, TestStepName());
 
-	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_ReadWrite::doTestStepL"));   
+	INFO_PRINTF1(_L("Exit: CEglTest_EGL_Image_Multi_Process_VgImage_ReadWrite::doTestStepL"));
     RecordTestResultL();
     CloseTMSGraphicsStep();
     return TestStepResult();
@@ -2275,17 +2061,17 @@
 	const TSize KTestReadWriteImageSize(90,90);
 	const TInt KTestReadWriteSubImageLength = KTestReadWriteImageSize.iHeight / 3;
 	const TInt KTestNumColors = 9;
-	const VGfloat KTestClearColors[KTestNumColors][4] = 
+	const VGfloat KTestClearColors[KTestNumColors][4] =
 		{
-		{0.11f, 0.13f, 0.15f, 0.17f},	// arbitrary colour 1 		
-		{0.21f, 0.23f, 0.25f, 0.27f},	// arbitrary colour 2 		
-		{0.31f, 0.33f, 0.35f, 0.37f},	// arbitrary colour 3 		
-		{0.41f, 0.43f, 0.45f, 0.47f},	// arbitrary colour 4 		
-		{0.51f, 0.53f, 0.55f, 0.57f},	// arbitrary colour 5 		
-		{0.61f, 0.63f, 0.65f, 0.67f},	// arbitrary colour 6 		
-		{0.71f, 0.73f, 0.75f, 0.77f},	// arbitrary colour 7 		
-		{0.81f, 0.83f, 0.85f, 0.87f},	// arbitrary colour 8 		
-		{0.91f, 0.93f, 0.95f, 0.97f}	// arbitrary colour 9 		
+		{0.11f, 0.13f, 0.15f, 0.17f},	// arbitrary colour 1
+		{0.21f, 0.23f, 0.25f, 0.27f},	// arbitrary colour 2
+		{0.31f, 0.33f, 0.35f, 0.37f},	// arbitrary colour 3
+		{0.41f, 0.43f, 0.45f, 0.47f},	// arbitrary colour 4
+		{0.51f, 0.53f, 0.55f, 0.57f},	// arbitrary colour 5
+		{0.61f, 0.63f, 0.65f, 0.67f},	// arbitrary colour 6
+		{0.71f, 0.73f, 0.75f, 0.77f},	// arbitrary colour 7
+		{0.81f, 0.83f, 0.85f, 0.87f},	// arbitrary colour 8
+		{0.91f, 0.93f, 0.95f, 0.97f}	// arbitrary colour 9
 		};
 
 	//Retrieve source formats for the launched process from the process parameters.
@@ -2308,7 +2094,7 @@
     	imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
 #endif
     	ASSERT_EQUALS(rSgImageLocal.Create(imageInfo,NULL, NULL), KErrNone);
- 
+
         INFO_PRINTF2(_L("Process %d, Sending SgImage ID to other process..."), aIdx);
         messageQueueSgId.SendBlocking(rSgImageLocal.Id());
         }
@@ -2319,7 +2105,7 @@
         messageQueueSgId.ReceiveBlocking(sgImageId);
     	ASSERT_EQUALS(rSgImageLocal.Open(sgImageId),KErrNone);
         }
-    
+
     INFO_PRINTF2(_L("Process %d, Creating an EGLImage from the shared RSgImage"),aIdx);
 	CleanupClosePushL(rSgImageLocal);
 	EGLImageKHR eglImageLocal = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &rSgImageLocal, KEglImageAttribsPreservedTrue);
@@ -2327,7 +2113,7 @@
 	CleanupStack::PopAndDestroy(&rSgImageLocal); 	//transferring ownership of the buffer to the EGLImage
 
 	// OpenVG needs a current VG context before it will allow the call vgCreateEGLImageTargetKHR
-	// The created surface will remain un-used, hence we create it with the default pixel format, as we don't care 
+	// The created surface will remain un-used, hence we create it with the default pixel format, as we don't care
 	TUidPixelFormat pixelFormat = EglTestConversion::VgFormatToSgPixelFormat(KDefaultSurfaceFormat);
 	TSgImageInfoOpenVgTarget imageInfo = TSgImageInfoOpenVgTarget(pixelFormat, KTestReadWriteImageSize);
 	iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo,CTestEglSession::EResourceCloseSgImageEarly);
@@ -2336,7 +2122,7 @@
 	VGImage vgImageLocal = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)eglImageLocal);
 	ASSERT_VG_TRUE(vgImageLocal != VG_INVALID_HANDLE);
 	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, eglImageLocal));
-    
+
 	// Wait for both processes to reach this point
     Rendezvous(aIdx);
 
@@ -2348,7 +2134,8 @@
         	INFO_PRINTF3(_L("Process %d, Shading section[%d]"),aIdx, section);
     		//Shade section[i] to color[i]
     	    vgSetfv(VG_CLEAR_COLOR, 4, KTestClearColors[section]);
-            vgClearImage(vgImageLocal, section%3, section/3, KTestReadWriteSubImageLength, KTestReadWriteSubImageLength);        
+            vgClearImage(vgImageLocal, (section%3)*KTestReadWriteSubImageLength, (section/3)*KTestReadWriteSubImageLength, KTestReadWriteSubImageLength, KTestReadWriteSubImageLength);        
+    		vgFinish();
     		}
 
     	// Wait for both processes to reach this point
@@ -2359,21 +2146,24 @@
     		{
         	INFO_PRINTF3(_L("Process %d, Creating child vgimage for section[%d]"),aIdx, section);
 			//Create child VGImage for section[i]
-    		childImage = vgChildImage(vgImageLocal, section%3, section/3, KTestReadWriteSubImageLength, KTestReadWriteSubImageLength);
+    		childImage = vgChildImage(vgImageLocal, (section%3)*KTestReadWriteSubImageLength, (section/3)*KTestReadWriteSubImageLength, KTestReadWriteSubImageLength, KTestReadWriteSubImageLength);
     		//Read the value of child VGImage and compare it with colour[i]
-    		TUint32 vgPixel=0;
+			TUint32* vgPixel = new(ELeave) TUint32[KTestReadWriteSubImageLength];
+			CleanupArrayDeletePushL(vgPixel);
     		for (TInt i=0; i<KTestReadWriteSubImageLength; i++)
     			{
+    			// Read childImage, a line at a time
+    			vgGetImageSubData(childImage, vgPixel, 1, iSurfaceFormat, 0, i, KTestReadWriteSubImageLength, 1);
     			for (TInt j=0; j<KTestReadWriteSubImageLength; j++)
     				{
-    				vgGetImageSubData(childImage, &vgPixel, 1, iSurfaceFormat, i, j, 1, 1);
 					// Should be exact, but give a tolerance of 1 because VG rounds to nearer integer, whereas TInt rounds down 
-    				ASSERT_TRUE(Abs(((vgPixel & 0xff000000) >> 24) - (255 * KTestClearColors[section][3])) <= 1);	//alpha
-    				ASSERT_TRUE(Abs(((vgPixel & 0x00ff0000) >> 16) - (255 * KTestClearColors[section][0])) <= 1);	//red
-    				ASSERT_TRUE(Abs(((vgPixel & 0x0000ff00) >> 8) - (255 * KTestClearColors[section][1])) <= 1); 	//green
-    				ASSERT_TRUE(Abs(((vgPixel & 0x000000ff) >> 0) - (255 * KTestClearColors[section][2])) <= 1); 	//blue
+    				ASSERT_TRUE(Abs(((vgPixel[j] & 0xff000000) >> 24) - (255 * KTestClearColors[section][3])) <= 1);	//alpha
+    				ASSERT_TRUE(Abs(((vgPixel[j] & 0x00ff0000) >> 16) - (255 * KTestClearColors[section][0])) <= 1);	//red
+    				ASSERT_TRUE(Abs(((vgPixel[j] & 0x0000ff00) >> 8) - (255 * KTestClearColors[section][1])) <= 1); 	//green
+    				ASSERT_TRUE(Abs(((vgPixel[j] & 0x000000ff) >> 0) - (255 * KTestClearColors[section][2])) <= 1); 	//blue
 					}
     			}
+    		CleanupStack::PopAndDestroy(vgPixel);
     		}
     	if (aIdx==0)
     		{
@@ -2382,8 +2172,9 @@
         		{
             	TInt surroundingSection = (KTestNumColors + section + k) % KTestNumColors;
         	    vgSetfv(VG_CLEAR_COLOR, 4, KTestClearColors[surroundingSection]);
-        	    vgClearImage(vgImageLocal, surroundingSection*KTestReadWriteSubImageLength, section*KTestReadWriteSubImageLength, KTestReadWriteSubImageLength, KTestReadWriteSubImageLength);        
+        	    vgClearImage(vgImageLocal, (surroundingSection%3)*KTestReadWriteSubImageLength, (surroundingSection/3)*KTestReadWriteSubImageLength, KTestReadWriteSubImageLength, KTestReadWriteSubImageLength);        
         		}
+    		vgFinish(); 
     		}
 
     	// Wait for both processes to reach this point
--- a/egl/egltest/src/egltest_image_negative.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltest_image_negative.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -76,13 +76,13 @@
 	GetDisplayL();
 	CreateEglSessionL();
 	iEglSess->InitializeL();
-	iEglSess->OpenSgDriverL();	
-	
+	iEglSess->OpenSgDriverL();
+
 	INFO_PRINTF1(_L("Creating one EGLImage from a NULL RSgImage"));
 	EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, NULL, KEglImageAttribsPreservedTrue);
 	ASSERT_EGL_TRUE(imageKHR == EGL_NO_IMAGE_KHR);
 	ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
-	
+
 	INFO_PRINTF1(_L("Creating one EGLImage from a not fully constructed RSgImage"));
 	RSgImage sgImage;
 	CleanupClosePushL(sgImage);
@@ -241,7 +241,7 @@
 	TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
 	CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KPixmapSize, 8);
 	CleanupStack::PushL(bitmap);
-	
+
 	// Create RSgImage's attributes.
 	TSgImageInfoTest imageInfo;
 	imageInfo.iSizeInPixels = KPixmapSize;
@@ -254,20 +254,22 @@
 	imageInfo.iCpuAccess = ESgCpuAccessNone;
 	imageInfo.iScreenId = KSgScreenIdMain;
 	imageInfo.iUserAttributes = NULL;
-	imageInfo.iUserAttributeCount = 0;	
+	imageInfo.iUserAttributeCount = 0;
 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 
 	RSgImage sgImage;
 	CleanupClosePushL(sgImage);
 	ASSERT_EQUALS(sgImage.Create(imageInfo, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
 
-	//First Subtest: creation of an EGLImageKhr with wrong Usage will fail
-	INFO_PRINTF1(_L("Trying to create an EGLImage from a RSgImage that doesn't have correct iUsage, ESgUsageBitOpenVgImage|ESgUsageOpenGlesTexture2D|ESgUsageOpenGles2Texture2D"));
+	//First Subtest: Attempted creation of an EGLImageKhr from an RSgImage with the wrong Usage should fail
+	INFO_PRINTF1(_L("Attempt creation of an EGLImage from a RSgImage with incorrect iUsage ESgUsageBitOpenGlesSurface"));
+	INFO_PRINTF1(_L("Correct iUsage needs to have at least one of ESgUsageBitOpenVgImage, ESgUsageOpenGlesTexture2D or ESgUsageOpenGles2Texture2D bits set"));
+
 	EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
 	ASSERT_EGL_TRUE(imageKHR == EGL_NO_IMAGE_KHR);
 	ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
     CleanupStack::PopAndDestroy(&sgImage);
-	
+
 	if(iEglSess->IsOpenGLES2Supported())
 	    {
 	    TSgImageInfoTest imageInfo2;
@@ -278,15 +280,15 @@
 #else
 		imageInfo2.iUsage = ESgUsageOpenGlesTexture2D;
 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
-	
+
 	    // Create a SgImage
 		RSgImage sgImage2;
 		CleanupClosePushL(sgImage2);
 		ASSERT_EQUALS(sgImage2.Create(imageInfo2, bitmap->DataAddress(), bitmap->DataStride()), KErrNone);
 
-	    // Create a EGLImage from the RSgImage
+	    // The creation of an EGLImage from a RSgImage with correct usage (ESgUsageBitOpenGles2Texture2D or ESgUsageOpenGlesTexture2D) should pass
 		EGLImageKHR imageKHR2 = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage2, KEglImageAttribsPreservedTrue);
-		ASSERT_EGL_TRUE(imageKHR2 == EGL_NO_IMAGE_KHR);
+		ASSERT_EGL_TRUE(imageKHR2 != EGL_NO_IMAGE_KHR);
 
 	    //Create an OffScreen Pixmap, we need it to make a Context current
 	    imageInfo2.iSizeInPixels = KPixmapSize;
@@ -305,13 +307,13 @@
 	    ASSERT_TRUE(vgGetError()==VG_UNSUPPORTED_IMAGE_FORMAT_ERROR);
 
         CleanupStack::PopAndDestroy(&sgImage2);
-        ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR2));		
+        ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR2));
 	    }
-	
+
 	//cleanup
 	CleanupStack::PopAndDestroy(bitmap);
 	CleanAll();
-	
+
 	RecordTestResultL();
 	CloseTMSGraphicsStep();
 	return TestStepResult();
@@ -373,11 +375,11 @@
 	iEglSess->InitializeL();
 	iEglSess->OpenSgDriverL();
 
-	INFO_PRINTF1(_L("Creating one RSgImage"));	
+	INFO_PRINTF1(_L("Creating one RSgImage"));
 	TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 	imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
-#endif	
+#endif
 	RSgImage sgImage;
 	CleanupClosePushL(sgImage);
 	ASSERT_EQUALS(sgImage.Create(imageInfo, NULL, NULL), KErrNone);
@@ -385,26 +387,26 @@
 	INFO_PRINTF1(_L("Creating one EGLImage from it"));
 	EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
 	ASSERT_EGL_TRUE(imageKHR != EGL_NO_IMAGE_KHR);
-	
+
 	INFO_PRINTF1(_L("Calling eglDestroyImageKHR with EGL_NO_DISPLAY"));
-	ASSERT_EGL_TRUE(!iEglSess->DestroyEGLImage(EGL_NO_DISPLAY, imageKHR));		
+	ASSERT_EGL_TRUE(!iEglSess->DestroyEGLImage(EGL_NO_DISPLAY, imageKHR));
 	ASSERT_EGL_ERROR(EGL_BAD_DISPLAY);
 
 	INFO_PRINTF1(_L("Calling eglDestroyImageKHR with a random number (but not 1) as Display"));
-	ASSERT_EGL_TRUE(!iEglSess->DestroyEGLImage(7, imageKHR));		
+	ASSERT_EGL_TRUE(!iEglSess->DestroyEGLImage(7, imageKHR));
 	ASSERT_EGL_ERROR(EGL_BAD_DISPLAY);
 
 	INFO_PRINTF1(_L("Calling eglDestroyImageKHR with valid EGLImage handle (so, that should succeed)"));
-	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));		
+	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
 
 	INFO_PRINTF1(_L("Calling eglDestroyImageKHR with invalid handle"));
-	ASSERT_EGL_TRUE(!iEglSess->DestroyEGLImage(iDisplay, imageKHR));		
+	ASSERT_EGL_TRUE(!iEglSess->DestroyEGLImage(iDisplay, imageKHR));
 	ASSERT_EGL_ERROR(EGL_BAD_PARAMETER);
-	
+
 	//cleanup
-    CleanupStack::PopAndDestroy(&sgImage);	
+    CleanupStack::PopAndDestroy(&sgImage);
 	CleanAll();
-	
+
 	RecordTestResultL();
 	CloseTMSGraphicsStep();
 	return TestStepResult();
@@ -464,11 +466,11 @@
 	iEglSess->InitializeL();
 	iEglSess->OpenSgDriverL();
 
-	INFO_PRINTF1(_L("Creating one RSgImage"));	
+	INFO_PRINTF1(_L("Creating one RSgImage"));
 	TSgImageInfoOpenVgImage imageInfo = TSgImageInfoOpenVgImage(iSourceFormat, KPixmapSize);
 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 	imageInfo.iCpuAccess = ESgCpuAccessReadWrite;
-#endif	
+#endif
 	RSgImage sgImage;
 	CleanupClosePushL(sgImage);
 	ASSERT_EQUALS(sgImage.Create(imageInfo, NULL, NULL), KErrNone);
@@ -483,10 +485,10 @@
 	iEglSess->CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo2, CTestEglSession::EResourceCloseSgImageEarly);
 
 	INFO_PRINTF1(_L("Destroying the EGLImage but retain the handle value"));
-	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));		
+	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
 
 	INFO_PRINTF1(_L("Attemptimg to create a VGImage from an invalid handle"));
-	VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);	
+	VGImage vgImage = iEglSess->vgCreateImageTargetKHR((VGeglImageKHR)imageKHR);
 	ASSERT_VG_TRUE(vgImage == VG_INVALID_HANDLE);
 	ASSERT_TRUE(vgGetError()==VG_ILLEGAL_ARGUMENT_ERROR);
 
@@ -494,9 +496,9 @@
 	ASSERT_TRUE(vgGetError()==VG_BAD_HANDLE_ERROR);
 
 	//cleanup
-    CleanupStack::PopAndDestroy(&sgImage);	
+    CleanupStack::PopAndDestroy(&sgImage);
 	CleanAll();
-	
+
 	RecordTestResultL();
 	CloseTMSGraphicsStep();
 	return TestStepResult();
@@ -568,8 +570,8 @@
 	TDisplayMode bitmapMode = EglTestConversion::PixelFormatToDisplayMode(iSourceFormat);
 	CFbsBitmap* bitmap = iEglSess->CreateReferenceBitmapL(bitmapMode, KPixmapSize, 8);
 	CleanupStack::PushL(bitmap);
-	
-	INFO_PRINTF1(_L("Creating one RSgImage"));	
+
+	INFO_PRINTF1(_L("Creating one RSgImage"));
 	TSgImageInfoTest imageInfo;
 	imageInfo.iSizeInPixels = KPixmapSize;
 	imageInfo.iPixelFormat = iSourceFormat;
@@ -589,7 +591,7 @@
 	INFO_PRINTF1(_L("Calling eglBindAPI(EGL_OPENVG_API)"));
 	ASSERT_EGL_TRUE(eglBindAPI(EGL_OPENVG_API));
 
-    EGLint numConfigsWithPre = 0;       
+    EGLint numConfigsWithPre = 0;
     EGLConfig configWithPre;
     const EGLint KAttribImagePre[] = { EGL_MATCH_NATIVE_PIXMAP,  reinterpret_cast<EGLint>(&sgImage),
                                        EGL_RENDERABLE_TYPE,      EGL_OPENVG_BIT,
@@ -623,7 +625,7 @@
 	//cleanup
 	vgDestroyImage(vgImage);
 	ASSERT_TRUE(vgGetError()==VG_NO_ERROR);
-	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));		
+	ASSERT_EGL_TRUE(iEglSess->DestroyEGLImage(iDisplay, imageKHR));
 	CleanupStack::PopAndDestroy(2, bitmap); // bitmap, sgImage
 	//This test doesn't check the drawing because the content of the image are undefined
 	//since we are using the same buffer both as target and as source
--- a/egl/egltest/src/egltest_syncobject.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltest_syncobject.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -77,7 +77,6 @@
 		}
 	INFO_PRINTF2(_L("Tick period in micro seconds %d"), iTickPeriodMicroSeconds);
 	
-	_LIT(KSectionSyncObject, "SyncObject");
 	_LIT(KKeyThreshold, "Threshold");
 	_LIT(KKeyDelaySignalling, "DelaySignalling");
 	_LIT(KKeyWaitSyncTimeout, "WaitSyncTimeout");
@@ -85,11 +84,11 @@
 	_LIT(KKeyNumStressIterations, "NumIterations");
 
 	//retrive all setting from INI file
-	GetIntFromConfig(KSectionSyncObject, KKeyThreshold, iThreshold);
-	GetIntFromConfig(KSectionSyncObject, KKeyDelaySignalling, iDelaySignalling);
-	GetIntFromConfig(KSectionSyncObject, KKeyWaitSyncTimeout, iWaitSyncTimeout);
-	GetIntFromConfig(KSectionSyncObject, KKeyLongDelaySignalling, iLongDelaySignalling);
-	GetIntFromConfig(KSectionSyncObject, KKeyNumStressIterations, iNumStressIterations);
+	GetIntFromConfig(ConfigSection(), KKeyThreshold, iThreshold);
+	GetIntFromConfig(ConfigSection(), KKeyDelaySignalling, iDelaySignalling);
+	GetIntFromConfig(ConfigSection(), KKeyWaitSyncTimeout, iWaitSyncTimeout);
+	GetIntFromConfig(ConfigSection(), KKeyLongDelaySignalling, iLongDelaySignalling);
+	GetIntFromConfig(ConfigSection(), KKeyNumStressIterations, iNumStressIterations);
 	
 	INFO_PRINTF2(_L("Level of tolerance %d"), iThreshold);
 	INFO_PRINTF2(_L("Delay before the signal occurs  %d"), iDelaySignalling);
--- a/egl/egltest/src/egltest_vgimagetosurfaces.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltest_vgimagetosurfaces.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -389,7 +389,7 @@
 		return TestStepResult();
 		}
     User::LeaveIfError(res); // leave here if any other error was raised other than the one above.
-	iEglSess->CreateWindowSurfaceAndMakeCurrentL(config, window);
+	iEglSess->CreateWindowSurfaceAndMakeCurrentL(config, window, windowFormat == EWindowAttribsColor16MAP);
 
 	INFO_PRINTF1(_L("Creating 1 EGLImage from the RSgImage"));
 	EGLImageKHR imageKHR = iEglSess->eglCreateImageKhrL(iDisplay, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, &sgImage, KEglImageAttribsPreservedTrue);
--- a/egl/egltest/src/egltestcommoninisettings.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltestcommoninisettings.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -153,7 +153,40 @@
         {
         return size;
         }
-
     return TSize(0,0);
    }
 
+EXPORT_C TSize CEglTestCommonIniSettings::GetWindowSize(const TDesC& aSectioName)
+    {
+    _LIT(KKeyWindowWidth, "WindowWidth");
+    _LIT(KKeyWindowHeight, "WindowHeight");
+    TSize size(0, 0);
+    if(iIniData->FindVar(aSectioName, KKeyWindowWidth, size.iWidth) && 
+            iIniData->FindVar(aSectioName, KKeyWindowHeight, size.iHeight))
+        {
+        return size;
+        }
+	return TSize(0,0);
+   }
+
+EXPORT_C TInt CEglTestCommonIniSettings::GetThresholdGPUUsedMemory(const TDesC& aSectioName)
+    {
+    _LIT(KKeyThresholdGPUUsedMemory, "ThresholdGPUUsedMemory");
+    TInt thresholdGPUUsedMemory = 0;
+    if(iIniData->FindVar(aSectioName, KKeyThresholdGPUUsedMemory, thresholdGPUUsedMemory))
+        {
+        return thresholdGPUUsedMemory;
+        }
+    return 0;
+   }
+
+EXPORT_C TInt CEglTestCommonIniSettings::GetThresholdLastIteration(const TDesC& aSectioName)
+    {
+    _LIT(KKeyThresholdLastIteration, "ThresholdLastIteration");
+    TInt thresholdLastIteration = 0;
+    if(iIniData->FindVar(aSectioName, KKeyThresholdLastIteration, thresholdLastIteration))
+        {
+        return thresholdLastIteration;
+        }
+    return 0;
+   }
--- a/egl/egltest/src/egltestcommonsession.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltestcommonsession.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -15,7 +15,7 @@
 
 /**
  @file
- @test 
+ @test
 */
 
 #include "egltestcommonsession.h"
@@ -82,7 +82,7 @@
                 {
                 WARN_PRINTF3(_L("thread %d: eglMakeCurrent returned error = %x ~CTestEglSession..."), iThreadIdx, eglGetError());
                 }
-            
+
             // Warn because this should be done by the test, rather than relying on the d'tor
             // which may not leave if there is an error (so no CHECK_EXPECTED_ERROR)
             WARN_PRINTF2(_L("thread %d: Calling eglDestroyContext() from ~CTestEglSession..."), iThreadIdx);
@@ -90,7 +90,7 @@
             if(ret == EGL_FALSE)
                 {
                 WARN_PRINTF3(_L("thread %d: eglDestroyContext returned error = %x ~CTestEglSession..."), iThreadIdx, eglGetError());
-                }   
+                }
 		    }
 
 		if (iSurface != EGL_NO_SURFACE)
@@ -102,9 +102,9 @@
 			if(ret == EGL_FALSE)
 				{
 				WARN_PRINTF3(_L("thread %d: eglDestroySurface returned error = %x ~CTestEglSession..."), iThreadIdx, eglGetError());
-				}	
+				}
 			}
-		
+
 		if (iTerminateDisplay)
 			{
 			INFO_PRINTF1(_L("Calling eglTerminate..."));
@@ -113,14 +113,14 @@
 			if(ret == EGL_FALSE)
 				{
 				WARN_PRINTF3(_L("thread %d: eglTerminate returned error = %x ~CTestEglSession..."), iThreadIdx, eglGetError());
-				}	
+				}
 			}
 		}
 
 	// Only destroy native resource after the surface and context that wraps it has been destroyed.
 	delete iFbsBitmap;
 	CloseFbsSession();
-	
+
 	iSgImage.Close();
 	CloseSgDriver();
 	}
@@ -129,7 +129,7 @@
 	{
 	VERBOSE_INFO_PRINTF3(_L("thread %d: Setting the expected error code for the next EGL call to %x"), iThreadIdx, aExpectedErrorCode);
 		{
-		iExpectedErrorCode = aExpectedErrorCode; 
+		iExpectedErrorCode = aExpectedErrorCode;
 		}
 	}
 
@@ -149,15 +149,15 @@
 	{
 	TBool isExpectedError = ETrue;
 	EGLint eglErr = eglGetError();
-	
+
 	// First check that we got the correct return value
 	if ((iExpectedErrorCode == EGL_SUCCESS) && !aFunctionReturnValue)
 		{
 		ERR_PRINTF3(_L("thread %d: Wrong function return value: %d"), iThreadIdx, aFunctionReturnValue);
 		isExpectedError = EFalse;
 		}
-	// Also check that we got the 
-	if (eglErr != iExpectedErrorCode) 
+	// Also check that we got the
+	if (eglErr != iExpectedErrorCode)
 		{
 		ERR_PRINTF4(_L("thread %d: eglGetError() returned %x, but expected %x"), iThreadIdx, eglErr, iExpectedErrorCode);
 		isExpectedError = EFalse;
@@ -166,18 +166,18 @@
 		{
 		VERBOSE_INFO_PRINTF3(_L("thread %d: eglGetError() returned %x, as expected"), iThreadIdx, eglErr);
 		}
-	
+
 	// Reset the expected error
 	ResetExpectedError();
-	
+
 	return isExpectedError;
 	}
 
 EXPORT_C void CTestEglSession::CheckExpectedErrorL(EGLint aExpectedErrorCode)
 	{
-	EGLint eglErr = eglGetError();	
+	EGLint eglErr = eglGetError();
 	// check that we got the expected error
-	if (eglErr != aExpectedErrorCode) 
+	if (eglErr != aExpectedErrorCode)
 		{
 		ERR_PRINTF4(_L("thread %d: eglGetError() returned %x, but expected %x"), iThreadIdx, eglErr, aExpectedErrorCode);
 		User::Leave(KErrTEFUnitFail);
@@ -188,7 +188,7 @@
 	{
 	// reset the cached extensions
 	iExtensionStrings.Reset();
-	
+
 	const char* extensionsString = NULL;
 	if(aExtensionBelongsTo == EIsEGL)
 		{
@@ -196,19 +196,13 @@
 		extensionsString = eglQueryString(iDisplay, EGL_EXTENSIONS);
 		}
 	else if(aExtensionBelongsTo == EIsVG)
-		{	
+		{
 		INFO_PRINTF2(_L("thread %d: Calling vgGetString for VG_EXTENSIONS)"), iThreadIdx);
 
 		// OpenVG needs a current VG context before it will allow the call to vgGetString
-		TSgImageInfoOpenVgTarget imageInfo;
-		imageInfo.iSizeInPixels = KPixmapSize;
-		imageInfo.iPixelFormat = EUidPixelFormatXRGB_8888;
-#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
-		imageInfo.iUsage = ESgUsageBitOpenVgSurface;
-#else
-        imageInfo.iUsage = ESgUsageOpenVgTarget;
-#endif		
-		CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo,CTestEglSession::EResourceCloseSgImageEarly);
+		// The created surface will remain un-used, hence we create it with an arbitrary pixel format 
+        EGLConfig currentConfig = GetConfigExactMatchL(EPBufferAttribsColor64K);
+        CreatePbufferSurfaceAndMakeCurrentL(currentConfig, TSize(1,1), EGL_OPENVG_API);
 
 		extensionsString = (const char*) vgGetString(VG_EXTENSIONS);
 
@@ -220,13 +214,17 @@
 		ERR_PRINTF2(_L("CTestEglSession::QueryExtensionsL() - Unknown extension group provided (%d)."), aExtensionBelongsTo);
 		User::Leave(KErrArgument);
 		}
-	CHECK_EXPECTED_ERROR(extensionsString!=NULL);	
-	
+	CHECK_EXPECTED_ERROR(extensionsString!=NULL);
+
 	TPtrC8 ptrExtensions((const TUint8 *) extensionsString );
-	TBuf16<128> bufExtensions;
-	bufExtensions.Copy(ptrExtensions.Left(128));
-	INFO_PRINTF3(_L("thread %d: QueryExtensionsL: \"%S\""), iThreadIdx, &bufExtensions);
-	
+
+	RBuf buffer;
+    buffer.CreateL(ptrExtensions.Length());
+    buffer.CleanupClosePushL();
+    buffer.Copy(ptrExtensions);
+	INFO_PRINTF3(_L("thread %d: QueryExtensionsL: \"%S\""), iThreadIdx, &buffer);
+    CleanupStack::PopAndDestroy(&buffer);
+
 	TInt posSpace=1;
 	while (posSpace > 0 && ptrExtensions.Length() > 0)
 		{
@@ -244,7 +242,7 @@
 			{
 			iExtensionStrings.Append(ptrExtensions);
 			}
-		} 
+		}
 	}
 
 TBool CTestEglSession::FindExtensionStringL(TExtensionsGroups aExtensionBelongsTo, const TDesC8& aExtensionString)
@@ -255,7 +253,7 @@
 		QueryExtensionsL(aExtensionBelongsTo); // Load extension info
 		iExtensionGroupCached = aExtensionBelongsTo;
 		}
-	
+
 	TInt countExtensionStrings = iExtensionStrings.Count();
 	for(TUint i=0; i<countExtensionStrings; i++)
 		{
@@ -270,7 +268,7 @@
 	const TInt KBufLenMissingExtension=128;
 	TBuf16<KBufLenMissingExtension> bufMissingExtension16;
 	bufMissingExtension16.Copy(aExtensionString.Left(KBufLenMissingExtension));
-	
+
 	WARN_PRINTF2(_L("EGL extension missing: [%S]"), &bufMissingExtension16);
 	return EFalse;
 	}
@@ -300,11 +298,11 @@
 	INFO_PRINTF1(_L("Checking number of configs..."));
 	ASSERT_TRUE(numConfigs >= 1);
 	INFO_PRINTF2(_L("Found %d configs"), numConfigs);
-	
+
 	// Get the configs
 	INFO_PRINTF1(_L("Calling eglGetConfigs to get configs..."));
 	CHECK_EXPECTED_ERROR(eglGetConfigs(iDisplay, configs, KMaxEglConfigs, &numConfigs));
-	
+
 	for(TUint index = 0; index < numConfigs; index++)
 		{
 		EGLint EGL_BUFFER_SIZE_value;
@@ -381,14 +379,14 @@
 
 		TBool good = ETrue;
 
-		INFO_PRINTF7(_L("(idx: %3d) RGBA=(%2d) %2d,%2d,%2d,%2d"), index, EGL_BUFFER_SIZE_value, 
-				EGL_RED_SIZE_value, EGL_GREEN_SIZE_value, EGL_BLUE_SIZE_value, 
+		INFO_PRINTF7(_L("(idx: %3d) RGBA=(%2d) %2d,%2d,%2d,%2d"), index, EGL_BUFFER_SIZE_value,
+				EGL_RED_SIZE_value, EGL_GREEN_SIZE_value, EGL_BLUE_SIZE_value,
 				EGL_ALPHA_SIZE_value);
 		if (!(EGL_RED_SIZE_value == 8 && EGL_GREEN_SIZE_value == 8 && EGL_BLUE_SIZE_value == 8 && EGL_ALPHA_SIZE_value == 0))
 			{
 			continue;
 			}
-		
+
 		INFO_PRINTF2(_L("\n\n^^^^^^ CONFIG [%d] VALUES ******"), index);
 		if (EGL_SURFACE_TYPE_value & EGL_PIXMAP_BIT)
 			{
@@ -399,7 +397,7 @@
 			INFO_PRINTF2(_L("EGL_SURFACE_TYPE=%d. <<< BAD (not pixmap)"), EGL_SURFACE_TYPE_value);
 			good = EFalse;
 			}
-		
+
 		if (EGL_RENDERABLE_TYPE_value & EGL_OPENVG_BIT)
 			{
 			INFO_PRINTF2(_L("EGL_RENDERABLE_TYPE=%d. <<< Has EGL_OPENVG_BIT"), EGL_RENDERABLE_TYPE_value);
@@ -409,7 +407,7 @@
 			INFO_PRINTF2(_L("EGL_RENDERABLE_TYPE=%d. <<< BAD (not open vg)"), EGL_RENDERABLE_TYPE_value);
 			good = EFalse;
 			}
-		
+
 		if (good)
 			{
 			INFO_PRINTF1(_L("^^^^^^^ GOOD ^^^^^^^"));
@@ -456,7 +454,7 @@
 EXPORT_C static TEglConfigMatchType GetMatchType(EGLint aAttrib, TEglConfigMatchRule aMatchRule)
 	{
 	const TConfigMatchRuleItem* curMatchRuleItem = KConfigMatchRules[aMatchRule];
-			
+
 	while(curMatchRuleItem->iAttrib != EGL_NONE)
 		{
 		if (aAttrib == curMatchRuleItem->iAttrib)
@@ -473,7 +471,7 @@
 /**
  Returns the first index of a config that matches the requested config extactly
  */
-TInt CTestEglSession::GetFullMatchConfigIndex(EGLDisplay aDisplay, EGLConfig *aConfigs, TInt aNumConfigs, 
+TInt CTestEglSession::GetFullMatchConfigIndex(EGLDisplay aDisplay, EGLConfig *aConfigs, TInt aNumConfigs,
 											  const EGLint aWantedAttribs[], TEglConfigMatchRule aMatchRule)
 	{
 	EGLint value=0;
@@ -481,7 +479,7 @@
 		{
 		const EGLint *curAttrib = aWantedAttribs;
 		TBool match = ETrue;
-		
+
 		while(*curAttrib != EGL_NONE && match)
 			{
 			ASSERT_EGL_TRUE(eglGetConfigAttrib(aDisplay, aConfigs[idxConfig], *curAttrib, &value));
@@ -492,7 +490,7 @@
 					if (value != curAttrib[1])
 						{
 						match = EFalse;
-						}		
+						}
 					break;
 				case eMatchAtLeast:
 					if (value < curAttrib[1])   // Note, we detect "failure to match", hence "<" not ">="!
@@ -508,17 +506,17 @@
 					break;
 				case eMatchAlways:
 				    break;
-				    
+
 				default:
 					// We should not get here.
-				    ASSERT(FALSE); 
+				    ASSERT(FALSE);
 				    break;
 				}
 			curAttrib += 2;
 			}
-		
-		// If we get here with match set, we have matched all attributes, and have found a match. 
-		if (match) 
+
+		// If we get here with match set, we have matched all attributes, and have found a match.
+		if (match)
 			{
 			return idxConfig;
 			}
@@ -539,7 +537,7 @@
 /**
  Returns pixel format inforamtion for a given EGL config.
  @param aConfig The EGL config for which pixel format information will be returned.
- @return A pointer to the pixel format information for the given EGL config.  
+ @return A pointer to the pixel format information for the given EGL config.
          Tf the config cannot be mapped, then NULL is returned.
  */
 EXPORT_C const TMapEglConfigToPixelFormat* CTestEglSession::GetPixelFormatFromEglConfigL(EGLConfig aConfig)
@@ -561,7 +559,7 @@
 	CHECK_EXPECTED_ERROR(eglGetConfigAttrib(iDisplay, aConfig, EGL_SURFACE_TYPE, &surfaceType));
 
 	INFO_PRINTF7(_L(">>>>> Config info: %d, %d, %d,%d,%d, 0x%x"), bufferSize, alphaSize, redSize, greenSize, blueSize, colorBufferType);
-	
+
 	for(TUint i=0; i<ConfigToPixelFormatTableLength(); i++)
 		{
 		if ((ConfigToPixelFormatTable(i).iBufferSize == bufferSize)
@@ -632,7 +630,7 @@
 		ERR_PRINTF1(_L("Attribute index out of range, please check the INI file"));
 		User::Leave(KErrArgument);
 		}
-	
+
 	EGLConfig configs[KMaxEglConfigs];
 	EGLint numConfigs=0;
 	ASSERT_EGL_TRUE(eglChooseConfig(iDisplay, KConfigAttribs[aConfigAttribIndex], configs, KMaxEglConfigs, &numConfigs));
@@ -642,7 +640,7 @@
 		WARN_PRINTF1(_L("GetConfigExactMatchL - Could not find a matching config, eglChooseConfig returned 0 configs!"));
 		User::Leave(KTestNoMatchingConfig);
 		}
-	
+
 	// Check that any of the configs returned matches the desired attributes
 	TInt match = GetFullMatchConfigIndex(iDisplay, configs, numConfigs, KConfigAttribs[aConfigAttribIndex], aMatchRule);
 	if (match == KErrNotFound)
@@ -671,10 +669,10 @@
 	{
 	CreatePixmapSurfaceAndMakeCurrentL(aConfig, aSize, aDisplayMode);
 	DrawOpenVgL();
-	
+
 	// Wait for the drawing to complete
 	eglWaitClient();
-	
+
 	CheckImageDataL(iFbsBitmap);
 	CheckImageDataVgL(VG_sRGB_565);
 	CleanupSurfaceFbsBitmapL();
@@ -688,10 +686,10 @@
 	{
 	CreatePixmapSurfaceAndMakeCurrentL(aConfig, aSize, aDisplayMode,EGL_OPENGL_ES_API, aRenderVersion);
 	DrawOpenGLesL();
-	
+
 	// Wait for the drawing to complete
 	eglWaitClient();
-	
+
 	CheckImageDataFullRedishL(iFbsBitmap);
 	CleanupSurfaceFbsBitmapL();
 	CloseFbsSession();
@@ -707,7 +705,7 @@
 	imageInfo.iSizeInPixels = KPixmapSize;
 	imageInfo.iPixelFormat = EUidPixelFormatXRGB_8888;
 	// will draw to and read from the image using OpenVg
-#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE	
+#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 	imageInfo.iUsage = ESgUsageBitOpenVgSurface | ESgUsageBitOpenVgImage;
 #else
     // will also read from the image using DirectGdi
@@ -720,11 +718,11 @@
 #endif
 	CreatePixmapSurfaceAndMakeCurrentAndMatchL(imageInfo, EResourceCloseSgImageLate);
 	DrawOpenVgL();
-	            
+
 	// Wait for the drawing to complete
 	 eglWaitClient();
-	    
-	//we can't retrieve data directly from the SgImage as 
+
+	//we can't retrieve data directly from the SgImage as
 	//non-unified architecture doesn't allow readback from the GPU
 	CheckImageDataVgL(VG_sXRGB_8888);
 	CleanupSurfaceSgImageL();
@@ -734,18 +732,18 @@
 EXPORT_C TBool CTestEglSession::TryUsePixmapRSgImageOpenGlesL(EGLConfig aConfig, const TSgImageInfo& aImageInfo, TResourceCloseRule aResourceCloseRule, TInt aRenderVersion)
 	{
 	CreatePixmapSurfaceAndMakeCurrentL(aConfig, aImageInfo, aResourceCloseRule ,EGL_OPENGL_ES_API, aRenderVersion);
-		
+
 	DrawOpenGLesL();
-			
+
 	// Wait for the drawing to complete
 	eglWaitClient();
 
-	//we can't retrieve data directly from SgImage as non-unified 
+	//we can't retrieve data directly from SgImage as non-unified
 	//architecture doesn't allow readback from the GPU
-	
-	if (aImageInfo.iPixelFormat == EUidPixelFormatXRGB_8888  || 
+
+	if (aImageInfo.iPixelFormat == EUidPixelFormatXRGB_8888  ||
 		aImageInfo.iPixelFormat == EUidPixelFormatARGB_8888_PRE)
-		{	
+		{
 		CheckImageDataGLesL();
 		}
 
@@ -767,13 +765,13 @@
 EXPORT_C TBool CTestEglSession::TryUsePixmapRSgImageOpenVgL(EGLConfig aConfig, const TSgImageInfo& aImageInfo, TResourceCloseRule aResourceCloseRule)
 	{
 	CreatePixmapSurfaceAndMakeCurrentL(aConfig, aImageInfo, aResourceCloseRule);
-		
+
 	DrawOpenVgL();
-			
+
 	// Wait for the drawing to complete
 	eglWaitClient();
-	
-	//we can't retrieve data directly from the SgImage as 
+
+	//we can't retrieve data directly from the SgImage as
 	//non-unified architecture doesn't allow readback from the GPU
 	CheckImageDataVgL(VG_sXRGB_8888);
 	CleanupSurfaceSgImageL();
@@ -781,26 +779,24 @@
 	return ETrue;
 	}
 
-EXPORT_C void CTestEglSession::CreateWindowSurfaceAndMakeCurrentL(EGLConfig aConfig, RWindow& aWindow, EGLenum aBindAPI, TInt aRenderVersionNumber)
+EXPORT_C void CTestEglSession::CreateWindowSurfaceAndMakeCurrentL(EGLConfig aConfig, RWindow& aWindow, TBool aVgAlphaFormatPre, EGLenum aBindAPI, TInt aRenderVersionNumber)
 	{
 	ASSERT_EQUALS(iSurface, EGL_NO_SURFACE);
 	ASSERT_EQUALS(iContext, EGL_NO_CONTEXT);
-	
+
 	ASSERT_EGL_TRUE(eglBindAPI(aBindAPI));
-		
+
 	// Create a Window surface from the native image
-	EGLint EGL_RENDERABLE_TYPE_value = 0;
-	ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, aConfig, EGL_RENDERABLE_TYPE, &EGL_RENDERABLE_TYPE_value));
-	const EGLint* pixmapAttribs = ((aWindow.DisplayMode() == EColor16MAP) && (EGL_RENDERABLE_TYPE_value & EGL_OPENVG_BIT)) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
-	iSurface = eglCreateWindowSurface(iDisplay, aConfig, &aWindow, pixmapAttribs);
+	const EGLint* windowAttribs = (aVgAlphaFormatPre && aBindAPI == EGL_OPENVG_API) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
+	iSurface = eglCreateWindowSurface(iDisplay, aConfig, &aWindow, windowAttribs);
 	ASSERT_EGL_TRUE(iSurface != EGL_NO_SURFACE);
 
 	// Create a context for drawing to/reading from the pixmap surface and make it current
 	const EGLint KAttribsListCtxNone[] = { EGL_NONE };;
 	const EGLint KAttribsListCtxGles2[] = { EGL_CONTEXT_CLIENT_VERSION, aRenderVersionNumber, EGL_NONE };
-	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone; 
+	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone;
 	iContext = eglCreateContext(iDisplay, aConfig, EGL_NO_CONTEXT, attrib_list_ctx);
-	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);	
+	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);
 	ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, iSurface, iSurface, iContext));
 	}
 
@@ -816,7 +812,7 @@
 	{
 	ASSERT_EQUALS(iSurface, EGL_NO_SURFACE);
 	ASSERT_EQUALS(iContext, EGL_NO_CONTEXT);
-	
+
     OpenSgDriverL();
     ASSERT_EQUALS(iSgImage.Create(aImageInfo, NULL, 0), KErrNone);
 
@@ -838,7 +834,7 @@
 		ERR_PRINTF1(_L("CreatePixmapSurfaceAndMakeCurrentAndMatchL - Unkown API requested!"));
 		User::Leave(KErrArgument);
 		}
-	EGLint attrib_list[] = { 
+	EGLint attrib_list[] = {
 			  EGL_MATCH_NATIVE_PIXMAP,(TInt)&iSgImage,
 			  EGL_RENDERABLE_TYPE,renderableType,
 			  EGL_SURFACE_TYPE,EGL_PIXMAP_BIT,
@@ -865,25 +861,25 @@
 	const EGLint* pixmapAttribs = ((aImageInfo.iPixelFormat == EUidPixelFormatARGB_8888_PRE) && (EGL_RENDERABLE_TYPE_value & EGL_OPENVG_BIT)) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
 	iSurface = eglCreatePixmapSurface(iDisplay, config, &iSgImage, pixmapAttribs);
 	ASSERT_EGL_TRUE(iSurface != EGL_NO_SURFACE);
-	
+
 	if (aResourceCloseRule == EResourceCloseSgImageEarly)
 		{
 		// EGL should have taken its own reference to the SgImage, so it should be able to continue
 		// to use the underlying data after this local image has been closed.
 		iSgImage.Close();
 		}
-	
+
 	if (aResourceCloseRule == EResourceCloseSgDriverAndImageEarly)
 		{
 		// EGL should have taken its own reference to the SgDriver, so it should be able to continue
-		// to use its reference to the image resource after this local reference to the driver has 
+		// to use its reference to the image resource after this local reference to the driver has
 		// been closed.
 		iSgImage.Close();
-		CloseSgDriver();		
+		CloseSgDriver();
 		}
 
 	// Create a context for drawing to/reading from the pixmap surface and make it current
-	const EGLint KAttribsListCtxNone[] = { EGL_NONE };;
+	const EGLint KAttribsListCtxNone[] = { EGL_NONE };
 	const EGLint KAttribsListCtxGles2[] = { EGL_CONTEXT_CLIENT_VERSION, aRenderVersionNumber, EGL_NONE };
 	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone; 
 	iContext = eglCreateContext(iDisplay, config, EGL_NO_CONTEXT, attrib_list_ctx);
@@ -892,12 +888,12 @@
 	}
 
 /**
-Compound operation that constructs an RSgImage and uses it to create a pixmap suface. 
+Compound operation that constructs an RSgImage and uses it to create a pixmap suface.
 It then makes it current to the thread.
 @param aConfig The EGL config to be used when creating the pixmap surface
 @param aImageInfo Used to create the RSgImage pixmap
 @param aCloseNativeImageEarly When ETrue, the RSgImage is closed as soon as the pixmap surface has been
-		created.  Otherwise, the RSgImage is left to be destroyed later by some other method 
+		created.  Otherwise, the RSgImage is left to be destroyed later by some other method
 		- e.g at the same time as destroying the surface.
 @return Whether it was possible to create an iSgImage for the given aImageInfo
 */
@@ -905,10 +901,10 @@
 	{
 	ASSERT_EQUALS(iSurface, EGL_NO_SURFACE);
 	ASSERT_EQUALS(iContext, EGL_NO_CONTEXT);
-	
+
 	OpenSgDriverL();
     ASSERT_EQUALS(iSgImage.Create(aImageInfo, NULL, 0), KErrNone);
-		
+
 	ASSERT_EGL_TRUE(eglBindAPI(aBindAPI));
 
 	// Create a pixmap surface from the native image
@@ -917,7 +913,7 @@
 	const EGLint* pixmapAttribs = ((aImageInfo.iPixelFormat == EUidPixelFormatARGB_8888_PRE) && (EGL_RENDERABLE_TYPE_value & EGL_OPENVG_BIT)) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
 	iSurface = eglCreatePixmapSurface(iDisplay, aConfig, &iSgImage, pixmapAttribs);
 	ASSERT_EGL_TRUE(iSurface != EGL_NO_SURFACE);
-	
+
 	if (aResourceCloseRule == EResourceCloseSgImageEarly)
 		{
 		// EGL should have taken its own reference to the SgImage, so it should be able to continue
@@ -927,18 +923,18 @@
 	if (aResourceCloseRule == EResourceCloseSgDriverAndImageEarly)
 		{
 		// EGL should have taken its own reference to the SgDriver, so it should be able to continue
-		// to use its reference to the image resource after this local reference to the driver has 
+		// to use its reference to the image resource after this local reference to the driver has
 		// been closed.
 		iSgImage.Close();
-		CloseSgDriver();		
+		CloseSgDriver();
 		}
-	
+
 	// Create a context for drawing to/reading from the pixmap surface and make it current
 	const EGLint KAttribsListCtxNone[] = { EGL_NONE };;
 	const EGLint KAttribsListCtxGles2[] = { EGL_CONTEXT_CLIENT_VERSION, aRenderVersionNumber, EGL_NONE };
-	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone; 
+	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone;
 	iContext = eglCreateContext(iDisplay, aConfig, EGL_NO_CONTEXT, attrib_list_ctx);
-	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);	
+	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);
 	ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, iSurface, iSurface, iContext));
 	}
 
@@ -946,7 +942,7 @@
 	{
 	//Fist try with CreateHardwareBitmap to check whether we are on hardware
 	TInt result = aFbsBitmap->CreateHardwareBitmap(aSize, aDisplayMode, KUidEglTestServer);
-	
+
 	if(result == KErrNotSupported)
 		{
 		//we are not on hardware
@@ -959,12 +955,12 @@
 	{
 	ASSERT_EQUALS(iSurface, EGL_NO_SURFACE);
 	ASSERT_EQUALS(iContext, EGL_NO_CONTEXT);
-	
+
 	// Create an empty native CFbsBitmap
 	OpenFbsSessionL();
 	iFbsBitmap = new(ELeave)CFbsBitmap;
 	ASSERT_EQUALS(CreateBitmap(iFbsBitmap, aSize, displayMode), KErrNone);
-	
+
     const EGLint* attrib_list = NULL;
 	if(aBindAPI == EGL_OPENVG_API)
 		{
@@ -985,28 +981,28 @@
 		User::Leave(KErrArgument);
 		}
 	ASSERT_EGL_TRUE(eglBindAPI(aBindAPI));
-	
+
 	// Create a pixmap surface from the native image
 	EGLint EGL_RENDERABLE_TYPE_value = 0;
 	ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, aConfig, EGL_RENDERABLE_TYPE, &EGL_RENDERABLE_TYPE_value));
 	const EGLint* pixmapAttribs = ((displayMode == EColor16MAP) && (EGL_RENDERABLE_TYPE_value & EGL_OPENVG_BIT)) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
 	iSurface = eglCreatePixmapSurface(iDisplay, aConfig, iFbsBitmap, pixmapAttribs);
 	ASSERT_EGL_TRUE(iSurface != EGL_NO_SURFACE);
-	
+
 	// Create a context for drawing to/reading from the pixmap surface and make it current
 	iContext = eglCreateContext(iDisplay, aConfig, EGL_NO_CONTEXT, attrib_list);
-	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);	
+	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);
 	ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, iSurface, iSurface, iContext));
 	}
 
-EXPORT_C void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentAndMatchL(const TSize& aSize, TDisplayMode displayMode, EGLenum aBindAPI, TInt aRenderVersionNumber)
+EXPORT_C void CTestEglSession::CreatePixmapSurfaceAndMakeCurrentAndMatchL(const TSize& aSize, TDisplayMode aDisplayMode, EGLenum aBindAPI, TInt aRenderVersionNumber)
 	{
 	ASSERT_EQUALS(iSurface, EGL_NO_SURFACE);
 	ASSERT_EQUALS(iContext, EGL_NO_CONTEXT);
-	
+
 	OpenFbsSessionL();
 	iFbsBitmap = new(ELeave)CFbsBitmap;
-	ASSERT_EQUALS(CreateBitmap(iFbsBitmap, aSize, displayMode), KErrNone);
+	ASSERT_EQUALS(CreateBitmap(iFbsBitmap, aSize, aDisplayMode), KErrNone);
 
 	EGLint renderableType = 0;
 	if(aBindAPI == EGL_OPENVG_API)
@@ -1026,7 +1022,7 @@
 		ERR_PRINTF1(_L("CreatePixmapSurfaceAndMakeCurrentAndMatchL - Unkown API requested!"));
 		User::Leave(KErrArgument);
 		}
-	EGLint attrib_list[] = { 
+	EGLint attrib_list[] = {
 			  EGL_MATCH_NATIVE_PIXMAP,(TInt)iFbsBitmap,
 			  EGL_RENDERABLE_TYPE,renderableType,
 			  EGL_SURFACE_TYPE,EGL_PIXMAP_BIT,
@@ -1048,18 +1044,16 @@
 		}
 
 	// Create a pixmap surface from the native image
-	EGLint EGL_RENDERABLE_TYPE_value = 0;
-	ASSERT_EGL_TRUE(eglGetConfigAttrib(iDisplay, config, EGL_RENDERABLE_TYPE, &EGL_RENDERABLE_TYPE_value));
-	const EGLint* pixmapAttribs = ((displayMode == EColor16MAP) && (EGL_RENDERABLE_TYPE_value & EGL_OPENVG_BIT)) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
+	const EGLint* pixmapAttribs = (aDisplayMode == EColor16MAP && aBindAPI == EGL_OPENVG_API) ? KPixmapAttribsVgAlphaFormatPre : KPixmapAttribsNone;
 	iSurface = eglCreatePixmapSurface(iDisplay, config, iFbsBitmap, pixmapAttribs);
 	ASSERT_EGL_TRUE(iSurface != EGL_NO_SURFACE);
-	
+
 	// Create a context for drawing to/reading from the pixmap surface and make it current
 	const EGLint KAttribsListCtxNone[] = { EGL_NONE };;
 	const EGLint KAttribsListCtxGles2[] = { EGL_CONTEXT_CLIENT_VERSION, aRenderVersionNumber, EGL_NONE };
-	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone; 
+	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone;
 	iContext = eglCreateContext(iDisplay, config, EGL_NO_CONTEXT, attrib_list_ctx);
-	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);	
+	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);
 	ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, iSurface, iSurface, iContext));
 	}
 
@@ -1070,27 +1064,27 @@
 
 	ASSERT_EQUALS(iSurface, EGL_NO_SURFACE);
 	ASSERT_EQUALS(iContext, EGL_NO_CONTEXT);
-	
+
 	ASSERT_EGL_TRUE(eglBindAPI(aBindAPI));
-	
+
 	//	PBuffer attribs options are:
 	//		EGL_WIDTH, EGL_HEIGHT, EGL_LARGEST_PBUFFER,
 	//		EGL_TEXTURE_FORMAT, EGL_TEXTURE_TARGET, EGL_MIPMAP_TEXTURE,
 	//		EGL_VG_COLORSPACE, and EGL_VG_ALPHA_FORMAT
 	// Create a pbuffer surface of the given size
-	const EGLint KPbufferAttribs[] = { 
+	const EGLint KPbufferAttribs[] = {
 			EGL_WIDTH,	aSize.iWidth,
 			EGL_HEIGHT,	aSize.iHeight,
 			EGL_NONE };
-	iSurface = eglCreatePbufferSurface(iDisplay, aConfig, KPbufferAttribs);	
+	iSurface = eglCreatePbufferSurface(iDisplay, aConfig, KPbufferAttribs);
 	ASSERT_EGL_TRUE(iSurface != EGL_NO_SURFACE);
 
 	// Create a context for drawing to/reading from the pixmap surface and make it current
 	const EGLint KAttribsListCtxNone[] = { EGL_NONE };;
 	const EGLint KAttribsListCtxGles2[] = { EGL_CONTEXT_CLIENT_VERSION, aRenderVersionNumber, EGL_NONE };
-	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone; 
+	const EGLint* attrib_list_ctx = (aBindAPI == EGL_OPENGL_ES_API && aRenderVersionNumber == 2) ? KAttribsListCtxGles2 : KAttribsListCtxNone;
 	iContext = eglCreateContext(iDisplay, aConfig, EGL_NO_CONTEXT, attrib_list_ctx);
-	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);	
+	ASSERT_EGL_TRUE(iContext != EGL_NO_CONTEXT);
 	ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, iSurface, iSurface, iContext));
 	}
 
@@ -1098,14 +1092,14 @@
 	{
 	ASSERT_TRUE(iSurface != EGL_NO_SURFACE);
 	ASSERT_TRUE(iContext != EGL_NO_CONTEXT);
-	
-	// Draw to the pixmap surface 
+
+	// Draw to the pixmap surface
 	// Clear it: redish
 	VGfloat colorBackground[4];
 	ConvertColor(KRgbReddish, colorBackground);
 	vgSetfv(VG_CLEAR_COLOR, 4, colorBackground);
 	vgClear(0, 0, KPixmapSize.iWidth, KPixmapSize.iHeight);
-	
+
 	// And add a square: greenish
 	VGfloat colorSquare[4];
 	ConvertColor(KRgbGreenish, colorSquare);
@@ -1126,16 +1120,16 @@
 	const GLfloat glGreenBits = 255.f;
 	const GLfloat glBlueBits  = 255.f;
 	const GLfloat glAlphaBits = 255.f;
-	
+
 	// Disable  cdither - when using exact comparison to reference bitmap
 	// because reference bitmap cannot be created to match dither exactly
-	glDisable(GL_DITHER);	
+	glDisable(GL_DITHER);
 	// Clear the surface to the colour specified
 	glClearColor((glRed)/glRedBits, (glGreen)/glGreenBits, (glBlue)/glBlueBits, glAlpha/glAlphaBits);
-	
+
 	//glColor3f(KRgbGreenish.Red(),KRgbGreenish.Green(),KRgbGreenish.Blue());
 	//glRectf(KPixmapSquare.iTl.iX, KPixmapSquare.iTl.iY,KPixmapSquare.iTl.iX + KPixmapSquare.Width(),KPixmapSquare.iTl.iY + KPixmapSquare.Height());
-	
+
 	glClear(GL_COLOR_BUFFER_BIT);
 	}
 
@@ -1148,7 +1142,7 @@
 	ASSERT_TRUE(PixelsMatch(KRgbReddish, rgbPixelSample, EFalse));
 	aFbsBitmap->GetPixel(rgbPixelSample, TPoint(90,90));
 	ASSERT_TRUE(PixelsMatch(KRgbReddish, rgbPixelSample, EFalse));
-	
+
 	// Inside the square
 	aFbsBitmap->GetPixel(rgbPixelSample, TPoint(30,30));
 	ASSERT_TRUE(PixelsMatch(KRgbGreenish, rgbPixelSample, EFalse));
@@ -1165,7 +1159,7 @@
 	ASSERT_TRUE(PixelsMatch(KRgbReddish, rgbPixelSample, EFalse));
 	aFbsBitmap->GetPixel(rgbPixelSample, TPoint(90,90));
 	ASSERT_TRUE(PixelsMatch(KRgbReddish, rgbPixelSample, EFalse));
-	
+
 	// Inside the square
 	aFbsBitmap->GetPixel(rgbPixelSample, TPoint(30,30));
 	ASSERT_TRUE(PixelsMatch(KRgbReddish, rgbPixelSample, EFalse));
@@ -1184,13 +1178,13 @@
 		case VG_sRGB_565:
 			{
 			TUint16 intPixelSample=0;
-			
+
 			// Outside the square
 			vgReadPixels(&intPixelSample, 1, aDataFormat, 10,10, 1,1);
 			ASSERT_TRUE(PixelsMatch(KRgbReddish, TRgb::Color64K(intPixelSample), EFalse));
 			vgReadPixels(&intPixelSample, 1, aDataFormat, 90,90, 1,1);
 			ASSERT_TRUE(PixelsMatch(KRgbReddish, TRgb::Color64K(intPixelSample), EFalse));
-			
+
 			// Inside the square
 			vgReadPixels(&intPixelSample, 1, aDataFormat, 30,30, 1,1);
 			ASSERT_TRUE(PixelsMatch(KRgbGreenish, TRgb::Color64K(intPixelSample), EFalse));
@@ -1198,16 +1192,16 @@
 			ASSERT_TRUE(PixelsMatch(KRgbGreenish, TRgb::Color64K(intPixelSample), EFalse));
 			break;
 			}
-		case VG_sXRGB_8888:		
+		case VG_sXRGB_8888:
 			{
 			TUint32 intPixelSample=0;
-	
+
 			// Outside the square
 			vgReadPixels(&intPixelSample, 1, aDataFormat, 10,10, 1,1);
 			ASSERT_TRUE(PixelsMatch(KRgbReddish, TRgb::Color16MU(intPixelSample), EFalse));
 			vgReadPixels(&intPixelSample, 1, aDataFormat, 90,90, 1,1);
 			ASSERT_TRUE(PixelsMatch(KRgbReddish, TRgb::Color16MU(intPixelSample), EFalse));
-			
+
 			// Inside the square
 			vgReadPixels(&intPixelSample, 1, aDataFormat, 30,30, 1,1);
 			ASSERT_TRUE(PixelsMatch(KRgbGreenish, TRgb::Color16MU(intPixelSample), EFalse));
@@ -1218,13 +1212,13 @@
 		case VG_sARGB_8888:
 			{
 			TUint32 intPixelSample=0;
-	
+
 			// Outside the square
 			vgReadPixels(&intPixelSample, 1, aDataFormat, 10,10, 1,1);
 			ASSERT_TRUE(PixelsMatch(KRgbReddish, TRgb::Color16MA(intPixelSample), EFalse));
 			vgReadPixels(&intPixelSample, 1, aDataFormat, 90,90, 1,1);
 			ASSERT_TRUE(PixelsMatch(KRgbReddish, TRgb::Color16MA(intPixelSample), EFalse));
-			
+
 			// Inside the square
 			vgReadPixels(&intPixelSample, 1, aDataFormat, 30,30, 1,1);
 			ASSERT_TRUE(PixelsMatch(KRgbGreenish, TRgb::Color16MA(intPixelSample), EFalse));
@@ -1247,8 +1241,8 @@
 	TUint32 intPixelSample;
 	glReadPixels(10,10,1,1,GL_RGBA,GL_UNSIGNED_BYTE ,&intPixelSample);
 	SwapChannels(intPixelSample);
-	ASSERT_TRUE(PixelsMatch(KRgbReddish, TRgb::Color16MU(intPixelSample), EFalse));	
-	
+	ASSERT_TRUE(PixelsMatch(KRgbReddish, TRgb::Color16MU(intPixelSample), EFalse));
+
 	glReadPixels(45,45,1,1,GL_RGBA,GL_UNSIGNED_BYTE ,&intPixelSample);
 	SwapChannels(intPixelSample);
 	ASSERT_TRUE(PixelsMatch(KRgbReddish, TRgb::Color16MU(intPixelSample), EFalse));
@@ -1266,7 +1260,7 @@
 EXPORT_C void CTestEglSession::SwapChannels(TUint32 &aSwapMe)
 	{
 	TUint32 buff = aSwapMe;
-	
+
 	aSwapMe = 0;
 	aSwapMe |= (buff & 0x000000FF) << 16;
 	aSwapMe |= (buff & 0x0000FF00);
@@ -1290,12 +1284,12 @@
 Also closes the internal RSgImage handled that is associated to the surface.
 
 EGL destroys all surface and context handles associated with a display when
-eglTerminate() is called. 
+eglTerminate() is called.
 */
 EXPORT_C void CTestEglSession::ResetSurfaceAndContextSgImageL()
 	{
 	INFO_PRINTF1(_L("CTestEglSession::ResetSurfaceAndContextSgImageL()"));
-	
+
 	iContext = EGL_NO_CONTEXT;
 	iSurface = EGL_NO_SURFACE;
 	iSgImage.Close();
@@ -1304,7 +1298,7 @@
 /**
  Check that the pixel values match within a predefined tolerance
  @param aExpected the expected pixel colour vaule
- @param aActual the actual pixel colour value 
+ @param aActual the actual pixel colour value
  @param aCheckAlpha Whether to check the alpha channel value
  @return Whether the pixel values match - within the allowed tolerance
  */
@@ -1314,10 +1308,10 @@
 	//	differences, while too low will be too strict to allow for pixel conversions, i.e. from 16bpp to 32bpp
 	const TInt KPixelTolerance = 8;
 
-	if (aCheckAlpha && aExpected.Alpha()== 0 && 
-		aActual.Red() == 0 && 
-		aActual.Green() == 0 && 
-		aActual.Blue() == 0 && 
+	if (aCheckAlpha && aExpected.Alpha()== 0 &&
+		aActual.Red() == 0 &&
+		aActual.Green() == 0 &&
+		aActual.Blue() == 0 &&
 		aActual.Alpha() == 0)
 		{
 		// if the expected value for alpha is 0, all actual values should be 0
@@ -1346,7 +1340,7 @@
 	CHECK_EXPECTED_ERROR(eglInitialize(iDisplay, &major, &minor));
 	// Remember if the user wants us to terminate the display.
 	iTerminateDisplay = aTerminateDisplay;
-	
+
 	INFO_PRINTF4(_L("thread %d: Initialised: EGL Version %d.%d"), iThreadIdx, major, minor);
 	}
 
@@ -1379,11 +1373,11 @@
 	if (!iSgDriverOpen)
 		{
 		VERBOSE_INFO_PRINTF2(_L("CTestEglSession<0x%08x> Opening SgDriver"), this);
-#ifdef  SYMBIAN_GRAPHICS_EGL_SGIMAGELITE 		
+#ifdef  SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 		TInt ret=iSgDriver.Open();
 #else
 		TInt ret=SgDriver::Open();
-#endif	//SYMBIAN_GRAPHICS_EGL_SGIMAGELITE	
+#endif	//SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 		ASSERT_EQUALS(ret, KErrNone);
 		iSgDriverOpen = ETrue;
 		}
@@ -1394,10 +1388,10 @@
 	if (iSgDriverOpen)
 		{
 		VERBOSE_INFO_PRINTF2(_L("CTestEglSession<0x%08x> Closing SgDriver"), this);
-#ifdef  SYMBIAN_GRAPHICS_EGL_SGIMAGELITE        
+#ifdef  SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
         iSgDriver.Close();
 #else
-        SgDriver::Close(); 
+        SgDriver::Close();
 #endif  //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 		iSgDriverOpen = EFalse;
 		}
@@ -1444,7 +1438,7 @@
 	TBool bSuccess = FetchProcEglCreateImageKhr();
 	ASSERT_TRUE(bSuccess);
 	VERBOSE_INFO_PRINTF2(_L("thread %d: Calling eglCreateImageKHR"), iThreadIdx);
-	EGLImageKHR eglImage = ipfnEglCreateImageKHR(aDisplay,aContext,aTarget,reinterpret_cast<EGLClientBuffer>(aSgImage),const_cast<EGLint *>(aAttr_List));	
+	EGLImageKHR eglImage = ipfnEglCreateImageKHR(aDisplay,aContext,aTarget,reinterpret_cast<EGLClientBuffer>(aSgImage),const_cast<EGLint *>(aAttr_List));
 	return eglImage;
 	}
 
@@ -1454,7 +1448,7 @@
 	ASSERT_TRUE(bSuccess);
 	INFO_PRINTF2(_L("thread %d: Calling eglCreateImageKHR, with CFBsBitmap)"), iThreadIdx);
 	//the following call to eglCreateImageKHR MUST fail, error handling is made outside
-	EGLImageKHR eglImage = ipfnEglCreateImageKHR(aDisplay,aContext,aTarget,reinterpret_cast<EGLClientBuffer>(&aCFbsBitmap),const_cast<EGLint *>(aAttr_List));	
+	EGLImageKHR eglImage = ipfnEglCreateImageKHR(aDisplay,aContext,aTarget,reinterpret_cast<EGLClientBuffer>(&aCFbsBitmap),const_cast<EGLint *>(aAttr_List));
 	return eglImage;
 	}
 
@@ -1486,7 +1480,7 @@
 	if (!ipfnvgCreateImageTargetKHR)
 		{
 		INFO_PRINTF2(_L("thread %d: Calling eglGetProcAddress (\"vgCreateEGLImageTargetKHR\")"), iThreadIdx);
-		ipfnvgCreateImageTargetKHR = reinterpret_cast<TFPtrVgCreateEglImageTargetKhr>(eglGetProcAddress("vgCreateEGLImageTargetKHR"));		
+		ipfnvgCreateImageTargetKHR = reinterpret_cast<TFPtrVgCreateEglImageTargetKhr>(eglGetProcAddress("vgCreateEGLImageTargetKHR"));
 		if (ipfnvgCreateImageTargetKHR==NULL)
 			{
 			EGLint eglError = eglGetError();
@@ -1514,32 +1508,32 @@
 	EGLint EGL_SURFACE_TYPE_value;
 	EGLint EGL_RENDERABLE_TYPE_value;
 	EGLint EGL_CONFIG_ID_value;
-	
+
 	eglGetConfigAttrib(iDisplay, aConfig, EGL_CONFIG_ID, &EGL_CONFIG_ID_value);
 	eglGetConfigAttrib(iDisplay, aConfig, EGL_BUFFER_SIZE, &EGL_BUFFER_SIZE_value);
 	eglGetConfigAttrib(iDisplay, aConfig, EGL_ALPHA_SIZE, &EGL_ALPHA_SIZE_value);
 	eglGetConfigAttrib(iDisplay, aConfig, EGL_BLUE_SIZE, &EGL_BLUE_SIZE_value);
 	eglGetConfigAttrib(iDisplay, aConfig, EGL_GREEN_SIZE, &EGL_GREEN_SIZE_value);
 	eglGetConfigAttrib(iDisplay, aConfig, EGL_RED_SIZE, &EGL_RED_SIZE_value);
-	eglGetConfigAttrib(iDisplay, aConfig, EGL_SURFACE_TYPE, &EGL_SURFACE_TYPE_value);	
+	eglGetConfigAttrib(iDisplay, aConfig, EGL_SURFACE_TYPE, &EGL_SURFACE_TYPE_value);
 	eglGetConfigAttrib(iDisplay, aConfig, EGL_RENDERABLE_TYPE, &EGL_RENDERABLE_TYPE_value);
 #ifdef PRINTG_CONFIGS_LOG
-	INFO_PRINTF7(_L("(Config: %3d) RGBA=(%2d) %2d,%2d,%2d,%2d"), EGL_CONFIG_ID_value, EGL_BUFFER_SIZE_value, 
-					EGL_RED_SIZE_value, EGL_GREEN_SIZE_value, EGL_BLUE_SIZE_value, 
+	INFO_PRINTF7(_L("(Config: %3d) RGBA=(%2d) %2d,%2d,%2d,%2d"), EGL_CONFIG_ID_value, EGL_BUFFER_SIZE_value,
+					EGL_RED_SIZE_value, EGL_GREEN_SIZE_value, EGL_BLUE_SIZE_value,
 					EGL_ALPHA_SIZE_value);
 	INFO_PRINTF2(_L("RENDERABLE_TYPE %d"),EGL_RENDERABLE_TYPE_value);
 #endif
-	
+
 	if(!(EGL_SURFACE_TYPE_value & EGL_PIXMAP_BIT))
 		{
 		return EFalse;
 		}
-	
+
 	TBool good = ETrue;
 	//requested usage bits
 	TSgImageInfo requestedImageInfo;
 	aImage.GetInfo(requestedImageInfo);
-	
+
 #ifndef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 	//potential usage bits
     RSgImage potential;
@@ -1547,22 +1541,22 @@
     TSgImageInfo potentialImageInfo;
     potential.GetInfo(potentialImageInfo);
     potential.Close();
-#endif    
-	
+#endif
+
 	switch(requestedImageInfo.iPixelFormat)
-		{			
+		{
 		case EUidPixelFormatRGB_565:
 			if (!(EGL_RED_SIZE_value == 5 && EGL_GREEN_SIZE_value == 6 && EGL_BLUE_SIZE_value == 5 && EGL_ALPHA_SIZE_value == 0))
 				{
 				good = EFalse;
 				}
-			break;			
+			break;
 		case EUidPixelFormatXRGB_8888:
 			if (!(EGL_RED_SIZE_value == 8 && EGL_GREEN_SIZE_value == 8 && EGL_BLUE_SIZE_value == 8 && EGL_ALPHA_SIZE_value == 0))
 				{
 				good = EFalse;
-				}				
-			break;			
+				}
+			break;
 		case EUidPixelFormatARGB_8888_PRE:
 			if (!(EGL_RED_SIZE_value == 8 && EGL_GREEN_SIZE_value == 8 && EGL_BLUE_SIZE_value == 8 && EGL_ALPHA_SIZE_value == 8))
 				{
@@ -1595,17 +1589,17 @@
 		}
 
 #ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
-	// 
+	//
 	//Check if strict matching requirements are met:
-	//- All the supported APIs included in the EGL_RENDERABLE_TYPE of the 
+	//- All the supported APIs included in the EGL_RENDERABLE_TYPE of the
 	// EGLConfig must be matched by the corresponding iUsage of RSgImage
-	//- The following usages included in the iUsage of the RSgImage must be 
-	// matched by the corresponding API in EGL_RENDERABLE_TYPE of the EGLConfig: 
+	//- The following usages included in the iUsage of the RSgImage must be
+	// matched by the corresponding API in EGL_RENDERABLE_TYPE of the EGLConfig:
 	//         ESgUsageBitOpenGlSurface-> EGL_OPENGL_BIT
 	//         ESgUsageBitOpenGlesSurface-> EGL_OPENGL_ES_BIT
 	//         ESgUsageBitOpenGles2Surface-> EGL_OPENGL_ES2_BIT
 	//         ESgUsageBitOpenVgSurface->EGL_OPENVG_BIT
-	
+
 	EGLint usageBitsMask = 0;
 	if(requestedImageInfo.iUsage & ESgUsageBitOpenVgSurface)
 		{
@@ -1647,9 +1641,9 @@
         {
         return EFalse;
         }
-    
+
     // potential usage >= RENDERABLE_TYPE
-    
+
     EGLint potentialUsageBitsMask = 0;
     if(potentialImageInfo.iUsage & ESgUsageOpenVgTarget)
         {
@@ -1663,13 +1657,13 @@
         {
         potentialUsageBitsMask |= EGL_OPENGL_ES2_BIT;
         }
-    
+
     potentialUsageBitsMask = EGL_RENDERABLE_TYPE_value &~ potentialUsageBitsMask;
     if(potentialUsageBitsMask)
         {
         return EFalse;
         }
-#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE	
+#endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
 	return good;
 	}
 
@@ -1751,8 +1745,8 @@
             }
         }
 #endif //SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
-    
-	return ETrue;	
+
+	return ETrue;
 	}
 
 EXPORT_C CFbsBitmap* CTestEglSession::CreateReferenceBitmapL(TDisplayMode aMode)
@@ -1803,8 +1797,8 @@
 	fbsBitGc->Activate(bitmapDevice);
 	fbsBitGc->SetBrushColor(KRgbBlack);
 	fbsBitGc->Clear();
-	
-	// create the penBitmap (same size as the mask bitmap)	
+
+	// create the penBitmap (same size as the mask bitmap)
 	CFbsBitmap* penBitmap = new(ELeave) CFbsBitmap();
 	CleanupStack::PushL(penBitmap);
 	User::LeaveIfError(penBitmap->Create(aMaskBitmap->SizeInPixels(), aRefBitmapMode));
@@ -1817,9 +1811,9 @@
 	penBitGc->Clear();
 
 	// perform a masked bitmap transfer to the active refBitmap
-	TRect bmpRect(TPoint(0, 0), refBitmap->SizeInPixels()); 
+	TRect bmpRect(TPoint(0, 0), refBitmap->SizeInPixels());
 	fbsBitGc->Activate(bitmapDevice);
-	fbsBitGc->BitBltMasked(TPoint(0, 0), penBitmap, bmpRect, aMaskBitmap, EFalse);	
+	fbsBitGc->BitBltMasked(TPoint(0, 0), penBitmap, bmpRect, aMaskBitmap, EFalse);
 
 	CleanupStack::PopAndDestroy(5, bitmapDevice);
 	CleanupStack::Pop(refBitmap);
@@ -1837,7 +1831,7 @@
 	TInt height = bitmap->SizeInPixels().iHeight;
 	TInt width  = bitmap->SizeInPixels().iWidth;
 
-	// Initialise colour values to a random value (guarantees pixel uniqueness if update is done accordingly)  
+	// Initialise colour values to a random value (guarantees pixel uniqueness if update is done accordingly)
 	TInt red=0;
 	TInt green=127;
 	TInt blue=127;
@@ -1883,29 +1877,29 @@
 					{
 					// We should not get here - colour mode not supported by these tests
 					ERR_PRINTF1(_L("CTestEglSession::CreateReferenceBitmapL - Colour mode not supported!"));
-				    ASSERT(FALSE); 
+				    ASSERT(FALSE);
 					}
 				}
 			bmpUtil.IncYPos();
 
-			// Update red bit 
-			red = ++red + aIndex; 
-			if (red>255) 
+			// Update red bit
+			red = ++red + aIndex;
+			if (red>255)
 				red = red - 256;
-			
+
 			// Update green bit
-			green = --green - aIndex; 
-			if (green<0) 
+			green = --green - aIndex;
+			if (green<0)
 				green = green + 256;
-			
+
 			// Update blue bit
-			blue = ++blue + aIndex; 
-			if (blue>255) 
+			blue = ++blue + aIndex;
+			if (blue>255)
 				blue = blue - 256;
-			
+
 			// Update alpha bit
-			alpha = --alpha - aIndex; 
-			if (alpha<0) 
+			alpha = --alpha - aIndex;
+			if (alpha<0)
 				alpha = alpha + 256;
 			}
 		}
@@ -1923,14 +1917,14 @@
 	switch(aDataFormat)
 		{
 		case VG_sRGB_565:
-			{			
+			{
 			TUint16* vgPixel = new(ELeave) TUint16[width];
 			CleanupArrayDeletePushL(vgPixel);
 			for (TInt y=0; y < height; y++)
 				{
                 // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
                 vgReadPixels(vgPixel, 1, aDataFormat, 0,height-y-1, width,1);
-				
+
 				for (TInt x=0; x < width; x++)
 					{
 					aReferenceBitmap->GetPixel(refPixel, TPoint(x,y));
@@ -1938,21 +1932,21 @@
 						{
 						User::Leave(KErrTEFUnitFail);
 						}
-					}		
+					}
 				}
 			CleanupStack::PopAndDestroy(vgPixel);
 			break;
 			}
 
-		case VG_sXRGB_8888:		
-			{			
+		case VG_sXRGB_8888:
+			{
 			TUint32* vgPixel = new(ELeave) TUint32[width];
 			CleanupArrayDeletePushL(vgPixel);
 			for (TInt y=0; y < height; y++)
 				{
                 // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
                 vgReadPixels(vgPixel, 1, aDataFormat, 0,height-y-1, width,1);
-			
+
 				for (TInt x=0; x < width; x++)
 					{
 					aReferenceBitmap->GetPixel(refPixel, TPoint(x,y));
@@ -1960,21 +1954,21 @@
 						{
 						User::Leave(KErrTEFUnitFail);
 						}
-					}		
+					}
 				}
 			CleanupStack::PopAndDestroy(vgPixel);
 			break;
 			}
-			
-		case VG_sARGB_8888:		
-			{			
+
+		case VG_sARGB_8888:
+			{
 			TUint32* vgPixel = new(ELeave) TUint32[width];
 			CleanupArrayDeletePushL(vgPixel);
 			for (TInt y=0; y < height; y++)
 				{
                 // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
                 vgReadPixels(vgPixel, 1, aDataFormat, 0,height-y-1, width,1);
-			
+
 				for (TInt x=0; x < width; x++)
 					{
 					aReferenceBitmap->GetPixel(refPixel, TPoint(x,y));
@@ -1982,21 +1976,21 @@
 						{
 						User::Leave(KErrTEFUnitFail);
 						}
-					}		
+					}
 				}
 			CleanupStack::PopAndDestroy(vgPixel);
 			break;
 			}
-			
-		case VG_sARGB_8888_PRE:		
-			{			
+
+		case VG_sARGB_8888_PRE:
+			{
 			TUint32* vgPixel = new(ELeave) TUint32[width];
 			CleanupArrayDeletePushL(vgPixel);
 			for (TInt y=0; y < height; y++)
 				{
                 // Mind the fact that CFbsBitmap and VGImages use different coordinates origin!
                 vgReadPixels(vgPixel, 1, aDataFormat, 0,height-y-1, width,1);
-                
+
 				for (TInt x=0; x < width; x++)
 					{
 					aReferenceBitmap->GetPixel(refPixel, TPoint(x,y));
@@ -2004,7 +1998,7 @@
 						{
 						User::Leave(KErrTEFUnitFail);
 						}
-					}		
+					}
 				}
 			CleanupStack::PopAndDestroy(vgPixel);
 			break;
@@ -2013,21 +2007,21 @@
 		default:
 			// We should not get here - colour mode not supported by these tests
 			ERR_PRINTF1(_L("CTestEglSession::CheckVgDrawingL - Colour mode not supported!"));
-		    ASSERT(FALSE); 
+		    ASSERT(FALSE);
 			break;
 		}
 	}
 
-EXPORT_C TBool CTestEglSession::IsOpenGLESSupported() 
-    { 
+EXPORT_C TBool CTestEglSession::IsOpenGLESSupported()
+    {
     if(!iIsSupportedRenderInitialized)
         {
         CheckAllAvailableRenders();
         }
     return iIsOpenGLESSupported;
-    } 
+    }
 
-EXPORT_C TBool CTestEglSession::IsOpenGLES2Supported() 
+EXPORT_C TBool CTestEglSession::IsOpenGLES2Supported()
     {
     if(!iIsSupportedRenderInitialized)
         {
@@ -2035,7 +2029,7 @@
         }
     return iIsOpenGLES2Supported;
     }
-EXPORT_C TBool CTestEglSession::IsOpenVGSupported() 
+EXPORT_C TBool CTestEglSession::IsOpenVGSupported()
     {
     if(!iIsSupportedRenderInitialized)
         {
@@ -2049,7 +2043,7 @@
     ASSERT_EGL_TRUE(iDisplay != EGL_NO_DISPLAY);
     TPtrC8 ptrEglClientApis((const TText8 *)eglQueryString(iDisplay, EGL_CLIENT_APIS));
     _LIT8(KOpenGLES, "OpenGL_ES");
-    EGLint numConfigs= 0;       
+    EGLint numConfigs= 0;
     EGLConfig config;
     if(ptrEglClientApis.Find(KOpenGLES) != KErrNotFound)
         {
@@ -2076,7 +2070,7 @@
     _LIT8(KOpenVG, "OpenVG");
     if(ptrEglClientApis.Find(KOpenVG) != KErrNotFound)
         {
-        numConfigs= 0;       
+        numConfigs= 0;
         //check VG
         const EGLint KAttrib_list_vg[] = { EGL_RENDERABLE_TYPE, EGL_OPENVG_BIT,
                                            EGL_NONE };
--- a/egl/egltest/src/egltestcommonstep.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/egltestcommonstep.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -294,10 +294,12 @@
 	RMsgQueue<TSgDrawableId> messageQueueSgId;
 	TInt ret = messageQueueSgId.CreateGlobal(KNullDesC, 1, EOwnerProcess);
 	ASSERT_EQUALS(ret, KErrNone);
+	CleanupClosePushL(messageQueueSgId);
 
 	RMsgQueue<TProcessId> messageQueueProcId;
 	ret = messageQueueProcId.CreateGlobal(KNullDesC, 1, EOwnerProcess);
 	ASSERT_EQUALS(ret, KErrNone);
+	CleanupClosePushL(messageQueueProcId);
 
     // Create semphores that can be shared (only used in some test to synch between 2 process)
     ret = iSemaphore[0].CreateGlobal(KNullDesC(), 0, EOwnerProcess);
@@ -305,6 +307,12 @@
     ret = iSemaphore[1].CreateGlobal(KNullDesC(), 0, EOwnerProcess);
     ASSERT_EQUALS(ret, KErrNone);
 
+    // create MsgQueue (only used in some tests to pass data from client processes to the main process)
+    RMsgQueue<TEglStepMessageBuffer> messageQueueClientProcParam;
+    ret = messageQueueClientProcParam.CreateGlobal(KNullDesC, 1, EOwnerProcess);
+    ASSERT_EQUALS(ret, KErrNone);
+    CleanupClosePushL(messageQueueClientProcParam);
+    
 	for (TInt i=0; i<aProcessCount; i++)
 		{
 		TProcessInfo info;
@@ -338,14 +346,19 @@
 		User::LeaveIfError(ret);
 		ret = iProcessStatus[i].iProcess.SetParameter(EProcSlotSurfaceFormat, static_cast<TInt>(iSurfaceFormat));
 		User::LeaveIfError(ret);
-		               
+        ret = iProcessStatus[i].iProcess.SetParameter(EProcSlotCustomClientParam, messageQueueClientProcParam);
+        User::LeaveIfError(ret);
+		
 		iProcessStatus[i].iProcess.Logon(iProcessStatus[i].iStatus); 
 		iProcessStatus[i].iProcess.Resume();
 		}
+    
+	//by default an empty implementation
+    ReceiveMessageFromClient(messageQueueClientProcParam);
 
 	// wait for all processes to complete (not worried about the order)
 	// This is needed, as the only way to determine whether the process step has failed is to check
-	//   the return value (using TEST(EFalse) has no effect on the spawned process)
+	//  the return value (using TEST(EFalse) has no effect on the spawned process)
 	for (TInt i=0; i<aProcessCount; i++)
 		{
 		User::WaitForRequest(iProcessStatus[i].iStatus);
@@ -355,8 +368,7 @@
 		}
 
 	// close MsgQueue and semaphores (as used in some test with 2 spawned processes)
-	messageQueueSgId.Close();
-	messageQueueProcId.Close();
+	CleanupStack::PopAndDestroy(3, &messageQueueSgId); //messageQueueClientProcParam, messageQueueProcId
 	iSemaphore[1].Close();
 	iSemaphore[0].Close();
 	}
--- a/egl/egltest/src/eglteststep.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/egl/egltest/src/eglteststep.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -63,7 +63,7 @@
     else if (aStepName == KDisplay_OOM_ClientHeap)                                                  testStep = new CEglTest_Display_OOM_ClientHeap;
     else if (aStepName == KDisplay_OOM_ClientHeap_Initialize)                                       testStep = new CEglTest_Display_OOM_ClientHeap_Initialize;
 
-	//SyncObject tests excluding WaitFlush which requires OpenVG and OpenGL ES
+	// SyncObject tests excluding WaitFlush which requires OpenVG and OpenGL ES
 	else if (aStepName == KSyncObject_Positive_GetProcAddress)											testStep = new CEglTest_SyncObject_Positive_GetProcAddress;
 	else if (aStepName == KSyncObject_Positive_CreateDestroy)										testStep = new CEglTest_SyncObject_Positive_CreateDestroy;
 	else if (aStepName == KSyncObject_Positive_WaitSignal)											testStep = new CEglTest_SyncObject_Positive_WaitSignal;
@@ -101,19 +101,19 @@
 	else if (aStepName == KCreatePixmapSurface_Alpha_bit_RSgImage)									testStep = new CEglTest_CreatePixmapSurface_Alpha_bit_RSgImage;
     else if (aStepName == KCreatePixmapSurface_RSgImage_Positive_MantadoryFormatUsageSupport)       testStep = new CEglTest_CreatePixmapSurface_RSgImage_Positive_MantadoryFormatUsageSupport;
 
-	// image tests
+	// Image tests
 	else if (aStepName == KEGL_Image_SgDriverHandle)												testStep = new CEglTest_EGL_Image_SgDriverHandle;
 	else if (aStepName == KEGL_Image_RSgImage_UseOpenVG_PersistImageData)							testStep = new CEglTest_EGL_Image_RSgImage_UseOpenVG_PersistImageData;
 	else if (aStepName == KEGL_Image_Consistent_Linked_List)										testStep = new CEglTest_EGL_Image_Consistent_Linked_List;	
 
-	// image negative tests
+	// Image negative tests
 	else if (aStepName == KEGL_Image_eglCreateImage_Bad_Parameter)									testStep = new CEglTest_EGL_Image_eglCreateImage_Bad_Parameter;
 	else if (aStepName == KEGL_Image_UsageBits_Enforcement)											testStep = new CEglTest_EGL_Image_UsageBits_Enforcement;
 	else if (aStepName == KEGL_Image_DestroyImageKHR)												testStep = new CEglTest_EGL_Image_DestroyImageKHR;	
 	else if (aStepName == KEGL_Image_VGImage_From_Invalid_EGLHandle)								testStep = new CEglTest_EGL_Image_VGImage_From_Invalid_EGLHandle;
 	else if (aStepName == KEGL_Image_Self_Drawing)													testStep = new CEglTest_EGL_Image_Self_Drawing;
 
-	//Siblings tests
+	// Siblings tests
 	else if (aStepName == KEGL_Image_Sibling_Basic)													testStep = new CEglTest_EGL_Image_Sibling_Basic;
 	else if (aStepName == KEGL_Image_Sibling_VGImage)												testStep = new CEglTest_EGL_Image_Sibling_VGImage;
 	else if (aStepName == KEGL_Image_Sibling_Two_VGImages)											testStep = new CEglTest_EGL_Image_Sibling_Two_VGImages;
@@ -122,7 +122,7 @@
 	else if (aStepName == KEGL_Image_Sibling_VGImage_Child_CheckContents_CloseSgEarlier)			testStep = new CEglTest_EGL_Image_Sibling_VGImage_Child_CheckContents_CloseSgEarlier;
 	else if (aStepName == KEGL_Image_CreatePBufferFromClient_With_Sibling_VGImage)					testStep = new CEglTest_EGL_Image_CreatePBufferFromClient_With_Sibling_VGImage;
 
-	//VgImage to surfaces tests
+	// VgImage to surfaces tests
 	else if (aStepName == KEGL_Image_VgImage_To_Pixmap)												testStep = new CEglTest_EGL_Image_VgImage_To_Pixmap;
 	else if (aStepName == KEGL_Image_VGImage_To_Pixmap_CFbs)										testStep = new CEglTest_EGL_Image_VGImage_To_Pixmap_CFbs;
 	else if (aStepName == KEGL_Image_VgImage_To_pBuffer)											testStep = new CEglTest_EGL_Image_VgImage_To_pBuffer;
@@ -146,7 +146,6 @@
 	else if (aStepName == KEGL_Image_Multi_Process_FontServer_Deferred)								testStep = new CEglTest_EGL_Image_Multi_Process_FontServer_Deferred;
 	else if (aStepName == KEGL_Image_Multi_Process_ThemeServer)										testStep = new CEglTest_EGL_Image_Multi_Process_ThemeServer;
 	else if (aStepName == KEGL_Image_Multi_Process_VgImage_ProcessTerminate)						testStep = new CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate;
-	else if (aStepName == KEGL_Image_Multi_Process_VgImage_ProcessTerminate2)						testStep = new CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminate2;
 	else if (aStepName == KEGL_Image_Multi_Process_VgImage_ProcessTerminateNegative)				testStep = new CEglTest_EGL_Image_Multi_Process_VgImage_ProcessTerminateNegative;
 	else if (aStepName == KEGL_Image_Multi_Process_VgImage_ReadWrite)								testStep = new CEglTest_EGL_Image_Multi_Process_VgImage_ReadWrite;
 
--- a/fbs/fontandbitmapserver/group/BLD.INF	Thu Apr 08 12:02:10 2010 +0100
+++ b/fbs/fontandbitmapserver/group/BLD.INF	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -49,8 +49,6 @@
 ../group/FBSERV.MMP
 ../group/fbsrasterizerlib.mmp
 ../group/stubrasterizer.mmp
-../group/fbscli_fmm.mmp
-../group/fbserv_fmm.mmp
 
 PRJ_TESTEXPORTS
 
--- a/fbs/fontandbitmapserver/group/FBSCLI.MMP	Thu Apr 08 12:02:10 2010 +0100
+++ b/fbs/fontandbitmapserver/group/FBSCLI.MMP	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -28,7 +28,6 @@
 SOURCEPATH      ../sfbs
 
 userinclude     ../inc
-userinclude		../../../../textandloc/fontservices/fontstore/src
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 
--- a/fbs/fontandbitmapserver/group/fbscli_fmm.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// fbscli.dll Font & Bitmap server client-side library
-// 
-//
-
-/**
- @file
-*/
-
-target          fbscli_fmm.dll
-CAPABILITY All -Tcb
-targettype      DLL
-
-UID             0x1000008D 0x10003A15
-VENDORID 0x70000001
-SOURCEPATH      ../sfbs
-
-userinclude     ../inc
-userinclude		../../../../textandloc/fontservices/fontstore/src
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-source          BITBMP.CPP
-source          BITCOMP.CPP
-source          BITBMPEX.CPP
-source          BMPASTR.CPP
-source          BMPUTIL.CPP
-source          FBSBMP.CPP
-source          FBSFONT.CPP
-source          PILE.CPP
-source          SESSION.CPP
-source          TFSTORE.CPP
-source          FbsRalc.cpp
-source          fbshelper.cpp
-source          ShiftedFileStore.cpp
-source          BitmapCompr.cpp
-source          patchableconstantscli.cpp
-
-library         euser.lib
-library         efsrv.lib
-library         estor.lib
-library         gdi.lib
-library         fntstr.lib
-library         scdv.lib
-library         palette.lib
-library         lookuptable.lib
-library         hal.lib
-#if !defined(WINS)
-library         fbsrasterizer.lib
-#endif
-
-deffile         FBSCLI2.DEF
-
-
-START WINS
-BASEADDRESS     0x41400000
-END
-//configurable value to control bitmap heap management by setting
-//large bitmap threshold (requires rebuild)
-MACRO KMaxLargeBitmapAlloc=0x4000
-//MACRO SYMBIAN_DISABLE_HARDWARE_BITMAP_WHITEFILL // Uncomment this macro to disable whitefill of hardware bitmaps on creation
-
-// KCompressionThreshold is used to determine whether a bitmap gets compressed.  Values of 0 -> 256 represent 0% to 100% 
-// where 0% = no compression.  A value of 205 means that bitmaps are only compressed when the resulting size is 80% or 
-// less of the original size.
-MACRO KCompressionThreshold=205
-
-MACRO FNTSTORE_SUPPORT_FMM
-
-UNPAGED
-
-
-SMPSAFE
-
--- a/fbs/fontandbitmapserver/group/fbserv.iby	Thu Apr 08 12:02:10 2010 +0100
+++ b/fbs/fontandbitmapserver/group/fbserv.iby	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -47,8 +47,8 @@
 		#define FBSERV_PAGEDDATA_CONFIG unpageddata
 	#endif
 
-	file=ABI_DIR\BUILD_DIR\fbserv_fmm.exe 	\sys\bin\fbserv.exe	FBSERV_PAGEDDATA_CONFIG
-	file=ABI_DIR\BUILD_DIR\fbscli_fmm.dll 	\sys\bin\fbscli.dll
+	file=ABI_DIR\BUILD_DIR\fbserv.exe 	\sys\bin\fbserv.exe	FBSERV_PAGEDDATA_CONFIG
+	file=ABI_DIR\BUILD_DIR\fbscli.dll 	\sys\bin\fbscli.dll
 #else
 	file=ABI_DIR\DEBUG_DIR\fbserv.exe 	sys\bin\fbserv.exe
 	file=ABI_DIR\DEBUG_DIR\fbscli.dll 	sys\bin\fbscli.dll
--- a/fbs/fontandbitmapserver/group/fbserv_fmm.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-// fbserv.exe Font & Bitmap server
-// 
-//
-
-/**
- @file
-*/
-
-// Default stack size(8K) is too small and causes stack overflow
-// in the hardware test udeb
-EPOCSTACKSIZE   16384
-EPOCHEAPSIZE    0x10000 0x200000		
-					
-target          fbserv_fmm.exe
-
-EPOCFIXEDPROCESS
-CAPABILITY      ProtServ
-targettype      exexp
-
-uid             0x1000008C 0x10003A16
-VENDORID        0x70000001
-
-userinclude     ../inc
-userinclude     ../sfbs
-userinclude		../../../../textandloc/fontservices/fontstore/src
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-OS_LAYER_ESTLIB_SYSTEMINCLUDE
-
-sourcepath      ../sfbs
-
-source          FBSCLI.CPP
-source          FBSMAIN.CPP
-source          FBSTOP.CPP
-source          BackGroundCompression.CPP
-source          SERVER.CPP
-source          FBSMBMC.CPP
-source          ShiftedFileStore.cpp
-source          HASHMAP.CPP
-source			patchableconstants.cpp
-
-library         euser.lib
-library         efsrv.lib
-library         gdi.lib
-library         fntstr.lib
-library         fbscli.lib
-library         estor.lib
-library         ecom.lib
-library         hal.lib
-
-start wins
-baseaddress     0x41500000
-end
-
-deffile 		fbserv.def
-
-MACRO KFBSERVInitialHeapSize=0x10000
-MACRO KFBSERVHeapGrowByMultiplier=4
-MACRO KFBSERVSharedBitmapHashTableSizeInBits=12
-MACRO FNTSTORE_SUPPORT_FMM
-UNPAGEDCODE //Configure data paging via fbserv.iby
-
-
-SMPSAFE
--- a/fbs/fontandbitmapserver/sfbs/FBSCLI.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/fbs/fontandbitmapserver/sfbs/FBSCLI.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -35,7 +35,7 @@
 	{
 	if (aAny && aHeapBase)
 		{
-		return (TInt)aAny - (TInt)aHeapBase;
+		return reinterpret_cast<TInt>(aAny) - aHeapBase;
 		}
 	return 0;
 	}
@@ -47,11 +47,11 @@
 @return A pointer relative to the passed heap base.
 @see PointerToOffset()
  */
-LOCAL_C TAny* OffsetToPointer(const TInt aOffset, TInt aHeapBase)
+LOCAL_C TAny* OffsetToPointer(TInt aOffset, TInt aHeapBase)
 	{
 	if (aOffset && aHeapBase)
 		{
-		return (TAny*)(aOffset + (TInt)aHeapBase);
+		return reinterpret_cast<TAny*>(aOffset + aHeapBase);
 		}
 	return NULL;
 	}
--- a/fbs/fontandbitmapserver/sfbs/FBSFONT.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/fbs/fontandbitmapserver/sfbs/FBSFONT.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -38,7 +38,7 @@
 	{
 	if (aAny && aHeapBase)
 		{
-		return (TInt)aAny - (TInt)aHeapBase;
+		return reinterpret_cast<TInt>(aAny) - reinterpret_cast<TInt>(aHeapBase);
 		}
 	return 0;
 	}
@@ -50,11 +50,11 @@
 @return A pointer relative to the passed heap base.
 @see PointerToOffset()
  */
-LOCAL_C TAny* OffsetToPointer(const TInt aOffset, TUint8* aHeapBase)
+LOCAL_C TAny* OffsetToPointer(TInt aOffset, TUint8* aHeapBase)
 	{
 	if (aOffset && aHeapBase)
 		{
-		return (TAny*)(aOffset + (TInt)aHeapBase);
+		return reinterpret_cast<TAny*>(aOffset + reinterpret_cast<TInt>(aHeapBase));
 		}
 	return NULL;
 	}
@@ -469,10 +469,10 @@
 			{				
 			// Translate the offsets sent to the server back to pointers relative to
 			// the heap base of the current process
-			const TOpenFontCharMetrics* temp = (const TOpenFontCharMetrics*)OffsetToPointer(paramsBuf().iMetricsOffset, iFbs->HeapBase());
-			if (temp)
+			const TOpenFontCharMetrics* metrics = (const TOpenFontCharMetrics*)OffsetToPointer(paramsBuf().iMetricsOffset, iFbs->HeapBase());
+			if (metrics)
 				{
-				aMetrics = *temp;
+				aMetrics = *metrics;
 				}
 			aBitmap = static_cast<TUint8*>(OffsetToPointer(paramsBuf().iBitmapPointerOffset, iFbs->HeapBase()));			
 			}
@@ -587,7 +587,7 @@
 EXPORT_C TBool CFbsFont::HasCharacter(TInt aCode) const
 	{
 	if (iHandle)
-		{		
+		{
 		return iFbs->SendCommand(EFbsMessHasCharacter,iHandle,aCode);
 		}
 	return EFalse;
@@ -621,7 +621,7 @@
 
 /** help DoExtendedFunction to perform KFontDeleteShaping function
 @param aParam Input parameter block
-@return KErrNone if successful, KErrBadHandle if the font does not have a valid handle.
+@return KErrNone if successful, KErrGeneral if the font does not have a valid handle.
 */
 TInt CFbsFont::DoFontDeleteShaping(TFontShapeDeleteFunctionParameters* aParam) const
 	{
@@ -677,3 +677,4 @@
 		}
 	return CFont::DoExtendedFunction(aFunctionId, aParam);
 	}
+
--- a/fbs/fontandbitmapserver/tfbs/TFBS.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/fbs/fontandbitmapserver/tfbs/TFBS.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -84,7 +84,7 @@
 void CTFbs::ConstructL()
 	{
 	ExpandCleanupStackL();
-	
+	User::LeaveIfError(Logger().ShareAuto());
 	TestConstruction();
 	AllocScanLineBuf();
 	
@@ -2145,6 +2145,8 @@
 	are the same, thereby avoiding any unneccessary IPC calls.
 
 @SYMTestActions
+	Try to open a global semaphore called "FBSSessionCacheSemaphore" (this is a temporary measure to
+		ensure successful propagation of ou1cimx1#250526).
 	Create a large font which consumes a lot of memory.
 	Create a CFbsBitGc and a CFbsBitmap target.
 	Use the CFbsBitGc to render some text, thereby filling the font glyph cache. 
@@ -2156,6 +2158,7 @@
 		returned from CBitmapFont::GetCharacterData().
 
 @SYMTestExpectedResults
+	No global semaphore called "FBSSessionCacheSemaphore" should exist.
 	When using KNullHandle, CharacterNeedsToBeRasterized() with the first character, is expected to pass
 		proving that the font cache is working as expected when glyphs can fit into it.
 	When using KNullHandle, CharacterNeedsToBeRasterized() with the last character, it expected to fail, 
@@ -2172,6 +2175,11 @@
 	{
 	INFO_PRINTF1(_L("Test Font Session-cache Lookup"));
 
+	// Make sure the global semaphore is gone for good
+	_LIT(KSessionCacheSemaphoreName, "FBSSessionCacheSemaphore");
+	RSemaphore sem;
+	TEST(sem.OpenGlobal(KSessionCacheSemaphoreName) == KErrNotFound);
+
 	User::LeaveIfError(RFbsSession::Connect());    
 	RFbsSession* fbsSession = RFbsSession::GetSession();
 	CFbsTypefaceStore* ts = CFbsTypefaceStore::NewL(NULL);
@@ -2273,170 +2281,96 @@
 	TEST(KErrNone == iFbs->SendCommand(EFbsMessSetTwipsHeight, fontHandle, 49));
 	// In a second thread, send a IPC command to set the font's height with the 
 	// bitmap's handle.  Should panic with FBServ -6.
-	TFbsTestThreadInfo threadInfo = {EFbsSecondThreadInvalidHandleInIpcCall};
- 	TExitCategoryName exitCategoryName(KFbsPanicCategory);
 	_LIT(KTestName, "TestInvalidHandlesInIpcCall");
- 	CreateSecondThreadAndCheckPanicL(threadInfo, -6, exitCategoryName, KTestName);
+ 	CreateSecondThreadAndCheckPanicL(SecondThreadPanicInvalidHandleInIpcCallL, KErrArgument, KFbsPanicCategory, KTestName);
 
 	iTs->ReleaseFont(font);
 	delete bmp;
 	}
 
 /**
-Creates a second thread and do some panic tests in it.
-@param aTestInfo The information for the tests
-@param aPanicCode The expected panic code
-@param aExitCategory The expected panic category
-@param aThreadName The name of the new thread
-@leave Gets system wide error code
+Second thread function for test GRAPHICS-FBSERV-0650. It should panic with FBSERV -6 if the test is successful.
+ */
+void CTFbs::SecondThreadPanicInvalidHandleInIpcCallL()
+	{
+	User::LeaveIfError(RFbsSession::Connect());
+	RFbsSession* fbs = RFbsSession::GetSession();
+	CFbsBitmapEx* bmp = new(ELeave) CFbsBitmapEx();
+	CleanupStack::PushL(bmp);
+	User::LeaveIfError(bmp->Create(TSize(1,1), EGray2));
+	CFbsTypefaceStore* ts = CFbsTypefaceStore::NewL(NULL);
+	CleanupStack::PushL(ts);
+	CFbsFont* font=NULL;
+	User::LeaveIfError(ts->GetNearestFontToDesignHeightInPixels((CFont*&)font, TFontSpec(KTypefaceName, 15)));
+	TInt bitmapHandle = bmp->BitmapHandle();
+
+	// Send a IPC command to set twips height of font with a bitmap handle
+	(void)fbs->SendCommand(EFbsMessSetTwipsHeight, bitmapHandle, 49);
+
+	ts->ReleaseFont(font);
+	CleanupStack::PopAndDestroy(2);
+	RFbsSession::Disconnect();
+	}
+
+
+struct TFbsTestDelegator
+	{
+	CTFbs* iTestBase;
+	void (CTFbs::*iMethodPtr)();
+	};
+
+/**
+Creates a second thread and checks that it panics.
+@param aMethodL The leaving method of CTFbs that the second thread is going to execute.
+@param aPanicCode The expected panic code.
+@param aPanicCategory The expected panic category.
+@param aThreadName The name of the new thread.
 */
-void CTFbs::CreateSecondThreadAndCheckPanicL(TFbsTestThreadInfo& aTestInfo, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aThreadName)
+void CTFbs::CreateSecondThreadAndCheckPanicL(void (CTFbs::*aMethodL)(), TInt aPanicCode, const TDesC& aPanicCategory, const TDesC& aThreadName)
 	{
 	RThread secondThread;
-	User::LeaveIfError(secondThread.Create(aThreadName, SecondThreadStart, KDefaultStackSize, 0x1000, 0x1000, &aTestInfo));
+	TFbsTestDelegator delegator;
+	delegator.iTestBase = this;
+	delegator.iMethodPtr = aMethodL;
+	User::LeaveIfError(secondThread.Create(aThreadName, MethodDelegatorThreadFunction, KDefaultStackSize, 0x1000, 0x1000, &delegator));
 	// Launch second thread
 	TRequestStatus statusSecondThread;
 	secondThread.Logon(statusSecondThread);
-	secondThread.SetPriority(EPriorityLess);
-	secondThread.Resume();	
-	
+	secondThread.Resume();
+	// Wait until second thread is finished
 	User::WaitForRequest(statusSecondThread);
-	
-	if(EExitPanic != secondThread.ExitType())
+	// Check results
+	if (EExitPanic != secondThread.ExitType())
 		{
-		ERR_PRINTF3(_L("Expected exit type: %d, Actual exit type: %d"), EExitPanic, secondThread.ExitType());
+		ERR_PRINTF2(_L("Expected exit type: EExitPanic, actual exit type: %d"), secondThread.ExitType());
 		TEST(EFalse);
 		}
-	
-	if(aPanicCode != secondThread.ExitReason())
+	if (aPanicCode != secondThread.ExitReason())
 		{
-		ERR_PRINTF3(_L("Expected panic code: %d, Actual panic code: %d"), aPanicCode, secondThread.ExitReason());
+		ERR_PRINTF3(_L("Expected exit reason: %d, actual exit reason: %d"), aPanicCode, secondThread.ExitReason());
         TEST(EFalse);
 		}
-	
 	TExitCategoryName secondThreadExitCategory = secondThread.ExitCategory();
-	if(aExitCategory != secondThreadExitCategory)
+	if (aPanicCategory != secondThreadExitCategory)
 		{
-		ERR_PRINTF3(_L("Expected panic category: %S, Actual panic category: %S"), &aExitCategory, &secondThreadExitCategory);
+		ERR_PRINTF3(_L("Expected exit category: %S, actual exit category: %S"), &aPanicCategory, &secondThreadExitCategory);
         TEST(EFalse);
 		}
-	
-	//Close the handle
+	// Dispose of the remains of the second thread
 	secondThread.Close();
 	}
 
-/**
-Second thread entry function.
-*/
-TInt CTFbs::SecondThreadStart(TAny* aTestInfo)
+TInt CTFbs::MethodDelegatorThreadFunction(TAny* aDelegator)
 	{
-	
-	__UHEAP_MARK;
-    TInt procHandles1  =0;
-    TInt threadHandles1=0;
-    RThread().HandleCount(procHandles1, threadHandles1);
 	CTrapCleanup* cleanupStack = CTrapCleanup::New();
-	
 	if (!cleanupStack)
 	    {
-	    __UHEAP_MARKEND;
 	    return KErrNoMemory;
 	    }
-	
-	TInt result = KErrNone;
-	TRAP(result, SecondThreadMainL(static_cast<TFbsTestThreadInfo*>(aTestInfo)));
-	
+	TFbsTestDelegator* delegator = static_cast<TFbsTestDelegator*>(aDelegator);
+	TRAPD(err, (delegator->iTestBase->*delegator->iMethodPtr)());
 	delete cleanupStack;
-
-    TInt procHandles2  =0;
-    TInt threadHandles2=0;
-    RThread().HandleCount(procHandles2,threadHandles2);
-    if (threadHandles1 != threadHandles2)
-        {
-        result = KErrGeneral;  // Thread-owned handles not closed
-        }
-	__UHEAP_MARKEND;
-
-	return result;
-	}
-
-/**
-Run the test contained within the TFbsTestThreadInfo object. A new thread is
-created for each test and only one of the cases in the switch statements
-below will be used.
-
-@param aTestInfo The parameters for the test
-@return One of the system wide error codes or an enumeration of passed tests.
- */
-TInt CTFbs::SecondThreadMainL(TFbsTestThreadInfo* aTestInfo)
-    {
-    TInt result = 0;
-    TFbsMultiThreadTestCase testcase = aTestInfo->iTestCase;
-
-    //test cases without the need of an initialised driver
-    switch (testcase)
-    	{
-    case EFbsSecondThreadInvalidHandleInIpcCall:
-    	result = SecondThreadPanicInvalidHandleInIpcCall();
-        break;
-    	}
-    return result;
-    }
-
-/**
-Implementation of SecondThread test EFbsSecondThreadInvalidHandleInIpcCall
-
-@panic FBSERV -6 If the test is successful
-
-@return One of the system wide error codes.
- */
-TInt CTFbs::SecondThreadPanicInvalidHandleInIpcCall()
-	{
-	TInt result = RFbsSession::Connect();
-	if (KErrNone != result)
-		{
-		return result;
-		}
-	RFbsSession* fbs = RFbsSession::GetSession();
-	CFbsBitmapEx* bmp = new CFbsBitmapEx();
-	if (!bmp)
-		{
-		return KErrGeneral;
-		}
-	result = bmp->Create(TSize(1,1),EGray2);
-	if(KErrNone != result)
-		{
-		delete bmp;
-		return KErrGeneral;
-		}
-
-	CFbsTypefaceStore* ts = NULL;
-	ts = (CFbsTypefaceStore*)CFbsTypefaceStore::NewL(NULL);
-	if (!ts)
-		{
-		delete bmp;
-		return KErrGeneral;
-		}
-
-	CFbsFontEx* font=NULL;
-	result = ts->GetNearestFontToDesignHeightInPixels((CFont*&)font, TFontSpec(KTypefaceName, 15));
-	if (!font)
-		{
-		delete bmp;
-		delete ts;
-		return KErrGeneral;
-		}
-
-	TInt fontHandle = font->FontHandle();
-	TInt bitmapHandle = bmp->BitmapHandle();
-
-	// Send a IPC command to set twips height of font with a bitmap handle
-	result = fbs->SendCommand(EFbsMessSetTwipsHeight, bitmapHandle, 49);
-
-	ts->ReleaseFont(font);
-	delete bmp;
-	delete ts;
-	return result;
+	return err;
 	}
 
 /**
--- a/fbs/fontandbitmapserver/tfbs/TFBS.H	Thu Apr 08 12:02:10 2010 +0100
+++ b/fbs/fontandbitmapserver/tfbs/TFBS.H	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1995-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -20,7 +20,6 @@
 #include <gdi.h>
 #include <test/fontinjector.h>
 #include <test/TGraphicsHarness.h>
-#include "tfbsmultithread.h"
 
 _LIT(KTempFilename,"c:\\temp.mbm");
 _LIT(KTestBitmapOnZ,"z:\\system\\data\\tfbs.mbm");
@@ -138,10 +137,9 @@
 	TInt LoadOpenFontLibraries();
 	TBool CheckTypefacesSupport(const TTypefaceSupport& aInfo1, const TTypefaceSupport& aInfo2);
 	void LoadFontsL(const TDesC& aFontsDir);
-	void CreateSecondThreadAndCheckPanicL(TFbsTestThreadInfo& aTestCase, TInt aPanicCode, TExitCategoryName aExitCategory, const TDesC &aThreadName);
-	static TInt SecondThreadStart(TAny* aTestInfo);
-	static TInt SecondThreadMainL(TFbsTestThreadInfo* aTestInfo);
-	static TInt SecondThreadPanicInvalidHandleInIpcCall();
+	void SecondThreadPanicInvalidHandleInIpcCallL();
+	void CreateSecondThreadAndCheckPanicL(void (CTFbs::*aMethodL)(), TInt aPanicCode, const TDesC& aPanicCategory, const TDesC &aThreadName);
+	static TInt MethodDelegatorThreadFunction(TAny* aDelegator);
 
 private:
 	TInt iHandle;
--- a/fbs/fontandbitmapserver/tfbs/tfbsmultithread.h	Thu Apr 08 12:02:10 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-// All rights reserved.
-// This component and the accompanying materials are made available
-// under the terms of "Eclipse Public License v1.0"
-// which accompanies this distribution, and is available
-// at the URL "http://www.eclipse.org/legal/epl-v10.html".
-//
-// Initial Contributors:
-// Nokia Corporation - initial contribution.
-//
-// Contributors:
-//
-// Description:
-//
-
-#ifndef TFBSMULTITHREAD_H
-#define TFBSMULTITHREAD_H
-
-/**
-* Enums for passing between the test thread and the second thead used in testing,
-* used to define which test should be run on the second thread.
-*/
-enum TFbsMultiThreadTestCase
-	{
-	EFbsSecondThreadInvalidHandleInIpcCall,
-	};
-
-/**
- * Class for passing test info to other threads.
- */	
-struct TFbsTestThreadInfo 
-	{
-	TFbsMultiThreadTestCase iTestCase;
-	};
-
-#endif // TFBSMULTITHREAD_H
--- a/graphicsdeviceinterface/bitgdi/bitgdi_switch/bitgdiswitch.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/bitgdi/bitgdi_switch/bitgdiswitch.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -40,10 +40,16 @@
 FARPROC vector[MAX_ORDINAL+1];
 
 
+#ifdef _DEBUG
 void Stop(char* aErrorMessage)
+#else
+void Stop(char* /*aErrorMessage*/)
+#endif
 	{
 	int err = GetLastError();
+#ifdef _DEBUG
 	RDebug::Printf("%s, (last error = %i)", aErrorMessage, err);
+#endif
 	_asm int 3;
 	}
 
@@ -77,8 +83,10 @@
 	UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty,  (TAny*)"symbian_graphics_use_gce",  &gce);
 	const char* library = gce ? "bitgdi_gce.dll" : "bitgdi_nongce.dll";
 
+#ifdef _DEBUG
 	RDebug::Printf("Redirecting bitgdi.dll to \"%s\" ...\n", library);
-	
+#endif
+
 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
 	// try to load selected DLL
 	HINSTANCE instance = LoadLibraryA(library);
@@ -91,7 +99,9 @@
 	else
 		{
 		fill_vector(instance);
+#ifdef _DEBUG
 		RDebug::Printf("... DLL loaded successfully");
+#endif
 		}
 	}
 
--- a/graphicsdeviceinterface/gdi/bwins/GDI2U.def	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/gdi/bwins/GDI2U.def	Thu Apr 08 12:06:20 2010 +0100
@@ -290,4 +290,34 @@
 	?DrawTextVertical@CGraphicsContext@@QAEXABVTDesC16@@PBVTTextParameters@1@ABVTPoint@@H@Z @ 289  NONAME ; void CGraphicsContext::DrawTextVertical(class TDesC16 const &, class CGraphicsContext::TTextParameters const *, class TPoint const &, int)
 	?DrawTextVertical@CGraphicsContext@@QAEXABVTDesC16@@PBVTTextParameters@1@ABVTRect@@HHW4TTextAlign@1@H@Z @ 290  NONAME ; void CGraphicsContext::DrawTextVertical(class TDesC16 const &, class CGraphicsContext::TTextParameters const *, class TRect const &, int, int, enum CGraphicsContext::TTextAlign, int)
 	?TextWidthInPixels@CFont@@QBEHABVTDesC16@@PBVTMeasureTextInput@1@@Z @ 291 NONAME ; int CFont::TextWidthInPixels(class TDesC16 const &, class CFont::TMeasureTextInput const *) const
+	?Open@RFontTable@@QAEHAAVCFont@@K@Z @ 292 NONAME ABSENT ; int RFontTable::Open(class CFont &, unsigned long)
+	?Next@RGlyphOutlineIterator@@QAEHXZ @ 293 NONAME ABSENT ; int RGlyphOutlineIterator::Next(void)
+	?TableLength@RFontTable@@QBEHXZ @ 294 NONAME ABSENT ; int RFontTable::TableLength(void) const
+	?OutlineLength@RGlyphOutlineIterator@@QBEHXZ @ 295 NONAME ABSENT ; int RGlyphOutlineIterator::OutlineLength(void) const
+	?Outline@RGlyphOutlineIterator@@QBEPBEXZ @ 296 NONAME ABSENT ; unsigned char const * RGlyphOutlineIterator::Outline(void) const
+	?TableContent@RFontTable@@QBEPBEXZ @ 297 NONAME ABSENT ; unsigned char const * RFontTable::TableContent(void) const
+	?Close@RGlyphOutlineIterator@@QAEXXZ @ 298 NONAME ABSENT ; void RGlyphOutlineIterator::Close(void)
+	?Close@RFontTable@@QAEXXZ @ 299 NONAME ABSENT ; void RFontTable::Close(void)
+	??0RGlyphOutlineIterator@@QAE@XZ @ 300 NONAME ABSENT ; RGlyphOutlineIterator::RGlyphOutlineIterator(void)
+	?Open@RGlyphOutlineIterator@@QAEHAAVCFont@@PAIHH@Z @ 301 NONAME ABSENT ; int RGlyphOutlineIterator::Open(class CFont &, unsigned int *, int, int)
+	??0RFontTable@@QAE@XZ @ 302 NONAME ABSENT ; RFontTable::RFontTable(void)
+	?Image@RGlyphDataIterator@@QBEABVRSgImage@@XZ @ 303 NONAME ABSENT ; class RSgImage const & RGlyphDataIterator::Image(void) const
+	??0RGlyphMetricsArray@@QAE@XZ @ 304 NONAME ABSENT ; RGlyphMetricsArray::RGlyphMetricsArray(void)
+	?Count@RGlyphMetricsArray@@QBEHXZ @ 305 NONAME ABSENT ; int RGlyphMetricsArray::Count(void) const
+	?Metrics@RGlyphDataIterator@@QBEABVTOpenFontCharMetrics@@XZ @ 306 NONAME ABSENT ; class TOpenFontCharMetrics const & RGlyphDataIterator::Metrics(void) const
+	??0RGlyphDataIterator@@QAE@XZ @ 307 NONAME ABSENT ; RGlyphDataIterator::RGlyphDataIterator(void)
+	??ARGlyphMetricsArray@@QBEABVTOpenFontCharMetrics@@H@Z @ 308 NONAME ABSENT ; class TOpenFontCharMetrics const & RGlyphMetricsArray::operator[](int) const
+	?GlyphCode@RGlyphDataIterator@@QBEIXZ @ 309 NONAME ABSENT ; unsigned int RGlyphDataIterator::GlyphCode(void) const
+	?Rect@RGlyphDataIterator@@QBEABVTRect@@XZ @ 310 NONAME ABSENT ; class TRect const & RGlyphDataIterator::Rect(void) const
+	?Next@RGlyphDataIterator@@QAEHXZ @ 311 NONAME ABSENT ; int RGlyphDataIterator::Next(void)
+	?Close@RGlyphMetricsArray@@QAEXXZ @ 312 NONAME ABSENT ; void RGlyphMetricsArray::Close(void)
+	?Get@RGlyphMetricsArray@@QAEHAAVCFont@@PBIH@Z @ 313 NONAME ABSENT ; int RGlyphMetricsArray::Get(class CFont &, unsigned int const *, int)
+	?Close@RGlyphDataIterator@@QAEXXZ @ 314 NONAME ABSENT ; void RGlyphDataIterator::Close(void)
+	?Open@RGlyphDataIterator@@QAEHAAVCFont@@PBIH@Z @ 315 NONAME ABSENT ; int RGlyphDataIterator::Open(class CFont &, unsigned int const *, int)
+	?SetName@TTypeface@@QAEXABVTDesC16@@@Z @ 316 NONAME ; void TTypeface::SetName(class TDesC16 const &)
+	?Name@TTypeface@@QBEABVTDesC16@@XZ @ 317 NONAME ; class TDesC16 const & TTypeface::Name(void) const
+	?At@RHexTreeBase@@IBEPAXI@Z @ 318 NONAME ; void * RHexTreeBase::At(unsigned int) const
+	??0RHexTreeBase@@IAE@PAVRHeap@@@Z @ 319 NONAME ; RHexTreeBase::RHexTreeBase(class RHeap *)
+	?SetAt@RHexTreeBase@@IAEHIPAX@Z @ 320 NONAME ; int RHexTreeBase::SetAt(unsigned int, void *)
+	?ResetAndDestroy@RHexTreeBase@@QAEXXZ @ 321 NONAME ; void RHexTreeBase::ResetAndDestroy(void)
 
--- a/graphicsdeviceinterface/gdi/eabi/GDI2U.def	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/gdi/eabi/GDI2U.def	Thu Apr 08 12:06:20 2010 +0100
@@ -361,4 +361,39 @@
 	_ZN16CGraphicsContext8DrawTextERK7TDesC16PKNS_15TTextParametersERK6TPoint @ 360 NONAME
 	_ZN16CGraphicsContext8DrawTextERK7TDesC16PKNS_15TTextParametersERK6TPointRKNS_14TDrawTextParamE @ 361 NONAME
 	_ZNK5CFont17TextWidthInPixelsERK7TDesC16PKNS_17TMeasureTextInputE @ 362 NONAME
+	_ZN10RFontTable4OpenER5CFontm @ 363 NONAME ABSENT
+	_ZN10RFontTable5CloseEv @ 364 NONAME ABSENT
+	_ZN10RFontTableC1Ev @ 365 NONAME ABSENT
+	_ZN10RFontTableC2Ev @ 366 NONAME ABSENT
+	_ZN21RGlyphOutlineIterator4NextEv @ 367 NONAME ABSENT
+	_ZN21RGlyphOutlineIterator4OpenER5CFontPjii @ 368 NONAME ABSENT
+	_ZN21RGlyphOutlineIterator5CloseEv @ 369 NONAME ABSENT
+	_ZN21RGlyphOutlineIteratorC1Ev @ 370 NONAME ABSENT
+	_ZN21RGlyphOutlineIteratorC2Ev @ 371 NONAME ABSENT
+	_ZNK10RFontTable11TableLengthEv @ 372 NONAME ABSENT
+	_ZNK10RFontTable12TableContentEv @ 373 NONAME ABSENT
+	_ZNK21RGlyphOutlineIterator13OutlineLengthEv @ 374 NONAME ABSENT
+	_ZNK21RGlyphOutlineIterator7OutlineEv @ 375 NONAME ABSENT
+	_ZN18RGlyphDataIterator4NextEv @ 376 NONAME ABSENT
+	_ZN18RGlyphDataIterator4OpenER5CFontPKji @ 377 NONAME ABSENT
+	_ZN18RGlyphDataIterator5CloseEv @ 378 NONAME ABSENT
+	_ZN18RGlyphDataIteratorC1Ev @ 379 NONAME ABSENT
+	_ZN18RGlyphDataIteratorC2Ev @ 380 NONAME ABSENT
+	_ZN18RGlyphMetricsArray3GetER5CFontPKji @ 381 NONAME ABSENT
+	_ZN18RGlyphMetricsArray5CloseEv @ 382 NONAME ABSENT
+	_ZN18RGlyphMetricsArrayC1Ev @ 383 NONAME ABSENT
+	_ZN18RGlyphMetricsArrayC2Ev @ 384 NONAME ABSENT
+	_ZNK18RGlyphDataIterator4RectEv @ 385 NONAME ABSENT
+	_ZNK18RGlyphDataIterator5ImageEv @ 386 NONAME ABSENT
+	_ZNK18RGlyphDataIterator7MetricsEv @ 387 NONAME ABSENT
+	_ZNK18RGlyphDataIterator9GlyphCodeEv @ 388 NONAME ABSENT
+	_ZNK18RGlyphMetricsArray5CountEv @ 389 NONAME ABSENT
+	_ZNK18RGlyphMetricsArrayixEi @ 390 NONAME ABSENT
+	_ZN9TTypeface7SetNameERK7TDesC16 @ 391 NONAME
+	_ZNK9TTypeface4NameEv @ 392 NONAME
+	_ZN12RHexTreeBase15ResetAndDestroyEv @ 393 NONAME
+	_ZN12RHexTreeBase5SetAtEjPv @ 394 NONAME
+	_ZN12RHexTreeBaseC1EP5RHeap @ 395 NONAME
+	_ZN12RHexTreeBaseC2EP5RHeap @ 396 NONAME
+	_ZNK12RHexTreeBase2AtEj @ 397 NONAME
 
--- a/graphicsdeviceinterface/gdi/group/BLD.INF	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/gdi/group/BLD.INF	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-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"
@@ -45,6 +45,9 @@
 ../inc/gdiconsts.h	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/gdi/gdiconsts.h)
 ../inc/gdiinline.inl	SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(graphics/gdi/gdiinline.inl)
 
+../inc/hextree.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(hextree.h)
+../inc/hextree.inl SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(hextree.inl)
+
 ../group/gdi.iby	/epoc32/rom/include/gdi.iby
 
 
--- a/graphicsdeviceinterface/gdi/group/GDI.MMP	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/gdi/group/GDI.MMP	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -53,6 +53,7 @@
 SOURCE FontIndic.cpp
 SOURCE ShaperCli.cpp
 SOURCE GDI.CPP
+SOURCE hextree.cpp
 
 LIBRARY         euser.lib
 LIBRARY         efsrv.lib
--- a/graphicsdeviceinterface/gdi/inc/GDI.H	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/gdi/inc/GDI.H	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -140,7 +140,12 @@
 	/** Insufficient text for successful completion of the method */
 	EGdiPanic_OutOfText				= 2,
 	/** Internal failure. */
-	EGdiPanic_Invariant				= 3
+	EGdiPanic_Invariant				= 3,
+	/** Reserved panic codes. Not to be used. */
+	EGdiPanic_Reserved1				= 4,
+	EGdiPanic_Reserved2				= 5,
+	/** Setting a typeface name that is too long */
+	EGdiPanic_TypefaceNameOverflow	= 6,
 	};
 
 
@@ -560,6 +565,8 @@
 	IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
 	IMPORT_C void SetScriptTypeForMetrics(TInt aScript);
 	IMPORT_C TInt ScriptTypeForMetrics() const;
+	IMPORT_C void SetName(const TDesC& aName);
+	IMPORT_C const TDesC& Name() const;
 private:
 	void ResetAttributes();
 	void ResetScriptType();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicsdeviceinterface/gdi/inc/hextree.h	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,74 @@
+// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// Hexadecimal trees - declaration
+//
+
+#ifndef HEXTREE_H
+#define HEXTREE_H
+
+#include <e32std.h>
+
+/**
+Base class that provides the implementation for RHexTree, which is just a thin
+template.
+
+An instance of this class can have up to eight 16-way prefix trees, with heights
+from 1 to 8. All the values are stored in the leaves. To find a value from a
+32-bit key, first the key is decomposed into 8 hexadecimal digits and then the
+prefix tree with height matching the number of digits in the key (ignoring zeros
+to the left) is traversed using the sequence of digits in the key as the
+indexing string. Offsets are internally used instead of pointers to allow
+instances to be placed in a heap shared between several processes.
+*/
+class RHexTreeBase
+    {
+public:
+    IMPORT_C void ResetAndDestroy();
+protected:
+    IMPORT_C RHexTreeBase(RHeap* aHeap);
+    IMPORT_C TInt SetAt(TUint aKey, TAny* aValue);
+    IMPORT_C TAny* At(TUint aKey) const;
+private:
+    TInt SetAt(TUint aKey, TAny* aLeaf, TInt aHeight);
+    TInt SetAt(TUint aKey, TAny* aLeaf, TInt aHeight, TAny* aNode, TInt aLevel);
+    TAny* At(TUint aKey, TInt aHeight) const;
+    void ResetAndDestroy(TInt aHeight, TAny* aNode, TInt aLevel);
+private:
+    enum { EMaxNumHexDigits = 8 };
+private:
+    RHeap* iHeap;
+    TInt iRootOffsets[EMaxNumHexDigits];
+    };
+
+/**
+An associative array implementation optimised for the case where the keys are
+32-bit codes with spatial locality of reference. The values can be of any
+self-contained data type (that is, without destructor or clean-up functions).
+It allows multiple-readers, single-writer concurrent access from different
+processes in an SMP-safe manner without locking, excluding deletion of
+individual key-value pairs.
+*/
+template<class T>
+class RHexTree : public RHexTreeBase
+    {
+public:
+    inline RHexTree(RHeap* aHeap);
+    inline TInt SetAt(TUint aKey, T* aValue);
+    inline const T* At(TUint aKey) const;
+    inline T* At(TUint aKey);
+    };
+
+#include <hextree.inl>
+
+#endif // HEXTREE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicsdeviceinterface/gdi/inc/hextree.inl	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,83 @@
+// 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:
+// Hexadecimal trees - inline functions
+//
+
+#ifndef HEXTREE_INL
+#define HEXTREE_INL
+
+/**
+Constructor. It constructs an associative array with no key-value pairs.
+
+@param aHeap A pointer to the heap to be used by the associative array
+       implementation to allocate memory for internal data structures. This
+       heap can be shared between several processes.
+*/
+template<class T>
+inline RHexTree<T>::RHexTree(RHeap* aHeap)
+    : RHexTreeBase(aHeap)
+    {
+    }
+
+/**
+Adds a key-value pair to this associative array.
+
+@param aKey The 32-bit key to add to this associative array.
+@param aValue A pointer to the value to associate with aKey. It must have been
+       allocated on the same heap as the one used by the associative array
+       implementation to allocate memory for internal data structures. Ownership
+       is transferred to this associative array.
+@return KErrNone if the key-value pair was added successfully. KErrNoMemory if
+        there was not enough memory in the heap for internal data structures.
+        KErrAlreadyExists if an attempt was made to add a duplicate key.
+*/
+template<class T>
+inline TInt RHexTree<T>::SetAt(TUint aKey, T* aValue)
+    {
+    return RHexTreeBase::SetAt(aKey, aValue);
+    }
+
+/**
+Looks up a given key in this associative array and returns a pointer to the
+corresponding value.
+
+@param aKey The 32-bit key to look up.
+@return A pointer to the corresponding value in this associative array, if the
+        given key was found. The value may not be modified via this pointer.
+        NULL if the given key was not found.
+*/
+template<class T>
+inline const T* RHexTree<T>::At(TUint aKey) const
+    {
+    return static_cast<T*>(RHexTreeBase::At(aKey));
+    }
+
+/**
+Looks up a given key in this associative array and returns a pointer to the
+corresponding value. Note that if values are modified after being added to an
+associative array, then the user is responsible for synchronisation when
+concurrent access is needed.
+
+@param aKey The 32-bit key to look up.
+@return A pointer to the corresponding value in this associative array, if the
+        given key was found. The value may be modified via this pointer.
+        NULL if the given key was not found.
+*/
+template<class T>
+inline T* RHexTree<T>::At(TUint aKey)
+    {
+    return static_cast<T*>(RHexTreeBase::At(aKey));
+    }
+
+#endif // HEXTREE_INL
--- a/graphicsdeviceinterface/gdi/sgdi/FONT.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/gdi/sgdi/FONT.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -345,10 +345,13 @@
 The object's font style is set to the default: EPostureUpright, EStrokeWeightNormal, 
 and EPrintPosNormal.
 
-@param aTypefaceName The name of the typeface (e.g. "Roman"). 
-@param aHeight The height of the typeface, in twips. */
+@param aTypefaceName The name of the typeface (e.g. "Roman"). It should be no
+	longer than KMaxTypefaceNameLength characters in length.
+@param aHeight The height of the typeface, in twips. 
+@panic GDI 6, if aTypefaceName is more than KMaxTypefaceNameLength characters long.
+*/
 	{
-	iTypeface.iName=aTypefaceName;
+	iTypeface.SetName(aTypefaceName);
 	}
 
 
@@ -605,6 +608,29 @@
 	return (KTTypefaceMaskScript & iFlags) >> KTTypefaceBitsNumAttrib;
 	}
 
+/**
+Sets the name of the typeface. This method should be used rather than
+directly accessing the iName public member.
+@param aName The name of the typeface (e.g. "Roman"). It should be no 
+	longer than KMaxTypefaceNameLength characters in length.
+@panic GDI 6, if aName is more than KMaxTypefaceNameLength characters
+	long.
+*/
+EXPORT_C void TTypeface::SetName(const TDesC& aName)
+	{
+	GDI_ASSERT_ALWAYS(aName.Length() <= KMaxTypefaceNameLength, EGdiPanic_TypefaceNameOverflow);
+	iName=aName;
+	}
+
+/**
+Returns the name of the typeface.
+@return The name of the typeface.
+*/
+EXPORT_C const TDesC& TTypeface::Name() const
+	{
+	return iName;
+	}
+
 
 //
 // CFont
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/graphicsdeviceinterface/gdi/sgdi/hextree.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,195 @@
+// 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:
+// Hexadecimal trees - implementation
+//
+
+#include <hextree.h>
+#include <e32atomics.h>
+
+EXPORT_C RHexTreeBase::RHexTreeBase(RHeap* aHeap)
+    : iHeap(aHeap)
+    {
+    Mem::FillZ(iRootOffsets, sizeof(iRootOffsets));
+    }
+
+EXPORT_C TInt RHexTreeBase::SetAt(TUint aKey, TAny* aValue)
+    {
+    TUint mask = 0xF0000000;
+    for (TInt height = EMaxNumHexDigits; height > 1; --height)
+        {
+        if ((aKey & mask) != 0)
+            {
+            return SetAt(aKey, aValue, height);
+            }
+        mask >>= 4;
+        }
+    return SetAt(aKey, aValue, 1);
+    }
+
+EXPORT_C TAny* RHexTreeBase::At(TUint aKey) const
+    {
+    TUint mask = 0xF0000000;
+    for (TInt height = EMaxNumHexDigits; height > 1; --height)
+        {
+        if ((aKey & mask) != 0)
+            {
+            return At(aKey, height);
+            }
+        mask >>= 4;
+        }
+    return At(aKey, 1);
+    }
+
+/**
+Empties this associative array and frees all memory allocated both for the
+associative array implementation and for the values that have been added to
+this associative array.
+
+The internal state of this associative array is reset so that it can be reused
+or allowed to go out of scope after a call to this function.
+*/
+EXPORT_C void RHexTreeBase::ResetAndDestroy()
+    {
+    for (TInt height = 1; height <= EMaxNumHexDigits; ++height)
+        {
+        TInt offset = iRootOffsets[height - 1];
+        if (offset != 0)
+            {
+            TAny* root = PtrAdd(this, offset);
+            ResetAndDestroy(height, root, 1);
+            iRootOffsets[height - 1] = 0;
+            }
+        }
+    }
+
+TInt RHexTreeBase::SetAt(TUint aKey, TAny* aLeaf, TInt aHeight)
+    {
+    TInt err;
+    TInt offset = iRootOffsets[aHeight - 1];
+    if (offset == 0)
+        {
+        TAny* root = iHeap->AllocZ(aHeight > 1 ? sizeof(TInt) * 15 : sizeof(TInt) * 16);
+        if (!root)
+            {
+            return KErrNoMemory;
+            }
+        err = SetAt(aKey, aLeaf, aHeight, root, 1);
+        if (err == KErrNone)
+            {
+            __e32_atomic_store_rel32(&iRootOffsets[aHeight - 1], reinterpret_cast<TInt>(root) - reinterpret_cast<TInt>(this));
+            }
+        else
+            {
+            iHeap->Free(root);
+            }
+        }
+    else
+        {
+        TAny* root = PtrAdd(this, offset);
+        err = SetAt(aKey, aLeaf, aHeight, root, 1);
+        }
+    return err;
+    }
+
+TInt RHexTreeBase::SetAt(TUint aKey, TAny* aLeaf, TInt aHeight, TAny* aNode, TInt aLevel)
+    {
+    TInt err = KErrNone;
+    TInt branch = (aKey >> ((aHeight - aLevel) << 2)) & 0xF;
+    if (aLevel == 1 && aHeight > 1)
+        {
+        --branch;
+        }
+    TInt offset = static_cast<TInt*>(aNode)[branch];
+    if (aLevel == aHeight)
+        {
+        if (offset == 0)
+            {
+            __e32_atomic_store_rel32(&static_cast<TInt*>(aNode)[branch], reinterpret_cast<TInt>(aLeaf) - reinterpret_cast<TInt>(aNode));
+            }
+        else
+            {
+            err = KErrAlreadyExists;
+            }
+        }
+    else if (offset == 0)
+        {
+        TAny* newNode = iHeap->AllocZ(sizeof(TInt) * 16);
+        if (!newNode)
+            {
+            return KErrNoMemory;
+            }
+        err = SetAt(aKey, aLeaf, aHeight, newNode, aLevel + 1);
+        if (err == KErrNone)
+            {
+            __e32_atomic_store_rel32(&static_cast<TInt*>(aNode)[branch], reinterpret_cast<TInt>(newNode) - reinterpret_cast<TInt>(aNode));
+            }
+        else
+            {
+            iHeap->Free(newNode);
+            }
+        }
+    else
+        {
+        TAny* nextNode = PtrAdd(aNode, offset);
+        err = SetAt(aKey, aLeaf, aHeight, nextNode, aLevel + 1);
+        }
+    return err;
+    }
+
+TAny* RHexTreeBase::At(TUint aKey, TInt aHeight) const
+    {
+    TInt offset = __e32_atomic_load_acq32(&iRootOffsets[aHeight - 1]);
+    if (offset == 0)
+        {
+        return NULL;
+        }
+    const TAny* node = PtrAdd(this, offset);
+    for (TInt level = 1; level <= aHeight; ++level)
+        {
+        TInt branch = (aKey >> ((aHeight - level) << 2)) & 0xF;
+        if (level == 1 && aHeight > 1)
+            {
+            --branch;
+            }
+        offset = __e32_atomic_load_acq32(&static_cast<const TInt*>(node)[branch]);
+        if (offset == 0)
+            {
+            return NULL;
+            }
+        node = PtrAdd(node, offset);
+        }
+    return const_cast<TAny*>(node);
+    }
+
+void RHexTreeBase::ResetAndDestroy(TInt aHeight, TAny* aNode, TInt aLevel)
+    {
+    TInt maxNumBranches = (aLevel == 1 && aHeight > 1 ? 15 : 16);
+    for (TInt branch = 0; branch < maxNumBranches; ++branch)
+        {
+        TInt offset = static_cast<TInt*>(aNode)[branch];
+        if (offset != 0)
+            {
+            TAny* nextNode = PtrAdd(aNode, offset);
+            if (aLevel == aHeight)
+                {
+                iHeap->Free(nextNode);
+                }
+            else
+                {
+                ResetAndDestroy(aHeight, nextNode, aLevel + 1);
+                }
+            }
+        }
+    iHeap->Free(aNode);
+    }
--- a/graphicsdeviceinterface/screendriver/sbit/Cdsb.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/screendriver/sbit/Cdsb.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -17,7 +17,6 @@
 #include <cdsb.h>
 #include <e32hal.h>
 
-
 #ifdef SYMBIAN_GRAPHICS_GCE
 #undef __WINS__
 #include "../sgeneric/scdraw.h"
@@ -73,8 +72,6 @@
 #ifdef SYMBIAN_GRAPHICS_GCE
     CScreenDeviceHelper iSurfaceUpdater;
     TUidPixelFormat iPixelFormat;
-    TBool iDsaBufferIsBusy;
-    TRequestStatus iDsaBufferAvailable;
 #endif
 	TAcceleratedBitmapInfo iBitmapInfo;
 	TUint32 iSettingsFlags;
@@ -110,9 +107,6 @@
 #ifndef __WINS__
 	iVideoAddress(NULL),
 #endif
-#ifdef SYMBIAN_GRAPHICS_GCE
-	iDsaBufferIsBusy(EFalse),
-#endif
 	iBitmapInfo(),
 	iSettingsFlags(ENone),
 	iUpdateRect(),
@@ -163,12 +157,16 @@
 		{
 		return r;
 		}
-
+	
 	__ASSERT_ALWAYS(aScreenRect.iTl.iX >= 0 &&
-					aScreenRect.iTl.iY >= 0 &&
-					aScreenRect.Width() <= screenWidth &&
-					aScreenRect.Height() <= screenHeight, Panic(EPanicOutOfBounds));
-
+	                aScreenRect.iTl.iY >= 0 &&
+	                ((aScreenRect.Width() <= screenWidth &&
+	                aScreenRect.Height() <= screenHeight)
+	                ||
+	                (aScreenRect.Width() <= screenHeight &&
+	                aScreenRect.Height() <= screenWidth)),
+	                Panic(EPanicOutOfBounds));
+	
 	__ASSERT_ALWAYS(aScreenRect.Width() > 0 &&
 					aScreenRect.Height() > 0, Panic(EPanicInvalidRect));
 
@@ -529,14 +527,7 @@
 #else
 	TUint8* pD = (TUint8*)iVideoAddress;
 	const TUint dD = iDisplayOffsetLines;
-#ifdef SYMBIAN_GRAPHICS_GCE
-	if (iDsaBufferIsBusy)
-		{
-		User::WaitForRequest(iDsaBufferAvailable);
-		__ASSERT_DEBUG(iDsaBufferAvailable != KRequestPending, Panic(EPanicIncompleteRequest));
-		iDsaBufferIsBusy=EFalse;
-		}
-#endif	
+
 	for(TInt y=iUpdateRect.Height(); y>0; y--)
 		{
 		Mem::Move((void *)pD, (void *)pS, dS);
@@ -546,17 +537,18 @@
 #endif
 	
 #ifdef SYMBIAN_GRAPHICS_GCE
-	iDsaBufferIsBusy=ETrue;
+	// update the region and complete notification on the client's TRequestStatus
+	// This means the backbuffer is held up until the surface update has completed
+	// notification.
 	iSurfaceUpdater.UpdateRegion(iUpdateRect);
-	iDsaBufferAvailable = KRequestPending;
-	iSurfaceUpdater.NotifyWhenAvailable(iDsaBufferAvailable);
-	iSurfaceUpdater.Update();
+	iSurfaceUpdater.Update(aComplete);
+#else
+	// In the generic implementation, complete the request immediately to allow the client
+	// to render to the back buffer
+	TRequestStatus* pComplete=&aComplete;
+	User::RequestComplete(pComplete,KErrNone);
 #endif
-	// In the generic implementation, complete the request immediately to allow the client
-    // to render to the back buffer
-	TRequestStatus* pComplete=&aComplete;
 
-    User::RequestComplete(pComplete,KErrNone);
  	}
 
 //
@@ -606,15 +598,6 @@
 	TUint8* pS = iBitmapInfo.iAddress + offX + (offY*dS);
 	TUint8* pD = (TUint8*)iVideoAddress + offX + (offY*dD);
 
-#ifdef SYMBIAN_GRAPHICS_GCE
-	if (iDsaBufferIsBusy)
-		{
-		User::WaitForRequest(iDsaBufferAvailable);
-		__ASSERT_DEBUG(iDsaBufferAvailable != KRequestPending, Panic(EPanicIncompleteRequest));
-		iDsaBufferIsBusy=EFalse;
-		}
-#endif	
-	
 	for(TInt y=aScreenRect.Height(); y>0; y--)
 		{
 		Mem::Move((void *)pD, (void *)pS, bytesToCopy);
@@ -624,16 +607,18 @@
 #endif
 
 #ifdef SYMBIAN_GRAPHICS_GCE
-	iDsaBufferIsBusy=ETrue;
+	// update the region and complete notification on the client's TRequestStatus
+	// This means the backbuffer is held up until the surface update has completed
+	// notification.
 	iSurfaceUpdater.UpdateRegion(iUpdateRect);
-	iDsaBufferAvailable = KRequestPending;
-	iSurfaceUpdater.NotifyWhenAvailable(iDsaBufferAvailable);
-	iSurfaceUpdater.Update();
+	iSurfaceUpdater.Update(aComplete);
+#else
+	// In the generic implementation, complete the request immediately to allow the client
+	// to render to the back buffer
+	TRequestStatus* pComplete=&aComplete;
+	User::RequestComplete(pComplete,KErrNone);
 #endif	
-	// In the generic implementation, complete the request immediately.
-	TRequestStatus* pComplete=&aComplete;
 
-	User::RequestComplete(pComplete,KErrNone);
 	}
 
 #ifdef __WINS__
@@ -728,6 +713,7 @@
 	}
 #endif
 
+
 //
 // Close - Deallocate resources and cancel outstanding updates
 //
@@ -735,6 +721,9 @@
 	{
 	if(iCreated)
 		{
+#ifdef SYMBIAN_GRAPHICS_GCE
+		iSurfaceUpdater.CancelUpdateNotification();
+#endif
 		User::Free(iBitmapInfo.iAddress);
 		iBitmapInfo.iAddress = NULL;
 		iCreated = EFalse;
--- a/graphicsdeviceinterface/screendriver/scdv_switch/scdvswitch.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/screendriver/scdv_switch/scdvswitch.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -39,11 +39,16 @@
 
 FARPROC vector[MAX_ORDINAL+1];
 
-
+#ifdef _DEBUG
 void Stop(char* aErrorMessage)
+#else
+void Stop(char* /*aErrorMessage*/)
+#endif
 	{
 	int err = GetLastError();
+#ifdef _DEBUG
 	RDebug::Printf("%S, (last error = %i)", aErrorMessage, err);
+#endif
 	_asm int 3;
 	}
 
@@ -77,8 +82,10 @@
 	UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty,  (TAny*)"symbian_graphics_use_gce",  &gce);
 	const char* library = gce ? "_generic_scdv.dll" : "_wins_scdv.dll";
 
+#ifdef _DEBUG
 	RDebug::Printf("Redirecting scdv.dll to \"%s\" ...\n", library);
-	
+#endif
+  	
 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
 	// try to load selected DLL
 	HINSTANCE instance = LoadLibraryA(library);
@@ -91,7 +98,9 @@
 	else
 		{
 		fill_vector(instance);
+#ifdef _DEBUG
 		RDebug::Printf("... DLL loaded successfully");
+#endif
 		}
 	}
 
--- a/graphicsdeviceinterface/screendriver/sgeneric/scdraw.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/screendriver/sgeneric/scdraw.h	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -61,10 +61,13 @@
 	inline TInt ScreenNumber() const { return iSurface.iInternal[TSurfaceId::TScreenSurfaceUsage::EScreenField]; }
 
 	void Update();
+	void Update(TRequestStatus& aStatus);
+
 	void Update(const TRegion& aRegion);
 	void UpdateRegion(const TRect& aRect);
 	void ResetUpdateRegion();
 	void NotifyWhenAvailable(TRequestStatus& aStatus);
+	void CancelUpdateNotification();
 
 	void GetSurface(TSurfaceId& aSid) const ;
 	TUint DeviceOrientationsAvailable(const TSize& aScreenSize) const ;
--- a/graphicsdeviceinterface/screendriver/sgeneric/scdraw.inl	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/screendriver/sgeneric/scdraw.inl	Thu Apr 08 12:06:20 2010 +0100
@@ -49,7 +49,7 @@
 		{	//Note: This will cause WServ startup to fail. WServ only accepts KErrNotSupported
 		return KErrHardwareNotAvailable;
 		}
-	TInt ret = CDrawXxxBppBitmap::Construct(aSize);
+	TInt ret = CDrawXxxBppBitmap::Construct(aSize, CDrawXxxBppBitmap::iScanLineWords << 2);
 	if (ret == KErrNone)
 		{
 		CDrawXxxBppBitmap::iBits = (TUint32*)iHelper.AddressFirstPixel();
--- a/graphicsdeviceinterface/screendriver/sgeneric/scnew.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/screendriver/sgeneric/scnew.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -27,8 +27,7 @@
 #include "scdraw.h"
 #include "scdraw.inl"
 #include <graphics/gdi/gdiconsts.h>
-
-
+#include <graphics/suerror.h>
 /**
 Creates an instance of CFbsDrawDevice class.
 @param aScreenNo Screen number
@@ -341,6 +340,11 @@
 	iSurfaceUpdateSession.NotifyWhenAvailable(aStatus);
 	}
 
+void CScreenDeviceHelper::CancelUpdateNotification()
+	{
+	iSurfaceUpdateSession.CancelAllUpdateNotifications();
+	}
+
 /**
 Implementation of corresponding function in CDrawDevice, utilizing a tracked
 update region. Updates the screen from the surface, if the update region is
@@ -348,11 +352,24 @@
 */
 void CScreenDeviceHelper::Update()
 	{
-	if (iUpdateRegion.IsEmpty())
-		return;
+	TRequestStatus updateComplete = KRequestPending;
+	Update(updateComplete);
+	User::WaitForRequest(updateComplete);
+	}
 
-	iSurfaceUpdateSession.SubmitUpdate(ScreenNumber(), iSurface, 0, &iUpdateRegion);
-	iUpdateRegion.Clear();
+void CScreenDeviceHelper::Update(TRequestStatus& aStatus)
+	{
+	if (!iUpdateRegion.IsEmpty())
+		{
+		iSurfaceUpdateSession.NotifyWhenAvailable(aStatus);
+		iSurfaceUpdateSession.SubmitUpdate(KAllScreens, iSurface, 0, &iUpdateRegion);
+		iUpdateRegion.Clear();
+		}
+	else
+		{
+		TRequestStatus* pComplete=&aStatus;
+		User::RequestComplete(pComplete,KErrNone);	    
+		}
 	}
 
 /**
--- a/graphicsdeviceinterface/screendriver/tsrc/TDirectScreenBitmap.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/screendriver/tsrc/TDirectScreenBitmap.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -546,7 +546,7 @@
 	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
 	if (err)
 		{
-		INFO_PRINTF2(_L("Warning: Failed to create screen device for display mode %i - not supported on this config?"),aDisplayMode);
+		INFO_PRINTF2(_L("Note: Failed to create screen device for display mode %i - not supported on this config?"),aDisplayMode);
 
 		}
 	else
@@ -655,7 +655,7 @@
 	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
 	if (err)
 		{
-		INFO_PRINTF2(_L("Warning: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
+		INFO_PRINTF2(_L("Note: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
 
 		}
 	else
@@ -786,7 +786,7 @@
 	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0, aDisplayMode));
 	if (err)
 		{
-		INFO_PRINTF2(_L("Warning: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
+		INFO_PRINTF2(_L("Note: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
 		}
 	else
 		{
@@ -936,7 +936,7 @@
 	TRAPD(err,pDev = CFbsDrawDevice::NewScreenDeviceL(0,aDrawDeviceDispMode));
 	if (err !=KErrNone)
 		{
-		INFO_PRINTF2(_L("Warning: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
+		INFO_PRINTF2(_L("Note: Failed to create screen device for display mode %i - not supported on this config?"),iDispMode);
 		}
 	else
 		{
--- a/graphicsdeviceinterface/screendriver/tsrc/scripts/mnt.cmd	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicsdeviceinterface/screendriver/tsrc/scripts/mnt.cmd	Thu Apr 08 12:06:20 2010 +0100
@@ -39,6 +39,11 @@
 if "%1"=="" goto help
 if "%EPOCROOT%"=="" echo error: Variable Epocroot must be defined
 if "%EPOCROOT%"=="" goto help
+
+if  not defined EPOC_INI (
+	set EPOC_INI=%EPOCROOT%epoc32\data\epoc.ini
+)
+
 goto %1
 goto help
 
@@ -46,15 +51,15 @@
 
 :install
 echo Backing up EPOC.INI.
-if not exist %EPOCROOT%epoc32\data\epoc.bak copy %EPOCROOT%epoc32\data\epoc.ini %EPOCROOT%epoc32\data\epoc.bak >nul
+if not exist %EPOC_INI%.scdvbak copy %EPOC_INI% %EPOC_INI%.scdvbak >nul
 
 rem add line to epoc.ini so that the system starter will start the emulator in the specified display mode
-echo SYMBIAN_GRAPHICS_USE_GCE ON >> %EPOCROOT%epoc32\data\epoc.ini
-echo SYMBIAN_BASE_USE_GCE ON >> %EPOCROOT%epoc32\data\epoc.ini
-echo ColorDepth Color16M >> %EPOCROOT%epoc32\data\epoc.ini
+echo SYMBIAN_GRAPHICS_USE_GCE ON >> %EPOC_INI%
+echo SYMBIAN_BASE_USE_GCE ON >> %EPOC_INI%
+echo ColorDepth Color16M >> %EPOC_INI%
 
-echo === New EPOC.INI -- %EPOCROOT%epoc32\data\epoc.ini ===
-type %EPOCROOT%epoc32\data\epoc.ini
+echo === New EPOC.INI -- %EPOC_INI% ===
+type %EPOC_INI%
 echo ======================================================
 
 goto :EOF
@@ -63,14 +68,14 @@
 rem ================ Installonb ==============
 :installonb
 echo Backing up EPOC.INI.
-if not exist %EPOCROOT%epoc32\data\epoc.bak copy %EPOCROOT%epoc32\data\epoc.ini %EPOCROOT%epoc32\data\epoc.bak >nul
+if not exist %EPOC_INI%.scdvbak copy %EPOC_INI% %EPOC_INI%.scdvbak >nul
 
 rem For ONB system only add line to epoc.ini so that the system starter will start the emulator in the specified display mode
-echo. >> %EPOCROOT%epoc32\data\epoc.ini
-echo ColorDepth Color16M >> %EPOCROOT%epoc32\data\epoc.ini
+echo. >> %EPOC_INI%
+echo ColorDepth Color16M >> %EPOC_INI%
 
-echo === New EPOC.INI -- %EPOCROOT%epoc32\data\epoc.ini ===
-type %EPOCROOT%epoc32\data\epoc.ini
+echo === New EPOC.INI -- %EPOC_INI% ===
+type %EPOC_INI%
 echo ======================================================
 
 goto :EOF
@@ -79,7 +84,7 @@
 
 :uninstall
 echo Restoring EPOC.INI.
-if exist %EPOCROOT%epoc32\data\epoc.bak xcopy /r /y %EPOCROOT%epoc32\data\epoc.bak %EPOCROOT%epoc32\data\epoc.ini >nul
+if exist %EPOC_INI%.scdvbak xcopy /r /y %EPOC_INI%.scdvbak %EPOC_INI% >nul
 goto :EOF
 
 
--- a/graphicstest/graphicstestharness/automation/graphicssystemgui.sysdef.tb92.xml	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/graphicssystemgui.sysdef.tb92.xml	Thu Apr 08 12:06:20 2010 +0100
@@ -199,6 +199,18 @@
 					<component name="Surface Update">
 						<unit bldFile="sf\os\graphics\graphicscomposition\surfaceupdate\group" mrp="sf\os\graphics\graphicscomposition\surfaceupdate\group\graphics_surfaceupdate.mrp"/>
 					</component>
+					<component name="OpenWF Support">
+						<unit bldFile="sf\os\graphics\graphicscomposition\openwfsupport\group" mrp="sf\os\graphics\graphicscomposition\openwfsupport\group\graphics_openwfsupport.mrp"/>
+					</component>
+					<component name="OpenWF Composition Conformance Tests">
+						<unit bldFile="sf\os\graphics\graphicscomposition\openwfconformancetest\group" mrp="sf\os\graphics\graphicscomposition\openwfconformancetest\CT_PortingLayer\src\Platform\Symbian\group\graphics_openwfconformancetest.mrp"/>
+					</component>
+					<component name="OpenWF Composition Interface">
+						<unit bldFile="sf\os\graphics\graphicscomposition\openwfcinterface\group" mrp="sf\os\graphics\graphicscomposition\openwfcinterface\group\graphics_openwfcinterface.mrp"/>
+					</component>
+					<component name="OpenWF Composition Engine">
+						<unit bldFile="sf\os\graphics\graphicscomposition\openwfcompositionengine\group" mrp="sf\os\graphics\graphicscomposition\openwfcompositionengine\group\graphics_openwfcompositionengine.mrp"/>
+					</component>
 				</collection>
 				<collection name="Graphics Device Interface">
 					<component name="BitGDI">
--- a/graphicstest/graphicstestharness/automation/h4/roms.tb92.txt	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h4/roms.tb92.txt	Thu Apr 08 12:06:20 2010 +0100
@@ -13,7 +13,7 @@
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby te_uibench_s60.iby egl.iby opengles.iby openvg.iby internaltestfonts.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','h4hrp_uibench_s60_armv5_dpdef','Graphics Test ROM UIBench S60 DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_uibench_s60.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics7_armv5_dpdef','Graphics Test ROM (7) DP Default','\epoc32\data\z\graphics\wsini_integ_color64k.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_07.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec t_wservinteg.iby opengles.iby graphics_testharness.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics8_armv5_dpdef','Graphics Test ROM (8) - WServ Integ DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini;\epoc32\data\z\system\data\testexecute_modified.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_08.txt','')
-RomAndAutoRom('armv5','h4hrp pagedrom techview platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DGRAPHICS_TEST_GCE','h4hrp_graphics9_armv5_dpdef','Graphics Test ROM (9) - Hybrid GCE DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_09.txt','')
+RomAndAutoRom('armv5','h4hrp pagedrom textshell platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','h4hrp_graphics9_armv5_dpdef','Graphics Test ROM (9) - Hybrid GCE DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_09.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby directgditest.iby ityperast.iby graphicsresourcetest.iby opengles.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','h4hrp_graphics11_armv5_dpdef','Graphics Test ROM (11) - Graphics Resource DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_11.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby directgditest.iby ityperast.iby graphicsresourcetest.iby opengles.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','h4hrp_graphics11a_armv5_dpdef','Graphics Test ROM (11a) - DirectGDI tests (requiring USB/Memory Card support) DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_11a.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','h4hrp_graphics12_armv5_dpdef','Graphics Test ROM (12) DP Default','\epoc32\data\z\graphics\wsini_integ_color16ma.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_12.txt','')
--- a/graphicstest/graphicstestharness/automation/h4/roms.wdp.tb92.txt	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h4/roms.wdp.tb92.txt	Thu Apr 08 12:06:20 2010 +0100
@@ -13,7 +13,7 @@
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby te_uibench_s60.iby egl.iby opengles.iby openvg.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_uibench_s60_armv5_wdp','Graphics Test ROM UIBench S60 WDP','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_uibench_s60.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_test2.iby wservtest.iby csc_plugin.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_graphics7_armv5_wdp','Graphics Test ROM (7) WDP','\epoc32\data\z\graphics\wsini_integ_color64k.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_07.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec t_wservinteg.iby opengles.iby graphics_testharness.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_graphics8_armv5_wdp','Graphics Test ROM (8) - WServ Integ WDP','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_08.txt','')
-RomAndAutoRom('armv5','h4hrp pagedrom techview platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby dptestcons.oby','-DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DGRAPHICS_TEST_GCE -D_SSMSTARTUPMODE=5 -DWITH_FLEXIBLE_MM -D_INTERNAL_MMC -DUSE_DATA_PAGING','h4hrp_graphics9_armv5_wdp','Graphics Test ROM (9) - Hybrid GCE WDP','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_09.txt','')
+RomAndAutoRom('armv5','h4hrp pagedrom textshell platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby dptestcons.oby','-DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -D_SSMSTARTUPMODE=5 -DWITH_FLEXIBLE_MM -D_INTERNAL_MMC -DUSE_DATA_PAGING','h4hrp_graphics9_armv5_wdp','Graphics Test ROM (9) - Hybrid GCE WDP','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_09.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby directgditest.iby ityperast.iby graphicsresourcetest.iby opengles.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_graphics11_armv5_wdp','Graphics Test ROM (11) - Graphics Resource WDP','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_11.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_testharness.iby directgditest.iby ityperast.iby graphicsresourcetest.iby opengles.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_graphics11a_armv5_wdp','Graphics Test ROM (11a) - DirectGDI tests (requiring USB/Memory Card support) WDP','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_11a.txt','')
 RomAndAutoRom('armv5','h4hrp pagedrom techview platsec graphics_test2.iby wservtest.iby csc_plugin.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_graphics12_armv5_wdp','Graphics Test ROM (12) WDP','\epoc32\data\z\graphics\wsini_integ_color16ma.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h4\tests_12.txt','')
--- a/graphicstest/graphicstestharness/automation/h4/tests_07.txt	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h4/tests_07.txt	Thu Apr 08 12:06:20 2010 +0100
@@ -43,3 +43,6 @@
 
 # WServ
 TESTEXECUTE, \logs\testexecute\wsgcetests_hw_color64k_screen1.htm,			, z:\wstest\wsgcetests_hw_color64k_screen1.script, 800
+
+# WServ
+TESTEXECUTE, \logs\testexecute\graphics-wserv-nativeorientation-test.htm, , z:\wstest\tnativeorientation\graphics-wserv-nativeorientation-test.script, 800
--- a/graphicstest/graphicstestharness/automation/h6/roms.tb92.txt	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h6/roms.tb92.txt	Thu Apr 08 12:06:20 2010 +0100
@@ -13,7 +13,7 @@
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby te_uibench_s60.iby egl.iby opengles.iby openvg.iby internaltestfonts.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24UBPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','34xx_sdp_uibench_s60_armv5_dpdef','Graphics Test ROM UIBench S60 DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_uibench_s60.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','34xx_sdp_graphics7_armv5_dpdef','Graphics Test ROM (7) DP Default','\epoc32\data\z\graphics\wsini_integ_h6_color64k.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_07.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec t_wservinteg.iby opengles.iby graphics_testharness.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','34xx_sdp_graphics8_armv5_dpdef','Graphics Test ROM (8) - WServ Integ DP Default','\epoc32\data\z\graphics\wsini_integ.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_08.txt','')
-RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DGRAPHICS_TEST_GCE','34xx_sdp_graphics9_armv5_dpdef','Graphics Test ROM (9) - Hybrid GCE DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_09.txt','')
+RomAndAutoRom('armv5','34xx_sdp pagedrom textshell platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','34xx_sdp_graphics9_armv5_dpdef','Graphics Test ROM (9) - Hybrid GCE DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_09.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby directgditest.iby ityperast.iby graphicsresourcetest.iby opengles.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','34xx_sdp_graphics11_armv5_dpdef','Graphics Test ROM (11) - Graphics Resource DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_11.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby directgditest.iby ityperast.iby graphicsresourcetest.iby opengles.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','34xx_sdp_graphics11a_armv5_dpdef','Graphics Test ROM (11a) - DirectGDI tests (requiring USB/Memory Card support) DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_11a.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','34xx_sdp_graphics12_armv5_dpdef','Graphics Test ROM (12) DP Default','\epoc32\data\z\graphics\wsini_integ_h6_color16ma.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_12.txt','')
@@ -26,7 +26,7 @@
 RomAndAutoRom('armv5','34xx_sdp pagedrom minigui platsec graphics_testharness.iby csc_plugin.iby tcsc.iby egltesthybrid.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','34xx_sdp_graphicseglhybrid_armv5_dpdef','Graphics Test ROM (eglhybrid) - EGL Hybrid Graphics Implementation DP Default','\epoc32\data\z\wstest\wsini_csc_nga_h6.ini,\epoc32\data\z\wsini_minigui.ini;\epoc32\data\z\graphicstest\testexecute_minigui.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_eglhybrid.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom minigui platsec graphics_testharness.iby csc_plugin.iby tcsc.iby egltestref.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_USE_EGL_REF','34xx_sdp_graphicseglref_armv5_dpdef','Graphics Test ROM (eglref) - EGL Reference Graphics Implementation DP Default','\epoc32\data\z\wstest\wsini_csc_nga_h6.ini,\epoc32\data\z\wsini_minigui.ini;\epoc32\data\z\graphicstest\testexecute_minigui.ini,\epoc32\data\z\system\data\testexecute.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_eglref.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby talf.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','34xx_sdp_graphics23_armv5_dpdef','Graphics Test ROM (23) - ALF/ChangeTracking DP Default','\epoc32\data\z\talf\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_23.txt','')
-RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby t_eventchecker.iby t_bitgdirenderstage.iby wserv.oby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DRVT','34xx_sdp_graphics24_armv5_dpdef','Graphics Test ROM (24) - BitGDI Renderstage DP Default','\epoc32\data\z\wstest\tbitgdirenderstage\arm\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_24.txt','')
+RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec graphics_testharness.iby t_eventchecker.iby t_bitgdirenderstage.iby wserv.oby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT_TV -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DRVT','34xx_sdp_graphics24_armv5_dpdef','Graphics Test ROM (24) - BitGDI Renderstage DP Default','\epoc32\data\z\wstest\tbitgdirenderstage\arm\wsini.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_24.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec wserv.oby graphics_testharness.iby talf.iby','-D_NAND2 -DWITH_TVOUT -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','34xx_sdp_graphics25_armv5_dpdef','Graphics Test ROM (25) - ALF/ChangeTracking per screen DP Default','\epoc32\data\z\talf\wsini_ct_recovery.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_25.txt','')
 RomAndAutoRom('armv5','34xx_sdp pagedrom techview platsec appfwk_test.iby','-D_NAND2 -DUSE_SDIO_SD_MMC -DWITH_TVOUT -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -D_DEBUG','34xx_sdp_uiframeworks_armv5_dpdef','UI Frameworks DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\h6\tests_uif.txt','')
 Rom('armv5', '34xx_sdp minigui', '-nosymbols -DUSE_SDIO_SD_MMC', '34xx_sdp_minigui', 'MiniGUI ROM', '' )
--- a/graphicstest/graphicstestharness/automation/h6/tests_07.txt	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/h6/tests_07.txt	Thu Apr 08 12:06:20 2010 +0100
@@ -43,3 +43,6 @@
 
 # WServ
 TESTEXECUTE, \logs\testexecute\wsgcetests_hw_color64k_screen1.htm,			, z:\wstest\wsgcetests_hw_color64k_screen1.script, 800
+
+# WServ
+TESTEXECUTE, \logs\testexecute\graphics-wserv-nativeorientation-test.htm, , z:\wstest\tnativeorientation\graphics-wserv-nativeorientation-test.script, 800
\ No newline at end of file
--- a/graphicstest/graphicstestharness/automation/ne1/roms.tb92.txt	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/ne1/roms.tb92.txt	Thu Apr 08 12:06:20 2010 +0100
@@ -11,7 +11,7 @@
 RomAndAutoRom('armv5','naviengine techview platsec graphics_testharness.iby te_uibench_s60.iby egl.iby opengles.iby openvg.iby internaltestfonts.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24UBPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DFBSRASTERIZER_DRV="^<"fbsrasterizer_test.iby"^>"','naviengine_uibench_s60_armv5','Graphics Test ROM UIBench S60 DP Default','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_uibench_s60.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','naviengine_graphics7_armv5','Graphics Test ROM (7)','\epoc32\data\z\graphics\wsini_integ_naviengine_color64k.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_07.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec t_wservinteg.iby opengles.iby graphics_testharness.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','naviengine_graphics8_armv5','Graphics Test ROM (8) - WServ Integ','\epoc32\data\z\graphics\wsini_integ_norotation.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_08.txt','')
-RomAndAutoRom('armv5','naviengine techview platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DGRAPHICS_TEST_GCE','naviengine_graphics9_armv5','Graphics Test ROM (9) - Hybrid GCE','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_09.txt','')
+RomAndAutoRom('armv5','naviengine textshell platsec surfacemanagertest.iby wservtest.iby gce_tests.iby tdisplaychannel.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE','naviengine_graphics9_armv5','Graphics Test ROM (9) - Hybrid GCE','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_09.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec graphics_testharness.iby directgditest.iby ityperast.iby graphicsresourcetest.iby opengles.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW -DGRAPHICS_EXCLUDE_FREETYPE','naviengine_graphics11_armv5','Graphics Test ROM (11) - Graphics Resource','','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_11.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec graphics_test2.iby wservtest.iby csc_plugin.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','naviengine_graphics12_armv5','Graphics Test ROM (12)','\epoc32\data\z\graphics\wsini_integ_naviengine_color16ma.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_12.txt','')
 RomAndAutoRom('armv5','naviengine techview platsec graphics_testharness.iby t_wservgenericplugin.iby','-DUSE_SDIO_SD_MMC -DSMP -DUSE_24BPP_DISPLAY_VARIANT -DSYMBIAN_BASE_USE_GCE -DSYMBIAN_GRAPHICS_USE_GCE -DSYMBIAN_GRAPHICS_ADAPTATION=SGA_SW','naviengine_graphics13_armv5','Graphics Test ROM (13) - Generic Plugin','\epoc32\data\z\wstest\genericplugin\wsini_nga_onescreen.ini,\epoc32\data\z\system\data\wsini.ini','..\sf\os\graphics\graphicstest\graphicstestharness\automation\ne1\tests_13.txt','')
--- a/graphicstest/graphicstestharness/automation/ne1/tests_07.txt	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/automation/ne1/tests_07.txt	Thu Apr 08 12:06:20 2010 +0100
@@ -30,3 +30,6 @@
 
 # Surface Update
 TESTEXECUTE, \logs\testexecute\surfaceupdate.htm,			, z:\surfaceupdate\surfaceupdate.script, 800
+
+# WServ
+TESTEXECUTE, \logs\testexecute\graphics-wserv-nativeorientation-test.htm, , z:\wstest\tnativeorientation\graphics-wserv-nativeorientation-test.script, 800
\ No newline at end of file
--- a/graphicstest/graphicstestharness/batch/replace.py	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/batch/replace.py	Thu Apr 08 12:06:20 2010 +0100
@@ -14,7 +14,7 @@
 # Description: 
 #
 
-import sys
+import sys
 # first argument is path to file to modify
 filePath=sys.argv[1]
 outFile=filePath
--- a/graphicstest/graphicstestharness/group/graphicsimagecomparison.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/group/graphicsimagecomparison.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -16,14 +16,13 @@
 /**
  @file
  @test
- @internalComponent - Internal Symbian test code 
 */
 
 
 TARGET                  graphicsimagecomparison.dll
 TARGETTYPE              dll
 
-CAPABILITY              none
+CAPABILITY 		All -Tcb
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 MW_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/graphicstest/graphicstestharness/group/graphicsscreencomparison.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/group/graphicsscreencomparison.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -16,14 +16,13 @@
 /**
  @file
  @test
- @internalComponent - Internal Symbian test code 
 */
 
 
 TARGET                  graphicsscreencomparison.dll
 TARGETTYPE              dll
 
-CAPABILITY              none
+CAPABILITY 		All -Tcb
 
 OS_LAYER_SYSTEMINCLUDE_SYMBIAN
 MW_LAYER_SYSTEMINCLUDE_SYMBIAN
--- a/graphicstest/graphicstestharness/group/tprofiler.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/group/tprofiler.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -22,7 +22,7 @@
 SOURCE			tprofiler.cpp
 
 USERINCLUDE		../inc
-SYSTEMINCLUDE	/epoc32/include
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 LIBRARY			euser.lib testexecuteutils.lib testexecutelogclient.lib hal.lib
 
--- a/graphicstest/graphicstestharness/rom/graphics_test2.iby	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/rom/graphics_test2.iby	Thu Apr 08 12:06:20 2010 +0100
@@ -29,6 +29,13 @@
 #include <surfaceupdatetest.iby>
 #include <graphics_screencomparison.iby>
 #include <graphics_imagecomparison.iby>
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+#include <t_nativeorientation.iby>
 #endif
 
+#endif
+
+
+
 #endif
\ No newline at end of file
--- a/graphicstest/graphicstestharness/src/TTMSGraphicsStep.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/graphicstestharness/src/TTMSGraphicsStep.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -32,20 +32,19 @@
 void CTTMSGraphicsStep::CleanUpAndWriteResults()
 	{
 	TBuf<256> testID;
-	TBuf<8> unusableTestResult;    //In graphicstestharness it is not known whether the test was started with
-                                   //!Result=Fail or !Error=KErrSomething given as paramenter to RUN_TEST_STEP
+	TBuf<8> testResult;
 	
 	for (TInt iArrayIndex=0; iArrayIndex < iArrayTMSData.Count(); iArrayIndex++)
 		{
 		CTMSDataColumn columnData = iArrayTMSData[iArrayIndex];
 		
 		testID.Copy(columnData.iTheID);
-		unusableTestResult.Copy(columnData.iTheResult); //unusable because we don't know if the test is expected to pass or fail
+		testResult.Copy(columnData.iTheResult);
 		
 		INFO_PRINTF2(_L("START_TESTCASE %S"),&testID);
 		INFO_PRINTF2(_L("Line = 1 Command = START_TESTCASE %S"),&testID);
 		INFO_PRINTF2(_L("END_TESTCASE %S"),&testID);
-		INFO_PRINTF2(_L("Line = 1 Command = END_TESTCASE %S"),&testID);
+		INFO_PRINTF3(_L("Line = 1 Command = END_TESTCASE %S ***TestCaseResult = %S"),&testID,&testResult);
 		}
 	
 	iArrayTMSData.Close();		    
--- a/graphicstest/uibench/s60/group/glplanets.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/uibench/s60/group/glplanets.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -22,8 +22,7 @@
 userinclude     .
 userinclude     ../src
 userinclude     ../src/tests_zorder
-systeminclude   /epoc32/include
-systeminclude   /epoc32/include/stdapis
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 sourcepath      .
 START resource glplanets_reg.rss
--- a/graphicstest/uibench/s60/group/multiplesurfaces.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/uibench/s60/group/multiplesurfaces.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -25,8 +25,7 @@
 userinclude     ..\src\tests_zorder
 userinclude     ..\src\windows
 
-systeminclude   /epoc32/include
-systeminclude   /epoc32/include/stdapis
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
 
 sourcepath      .
 START resource multiplesurfaces_reg.rss
--- a/graphicstest/uibench/s60/group/te_uibench_s60.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/graphicstest/uibench/s60/group/te_uibench_s60.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -93,7 +93,7 @@
 USERINCLUDE  ../src/tests_egl
 
 //system includes
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+MW_LAYER_SYSTEMINCLUDE_SYMBIAN
 OS_LAYER_LIBC_SYSTEMINCLUDE
 
 START BITMAP videoplay2.mbm
--- a/m3g/m3gcore11/BWINS/m3gcoreU.DEF	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/BWINS/m3gcoreU.DEF	Thu Apr 08 12:06:20 2010 +0100
@@ -342,4 +342,5 @@
 	m3gSetAlphaWrite @ 341 NONAME
 	m3gGetAlphaWrite @ 342 NONAME
 	m3gInvalidateMemoryTarget @ 343 NONAME
+	m3gFreeGLESResources @ 344 NONAME
 
--- a/m3g/m3gcore11/EABI/m3gcoreU.DEF	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/EABI/m3gcoreU.DEF	Thu Apr 08 12:06:20 2010 +0100
@@ -342,4 +342,5 @@
 	m3gSetAlphaWrite @ 341 NONAME
 	m3gGetAlphaWrite @ 342 NONAME
 	m3gInvalidateMemoryTarget @ 343 NONAME
+	m3gFreeGLESResources @ 344 NONAME
 
--- a/m3g/m3gcore11/group/m3g.mmp	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/group/m3g.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -26,14 +26,14 @@
 CAPABILITY      CAP_GENERAL_DLL
 
 // Modify default options to optimize for speed over size in this module.
-OPTION ARMCC -O3
-OPTION ARMCC -Otime
+OPTION ARMCC -O3 -Otime
 ALWAYS_BUILD_AS_ARM
 
 // Uncomment the following flags to enable ARMv6 and/or VFP optimizations.
-//#define __ARMV6_SUPPORT
-//#define __VFPV2_SUPPORT
+#define __ARMV6_SUPPORT
+#define __VFPV2_SUPPORT
 
+#ifdef ARMCC
 #ifdef __ARMV6_SUPPORT
 MACRO			M3G_HW_ARMV6
 OPTION_REPLACE ARMCC --cpu 6
@@ -44,6 +44,7 @@
 MACRO			M3G_HW_FLOAT_VFPV2
 OPTION_REPLACE ARMCC --fpu softvfp+vfpv2 --fpmode fast
 #endif
+#endif
 
 
 #if defined(UDEB)
@@ -69,3 +70,5 @@
 LIBRARY         euser.lib estlib.lib fbscli.lib
 LIBRARY         efsrv.lib ws32.lib
 LIBRARY         libGLESv1_CM.lib ezlib.lib libEGL.lib
+
+SMPSAFE
--- a/m3g/m3gcore11/inc/m3g_appearance.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/inc/m3g_appearance.h	Thu Apr 08 12:06:20 2010 +0100
@@ -125,28 +125,32 @@
  */
 static M3G_INLINE M3Guint m3gGetAppearanceSortKey(const Appearance *appearance)
 {
-    M3Guint key = appearance ? appearance->sortKey : 0;
+    if (appearance) {
+        M3Guint key = appearance->sortKey;
 
-    /* The blending state bit is set dynamically, as it may change
-     * without changing the appearance (we have no signaling from
-     * CompositingMode for that) */
-    
-    if (appearance->compositingMode != NULL
-        && appearance->compositingMode->blendingMode != M3G_REPLACE) {
-        key |= (1u << (32 - M3G_APPEARANCE_HARD_SORT_BITS));
-    }
+        /* The blending state bit is set dynamically, as it may change
+         * without changing the appearance (we have no signaling from
+         * CompositingMode for that) */
+        
+        if (appearance->compositingMode != NULL
+            && appearance->compositingMode->blendingMode != M3G_REPLACE) {
+            key |= (1u << (32 - M3G_APPEARANCE_HARD_SORT_BITS));
+        }
 
-    if (m3gGetColorMaskWorkaround(M3G_INTERFACE(appearance))) {
-        /* Override the top 2 bits of the sorting key so that ColorMask
-         * changes are minimized */
-        if (appearance) {
-            key &= ~(0x03 << 22);
-            key |= (((M3Guint) m3gColorMask(appearance)) & 1) << 23;
-            key |= (((M3Guint) m3gAlphaMask(appearance)) & 1) << 22;
+        if (m3gGetColorMaskWorkaround(M3G_INTERFACE(appearance))) {
+            /* Override the top 2 bits of the sorting key so that ColorMask
+             * changes are minimized */
+            if (appearance) {
+                key &= ~(0x03 << 22);
+                key |= (((M3Guint) m3gColorMask(appearance)) & 1) << 23;
+                key |= (((M3Guint) m3gAlphaMask(appearance)) & 1) << 22;
+            }
         }
-    }
 
-    return key;
+        return key;
+    } 
+
+    return M3G_FALSE;
 }
 
 /*!
--- a/m3g/m3gcore11/inc/m3g_config.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/inc/m3g_config.h	Thu Apr 08 12:06:20 2010 +0100
@@ -32,6 +32,21 @@
 /* Support antialiasing */
 #define M3G_SUPPORT_ANTIALIASING    M3G_TRUE
 
+/*!
+ * \internal
+ * \def M3G_ENABLE_GLES_RESOURCE_HANDLING
+ * \brief Allow GLES resource freeing 
+ *
+ * This feature can be used with HW renderers with external memory architecture 
+ * to free all graphics resources allocated by M3G. 
+ *
+ * Enabling this feature is likely to increase host memory consumption (a copy of 
+ * all texture image data has to be kept kept in host memory), so it's advised to 
+ * undefine the flag when using SW GLES or HW GLES with unified memory architecture.
+ */
+#define M3G_ENABLE_GLES_RESOURCE_HANDLING
+
+
 #if defined(M3G_DEBUG)
 /*
 #define M3G_ENABLE_PROFILING
--- a/m3g/m3gcore11/inc/m3g_interface.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/inc/m3g_interface.h	Thu Apr 08 12:06:20 2010 +0100
@@ -132,8 +132,11 @@
  * Other internal functions
  *------------------------------------------------------------------*/
 
-static void     m3gAddChildObject(Interface *m3g);
-static void     m3gDelChildObject(Interface *m3g);
+static void     m3gAddChildObject(Interface *m3g, Object *obj);
+static void     m3gDelChildObject(Interface *m3g, Object *obj);
+
+#include "m3g_array.h"
+static void     m3gGetObjectsWithClassID(Interface *m3g, M3GClass classID, PointerArray* objects);
 
 #if !defined(M3G_NGL_TEXTURE_API)
 static void     m3gDeleteGLTextures(Interface *m3g, M3Gsizei n, M3Guint *t);
--- a/m3g/m3gcore11/src/m3g_appearance.c	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/src/m3g_appearance.c	Thu Apr 08 12:06:20 2010 +0100
@@ -427,9 +427,8 @@
 
         if (appearance != NULL) {
     		m3gInitObject(&appearance->object, m3g, M3G_CLASS_APPEARANCE);
+            m3gRegenerateSortKey(appearance);
         }
-
-        m3gRegenerateSortKey(appearance);
         
         return (M3GAppearance) appearance;
     }
--- a/m3g/m3gcore11/src/m3g_fog.c	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/src/m3g_fog.c	Thu Apr 08 12:06:20 2010 +0100
@@ -197,9 +197,10 @@
     M3G_ASSERT_GL;
 }
 
+#ifdef M3G_USE_NGL_API
 /*!
  * \internal
- * \brief Applies fog to OpenGL. This is used for
+ * \brief Applies fog to NGL. This is used for
  * Sprite3D objects only.
  *
  * \param self          Fog object
@@ -232,12 +233,9 @@
 
 		glEnable(GL_FOG);
 		glFogf(GL_FOG_MODE, GL_LINEAR);
-#ifdef M3G_USE_NGL_API
+
         /* NGL works differently in fog calculation */
 		glFogf(GL_FOG_START, -m3gDiv(finalZ, fogValue));
-#else
-		glFogf(GL_FOG_START, m3gAbs(m3gDiv(finalZ, fogValue)));
-#endif
 		glFogf(GL_FOG_END, 0.f);
 		glFogxv(GL_FOG_COLOR, temp);
     }
@@ -245,7 +243,7 @@
 		glDisable(GL_FOG);
     }
 }
-
+#endif
 /*----------------------------------------------------------------------
  * Virtual function table
  *--------------------------------------------------------------------*/
--- a/m3g/m3gcore11/src/m3g_image.c	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/src/m3g_image.c	Thu Apr 08 12:06:20 2010 +0100
@@ -1302,6 +1302,12 @@
                 return NULL;
             }
 
+#ifdef M3G_ENABLE_GLES_RESOURCE_HANDLING
+            /* If GLES resource freeing (see function m3gFreeGLESResources) 
+               is enabled, the GL texture might get deleted at any point, so
+			   a copy of the texture data has to be always kept in memory. */
+            img->pinned = M3G_TRUE;
+#else           
             /* Lock the image data in memory if the image is dynamic,
              * or the format has alpha information; otherwise, we'll
              * be able to get rid of an extra copy when generating a
@@ -1312,7 +1318,7 @@
                     img->format != M3G_LUMINANCE)) {
                 img->pinned = M3G_TRUE;
             }
-
+#endif
             /* If the image can be used as a rendering target, clear
              * to opaque white by default */
             
@@ -1368,13 +1374,14 @@
     
     image->flags = flags;
 
+#ifdef M3G_ENABLE_GLES_RESOURCE_HANDLING
     /* If the image format has no alpha information, we can discard
      * the image data under suitable conditions */
     
     if (image->format == M3G_RGB || image->format == M3G_LUMINANCE) {
         image->pinned = M3G_FALSE;
     }
-    
+#endif    
     M3G_LOG1(M3G_LOG_IMAGES, "Image 0x%08X made immutable\n",
              (unsigned) image);
 }
--- a/m3g/m3gcore11/src/m3g_indexbuffer.c	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/src/m3g_indexbuffer.c	Thu Apr 08 12:06:20 2010 +0100
@@ -483,7 +483,7 @@
                                    M3Gint *indices)
 {
     M3Gint i, j, tri = 0;
-    M3Gint triIndices[4];
+    M3Gint triIndices[4] = {0, 0, 0, 0};
     M3G_VALIDATE_OBJECT(buffer);
     M3G_UNREF(batchIndex);
 
--- a/m3g/m3gcore11/src/m3g_interface.c	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/src/m3g_interface.c	Thu Apr 08 12:06:20 2010 +0100
@@ -68,8 +68,6 @@
         /*@shared@*/ m3gReleaseTargetFunc *releaseTarget;
     } func;
     
-    /*Object *objects;*/
-
     /*! \internal \brief Latest error code for this interface */
     M3Genum error;
 
@@ -90,6 +88,8 @@
     M3Gint glRefCount;
 #   endif
 
+    /* \internal \brief List of live objects */
+    PointerArray objects;     
     /*! \internal \brief Number of objects registered for this interface */
     M3Gint objCount;
 
@@ -946,20 +946,26 @@
  * \internal
  * \brief
  */
-static void m3gAddChildObject(Interface *m3g)
+static void m3gAddChildObject(Interface *m3g, Object *obj)
 {
     M3G_ASSERT(!m3g->shutdown);
     M3G_ASSERT(m3gInRange(m3g->objCount, 0, 0x7FFFFFFF));
     ++m3g->objCount;
+
+    /* Add the object to the list of live objects */
+    m3gArrayAppend(&m3g->objects, obj, m3g);
 }
 
 /*!
  * \internal
  * \brief
  */
-static void m3gDelChildObject(Interface *m3g)
+static void m3gDelChildObject(Interface *m3g, Object *obj)
 {
     M3G_ASSERT(m3g->objCount > 0);
+
+    /* Remove the object from the list of live objects */
+    m3gArrayDelete(&m3g->objects, m3gArrayFind(&m3g->objects, obj));
     if (--m3g->objCount == 0 && m3g->shutdown) {
         m3gDeleteInterface(m3g);
     }
@@ -968,6 +974,19 @@
 #if !defined(M3G_NGL_TEXTURE_API)
 /*!
  * \internal
+ * \brief Get a list of live objects with matching class ID
+ */
+static void m3gGetObjectsWithClassID(Interface *m3g, M3GClass classID, PointerArray* objects)
+{
+    M3Gsizei i = m3gArraySize(&m3g->objects);
+    while (i > 0) {
+        M3GObject obj = (M3GObject)m3gGetArrayElement(&m3g->objects, --i);
+        if (m3gGetClass(obj) == classID)
+            m3gArrayAppend(objects, obj, m3g);
+    }
+}
+/*!
+ * \internal
  * \brief Queue OpenGL texture objects for deletion
  *
  * The objects will be deleted when a GL context is next made current.
@@ -1661,6 +1680,7 @@
         /* All done! Now we can allocate the more trival stuff */
 
         m3g->tcache = m3gCreateTransformCache(m3g);
+        m3gInitArray(&m3g->objects);
         
         M3G_LOG1(M3G_LOG_INTERFACE,
                  "Interface 0x%08X initialized\n", (unsigned) m3g);
@@ -1690,6 +1710,7 @@
         return;
     }
 
+    m3gDestroyArray(&m3g->objects, m3g);
 #   if !defined(M3G_NGL_TEXTURE_API)
     /* Free the list of dead GL objects (those will have been deleted
      * along with the owning contexts by now) */
--- a/m3g/m3gcore11/src/m3g_object.c	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/src/m3g_object.c	Thu Apr 08 12:06:20 2010 +0100
@@ -56,7 +56,7 @@
     
     M3G_VALIDATE_OBJECT(obj);
 
-    m3gAddChildObject(interface);
+    m3gAddChildObject(interface, obj);
     m3gMarkObject(obj);
     
     m3gIncStat(M3G_INTERFACE(obj), M3G_STAT_OBJECTS, 1);
@@ -86,7 +86,7 @@
         m3gFree(obj->interface, obj->animTracks);
     }
 
-    m3gDelChildObject(obj->interface);
+    m3gDelChildObject(obj->interface, obj);
     m3gUnmarkObject(obj);
     
     m3gIncStat(M3G_INTERFACE(obj), M3G_STAT_OBJECTS, -1);
--- a/m3g/m3gcore11/src/m3g_rendercontext.c	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/src/m3g_rendercontext.c	Thu Apr 08 12:06:20 2010 +0100
@@ -403,6 +403,69 @@
 	return ctx->alphaWrite;
 }
 
+/*!
+ * \brief Frees all GLES resources allocated by the M3G API 
+ *        (EGL surfaces, contexts and texture objects). 
+ *
+ * \note M3G must not be bound to any target when calling this.
+ *
+ */
+M3G_API void m3gFreeGLESResources(M3GRenderContext ctx)
+{
+#ifdef M3G_ENABLE_GLES_RESOURCE_HANDLING
+
+    PointerArray image2DObjects;
+    M3Gint i;
+
+    /* M3G must not be bound to a rendering target at this point. */
+    if (ctx->target.type != SURFACE_NONE) {
+        m3gRaiseError(M3G_INTERFACE(ctx), M3G_INVALID_OPERATION);
+    }
+
+    /* EGL might not be initialized yet, so do it here just in case. */ 
+    eglInitialize(eglGetDisplay(EGL_DEFAULT_DISPLAY), NULL, NULL);
+    eglMakeCurrent(eglGetDisplay(EGL_DEFAULT_DISPLAY), NULL, NULL, NULL);
+
+    /* Delete EGL surfaces */
+    for (i = 0; i < M3G_MAX_GL_SURFACES; ++i) {
+        GLSurfaceRecord *surf = &ctx->glSurface[i];
+        if (surf->handle) {
+            m3gDeleteGLSurface(surf->handle);
+        }
+        m3gZero(surf, sizeof(GLSurfaceRecord));
+    }
+    if (ctx->backBuffer.glSurface != NULL) {
+        m3gDeleteGLSurface(ctx->backBuffer.glSurface);
+        m3gZero(&ctx->backBuffer, sizeof(BackBuffer));
+    }
+
+    /* Delete EGL contexts */
+    for (i = 0; i < M3G_MAX_GL_CONTEXTS; ++i) {
+        GLContextRecord *context = &ctx->glContext[i];
+        if (context->handle) {
+            m3gDeleteGLContext(context->handle);
+        }
+        m3gZero(context, sizeof(GLContextRecord));
+    }
+
+    /* Delete references to GLES texture objects from all live Image2D objects. 
+       Texture objects themselves have already been destroyed with the last GL context. */
+
+    m3gInitArray(&image2DObjects);
+    m3gGetObjectsWithClassID(M3G_INTERFACE(ctx), M3G_CLASS_IMAGE, &image2DObjects);
+
+    i = m3gArraySize(&image2DObjects);
+
+    while (i > 0) {
+        Image *image = (Image*)m3gGetArrayElement(&image2DObjects, --i);
+
+        m3gInvalidateImage(image);
+        image->texObject = 0;
+    }
+    m3gDestroyArray(&image2DObjects, M3G_INTERFACE(ctx));
+#endif
+}
+
 
 /*!
  * \internal
--- a/m3g/m3gcore11/src/m3g_sprite.c	Thu Apr 08 12:02:10 2010 +0100
+++ b/m3g/m3gcore11/src/m3g_sprite.c	Thu Apr 08 12:06:20 2010 +0100
@@ -278,7 +278,10 @@
         m3gTransformVec4(projMatrix, &x);
         m3gTransformVec4(projMatrix, &y);
     }
-
+#ifndef M3G_USE_NGL_API
+    /* Store w after projection */
+    eyeSpace->w = ot.w;
+#endif
     m3gScaleVec4(&ot, m3gRcp(ot.w));
     m3gScaleVec4(&x, m3gRcp(x.w));
     m3gScaleVec4(&y, m3gRcp(y.w));
@@ -331,12 +334,12 @@
         x.x = m3gMul(x.x, (M3Gfloat) rIsect.width);
         y.y = m3gMul(y.y, (M3Gfloat) rIsect.height);
     }
-
+#ifdef M3G_USE_NGL_API
     /* Store final Z */
     if (eyeSpace != NULL) {
         eyeSpace->w = ot.z;
     }
-
+#endif
     /* Set up positions */
     vert[0 * 3 + 0] = (M3Gint) m3gMul(65536, m3gSub(ot.x, x.x));
     vert[0 * 3 + 1] = m3gRoundToInt(m3gAdd(m3gMul(65536, m3gAdd(ot.y, y.y)), 0.5f));
@@ -464,7 +467,11 @@
     glMatrixMode(GL_MODELVIEW);
 
     /* Apply fog and compositing mode */
+#ifdef M3G_USE_NGL_API
     m3gApplySpriteFog(sprite->appearance->fog, eyeSpace.z, eyeSpace.w);
+#else
+    m3gApplyFog(sprite->appearance->fog);
+#endif
     m3gApplyCompositingMode(sprite->appearance->compositingMode, ctx);
 
     {
@@ -484,6 +491,32 @@
 
     m3gPushScreenSpace(ctx, M3G_FALSE);
 
+#ifndef M3G_USE_NGL_API
+    /* Transform the sprite vertices (in NDC) back to eye coordinates, so that 
+       the fog distance will be calculated correctly in the OpenGL pipeline. */
+    {
+        GLfloat transform[16];
+        GLfloat scaleW[16] = { 0.f, 0.f, 0.f, 0.f,
+                               0.f, 0.f, 0.f, 0.f,
+                               0.f, 0.f, 0.f, 0.f,
+                               0.f, 0.f, 0.f, 0.f };
+        Matrix invProjMatrix;
+        const Matrix *projMatrix = m3gProjectionMatrix(m3gGetCurrentCamera(ctx));
+
+        m3gMatrixInverse(&invProjMatrix, projMatrix);
+		m3gGetMatrixColumns(&invProjMatrix, transform);
+        
+        glMatrixMode(GL_MODELVIEW);
+        glMultMatrixf(transform);
+        scaleW[0] = scaleW[5] = scaleW[10] = scaleW[15] = eyeSpace.w;
+        glMultMatrixf(scaleW);
+
+        glMatrixMode(GL_PROJECTION);
+        m3gGetMatrixColumns(projMatrix, transform);
+        glLoadMatrixf(transform);
+    }
+#endif
+
     /* Load indices -> draws the sprite */
     M3G_BEGIN_PROFILE(M3G_INTERFACE(ctx), M3G_PROFILE_NGL_DRAW);
     glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
--- a/windowing/windowserver/SERVER/openwfc/panics.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/SERVER/openwfc/panics.h	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2003-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"
@@ -162,6 +162,7 @@
 	EWsPanicInvalidRotation = 127,			//Invalid rotation used
 	EWsPanicInvalidPointerOffset = 128,      //The pointer offset value in wsini.ini is invalid.
 	EWsPanicArrayInsertFailed = 129,	//Array insert failed.           
+	EWsPanicCompleteNullMessage = 130,		//RMessage2 is NULL prior to calling Complete().
 	};
 
 void Panic(TWservPanic aPanic);
--- a/windowing/windowserver/SERVER/w32cmd.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/SERVER/w32cmd.h	Thu Apr 08 12:06:20 2010 +0100
@@ -426,8 +426,11 @@
 	EWsWinOpScreenNumber,
 	EWsWinOpEnableAdvancedPointers,
 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	
-	EWsWinOpSetSurfaceTransparency,
+	EWsWinOpSetSurfaceTransparency=EWsWinOpEnableAdvancedPointers+1, // Explicit offset to prevent clash with EWsWinOpFixNativeOrientation
 #endif
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+	EWsWinOpFixNativeOrientation=EWsWinOpEnableAdvancedPointers+2, // Offset to prevent clash with EWsWinOpSetSurfaceTransparency
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
 	EWsWinOpTestLowPriorityRedraw=0x2000,  //Specific opcode for testing redraw queue priorities
 	};
 
@@ -1915,13 +1918,17 @@
 
 enum TW32Assert	// used for w32 code errors
 	{
-	EW32AssertOddLengthData,
-	EW32AssertNotImplemented,
-	EW32AssertIllegalOpcode,
-	EW32AssertDirectMisuse,
-	EW32AssertBufferLogic,
-	EW32AssertUnexpectedOutOfRangePointerNumber, // Used for an out-of-range pointer number error within the old API's which doesn't take a pointer number.
-	EW32AssertWindowSizeCacheFailure,
+	EW32AssertOddLengthData=0,
+	EW32AssertNotImplemented=1,
+	EW32AssertIllegalOpcode=2,
+	EW32AssertDirectMisuse=3,
+	EW32AssertBufferLogic=4,
+	EW32AssertUnexpectedOutOfRangePointerNumber=5, // Used for an out-of-range pointer number error within the old API's which doesn't take a pointer number.
+	EW32AssertWindowSizeCacheFailure=6,
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+	EW32AssertWindowNativeSizeCacheFailure=7,
+	EW32AssertInvalidOrientation=8,
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
 	};
 
 enum TW32Panic // used for application errors
@@ -2073,6 +2080,9 @@
 	EWservPanicWrongScreen=82,                  // Child apps can only be constructed on the same screen as their parent. See RWindowGroup::ConstructChildApp
 	EWservPanicScreenCaptureInvalidRequest=83,  // With Screen Capture disabled, an unexpected invalid request has been received
 	EWservPanicInvalidDisplayConfiguration=84,  // Use of a display configuration without valid members
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+	EWservPanicFixNativeOrientation=85,         // Invalid use of FixNativeOrientation()
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION	
 	};
 
 #if defined(__WINS__)
--- a/windowing/windowserver/bwins/WS322U.DEF	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/bwins/WS322U.DEF	Thu Apr 08 12:06:20 2010 +0100
@@ -574,4 +574,7 @@
 	?Session@RWindowTreeNode@@QBEPAVRWsSession@@XZ @ 573 NONAME ; class RWsSession * RWindowTreeNode::Session(void) const
 	?HeapSetBurstFail@RWsSession@@QAEXHHH@Z @ 574 NONAME ; void RWsSession::HeapSetBurstFail(int, int, int)
 	?EnableWindowSizeCacheL@RWsSession@@QAEXXZ @ 575 NONAME ; void RWsSession::EnableWindowSizeCacheL(void)
-    ?SetSurfaceTransparency@RWindowBase@@QAEXH@Z @ 576 NONAME ; void RWindowBase::SetSurfaceTransparency(int)
+	?SetSurfaceTransparency@RWindowBase@@QAEXH@Z @ 576 NONAME ; void RWindowBase::SetSurfaceTransparency(int)
+	?SizeForEgl@RWindowBase@@QBE?AVTSize@@XZ @ 577 NONAME ; class TSize RWindowBase::SizeForEgl(void) const
+	?FixNativeOrientation@RWindowBase@@QAEHXZ @ 578 NONAME ; int RWindowBase::FixNativeOrientation(void)
+
--- a/windowing/windowserver/bwins/ws32switchu.def	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/bwins/ws32switchu.def	Thu Apr 08 12:06:20 2010 +0100
@@ -575,3 +575,6 @@
 	call_vector_574 @ 574 NONAME ; void RWsSession::HeapSetBurstFail(int, int, int)
 	call_vector_575 @ 575 NONAME ; void RWsSession::EnableWindowSizeCacheL(void)
 	call_vector_576 @ 576 NONAME ; void RWindowBase::SetSurfaceTransparency(int)
+	call_vector_577 @ 577 NONAME ; class TSize RWindowBase::SizeForEgl(void) const
+	call_vector_578 @ 578 NONAME ; int RWindowBase::FixNativeOrientation(void)
+
--- a/windowing/windowserver/debuglog/DECODER.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/debuglog/DECODER.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -189,10 +189,10 @@
 	switch (aOpcode)
 		{
 	case EWsWinOpReceiveFocus:
-		aText.AppendFormat(_L("ReceiveFocus(%d)"), pData.Bool);
+		aText.AppendFormat(_L("ReceiveFocus(%d)"), *pData.Bool);
 		break;
 	case EWsWinOpAutoForeground:
-		aText.AppendFormat(_L("AutoForeground(%d)"), pData.Bool);
+		aText.AppendFormat(_L("AutoForeground(%d)"), *pData.Bool);
 		break;
 	case EWsWinOpCancelCaptureKey:
 		aText.AppendFormat(_L("CancelCaptureKey(%d)"), *pData.UInt);
@@ -781,6 +781,24 @@
 		aText.AppendFormat(LogCreateGraphic);		
 		}
 		break;
+	case EWsClOpRegisterSurface:
+		{
+		TInt screenNumber = pData.SurfaceRegister->screenNumber;
+		const TSurfaceId& surfaceId = pData.SurfaceRegister->surfaceId;
+		
+		_LIT(LogRegisterSurface,"RegisterSurface(aScreenNumber(%d), TSurfaceId{%x,%x,%x,%x})");
+		aText.AppendFormat(LogRegisterSurface, screenNumber, surfaceId.iInternal[0], surfaceId.iInternal[1], surfaceId.iInternal[2], surfaceId.iInternal[3]);
+		}
+		break;
+	case EWsClOpUnregisterSurface:
+		{
+		TInt screenNumber = pData.SurfaceRegister->screenNumber;
+		const TSurfaceId& surfaceId = pData.SurfaceRegister->surfaceId;
+		
+		_LIT(LogUnregisterSurface,"UnregisterSurface(aScreenNumber(%d), TSurfaceId{%x,%x,%x,%x})");
+		aText.AppendFormat(LogUnregisterSurface, screenNumber, surfaceId.iInternal[0], surfaceId.iInternal[1], surfaceId.iInternal[2], surfaceId.iInternal[3]);
+		}
+		break;
 	case EWsClOpSetCloseProximityThresholds:
 		{
 		_LIT(LogSetCloseProximityThresholds,"SetCloseProximityThresholds(%d, %d)");
@@ -1259,19 +1277,19 @@
 	case EWsWinOpMoveToGroup:
 		{
 		_LIT(LogWinMoveToGroup,"MoveToGroup(%d)");
-		aText.AppendFormat(LogWinMoveToGroup, pData.Int);
+		aText.AppendFormat(LogWinMoveToGroup, *pData.Int);
 		}
 		break;	
 	case EWsWinOpStoreDrawCommands:
 		{
 		_LIT(LogWinStoreDrawCommands,"EnableRedrawStore(%u)");
-		aText.AppendFormat(LogWinStoreDrawCommands, pData.Bool);
+		aText.AppendFormat(LogWinStoreDrawCommands, *pData.Bool);
 		}
 		break;	
 	case EWsWinOpSetPointerCapturePriority:
 		{
 		_LIT(LogWinSetPointerCapturePriority,"SetPointerCapturePriority(%d)");
-		aText.AppendFormat(LogWinSetPointerCapturePriority, pData.Int);
+		aText.AppendFormat(LogWinSetPointerCapturePriority, *pData.Int);
 		}
 		break;	
 	case EWsWinOpGetPointerCapturePriority:
@@ -1289,7 +1307,7 @@
 	case EWsWinOpSetTransparencyPolicy:
 		{
 		_LIT(LogWinSetTransparentPolicy,"SetTransparencyPolicy(TransparencyPolicy= %d)");
-		aText.AppendFormat(LogWinSetTransparentPolicy, pData.Int);
+		aText.AppendFormat(LogWinSetTransparentPolicy, *pData.Int);
 		}
 		break;	
 	case EWsWinOpIsRedrawStoreEnabled:
@@ -1316,6 +1334,72 @@
 		aText.AppendFormat(LogClientHandle);
 		}
 		break;
+    case EWsWinOpSetBackgroundSurface:
+        {
+        _LIT(LogWinSetBackgroundSurface,"SetBackgroundSurface(TSurfaceId{%x,%x,%x,%x})");
+        aText.AppendFormat(LogWinSetBackgroundSurface, pData.Surface->iInternal[0],pData.Surface->iInternal[1],pData.Surface->iInternal[2],pData.Surface->iInternal[3]);
+        }
+        break;
+    case EWsWinOpKeyColor:
+        {
+        _LIT(LogWinKeyColor,"KeyColor()");
+        aText.AppendFormat(LogWinKeyColor);
+        }
+        break;          
+    case EWsWinOpSetBackgroundSurfaceConfig:
+        {        
+        TSurfaceConfiguration aSurfaceConfig = pData.SurfaceConfigurationAndTrigger->surfaceConfig;
+        TSurfaceId surfaceid;
+        aSurfaceConfig.GetSurfaceId(surfaceid);
+        CFbsBitGc::TGraphicsOrientation orientation = aSurfaceConfig.Orientation();
+        TRect extent;
+        aSurfaceConfig.GetExtent(extent);
+        TRect viewport;
+        aSurfaceConfig.GetViewport(viewport);
+        TBool flip = aSurfaceConfig.Flip();
+        TBool triggerRedraw = pData.SurfaceConfigurationAndTrigger->triggerRedraw;
+        
+        TLongBuf extentbuf(TDebugLogTextHandler::FormatRect(extent));
+        TLongBuf viewportbuf(TDebugLogTextHandler::FormatRect(viewport));
+        
+        _LIT(LogWinSetBackgroundSurfaceConfig,"SetBackgroundSurface({%x,%x,%x,%x},%d,%S,%S,%d,%d)");
+        aText.AppendFormat(LogWinSetBackgroundSurfaceConfig, surfaceid.iInternal[0],
+                                                             surfaceid.iInternal[1],
+                                                             surfaceid.iInternal[2],
+                                                             surfaceid.iInternal[3],
+                                                             orientation,
+                                                             &extentbuf, 
+                                                             &viewportbuf,
+                                                             flip,
+                                                             triggerRedraw);
+        }
+        break;
+    case EWsWinOpRemoveBackgroundSurface:
+        {
+        _LIT(LogWinRemoveBackgroundSurface,"RemoveBackgroundSurface(%d)");
+        aText.AppendFormat(LogWinRemoveBackgroundSurface, *(pData.Bool));
+        }
+        break;
+    case EWsWinOpGetBackgroundSurfaceConfig:
+        {
+        _LIT(LogWinGetBackgroundSurfaceConfig,"GetBackgroundSurface()");
+        aText.AppendFormat(LogWinGetBackgroundSurfaceConfig);
+        }
+        break;
+    case EWsWinOpClearRedrawStore:
+        {
+        _LIT(LogWinClearRedrawStore,"ClearRedrawStore()");
+        aText.AppendFormat(LogWinClearRedrawStore);
+        }
+        break;
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    case EWsWinOpFixNativeOrientation:
+        {
+        _LIT(LogWinFixNativeOrientation,"FixNativeOrientation()");
+        aText.AppendFormat(LogWinFixNativeOrientation);        
+        }
+        break;
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION        
 	default:
 		UnKnownOpcode(aText, aOpcode);
 		break;
@@ -1786,7 +1870,7 @@
 		{
 		TShortBuf buf1(TDebugLogTextHandler::FormatPoint(pData.GdiBltMasked->destination));
 		TLongBuf buf2(TDebugLogTextHandler::FormatRect(pData.GdiBltMasked->source));
-		_LIT(LogGcBitBltMasked,"BitBltMasked(%S, {%d}, %S)");
+		_LIT(LogGcBitBltMasked,"BitBltMasked(%S, {%d}, %S, {%d}, %d)");
 		aText.AppendFormat(LogGcBitBltMasked, &buf1, hHandleToValue(pData.GdiBltMasked->handle),
 										&buf2, hHandleToValue(pData.GdiBltMasked->maskHandle),
 										pData.GdiBltMasked->invertMask);
@@ -1859,7 +1943,7 @@
 	case EWsGcOpSetFaded:
 		{
 		_LIT(KLitGcSetFaded, "SetFaded(%d)");
-		aText.AppendFormat(KLitGcSetFaded, pData.Bool);
+		aText.AppendFormat(KLitGcSetFaded, *pData.Bool);
 		}
 		break;
 	case EWsGcOpSetFadeParams:
@@ -1884,7 +1968,7 @@
 	case EWsGcOpSetOpaque:
 		{
 		_LIT(KLitGcOpSetOpaque, "SetOpaque(%d)");
-		aText.AppendFormat(KLitGcOpSetOpaque, pData.Bool);
+		aText.AppendFormat(KLitGcOpSetOpaque, *pData.Bool);
 		}
 		break;
 	default:
@@ -2023,20 +2107,20 @@
 	case EWsSdOpSetScreenMode:
 		{
 		_LIT(LogScreenDeviceSetScreenMode,"ScreenMode(%d)");
-		aText.AppendFormat(LogScreenDeviceSetScreenMode,pData.Int);
+		aText.AppendFormat(LogScreenDeviceSetScreenMode,*pData.Int);
 		}
 		break;
 	case EWsSdOpGetScreenModeSizeAndRotation:
 	case EWsSdOpGetScreenModeSizeAndRotation2:
 		{
 		_LIT(LogScreenDeviceGetScreenModeSizeAndRotation,"GetScreenModeSizeAndRotation(%d)");
-		aText.AppendFormat(LogScreenDeviceGetScreenModeSizeAndRotation,pData.Int);
+		aText.AppendFormat(LogScreenDeviceGetScreenModeSizeAndRotation,*pData.Int);
 		}
 		break;
 	case EWsSdOpSetScreenModeEnforcement:
 		{
 		_LIT(LogScreenDeviceSetScreenModeEnforcement,"SetScreenModeEnforcement(%d)");
-		aText.AppendFormat(LogScreenDeviceSetScreenModeEnforcement,pData.Int);
+		aText.AppendFormat(LogScreenDeviceSetScreenModeEnforcement,*pData.Int);
 		}
 		break;
 	case EWsSdOpScreenModeEnforcement:
@@ -2054,7 +2138,7 @@
 	case EWsSdOpGetRotationList:
 		{
 		_LIT(LogScreenDeviceGetRotationList,"GetRotationList(%d)");
-		aText.AppendFormat(LogScreenDeviceGetRotationList,pData.Int);
+		aText.AppendFormat(LogScreenDeviceGetRotationList,*pData.Int);
 		}
 		break;
 	case EWsSdOpPaletteAttributes:
@@ -2090,13 +2174,13 @@
 	case EWsSdOpGetScreenModeOrigin:
 		{
 		_LIT(LogScreenDeviceGetScreenModeOrigin,"GetScreenModeOrigin(%d)");
-		aText.AppendFormat(LogScreenDeviceGetScreenModeOrigin, pData.Int);
+		aText.AppendFormat(LogScreenDeviceGetScreenModeOrigin, *pData.Int);
 		}	
 		break;
 	case EWsSdOpGetScreenModeScale:
 		{
 		_LIT(LogScreenDeviceGetScreenModeScale,"GetScreenModeScale(%d)");
-		aText.AppendFormat(LogScreenDeviceGetScreenModeScale, pData.Int);
+		aText.AppendFormat(LogScreenDeviceGetScreenModeScale, *pData.Int);
 		}	
 		break;
 	case EWsSdOpGetCurrentScreenModeScale:
@@ -2108,13 +2192,13 @@
 	case EWsSdOpSetAppScreenMode:
 		{
 		_LIT(LogScreenDeviceSetAppScreenMode,"SetAppScreenMode(%d)");
-		aText.AppendFormat(LogScreenDeviceSetAppScreenMode, pData.Int);
+		aText.AppendFormat(LogScreenDeviceSetAppScreenMode, *pData.Int);
 		}	
 		break;		
 	case EWsSdOpGetScreenModeScaledOrigin:
 		{
 		_LIT(LogScreenDeviceGetScreenModeScaledOrigin,"GetScreenModeScaledOrigin(%d)");
-		aText.AppendFormat(LogScreenDeviceGetScreenModeScaledOrigin, pData.Int);
+		aText.AppendFormat(LogScreenDeviceGetScreenModeScaledOrigin, *pData.Int);
 		}	
 		break;		
 	case EWsSdOpGetCurrentScreenModeScaledOrigin:
@@ -2151,13 +2235,13 @@
 	case EWsSdOpGetScreenModeDisplayMode:
 		{
 		_LIT(LogScreenDeviceGetScreenModeDisplayMode,"GetScreenModeDisplayMode(%d)");
-		aText.AppendFormat(LogScreenDeviceGetScreenModeDisplayMode, pData.Int);
+		aText.AppendFormat(LogScreenDeviceGetScreenModeDisplayMode, *pData.Int);
 		}	
 		break;		
 	case EWsClOpSetBackLight:
 		{
 		_LIT(LogScreenDeviceSetBackLight,"SetBackLight(%u)");
-		aText.AppendFormat(LogScreenDeviceSetBackLight, pData.UInt);
+		aText.AppendFormat(LogScreenDeviceSetBackLight, *pData.UInt);
 		}	
 		break;		
 	default:
@@ -2272,7 +2356,7 @@
 	case EWsDirectOpGetRegion:
 		{
 		_LIT(LogDirectGetRegion,"GetRegion(%d)");
-		aText.AppendFormat(LogDirectGetRegion,pData.Int);
+		aText.AppendFormat(LogDirectGetRegion,*pData.Int);
 		}
 		break;
 	case EWsDirectOpCancel:
@@ -2341,13 +2425,13 @@
 	case EWsClickOpSetKeyClick:
 		{			
 		_LIT(LogSetKeyClick,"SetKeyClick(%u)");
-		aText.AppendFormat(LogSetKeyClick, pData.Bool);
+		aText.AppendFormat(LogSetKeyClick, *pData.Bool);
 		}
 		break;
 	case EWsClickOpSetPenClick:
 		{			
 		_LIT(LogSetPenClick,"SetPenClick(%u)");
-		aText.AppendFormat(LogSetPenClick, pData.Bool);
+		aText.AppendFormat(LogSetPenClick, *pData.Bool);
 		}	
 		break;
 	case EWsClickOpKeyClickEnabled:
--- a/windowing/windowserver/debuglog/DebLogRD.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/debuglog/DebLogRD.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -55,7 +55,8 @@
 	buf.Copy(aDes.Mid(pos));
 	buf.Append(' ');
 	buf.Append(aDes2);
-	RDebug::Print(buf);
+	_LIT(KDebugFormatString, "%S");
+	RDebug::Print(KDebugFormatString, &buf);
 	}
 
 void CDebugLogPrint::WriteToLog8L(const TDesC8 &aDes, const TDesC8 &aDes2)
@@ -70,6 +71,7 @@
 	TPtr16 ptr(&buf[bufLen],buf.MaxLength()-bufLen);
 	ptr.Copy(aDes2);
 	buf.SetLength(bufLen+aDes2.Length());
-	RDebug::Print(buf);
+	_LIT(KDebugFormatString, "%S");
+	RDebug::Print(KDebugFormatString, &buf);
 	}
 
--- a/windowing/windowserver/eabi/WS322U.DEF	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/eabi/WS322U.DEF	Thu Apr 08 12:06:20 2010 +0100
@@ -649,4 +649,6 @@
 	_ZN10RWsSession16HeapSetBurstFailEiii @ 648 NONAME
 	_ZN10RWsSession22EnableWindowSizeCacheLEv @ 649 NONAME
 	_ZN11RWindowBase22SetSurfaceTransparencyEi @ 650 NONAME
+	_ZN11RWindowBase20FixNativeOrientationEv @ 651 NONAME
+	_ZNK11RWindowBase10SizeForEglEv @ 652 NONAME
 
--- a/windowing/windowserver/group/DEBLOG.MMP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/group/DEBLOG.MMP	Thu Apr 08 12:06:20 2010 +0100
@@ -24,6 +24,8 @@
 CAPABILITY PowerMgmt ReadDeviceData WriteDeviceData ProtServ
 TARGETTYPE		dll
 
+MACRO       SYMBIAN_GRAPHICS_GCE
+
 SOURCEPATH		../debuglog
 SOURCE			DEBUGLOG.CPP DECODER.CPP TXTHNDLR.CPP
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/group/samplegraphicsurface.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,46 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// samplegraphicsurface.dll Sample CWsGraphics demonstrating PlaceSurface
+// 
+//
+
+/**
+ @file
+*/
+
+TARGET			samplegraphicsurface.dll
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+
+MACRO			SYMBIAN_GRAPHICS_GCE
+
+UID 0x1000008D 0x10285C49
+VENDORID		0x70000001
+
+DEFFILE			samplegraphicsurface.DEF
+
+SOURCEPATH		../nga/samplegraphicsurfacedrawer
+
+
+USERINCLUDE      ../inc
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY			euser.lib
+LIBRARY			wsgraphicdrawer.lib 
+LIBRARY			fbscli.lib ws32.lib estor.lib
+UNPAGED
+
+SOURCE graphicsurface.cpp
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/group/samplegraphicsurfacedrawer.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,47 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// samplegraphicsurfacedrawer.DLL sample Surface-based Graphics ECOM plugins for Window Server
+// 
+//
+
+/**
+ @file
+*/
+
+TARGET		10285c4a.dll //samplegraphicsurfacedrawer.DLL
+TARGETTYPE	PLUGIN //ECOMIIC
+UID			0x10009D8D 0x10285C4A
+CAPABILITY	All -Tcb
+VENDORID	0x70000001
+
+MACRO		SYMBIAN_GRAPHICS_GCE
+
+#ifndef USERINCLUDE_WSGRAPHICDRAWERINTERFACE_H
+macro USERINCLUDE_WSGRAPHICDRAWERINTERFACE_H
+#endif
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY		ecom.lib estor.lib fbscli.lib euser.lib
+LIBRARY		wsgraphicdrawer.lib ws32.lib w32stdgraphic.lib
+
+UNPAGED
+
+SOURCEPATH	../nga/samplegraphicsurfacedrawer
+
+RESOURCE	10285C4A.RSS
+
+SOURCE proxy.cpp graphicsurfacedrawer.CPP
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/group/samplegraphictestsurfacemulti.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,46 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+// samplegraphictestsurfacemulti.dll Sample test crp for surfaces
+// 
+//
+
+/**
+ @file
+*/
+
+TARGET			samplegraphictestsurfacemulti.dll
+CAPABILITY		All -Tcb
+TARGETTYPE		dll
+
+UID 0x1000008D 0x10285E99
+VENDORID		0x70000001
+
+MACRO			SYMBIAN_GRAPHICS_GCE
+
+DEFFILE			samplegraphictestsurfacemulti.DEF
+
+SOURCEPATH		../tgce/samplegraphictestsurfacemultidrawer
+
+USERINCLUDE     ../nga/samplegraphicsurfacedrawer ../inc
+
+OS_LAYER_SYSTEMINCLUDE_SYMBIAN
+
+LIBRARY			euser.lib
+LIBRARY			wsgraphicdrawer.lib 
+LIBRARY			samplegraphicsurface.lib
+LIBRARY			fbscli.lib ws32.lib estor.lib
+UNPAGED
+
+SOURCE graphictestsurfacemulti.cpp
+SMPSAFE
--- a/windowing/windowserver/inc/Graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/inc/Graphics/openwfc/WSGRAPHICDRAWERINTERFACE.H	Thu Apr 08 12:06:20 2010 +0100
@@ -40,6 +40,7 @@
 class MEventHandler;
 class MWsElement;
 class MWsGraphicsContext;
+class MWsAnimationScheduler;
 
 /** 
 @publishedPartner
@@ -134,57 +135,6 @@
 	virtual TBool RedrawInvalid(const TArray<TGraphicDrawerId>& aInvalid) = 0;
 	};
 
-class MWsAnimationScheduler: public MWsObjectProvider
-/** A system mechanism for customising the animation timer to a particular hardware variant or to a
-	particular external compositor e.g. an out-of-scene transition engine.
-	The default animation scheduler in WSERV does not understand device-dependant parameters e.g.
-	screen refresh rates
-	@publishedPartner
-	@released
-	to be adapted when WSERV migrates to surfaces
-*/	{
-public:
-	/** Called to schedule an animation event for a screen to occur not before some point
-	A screen may be scheduled to animate several times without actually receiving an animation event from the scheduler
-	If the scheduler cannot honour the request e.g. device constraints, it ignores the request.
-	@param aScreen the screen to recieve the event
-	@param aWhen the point in time the event need not occur before
-	*/
-	virtual void ScheduleAnimation(MWsScreen& aScreen,const TTime& aWhen) = 0;
-	/** Called if a screen determines that it no longer needs to schedule any animation
-	@param aScreen the screen not needing to receive any animation events
-	*/
-	virtual void UnscheduleAnimation(MWsScreen& aScreen) = 0;
-	/** Called to schedule the redrawing of all screens containing this graphic.
-	The redrawing of affected screens can be deferred by the scheduler.
-	@param aId the ID of the graphic to be redrawn.  The graphic itself need not exist
-		(e.g. it has just been deleted, hence the need to redraw all potentially affected screens). */
-	virtual void Invalidate(const TGraphicDrawerId& aId) = 0;
-	/** Called when the Window Server receives a TRawEvent::EInactive  event, to signal power-saving */
-	virtual void OnInactive() = 0;
-	/** Called when the Window Server receives a TRawEvent::EActive event, to signal screen back on */
-	virtual void OnActive() = 0;
-
-	/** Called to schedule a redraw for a screen which is out of date
-	A screen may be scheduled to redraw several times without actually receiving aredraw event from the scheduler
-	If this request is ignored then the screen will be draw incorrectly untill a such a request is not ignored.
-	@param aScreen the screen to recieve the event
-	@param aWhen the point in time the event need not occur before
-	*/
-	virtual void ScheduleRedraw(MWsScreen& aScreen,const TTime& aWhen) = 0;
-	/** Called to force a previously scheduled redraw for a screen to happen synchronously
-	Used when we are about to loose our ability to perform the redraw correctly.
-	@param aScreen the screen to recieve the event
-	*/
-	virtual void DoRedrawNow(MWsScreen& aScreen) = 0;
-
-protected:
-	IMPORT_C void Animate(MWsScreen& aScreen);
-	IMPORT_C void Animate(MWsScreen& aScreen, TRequestStatus* aFinished);
-	IMPORT_C void Redraw(MWsScreen& aScreen);
-	IMPORT_C TBool RedrawInvalid(MWsScreen& aScreen,const TArray<TGraphicDrawerId>& aInvalid);
-	};
-
 /**
 @publishedPartner
 @prototype
@@ -245,7 +195,7 @@
 	/** Get a particular screen by ordinal
 	@return the screen, or NULL if aIndex is out of bounds */
 	virtual const MWsScreen* Screen(TInt aIndex) const = 0;
-	/** Set the animation scheduler; this can only be done once by custom code
+	/**  Not supported
 	@return success of overriding the default scheduler */
 	virtual TBool SetCustomAnimationScheduler(MWsAnimationScheduler* aScheduler) = 0;
 	/** Query whether a custom animation scheduler has been set
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/inc/Graphics/wsgraphicdrawerinternal.h	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,89 @@
+// Copyright (c) 1994-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 GRAPHICDRAWER_INTERNAL_H
+#define GRAPHICDRAWER_INTERNAL_H
+
+class MWsAnimationScheduler: public MWsObjectProvider
+/** A system mechanism for customising the animation timer to a particular hardware variant or to a
+	particular external compositor e.g. an out-of-scene transition engine.
+	The default animation scheduler in WSERV does not understand device-dependant parameters e.g.
+	screen refresh rates
+	@internalComponent
+	@released
+*/	{
+public:
+	/** Called to schedule an animation event for a screen to occur not before some point
+	A screen may be scheduled to animate several times without actually receiving an animation event from the scheduler
+	If the scheduler cannot honour the request e.g. device constraints, it ignores the request.
+	@param aScreen the screen to recieve the event
+	@param aWhen the point in time the event need not occur before
+	*/
+	virtual void ScheduleAnimation(MWsScreen& aScreen,const TTime& aWhen) = 0;
+	/** Called if a screen determines that it no longer needs to schedule any animation
+	@param aScreen the screen not needing to receive any animation events
+	*/
+	virtual void UnscheduleAnimation(MWsScreen& aScreen) = 0;
+	/** Called to schedule the redrawing of all screens containing this graphic.
+	The redrawing of affected screens can be deferred by the scheduler.
+	@param aId the ID of the graphic to be redrawn.  The graphic itself need not exist
+		(e.g. it has just been deleted, hence the need to redraw all potentially affected screens). */
+	virtual void Invalidate(const TGraphicDrawerId& aId) = 0;
+	/** Called when the Window Server receives a TRawEvent::EInactive  event, to signal power-saving */
+	virtual void OnInactive() = 0;
+	/** Called when the Window Server receives a TRawEvent::EActive event, to signal screen back on */
+	virtual void OnActive() = 0;
+
+	/** Called to schedule a redraw for a screen which is out of date
+	A screen may be scheduled to redraw several times without actually receiving aredraw event from the scheduler
+	If this request is ignored then the screen will be draw incorrectly untill a such a request is not ignored.
+	@param aScreen the screen to recieve the event
+	@param aWhen the point in time the event need not occur before
+	*/
+	virtual void ScheduleRedraw(MWsScreen& aScreen,const TTime& aWhen) = 0;
+	/** Called to force a previously scheduled redraw for a screen to happen immediately.
+	Used when we are about to loose our ability to perform the redraw correctly.
+	@param aScreen the screen to recieve the event
+	*/
+	virtual void DoRedrawNow(MWsScreen& aScreen) = 0;
+	
+	/** Interface to be implemented by callers of the asynchronous overload of 
+	DoRedrawNow, which takes a reference to this interface as argument to be able 
+	to give a callback once the screen update has been completed.
+	*/
+	class MScreenUpdateObserver 
+		{
+	public:
+		/** Callback when an asynchronous DoRedrawNow has been completed. */
+		virtual void ScreenUpdateComplete(TInt aResult) = 0;
+		};
+	
+	/** Called to force a previously scheduled redraw for a screen to happen immediately. 
+	@param aScreen the screen to recieve the event
+	@param aObserver reference which will receive a notification when the screen has been updated
+	*/
+	virtual void DoRedrawNow(MWsScreen& aScreen, MScreenUpdateObserver& aObserver) = 0;
+	
+	/** Callback to use if aObserver gets deleted before screen update takes place. */
+	virtual void ClearScreenUpdateObserver(const MScreenUpdateObserver& aObserver) = 0;
+
+protected:
+	IMPORT_C void Animate(MWsScreen& aScreen);
+	IMPORT_C void Animate(MWsScreen& aScreen, TRequestStatus* aFinished);
+	IMPORT_C void Redraw(MWsScreen& aScreen);
+	IMPORT_C TBool RedrawInvalid(MWsScreen& aScreen,const TArray<TGraphicDrawerId>& aInvalid);
+	};
+	
+#endif
\ No newline at end of file
--- a/windowing/windowserver/inc/W32STD.H	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/inc/W32STD.H	Thu Apr 08 12:06:20 2010 +0100
@@ -1230,7 +1230,15 @@
     void RefreshWindowSizeCache(const TSize& aNewSize) const;
     TInt CachedWindowSize(TSize& aSize) const;
     void DestroyWindowSizeCacheEntry();
-	
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+	void EnableWindowNativeSizeCacheL();
+	TBool WindowNativeSizeCacheEnabled() const;
+	TInt SetWindowNativeSize(const TSize& aNativeSize) const;
+	TInt WindowNativeSize(TSize& aSize) const;
+	void DestroyWindowNativeSizeCacheEntry();
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+
 protected:
 	TInt32 iWsHandle;	/**< WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
 	RWsBuffer *iBuffer;	/**< WARNING: Member variable for internal use ONLY. Compatibility is not guaranteed in future releases. Please access using the provided get/set APIs only. */
@@ -1712,6 +1720,8 @@
 	IMPORT_C void SetSurfaceTransparency(TBool aSurfaceTransparency);
 	IMPORT_C TRgb KeyColor() const;
 	IMPORT_C void EnableAdvancedPointers();
+	IMPORT_C TInt FixNativeOrientation();
+	IMPORT_C TSize SizeForEgl() const;
 protected:
 	TInt construct(const RWindowTreeNode &parent,TUint32 aHandle, TInt aType, TDisplayMode aDisplayMode);
 	};
--- a/windowing/windowserver/inc/WSGRAPHICDRAWERARRAY.H	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/inc/WSGRAPHICDRAWERARRAY.H	Thu Apr 08 12:06:20 2010 +0100
@@ -29,7 +29,7 @@
 */	{
 public:
 	//Placeholder for transacion record
-	class XRollBackBase;
+	struct XRollBackBase;
 	
 	//transactional manipulation methods that are deprecated because they leak 
 	IMPORT_C void AddLC(CWsGraphicDrawer* aDrawer);
--- a/windowing/windowserver/minigui/group/bld.inf	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/minigui/group/bld.inf	Thu Apr 08 12:06:20 2010 +0100
@@ -19,4 +19,6 @@
 PRJ_EXPORTS
 econs_wserv.iby  	  			/epoc32/rom/include/econs_wserv.iby
 minigui.oby						/epoc32/rom/include/minigui.oby
-wsini_minigui.ini				z:/
\ No newline at end of file
+wsini_minigui.ini				z:/
+minigui-stripped.oby  /epoc32/rom/include/minigui-stripped.oby
+wsini_minigui-stripped.ini				z:/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/minigui/group/minigui-stripped.oby	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* iwanj@users.sourceforge.net - modified to make it work for Symbian^3.
+* MattD <mattd@symbian.org> - renamed file and target to minigui-stripped so we can have both present and build seperate roms. 
+* Description:
+* This OBY File is used to build miniGUI ROM Images.
+*/
+ 
+#ifndef __MINIGUI_OBY__
+#define __MINIGUI_OBY__
+ 
+define OBEYFILE minigui-stripped
+define ROMDATE	##TODAY##
+ 
+#define _ARMV5
+#define SYMBIAN_BASE_USE_GCE
+#define SYMBIAN_EXCLUDE_SCDV
+ 
+// Kernel
+//
+#include <header.iby>
+#include <base.iby>
+ 
+// NGA stack
+//
+#define SYMBIAN_GRAPHICS_USE_GCE
+#define SYMBIAN_GRAPHICS_USE_OPENWF
+#define OPENWFCLIB_DRV <openwfc_ref.iby>
+#define EGL_DRV <egl_ref.iby>
+ 
+#include <gdi.iby>
+#include <bitgdi.iby>
+#include <fntstore.iby>
+#include <fbserv.iby>
+#include <iculayoutengine.iby>
+#include <freetype.iby>
+#include <directgdi.iby>
+#include <wserv.iby>
+#include <econs_wserv.iby>
+#include <surfaceupdate.iby>
+#include <surfacemanager.iby>
+file=\epoc32\release\ARMV5\urel\_generic_scdv.dll	sys\bin\scdv.dll
+ 
+data=DATAZ_\wsini_minigui-stripped.ini	\system\data\wsini.ini
+ 
+// miniGUI shell
+//
+#include <eshell.iby>
+ 
+// And the hell breaks loose :)
+// Let's just add bare minimum items enough to get graphics stack up and running
+// wserv wants ecom
+// libwfc wants openenv
+// freetype wants stdlib
+// openenv backend wants esock etc etc
+//
+#include <bafl.iby>
+#include <ecom.iby>
+#include <store.iby>
+#include <stdlib.iby>
+#include <openenv.iby>
+ 
+#include <c32.iby>
+#include <ecuart.iby>
+#include <irda.iby>
+#include <bluetooth.iby>
+#include <inetprotutil.iby>
+#include <network.iby>	
+#include <dial.iby>
+#include <crypto.iby>
+#include <certman.iby>
+#include <logeng.iby>
+#include <filetokens.iby>
+#include <asnpkcs.iby>
+#include <emime.iby>
+#include <scs.iby>
+ 
+file=\epoc32\release\ARMV5\urel\abclient.dll 				sys\bin\abclient.dll
+file=\epoc32\release\ARMV5\urel\Http.dll 					sys\bin\http.dll
+file=\epoc32\release\ARMV5\urel\Httputils.dll 				sys\bin\httputils.dll
+file=\epoc32\release\ARMV5\urel\securitymanager.dll 		sys\bin\securitymanager.dll
+file=\epoc32\release\ARMV5\urel\ocspsupportclient.dll 		sys\bin\ocspsupportclient.dll
+file=\epoc32\release\ARMV5\urel\siscontroller.dll 			sys\bin\siscontroller.dll
+file=\epoc32\release\ARMV5\urel\devinfosupportclient.dll	sys\bin\devinfosupportclient.dll 
+file=\epoc32\release\ARMV5\urel\uissclient.dll 				sys\bin\uissclient.dll
+file=\epoc32\release\ARMV5\urel\devinfosupportcommon.dll 	sys\bin\devinfosupportcommon.dll
+file=\epoc32\release\ARMV5\urel\ipcstream.dll 				sys\bin\ipcstream.dll
+//file=\epoc32\release\ARMV5\urel\usbcsc_bil.dll 				sys\bin\usbcsc_bil.dll 
+ 
+#endif /* __MINIGUI_OBY__ */
\ No newline at end of file
Binary file windowing/windowserver/minigui/group/wsini_minigui-stripped.ini has changed
--- a/windowing/windowserver/nga/CLIENT/CLIENT.H	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/CLIENT/CLIENT.H	Thu Apr 08 12:06:20 2010 +0100
@@ -84,6 +84,13 @@
 	inline void RefreshWindowSizeCache(TInt aHandle, const TSize& aNewSize);
 	inline TInt CachedWindowSize(TInt aHandle, TSize& aSize);
 	inline void DestroyWindowSizeCacheEntry(TInt aHandle);	
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+	void EnableWindowNativeSizeCacheL();
+	inline TBool WindowNativeSizeCacheEnabled() const;
+	inline TInt SetWindowNativeSize(TInt aHandle, const TSize& aNativeSize);
+	inline TInt WindowNativeSize(TInt aHandle, TSize& aSize);
+	inline void DestroyWindowNativeSizeCacheEntry(TInt aHandle);
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
     
 private:
 	TInt DoWrite(TInt aHandle, TUint aOpcode, TBool aFlush, const TIpcArgs* aIpcArgs, const TAny* aData1=NULL, TInt aLength1=0, const TAny* aData2=NULL, TInt aLength2=0);
@@ -116,6 +123,9 @@
 	    };
 	
 	RHashMap<TInt, TWindowSizeCacheEntry>* iWindowSizeCache;
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+	RHashMap<TInt, TWindowSizeCacheEntry>* iWindowNativeSizeCache;
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
 	};
 
 
@@ -185,5 +195,45 @@
     __ASSERT_DEBUG(err == KErrNone || err == KErrNotFound, Assert(EW32AssertWindowSizeCacheFailure));
     }
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+inline TBool RWsBuffer::WindowNativeSizeCacheEnabled() const
+    {
+    return iWindowNativeSizeCache ? ETrue : EFalse;
+    }
+
+inline TInt RWsBuffer::SetWindowNativeSize(TInt aHandle, const TSize& aNativeSize)
+    {
+    __ASSERT_ALWAYS(iWindowNativeSizeCache != NULL, Assert(EW32AssertWindowNativeSizeCacheFailure));
+    RWsBuffer::TWindowSizeCacheEntry* entry = iWindowNativeSizeCache->Find(aHandle);
+	__ASSERT_ALWAYS(!entry, Assert(EW32AssertWindowNativeSizeCacheFailure));
+    return iWindowNativeSizeCache->Insert(aHandle, RWsBuffer::TWindowSizeCacheEntry(aNativeSize));
+    }
+
+inline TInt RWsBuffer::WindowNativeSize(TInt aHandle, TSize& aSize)
+    {
+    __ASSERT_ALWAYS(iWindowNativeSizeCache != NULL, Assert(EW32AssertWindowNativeSizeCacheFailure));
+    RWsBuffer::TWindowSizeCacheEntry* entry = iWindowNativeSizeCache->Find(aHandle);
+    if (entry)
+        {
+        aSize = entry->iSize;
+        return KErrNone;
+        }
+    else
+        {
+        return KErrNotFound;
+        }
+    }
+
+inline void RWsBuffer::DestroyWindowNativeSizeCacheEntry(TInt aHandle)
+    {
+    __ASSERT_ALWAYS(iWindowNativeSizeCache != NULL, Assert(EW32AssertWindowNativeSizeCacheFailure));
+    TInt err = iWindowNativeSizeCache->Remove(aHandle);
+    // If there is a window size cache entry, then err == KErrNone.
+    // Otherwise, there isn't a size cache entry, and err == KErrNotFound.
+    __ASSERT_DEBUG(err == KErrNone || err == KErrNotFound, Assert(EW32AssertWindowNativeSizeCacheFailure));
+    }
+
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+
 
 #endif
--- a/windowing/windowserver/nga/CLIENT/MWSCLI.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/CLIENT/MWSCLI.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -142,3 +142,31 @@
     {
     iBuffer->DestroyWindowSizeCacheEntry(iWsHandle);
     }
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+void MWsClientClass::EnableWindowNativeSizeCacheL()
+    {
+    return iBuffer->EnableWindowNativeSizeCacheL();
+    }
+
+TBool MWsClientClass::WindowNativeSizeCacheEnabled() const
+    {
+    return iBuffer->WindowNativeSizeCacheEnabled();
+    }
+
+TInt MWsClientClass::SetWindowNativeSize(const TSize& aNativeSize) const
+    {
+    return iBuffer->SetWindowNativeSize(iWsHandle,aNativeSize);
+    }
+
+TInt MWsClientClass::WindowNativeSize(TSize& aSize) const
+    {
+    return iBuffer->WindowNativeSize(iWsHandle, aSize);
+    }
+
+void MWsClientClass::DestroyWindowNativeSizeCacheEntry()
+    {
+    iBuffer->DestroyWindowNativeSizeCacheEntry(iWsHandle);
+    }
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+
--- a/windowing/windowserver/nga/CLIENT/RBUFFER.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/CLIENT/RBUFFER.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -44,6 +44,9 @@
 	#endif
 	iBuf(NULL,0,0), iNext(NULL), iPreviousHandle(0), iBufSize(0), iMaxBufSize(EMinBufferSize),
 	iDirectAcessCount(0), iInvalidBitmapArray(EFalse), iWindowSizeCache(NULL)
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+, iWindowNativeSizeCache(NULL)
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
 	{
 	}
 
@@ -100,6 +103,14 @@
 	    delete iWindowSizeCache;
 	    iWindowSizeCache = NULL;
 	    }
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+	if (iWindowNativeSizeCache)
+	    {
+	    iWindowNativeSizeCache->Close();
+	    delete iWindowNativeSizeCache;
+	    iWindowNativeSizeCache = NULL;
+	    }
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
 	}
 
 void RWsBuffer::Destroy()
@@ -463,3 +474,14 @@
         iWindowSizeCache = new (ELeave) RHashMap<TInt, TWindowSizeCacheEntry>();        
         }
     }
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+void RWsBuffer::EnableWindowNativeSizeCacheL()
+    {
+    if (iWindowNativeSizeCache == NULL)
+        {
+        iWindowNativeSizeCache = new (ELeave) RHashMap<TInt, TWindowSizeCacheEntry>();        
+        }
+    }
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+
--- a/windowing/windowserver/nga/CLIENT/RSCRDEV.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/CLIENT/RSCRDEV.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -254,6 +254,11 @@
 	TInt64 twips=aTwips;
 	TSize displaySizeInPixels = DisplaySizeInPixels();
 	TSize physicalScreenSizeInTwips = PhysicalScreenSizeInTwips();
+	if (displaySizeInPixels.iWidth <= 0 ||
+	        physicalScreenSizeInTwips.iWidth <= 0)
+	    {
+        return 0;
+	    }
 	twips=(twips*displaySizeInPixels.iWidth+(physicalScreenSizeInTwips.iWidth/2))/physicalScreenSizeInTwips.iWidth;
 	return I64INT(twips);
 	}
@@ -267,6 +272,11 @@
 	TInt64 twips=aTwips;
 	TSize displaySizeInPixels = DisplaySizeInPixels();
 	TSize physicalScreenSizeInTwips = PhysicalScreenSizeInTwips();
+   if (displaySizeInPixels.iHeight <= 0 ||
+            physicalScreenSizeInTwips.iHeight <= 0)
+        {
+        return 0;
+        }
 	twips=(twips*displaySizeInPixels.iHeight+(physicalScreenSizeInTwips.iHeight/2))/physicalScreenSizeInTwips.iHeight;
 	return I64INT(twips);
 	}
@@ -280,6 +290,11 @@
 	TInt64 pixels=aPixels;
 	TSize displaySizeInPixels = DisplaySizeInPixels();
 	TSize physicalScreenSizeInTwips = PhysicalScreenSizeInTwips();
+   if (displaySizeInPixels.iWidth <= 0 ||
+            physicalScreenSizeInTwips.iWidth <= 0)
+        {
+        return 0;
+        }
 	pixels=(pixels*physicalScreenSizeInTwips.iWidth+(displaySizeInPixels.iWidth/2))/displaySizeInPixels.iWidth;
 	return I64INT(pixels);
 	}
@@ -294,6 +309,11 @@
 	TInt64 pixels=aPixels;
 	TSize displaySizeInPixels = DisplaySizeInPixels();
 	TSize physicalScreenSizeInTwips = PhysicalScreenSizeInTwips();
+   if (displaySizeInPixels.iHeight <= 0 ||
+            physicalScreenSizeInTwips.iHeight <= 0)
+        {
+        return 0;
+        }
 	pixels=(pixels*physicalScreenSizeInTwips.iHeight+(displaySizeInPixels.iHeight/2))/displaySizeInPixels.iHeight;
 	return I64INT(pixels);
 	}
--- a/windowing/windowserver/nga/CLIENT/RWINDOW.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/CLIENT/RWINDOW.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -170,6 +170,12 @@
 	         {
 	         DestroyWindowSizeCacheEntry();
 	         }
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+	    if (WindowNativeSizeCacheEnabled())
+	         {
+	         DestroyWindowNativeSizeCacheEntry();
+	         }
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
         Write(EWsWinOpFree);
 	    }
 	iWsHandle=NULL;
@@ -840,6 +846,31 @@
         }
 	}
 
+EXPORT_C TSize RWindowBase::SizeForEgl() const
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+/**
+@internalAll
+Disclaimer - this API is internal and is subject to change
+@prototype */
+	{
+	TSize size;
+	if (WindowNativeSizeCacheEnabled() && WindowNativeSize(size) == KErrNone)
+		{
+		return size;
+		}
+	else
+		{
+		return Size();
+		}
+	}
+#else
+    {
+    // API should not be used if macro undefined.
+    ASSERT(0);
+    return TSize();
+    }
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+
 EXPORT_C void RWindowBase::SetPosition(const TPoint &aPos)
 /** Sets the position of a window relative to its parent. 
 
@@ -1379,6 +1410,48 @@
 	Write(EWsWinOpEnableAdvancedPointers);
 	}
 
+/**
+@internalAll
+Disclaimer - this API is internal and is subject to change
+@prototype */
+EXPORT_C TInt RWindowBase::FixNativeOrientation()
+#if !defined(SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION) || defined (SYMBIAN_GRAPHICS_BUILD_OPENWF_WSERV) || defined (__WINS__) 
+    {
+    return KErrNotSupported;
+    }
+#else
+	{
+    TInt err = KErrNone;
+	if (!WindowNativeSizeCacheEnabled())
+		{
+		TRAP(err, EnableWindowNativeSizeCacheL());
+		if (err != KErrNone)
+		    {
+            return err;
+		    }
+		}
+	
+	const CFbsBitGc::TGraphicsOrientation orientation = static_cast<CFbsBitGc::TGraphicsOrientation>(WriteReply(EWsWinOpFixNativeOrientation));
+	switch (orientation)
+		{
+	case CFbsBitGc::EGraphicsOrientationNormal:
+    case CFbsBitGc::EGraphicsOrientationRotated180:
+		err = SetWindowNativeSize(Size());
+        break;
+	case CFbsBitGc::EGraphicsOrientationRotated90 :
+    case CFbsBitGc::EGraphicsOrientationRotated270:
+        {
+	    TSize size = Size();
+	    err = SetWindowNativeSize(TSize(size.iHeight, size.iWidth));
+        }
+		break;
+	default:
+	    Assert(EW32AssertInvalidOrientation);
+		}
+	return err;
+	}
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+
 EXPORT_C TInt RWindowBase::AllocPointerMoveBuffer(TInt aMaxNumPoints, TUint aFlags)
 /** Allocates a buffer for storing pointer movements. 
 
--- a/windowing/windowserver/nga/CLIENT/RWS.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/CLIENT/RWS.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -2308,9 +2308,11 @@
 	}
 	
 EXPORT_C void RWsSession::ClearAllRedrawStores()
-/** Clear the redraw store for all windows in the system
-By default Windows will recorded the drawing commands used during a redraw and use them latter if the window needs to be redrawn.
-Calling this function will cause all these stores to be thrown away redraw will then be sent to all window, visible windows will recieve them first.
+/** Clear the redraw store for all windows in the system.
+By default Windows will record the drawing commands used during a redraw and re-use them later if the window needs to be redrawn.
+Calling this function will cause all these server-side stores to be thrown away, redraw requests will then be sent to all client-side windows. Visible windows will receive them first.
+
+In most cases you should be using RWindow::ClearRedrawStore instead of this function. 
 
 This function always causes a flush of the window server buffer.*/
 	{
--- a/windowing/windowserver/nga/SERVER/EVENT.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/EVENT.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -32,6 +32,7 @@
 #include "pointer.h"
 #include "debugbar.h"
 #include "advancedpointereventhelper.h"
+#include "Graphics/wsgraphicdrawerinternal.h"
 
 GLREF_D CDebugLogBase *wsDebugLog;
 
--- a/windowing/windowserver/nga/SERVER/POINTER.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/POINTER.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -54,6 +54,9 @@
 CCirBuf<TPoint>*   CWsPointerBuffer::iPointerBuffer=NULL;
 TSglQue<CWsPointerBuffer> CWsPointerBuffer::iList(_FOFF(CWsPointerBuffer,iQue));
 TInt                TWsPointer::iYOffset;
+#if defined(__WINS__)
+TBool               TWsPointer::iEmulatorRotatePointerCoords;
+#endif
 
 static _LIT_SECURITY_POLICY_C1(KSecurityPolicy_SwEvent,ECapabilitySwEvent);
 
@@ -70,7 +73,14 @@
        {
        iYOffset = 0;
        }
-	
+
+#if defined(__WINS__)    
+	//An emulator may or may not deploy a renderchain or displaydriver that supports rotated drawing.
+	//On a real device target the coordinate system is always rotated together with wserv's screendevice.
+	_LIT( KWSERVIniFileVarEmulatorRotPointCoords, "EMULATOR_ROTATE_POINTER_COORDS");
+	iEmulatorRotatePointerCoords = WsIniFile->FindVar(KWSERVIniFileVarEmulatorRotPointCoords);
+#endif
+
 	iRootWindow = CWsTop::Screen()->RootWindow();
 	
 	TMachineInfoV1Buf machineInfo;
@@ -679,23 +689,17 @@
 			}
 		else
 			{
-			CScreen* screen=iRootWindow->Screen();
 	#if !defined(__WINS__)
-			TSize screenSize=screen->SizeInPixels()-TSize(1,1);		//This is in the current rotation
-			switch (screen->Orientation())
+			TranslateCoordsOnRotation(xy);
+	#else
+			if(iEmulatorRotatePointerCoords)
 				{
-				case CFbsBitGc::EGraphicsOrientationRotated90:
-					xy.SetXY(xy.iY,screenSize.iHeight-xy.iX);
-					break;
-				case CFbsBitGc::EGraphicsOrientationRotated180:
-					xy=-(xy-screenSize);
-					break;
-				case CFbsBitGc::EGraphicsOrientationRotated270:
-					xy.SetXY(screenSize.iWidth-xy.iY,xy.iX);
-					break;
-				default:;		//To stop warning
+				//emulators that support rotated drawing and touch may want to enable 
+				//rotation of pointer events in wsini.
+				TranslateCoordsOnRotation(xy);
 				}
 	#endif
+			CScreen* screen=iRootWindow->Screen();
 			ShiftYCoordinate(xy.iY);
 			// Move the raw event position by shifting it by Origin and scale
 			xy=screen->PhysicalToLogical(xy);
@@ -707,6 +711,25 @@
 	return ETrue;
 	}
 
+void TWsPointer::TranslateCoordsOnRotation(TPoint& aPoint)
+	{
+	CScreen* screen=iRootWindow->Screen();
+	TSize screenSize=screen->SizeInPixels()-TSize(1,1);     //This is in the current rotation
+	switch (screen->Orientation())
+		{
+		case CFbsBitGc::EGraphicsOrientationRotated90:
+			aPoint.SetXY(aPoint.iY,screenSize.iHeight-aPoint.iX);
+			break;
+		case CFbsBitGc::EGraphicsOrientationRotated180:
+			aPoint=-(aPoint-screenSize);
+			break;
+		case CFbsBitGc::EGraphicsOrientationRotated270:
+			aPoint.SetXY(screenSize.iWidth-aPoint.iY,aPoint.iX);
+			break;
+		default:;       //To stop warning
+		}
+	}
+
 /**
  * Validates events sent to the Window Server by its Client (Anim or Window Group).
  * May overwrite aRawEvent's Z coordinate and/or pointer number if Client or digitizer driver
--- a/windowing/windowserver/nga/SERVER/SERVER.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/SERVER.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -19,7 +19,6 @@
 #include "panics.h"
 #include "wstop.h"
 #include "EVENT.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include <bitdraw.h>
 #include <hal.h>
 #include "inifile.h"
@@ -107,6 +106,8 @@
 	void OnActive();
 	void ScheduleRedraw(MWsScreen& aScreen,const TTime& aWhen);
 	void DoRedrawNow(MWsScreen& aScreen);
+	void DoRedrawNow(MWsScreen& aScreen, MWsAnimationScheduler::MScreenUpdateObserver& aObserver);
+	void ClearScreenUpdateObserver(const MWsAnimationScheduler::MScreenUpdateObserver& aObserver);
 private:
 	static TBool OnIdleCallBack(TAny* aAny);
 	void ScheduleUpdate (TInt aScreenNumber, TBool aForce);
@@ -142,6 +143,8 @@
 	~CScreenState();
 	void SetActive ();
 	
+	void WaitForRedraws(MWsAnimationScheduler::MScreenUpdateObserver& aObserver, TInt aNumRedraws);
+	void ClearScreenUpdateObserver(const MWsAnimationScheduler::MScreenUpdateObserver& aObserver);
 	CPeriodic* iUpdateOn;
 	TTime      iExpectedTickTime;
 	TScreenUpdateDetails iScreenUpdateDetails;
@@ -151,6 +154,8 @@
 private:
 	CScreenState (CDefaultAnimationScheduler* aScheduler, TInt aScreenOrdinal);
 	void ConstructL ();
+	void ReleaseRemainingClients();
+	void ReleaseClientsWaitingFor(TUint aCurrentFrame);
 	
 	void RunL();
 	void DoCancel() 
@@ -158,6 +163,18 @@
 		TRequestStatus* tmpTRS = &iStatus;
 		User::RequestComplete(tmpTRS, KErrNone);
 		};
+	class TWaitingClient
+		{
+	public:
+		TWaitingClient(MWsAnimationScheduler::MScreenUpdateObserver& aObserver, TInt aTargetFrame)
+			: iObserver(aObserver), iTargetFrame(aTargetFrame)
+			{
+			}
+		MWsAnimationScheduler::MScreenUpdateObserver& iObserver;
+		TUint iTargetFrame;
+		};
+	TUint iFrameCount;
+	RArray<TWaitingClient> iWaitingClients;
 	};
 
 // If using the default animation scheduler on a device, these two numbers may be worth tweaking in the inifile
@@ -275,6 +292,7 @@
 void CWindowServer::CDefaultAnimationScheduler::CScreenState::ConstructL ()
 	{
 	iUpdateOn = CPeriodic::NewL(EComposeCompletePriority);
+	iWaitingClients.ReserveL(8);
 	CActiveScheduler::Add(this);
 	}
 
@@ -283,19 +301,91 @@
 	CActive::Cancel();
 	iInvalidated.Close();
 	delete iUpdateOn;
+	TInt i = iWaitingClients.Count();
+	while(i--)
+		{
+		iWaitingClients[i].iObserver.ScreenUpdateComplete(KErrAbort);
+		}
+	iWaitingClients.Close();
 	}
 
 void CWindowServer::CDefaultAnimationScheduler::CScreenState::SetActive()
 	{
 	CActive::SetActive ();
 	}
-	
+
+/**
+This function is called from CWsClient d'tor to make sure we will not hang on to any deleted objects. 
+*/
+void CWindowServer::CDefaultAnimationScheduler::CScreenState::ClearScreenUpdateObserver(const MWsAnimationScheduler::MScreenUpdateObserver& aObserver)
+	{
+	const TInt count = iWaitingClients.Count();
+	for(TInt i = count-1 ; i >= 0; i--)
+		{
+		if( &aObserver == &(iWaitingClients[i].iObserver) )
+			{
+			TWaitingClient& client = iWaitingClients[i];
+			client.iObserver.ScreenUpdateComplete(KErrCancel);
+			iWaitingClients.Remove(i);
+			}
+		}
+	}
+
+void CWindowServer::CDefaultAnimationScheduler::CScreenState::WaitForRedraws(MWsAnimationScheduler::MScreenUpdateObserver& aObserver, TInt aNumRedraws)
+	{
+	const TUint targetFrame = iFrameCount + aNumRedraws;
+	TWaitingClient request(aObserver, targetFrame);
+	TInt err = iWaitingClients.Append(request);
+	if(err != KErrNone)
+		{
+		//If OOM and already have 8 waiting clients we will not accept a 9th client
+		aObserver.ScreenUpdateComplete(KErrNoMemory);
+		}
+	}
+
+void CWindowServer::CDefaultAnimationScheduler::CScreenState::ReleaseRemainingClients()
+	{
+	const TInt count = iWaitingClients.Count();
+	for(TInt i = count-1; i >= 0; i--)
+		{
+		TWaitingClient& client = iWaitingClients[i];
+		client.iObserver.ScreenUpdateComplete(KErrNone);
+		iWaitingClients.Remove(i);
+		}
+	}
+
+void CWindowServer::CDefaultAnimationScheduler::CScreenState::ReleaseClientsWaitingFor(TUint aCurrentFrame)
+	{
+	const TInt count = iWaitingClients.Count();
+	for(TInt i = count-1; i >= 0; i--)
+		{
+		TWaitingClient& client = iWaitingClients[i];
+		if(aCurrentFrame >= client.iTargetFrame)
+			{
+			client.iObserver.ScreenUpdateComplete(KErrNone);
+			iWaitingClients.Remove(i);
+			}
+		}
+	}
+
 /** 
-Invoked when the rendering pipline signals that it is ready to recieve updated.
+Invoked when the rendering pipline signals that it is ready to recieve updates.
 */
 void CWindowServer::CDefaultAnimationScheduler::CScreenState::RunL() 
 	{
+	iFrameCount++;
+	
+	//Complete any clients waiting for this frame
+	ReleaseClientsWaitingFor(iFrameCount);
+	
 	iScreenUpdateDetails.iScheduler->ProcessUpdateCompletion (iScreenUpdateDetails.iScreenNumber);
+	
+	if(!IsActive())
+		{
+		//No further pending frames, release all remaining clients
+		ReleaseRemainingClients();
+		}
+	
 	}
 
 void CWindowServer::CDefaultAnimationScheduler::ProcessUpdateCompletion (TInt aScreenNumber)
@@ -310,6 +400,49 @@
 	ScheduleUpdate (aScreenNumber, ETrue);
 	}
 
+void CWindowServer::CDefaultAnimationScheduler::DoRedrawNow(MWsScreen& aScreen, MWsAnimationScheduler::MScreenUpdateObserver& aObserver)
+	{
+	TInt screenNumber = ScreenNumber (aScreen);
+	TInt redrawCount = 0;
+	
+	// redrawCount is the number of times we should wait for redraws to complete.
+	// If a redraw is not currently active then we need to wait (at most) once: for
+	// any outstanding scheduled update to complete.
+	// If a redraw is currently active then we need to wait (at most) twice: once for
+	// the current update to complete, and once for any outstanding scheduled update to complete.   
+	if (!iScreenState[screenNumber]->IsActive())
+		{
+		// No animation in progress, so force a redraw of due updates.
+		ScheduleUpdate(screenNumber, ETrue);
+
+		// If there is still nothing drawing, set redrawCount to zero to make sure we do not wait.
+		if (!iScreenState[screenNumber]->IsActive())
+			{
+			redrawCount = 0;
+			aObserver.ScreenUpdateComplete(KErrNone);
+			}
+		else
+			{
+			redrawCount = 1;
+			iScreenState[screenNumber]->WaitForRedraws(aObserver, redrawCount);
+			}
+		}
+	else
+		{
+		redrawCount = 2;
+		iScreenState[screenNumber]->WaitForRedraws(aObserver, redrawCount);
+		}
+	}
+
+void CWindowServer::CDefaultAnimationScheduler::ClearScreenUpdateObserver(const MWsAnimationScheduler::MScreenUpdateObserver& aObserver)
+	{
+	const TInt count = iScreenState.Count();
+	for(TInt screenNumber=0; screenNumber<count; screenNumber++) 
+		{
+		iScreenState[screenNumber]->ClearScreenUpdateObserver(aObserver);
+		}
+	}
+
 /**
 Switch to deactivate animation or drawing (based on setting of iInactivityBehaviour).
 See InvokeDueAnimation().
@@ -366,7 +499,7 @@
 	{	
 	TInt screenNumber = ScreenNumber (aScreen);
 	TInt redrawCount = 0;
-		
+	
 	// redrawCount is the number of times we should wait for redraws to complete.
 	// If a redraw is not currently active then we need to wait (at most) once: for
 	// any outstanding scheduled update to complete.
@@ -735,8 +868,7 @@
 	iDrawerMasterIndex.Close();
 	
 	delete iDefaultAnimationScheduler;
-	iDefaultAnimationScheduler = NULL; //might be called from clients during server destruction
-	iCustomAnimationScheduler = NULL; // not owned	
+	iDefaultAnimationScheduler = NULL; //might be called from clients during server destruction	
 	}
 	
 void CWindowServer::ConstructL()
@@ -799,37 +931,23 @@
 /**
 Custom Animation Scheduler
 */
-TBool CWindowServer::SetCustomAnimationScheduler(MWsAnimationScheduler* aScheduler)
+TBool CWindowServer::SetCustomAnimationScheduler(MWsAnimationScheduler* /*aScheduler*/)
 	{
-	if(!iCustomAnimationScheduler && aScheduler)
-		{
-		iCustomAnimationScheduler = aScheduler;
-		return ETrue;
-		}
 	return EFalse;
 	}
 
 TBool CWindowServer::HasCustomAnimationScheduler() const
 	{
-	return !!iCustomAnimationScheduler;
+	return EFalse;
 	}
 
-TBool CWindowServer::ClearCustomAnimationScheduler(MWsAnimationScheduler* aCurrentScheduler)
+TBool CWindowServer::ClearCustomAnimationScheduler(MWsAnimationScheduler* /*aCurrentScheduler*/)
 	{
-	if(iCustomAnimationScheduler && (iCustomAnimationScheduler == aCurrentScheduler))
-		{
-		iCustomAnimationScheduler = NULL;
-		return ETrue;
-		}
 	return EFalse;
 	}
 	
 MWsAnimationScheduler* CWindowServer::AnimationScheduler()
 	{
-	if(iCustomAnimationScheduler)
-		{
-		return iCustomAnimationScheduler;
-		}
 	return iDefaultAnimationScheduler;
 	}
 
--- a/windowing/windowserver/nga/SERVER/ScrDev.H	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/ScrDev.H	Thu Apr 08 12:06:20 2010 +0100
@@ -88,11 +88,16 @@
 	inline TDisplayMode DefaultDisplayMode();
 	TUint ClientDevicePointer();
 	void TestScreenCaptureL(const TAny* aMessage);
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+	TSize AppScreenSizeInPixels()const;
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
 private:
 	void CopyScreenToBitmapL(const TRect &aRect, TInt aHandle);
 	void SetScreenDeviceValidStates(const DWsScreenDevice *aDevice);
 	void PanicCurrentClient(TClientPanic aPanic);
+#ifndef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
 	TSize AppScreenSizeInPixels()const;
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
 	TSize AppScreenSizeInTwips()const;
 
 	// Implementing MWsTestScreenCaptureUtils
--- a/windowing/windowserver/nga/SERVER/openwfc/CLIENT.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/openwfc/CLIENT.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1994-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"
@@ -1844,23 +1844,28 @@
 
 void CWsClient::CompleteMessage(const RMessage2& aMessage,TInt aReason)
 	{
-	WS_ASSERT_DEBUG(!aMessage.IsNull(),EWsPanicPanicFlagError);
-	if (iInternalFlags&EPanicClientAsSoonAsPossible)
+	WS_ASSERT_DEBUG(!aMessage.IsNull(),EWsPanicCompleteNullMessage);
+	// This defensive check should not be necessary as aMessage should never
+	// be null, but in rare situations it is and WServ would die without this check.
+	if (!aMessage.IsNull())
 		{
-		aMessage.Panic(KWSERVSessionPanicCategory,iPanicReason);
-		iInternalFlags&=~EPanicClientAsSoonAsPossible;
-		}
-	else
-		{
-		if(!iResponseHandle)
-			aMessage.Complete(aReason);
+		if (iInternalFlags&EPanicClientAsSoonAsPossible)
+			{
+			aMessage.Panic(KWSERVSessionPanicCategory,iPanicReason);
+			iInternalFlags&=~EPanicClientAsSoonAsPossible;
+			}
 		else
 			{
-			aMessage.Complete(*iResponseHandle);
-			iResponseHandle=NULL;
+			if(!iResponseHandle)
+				aMessage.Complete(aReason);
+			else
+				{
+				aMessage.Complete(*iResponseHandle);
+				iResponseHandle=NULL;
+				}
 			}
 		}
-	}
+    }
 
 void CWsClient::ServiceError(const RMessage2& /*aMessage*/,TInt aError)
 	{
--- a/windowing/windowserver/nga/SERVER/openwfc/ScreenRedraw.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/openwfc/ScreenRedraw.h	Thu Apr 08 12:06:20 2010 +0100
@@ -24,6 +24,7 @@
 #include "wstypes.h"
 #include "tcursor.h"
 #include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "Graphics/wsgraphicdrawerinternal.h"
 
 class CScreen;
 class CWsRenderStage;
--- a/windowing/windowserver/nga/SERVER/openwfc/server.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/openwfc/server.h	Thu Apr 08 12:06:20 2010 +0100
@@ -28,6 +28,7 @@
 #include "CLIENT.H"
 #include "ScrDev.H"
 #include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "Graphics/wsgraphicdrawerinternal.h"
 #include "WSGRAPHICDRAWERARRAY.H"
 #include "panics.h"
 
--- a/windowing/windowserver/nga/SERVER/openwfc/wnredraw.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/openwfc/wnredraw.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -252,13 +252,18 @@
 
 	for (CWsSpriteBase * sprite = iWsWin->iSpriteList; sprite; sprite = sprite->Next())
 		{
+        TBool hasRedrawBegun = EFalse;
 		STACK_REGION redrawRegion;
 		sprite->CalcRedrawRegion(aRegion, redrawRegion);
 		if(redrawRegion.CheckError() || !redrawRegion.IsEmpty())
 			{
 			if (sprite->IsFlashingEnabled() || sprite->IsDirty() || sprite->HasAnimation())
 				{
-				AnnotateSpriteRedrawStart(*iWsWin, *sprite, redrawRegion);
+                if (sprite->IsDirty() || sprite->HasAnimation())
+                    {
+                    AnnotateSpriteRedrawStart(*iWsWin, *sprite, redrawRegion);
+                    hasRedrawBegun = ETrue;
+                    }
 				
 				if(sprite->HasAnimation())
 					{
@@ -276,10 +281,16 @@
 					}
 				
 				//...call Redraw on the sprite
-				aGc->Reset();
+				if (hasRedrawBegun)
+				    {
+                    aGc->Reset();
+				    }
 				sprite->Redraw(aGc, redrawRegion);
 				
-				AnnotateSpriteRedrawEnd(*iWsWin, *sprite);
+				if (hasRedrawBegun)
+				    {
+                    AnnotateSpriteRedrawEnd(*iWsWin, *sprite);
+				    }
 				}
 			}
 		redrawRegion.Close();
--- a/windowing/windowserver/nga/SERVER/pointer.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/pointer.h	Thu Apr 08 12:06:20 2010 +0100
@@ -66,6 +66,7 @@
 #else
 	static TBool PreProcessDriverEvent(TRawEvent &aRawEvent);
 #endif
+	static void TranslateCoordsOnRotation(TPoint& aPoint);
 	static TBool PreProcessClientEvent(TRawEvent &aRawEvent, TBool aAdvancedPointersEnabled);
 	static TBool IsPointerEventType(TRawEvent::TType aType);
 	static void ProcessWsEvent(TWsEvent& aEvent,const CWsWindowGroup* aForceInGroup,TBool aNatural);	
@@ -229,6 +230,11 @@
 	
 	/** Used to offset the y pointer */
 	static TInt iYOffset;
+	
+#if defined(__WINS__)
+	/** Tell whether to rotate pointer coords in _WINS_ builds */
+	static TBool iEmulatorRotatePointerCoords;
+#endif
 	};
 
 class CWsPointerBuffer : public CBase
--- a/windowing/windowserver/nga/SERVER/renderstagemanager.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/SERVER/renderstagemanager.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -78,7 +78,9 @@
 
 	if (!pluginMgr)
 		{
+#if _DEBUG
 		RDebug::Printf("ConstructRenderStageChain: Failed to obtain Plugin Manager at File: %s, Line: %d\n", __FILE__, __LINE__);
+#endif
 		return NULL;
 		}
 
@@ -103,7 +105,9 @@
 					TRAP(err, stage = factory->CreateFinalRenderStageL(aScreen, aScreenRedraw, aScreenNumber));
 					if (err)
 						{
+#if _DEBUG
 						RDebug::Printf("ConstructRenderStageChain: Create final renderstage error at File: %s, Line: %d Error Code: %d\n", __FILE__, __LINE__, err);
+#endif
 						}
 					}
 				else
@@ -112,7 +116,9 @@
 					TRAP(err, stage = factory->CreateRenderStageL(aScreen, aScreenRedraw, savedStage));
 					if (err)
 						{
+#if _DEBUG
 						RDebug::Printf("ConstructRenderStageChain: Create renderstage error at File: %s, Line: %d Error Code: %d\n", __FILE__, __LINE__, err);
+#endif
 						}
 					}
 				
--- a/windowing/windowserver/nga/graphicdrawer/graphicdrawerenvironment.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nga/graphicdrawer/graphicdrawerenvironment.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -15,6 +15,7 @@
 
 #include "Graphics/WSGRAPHICDRAWER.H"
 #include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "Graphics/wsgraphicdrawerinternal.h"
 
 // TGraphicDrawerId \\\\\\\\\\\\\\\\\\\\\\\\
 
--- a/windowing/windowserver/nonnga/CLIENT/RWINDOW.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nonnga/CLIENT/RWINDOW.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -813,6 +813,14 @@
 	return(sizePkg());
 	}
 
+EXPORT_C TSize RWindowBase::SizeForEgl() const
+/** Dummy implementation in order to preserve compatibility with WSERV NGA.
+    @internalComponent */ 
+	{
+	ASSERT(0);
+	return TSize();
+	}
+
 EXPORT_C void RWindowBase::SetPosition(const TPoint &aPos)
 /** Sets the position of a window relative to its parent. 
 
@@ -1237,6 +1245,14 @@
 	ASSERT(0);	
 	}
 
+EXPORT_C TInt RWindowBase::FixNativeOrientation()
+/** Dummy implementation in order to preserve compatibility with WSERV NGA.
+    @internalComponent */ 
+	{
+	ASSERT(0);
+	return KErrNotSupported;	
+	}
+
 EXPORT_C TInt RWindowBase::AllocPointerMoveBuffer(TInt aMaxNumPoints, TUint aFlags)
 /** Allocates a buffer for storing pointer movements. 
 
--- a/windowing/windowserver/nonnga/SERVER/EVENT.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nonnga/SERVER/EVENT.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -32,6 +32,8 @@
 #include "pointer.h"
 #include "debugbar.h"
 #include "wstraces.h"
+#include "Graphics/wsgraphicdrawerinternal.h"
+
 
 GLREF_D CDebugLogBase *wsDebugLog;
 
--- a/windowing/windowserver/nonnga/SERVER/SERVER.CPP	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nonnga/SERVER/SERVER.CPP	Thu Apr 08 12:06:20 2010 +0100
@@ -19,7 +19,6 @@
 #include "panics.h"
 #include "wstop.h"
 #include "EVENT.H"
-#include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
 #include <bitdraw.h>
 #include <hal.h>
 #include "inifile.h"
@@ -82,6 +81,8 @@
 	void OnActive();
 	void ScheduleRedraw(MWsScreen& aScreen,const TTime& aWhen);
 	void DoRedrawNow(MWsScreen& aScreen);
+	void DoRedrawNow(MWsScreen& aScreen, MWsAnimationScheduler::MScreenUpdateObserver& aObserver);
+	void ClearScreenUpdateObserver(const MWsAnimationScheduler::MScreenUpdateObserver& /*aObserver*/) {}
 	TInt RemoveGraphicDrawer(const TGraphicDrawerId &aId);
 	
 private:
@@ -326,6 +327,12 @@
 	OnIdleCallBack(ETrue);
 	}
 	
+void CWindowServer::CDefaultAnimationScheduler::DoRedrawNow(MWsScreen& /*aScreen*/, MWsAnimationScheduler::MScreenUpdateObserver& aObserver)
+	{
+	OnIdleCallBack(ETrue);
+	aObserver.ScreenUpdateComplete(KErrNone);
+	}	
+	
 void CWindowServer::CDefaultAnimationScheduler::ScheduleAnimation(MWsScreen& aScreen,const TTime& aWhen)
 	{
 	TSchedule schedule;
@@ -646,7 +653,6 @@
 	
 	delete iDefaultAnimationScheduler;
 	iDefaultAnimationScheduler = NULL; // might be called from clients during server destruction
-	iCustomAnimationScheduler = NULL; // not owned
 	delete iPluginManager;
 	}
 	
@@ -714,37 +720,23 @@
 /**
 Custom Animation Scheduler
 */
-TBool CWindowServer::SetCustomAnimationScheduler(MWsAnimationScheduler* aScheduler)
+TBool CWindowServer::SetCustomAnimationScheduler(MWsAnimationScheduler* /*aScheduler*/)
 	{
-	if(!iCustomAnimationScheduler && aScheduler)
-		{
-		iCustomAnimationScheduler = aScheduler;
-		return ETrue;
-		}
 	return EFalse;
 	}
 
 TBool CWindowServer::HasCustomAnimationScheduler() const
 	{
-	return !!iCustomAnimationScheduler;
+	return EFalse;
 	}
 
-TBool CWindowServer::ClearCustomAnimationScheduler(MWsAnimationScheduler* aCurrentScheduler)
+TBool CWindowServer::ClearCustomAnimationScheduler(MWsAnimationScheduler* /*aCurrentScheduler*/)
 	{
-	if(iCustomAnimationScheduler && (iCustomAnimationScheduler == aCurrentScheduler))
-		{
-		iCustomAnimationScheduler = NULL;
-		return ETrue;
-		}
 	return EFalse;
 	}
 	
 MWsAnimationScheduler* CWindowServer::AnimationScheduler()
 	{
-	if(iCustomAnimationScheduler)
-		{
-		return iCustomAnimationScheduler;
-		}
 	return iDefaultAnimationScheduler;
 	}
 
--- a/windowing/windowserver/nonnga/SERVER/ScreenRedraw.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nonnga/SERVER/ScreenRedraw.h	Thu Apr 08 12:06:20 2010 +0100
@@ -23,6 +23,7 @@
 #include <gdi.h>
 #include "wstypes.h"
 #include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "Graphics/wsgraphicdrawerinternal.h"
 
 class CScreen;
 class CWsRenderStage;
--- a/windowing/windowserver/nonnga/SERVER/server.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nonnga/SERVER/server.h	Thu Apr 08 12:06:20 2010 +0100
@@ -28,6 +28,7 @@
 #include "CLIENT.H"
 #include "ScrDev.H"
 #include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "Graphics/wsgraphicdrawerinternal.h"
 #include "WSGRAPHICDRAWERARRAY.H"
 #include "panics.h"
 
@@ -372,7 +373,6 @@
 private:
 	class CDefaultAnimationScheduler;
 	CDefaultAnimationScheduler* iDefaultAnimationScheduler;
-	MWsAnimationScheduler* iCustomAnimationScheduler;
 	CWsPluginManager* iPluginManager;
 	RPointerArray<MWsMemoryRelease> iMemoryReleases;
 	/** An index to all the CWsGraphicDrawer objects.
--- a/windowing/windowserver/nonnga/graphicdrawer/graphicdrawerenvironment.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/nonnga/graphicdrawer/graphicdrawerenvironment.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -15,6 +15,7 @@
 
 #include "Graphics/WSGRAPHICDRAWER.H"
 #include <Graphics/WSGRAPHICDRAWERINTERFACE.H>
+#include "Graphics/wsgraphicdrawerinternal.h"
 
 // TGraphicDrawerId \\\\\\\\\\\\\\\\\\\\\\\\
 
--- a/windowing/windowserver/tauto/twindowsizecache.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/tauto/twindowsizecache.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -33,7 +33,6 @@
 void CTWindowSizeCacheTest::ConstructL()
     {}
 
-
 void CTWindowSizeCacheTest::TestCreateRWindowL(TSizeCacheStatus aEnableWindowSizeCache)
     {
     __UHEAP_MARK;
@@ -579,7 +578,12 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
-    
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
+
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -624,11 +628,21 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
-    
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
+
     // w1 State 1
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size1);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size1);
+#endif
+
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -670,7 +684,12 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
-    
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
+
     // w1 State 1
     // Only the first call to EnableWindowSizeCacheL() should have an effect
     // All subsequent calls to EnableWindowSizeCacheL() should have no effect
@@ -717,6 +736,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 1
     // Only the first call to EnableWindowSizeCacheL() should have an effect
@@ -727,6 +751,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size1);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size1);
+#endif
+
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -771,6 +800,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -821,6 +855,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TPoint point2 (20202,223);
@@ -872,6 +911,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -922,6 +966,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TPoint point2 (20202,223);
@@ -973,6 +1022,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1027,6 +1081,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1082,6 +1141,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1136,6 +1200,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1188,6 +1257,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1242,6 +1316,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1252,6 +1331,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size2);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size2);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1296,6 +1380,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TPoint point2 (20202,223);
@@ -1307,6 +1396,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size2);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size2);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1351,6 +1445,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1361,6 +1460,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size2);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size2);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1405,6 +1509,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TPoint point2 (20202,223);
@@ -1416,6 +1525,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size2);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size2);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1460,6 +1574,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1474,6 +1593,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size3);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size3);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1518,6 +1642,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1533,6 +1662,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size3);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size3);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1577,6 +1711,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1591,6 +1730,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size3);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size3);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1635,6 +1779,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1650,6 +1799,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size3);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size3);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1691,6 +1845,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1704,6 +1863,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size2);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size2);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1752,6 +1916,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1767,6 +1936,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size3);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size3);
+#endif
+    
     // w1 State 2
     TSize size4 (40004,423);
     w1.SetSize(size4);
@@ -1775,6 +1949,11 @@
     TSize retSize3 = w1.Size();
     TEST(retSize3 == size4);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl3 = w1.SizeForEgl();
+    TEST(retSizeForEgl3 == size4);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1823,6 +2002,11 @@
     // w1 State 1
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
     
     // w1 State 2
     TSize size2 (20002,223);
@@ -1839,6 +2023,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size3);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size3);
+#endif
+    
     // w1 State 2
     TSize size4 (40004,423);
     err = w1.SetSizeErr(size4);
@@ -1848,6 +2037,11 @@
     TSize retSize3 = w1.Size();
     TEST(retSize3 == size4);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl3 = w1.SizeForEgl();
+    TEST(retSizeForEgl3 == size4);    
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
@@ -1901,6 +2095,11 @@
         // w1 State 1
         TSize retSize1 = w1.Size();
         TEST(retSize1 == size1);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+        TSize retSizeForEgl1 = w1.SizeForEgl();
+        TEST(retSizeForEgl1 == size1);  
+#endif
         }
     end.UniversalTime();
 
@@ -1989,6 +2188,11 @@
             {
             TSize retSize1 = aWindow.Size();
             TEST(retSize1 == aExpectedSize);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+            TSize retSizeForEgl1 = aWindow.SizeForEgl();
+            TEST(retSizeForEgl1 == aExpectedSize);      
+#endif
             }
             break;
         case EFlushSession :
@@ -2138,6 +2342,11 @@
         rws1_expectedSizePool.AppendL(expectedSize);
         TSize retSize1 = win->Size();
         TEST(retSize1 == expectedSize);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+        TSize retSizeForEgl1 = win->SizeForEgl();
+        TEST(retSizeForEgl1 == expectedSize);     
+#endif
         }
 
     // Windows for session 2 belonging to rws2_wg1
@@ -2158,6 +2367,11 @@
         rws2_expectedSizePool.AppendL(expectedSize);
         TSize retSize1 = win->Size();
         TEST(retSize1 == expectedSize);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+        TSize retSizeForEgl1 = win->SizeForEgl();
+        TEST(retSizeForEgl1 == expectedSize);  
+#endif
         }
     
     // Windows for session 2 belonging to rws2_wg2
@@ -2180,6 +2394,11 @@
         rws2_expectedSizePool.AppendL(expectedSize);
         TSize retSize1 = win->Size();
         TEST(retSize1 == expectedSize);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+        TSize retSizeForEgl1 = win->SizeForEgl();
+        TEST(retSizeForEgl1 == expectedSize);    
+#endif
         }
 
     // Stress system by performing actions on windows
@@ -2265,6 +2484,11 @@
         expectedSizePool.AppendL(expectedSize);
         TSize retSize1 = win->Size();
         TEST(retSize1 == expectedSize);
+
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+        TSize retSizeForEgl1 = win->SizeForEgl();
+        TEST(retSizeForEgl1 == expectedSize);     
+#endif
         }
 
     // Stress system by performing actions on windows
@@ -2320,6 +2544,11 @@
     TSize retSize1 = w1.Size();
     TEST(retSize1 == size1);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl1 = w1.SizeForEgl();
+    TEST(retSizeForEgl1 == size1);
+#endif
+    
     // w1 State 2
     TSize size2 (20002,223);
     w1.SetSize(size2); 
@@ -2336,6 +2565,11 @@
     TSize retSize2 = w1.Size();
     TEST(retSize2 == size2);
 
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+    TSize retSizeForEgl2 = w1.SizeForEgl();
+    TEST(retSizeForEgl2 == size2);
+#endif
+    
     // w1 State Final
     CleanupStack::Pop();
     w1.Close();
Binary file windowing/windowserver/tcsc/resources/wsini_csc_nga.ini has changed
Binary file windowing/windowserver/tcsc/resources/wsini_csc_nga_changetracking.ini has changed
Binary file windowing/windowserver/tcsc/resources/wsini_csc_nga_h6.ini has changed
Binary file windowing/windowserver/tcsc/resources/wsini_csc_nga_naviengine.ini has changed
Binary file windowing/windowserver/tcsc/resources/wsini_csc_nga_qvga.ini has changed
Binary file windowing/windowserver/tcsc/resources/wsini_csc_nga_qvga_changetracking.ini has changed
Binary file windowing/windowserver/tcsc/resources/wsini_csc_nga_vga.ini has changed
Binary file windowing/windowserver/tcsc/resources/wsini_csc_nga_vga_changetracking.ini has changed
--- a/windowing/windowserver/test/scripts/wstest_config.cmd	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/test/scripts/wstest_config.cmd	Thu Apr 08 12:06:20 2010 +0100
@@ -2,7 +2,7 @@
 rem Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
 rem All rights reserved.
 rem This component and the accompanying materials are made available
-rem under the terms of "Eclipse Public License v1.0"
+rem under the terms of the License "Eclipse Public License v1.0"
 rem which accompanies this distribution, and is available
 rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
 rem
@@ -17,12 +17,11 @@
 rem
 set nonnga=false
 if not defined EPOC_INI set EPOC_INI=\epoc32\data\epoc.ini
-if /i "%1"=="uninstall" goto :uninstall
-if /i "%2"=="changetracking" goto :install_changetracking
 if /i "%2"=="nonnga" set nonnga=true
 if /i "%3"=="nonnga" set nonnga=true
 if "%nonnga%"=="true" echo Configuring for Non-NGA
-
+if /i "%1"=="uninstall" goto :uninstall
+if /i "%2"=="changetracking" goto :install_changetracking
 rem ================ install ================
 
 :install
@@ -34,36 +33,22 @@
 	call :doinstall %EMULATOR_DATA_DIR% multiscreen %2 %3
 )
 
-rem Restore EPOC.INI from backup
-if exist %EPOC_INI%.backup xcopy /r /y %EPOC_INI%.backup %EPOC_INI% >nul
+echo If EPOC.INI isn't already backuped then backup EPOC.INI to EPOC.INI.bak
+if not exist %EPOC_INI%.bak copy /y %EPOC_INI% %EPOC_INI%.bak
 
-echo Backing up EPOC.INI.
-if not exist %EPOC_INI%.backup copy %EPOC_INI% %EPOC_INI%.backup >nul
-
-echo --------------------------------------------------------------
-echo original epoc.ini: %EPOC_INI%
-type %EPOC_INI%
-echo --------------------------------------------------------------
 echo Editing EPOC.INI to use multiscreen.
 echo. >> %EPOC_INI%
 echo StartupMode ^7>> %EPOC_INI%
 echo _NewScreen_ >> %EPOC_INI%
 echo ScreenWidth 640 >> %EPOC_INI%
 echo ScreenHeight 240 >> %EPOC_INI%
-
-echo --------------------------------------------------------------
-echo new epoc.ini: %EPOC_INI%
-type %EPOC_INI%
-echo --------------------------------------------------------------
-
 goto :EOF
 
 
-
 :doinstall
-rem Back up WSINI.INI
-if not exist %1\z\system\data\wsini.bak if exist %1\z\system\data\wsini.ini copy %1\z\system\data\wsini.ini %1\z\system\data\wsini.bak >nul
-if not exist %1\z\resource\data\wsini.bak if exist %1\z\resource\data\wsini.ini copy %1\z\resource\data\wsini.ini %1\z\resource\data\wsini.bak >nul
+rem If WSINI.INI(s) aren't already backuped then backup WSINI.INI(s)
+if not exist %1\z\system\data\wsini.bak   if exist %1\z\system\data\wsini.ini   copy /y %1\z\system\data\wsini.ini   %1\z\system\data\wsini.bak >nul
+if not exist %1\z\resource\data\wsini.bak if exist %1\z\resource\data\wsini.ini copy /y %1\z\resource\data\wsini.ini %1\z\resource\data\wsini.bak >nul
 
 rem Back up ECONS.DLL
 if exist %1\econs.dll copy /y %1\econs.dll %1\econs-temp.dll
@@ -73,24 +58,21 @@
 
 rem Replace WSINI.INI with test version
 if "%nonnga%"=="true" goto :doinstall_nonnga
-if exist %1\z\system\data\wsini.ini xcopy /r /y %1\z\wstest\wservu_multiscreen.ini %1\z\system\data\wsini.ini >nul
-if exist %1\z\resource\data\wsini.ini xcopy /r /y %1\z\wstest\wservu_multiscreen.ini %1\z\resource\data\wsini.ini >nul
+if exist %1\z\system\data\wsini.ini   copy /y %1\z\wstest\wservu_multiscreen.ini %1\z\system\data\wsini.ini
+if exist %1\z\resource\data\wsini.ini copy /y %1\z\wstest\wservu_multiscreen.ini %1\z\resource\data\wsini.ini
 goto :doinstall_editwsini
 
 :doinstall_nonnga
-if exist %1\z\system\data\wsini.ini xcopy /r /y \graphics\wserv\group\wservu_multiscreen-nonnga.ini %1\z\system\data\wsini.ini >nul
-if exist %1\z\resource\data\wsini.ini xcopy /r /y \graphics\wserv\group\wservu_multiscreen-nonnga.ini %1\z\resource\data\wsini.ini >nul
+if exist %1\z\system\data\wsini.ini   copy /y %1\z\wstest\wservu_multiscreen-nonnga.ini %1\z\system\data\wsini.ini
+if exist %1\z\resource\data\wsini.ini copy /y %1\z\wstest\wservu_multiscreen-nonnga.ini %1\z\resource\data\wsini.ini
 
 :doinstall_editwsini
 rem Edit WSINI.INI to run tests automatically/multiscreen
-if exist %1\z\system\data\wsini.ini perl %1\z\wstest\wsini-writer.pl %1\z\system\data\wsini.ini %2 %3 %4
+if exist %1\z\system\data\wsini.ini   perl %1\z\wstest\wsini-writer.pl %1\z\system\data\wsini.ini %2 %3 %4
 if exist %1\z\resource\data\wsini.ini perl %1\z\wstest\wsini-writer.pl %1\z\resource\data\wsini.ini %2 %3 %4
 
 goto :EOF
 
-
-
-
 rem ================ install changetracking ================
 
 :install_changetracking
@@ -102,16 +84,8 @@
 	call :doinstall_changetracking %EMULATOR_DATA_DIR% multiscreen %2 %3
 )
 
-rem Restore EPOC.INI from backup
-if exist %EPOC_INI%.backup xcopy /r /y %EPOC_INI%.backup %EPOC_INI% >nul
-
-echo Backing up EPOC.INI.
-if not exist %EPOC_INI%.backup copy %EPOC_INI% %EPOC_INI%.backup >nul
-
-echo --------------------------------------------------------------
-echo original epoc.ini: %EPOC_INI%
-type %EPOC_INI%
-echo --------------------------------------------------------------
+echo If EPOC.INI isn't already backuped then backup EPOC.INI to EPOC.INI.bak
+if not exist %EPOC_INI%.bak copy /y %EPOC_INI% %EPOC_INI%.bak >nul
 
 echo Editing EPOC.INI to use multiscreen.
 echo. >> %EPOC_INI%
@@ -119,11 +93,6 @@
 echo _NewScreen_ >> %EPOC_INI%
 echo ScreenWidth 640 >> %EPOC_INI%
 echo ScreenHeight 240 >> %EPOC_INI%
-echo --------------------------------------------------------------
-echo new epoc.ini: %EPOC_INI%
-type %EPOC_INI%
-echo --------------------------------------------------------------
-
 goto :EOF
 
 :doinstall_changetracking
@@ -135,12 +104,12 @@
 if exist %1\wsecons.dll copy /y %1\wsecons.dll %1\econs.dll
 
 rem Back up WSINI.INI
-if not exist %1\z\system\data\wsini.bak if exist %1\z\system\data\wsini.ini copy %1\z\system\data\wsini.ini %1\z\system\data\wsini.bak >nul
-if not exist %1\z\resource\data\wsini.bak if exist %1\z\resource\data\wsini.ini copy %1\z\resource\data\wsini.ini %1\z\resource\data\wsini.bak >nul
+if not exist %1\z\system\data\wsini.bak   if exist %1\z\system\data\wsini.ini   copy /y %1\z\system\data\wsini.ini %1\z\system\data\wsini.bak >nul
+if not exist %1\z\resource\data\wsini.bak if exist %1\z\resource\data\wsini.ini copy /y %1\z\resource\data\wsini.ini %1\z\resource\data\wsini.bak >nul
 
 rem Replace WSINI.INI with test changetracking version
-if exist %1\z\system\data\wsini.ini xcopy /r /y %1\z\wstest\wservu_multiscreen_changetracking.ini %1\z\system\data\wsini.ini >nul
-if exist %1\z\resource\data\wsini.ini xcopy /r /y %1\z\wstest\wservu_multiscreen_changetracking.ini %1\z\resource\data\wsini.ini >nul
+if exist %1\z\system\data\wsini.ini   copy /y %1\z\wstest\wservu_multiscreen_changetracking.ini %1\z\system\data\wsini.ini >nul
+if exist %1\z\resource\data\wsini.ini copy /y %1\z\wstest\wservu_multiscreen_changetracking.ini %1\z\resource\data\wsini.ini >nul
 
 rem Edit WSINI.INI to run tests automatically/multiscreen
 if exist %1\z\system\data\wsini.ini perl %1\z\wstest\wsini-writer.pl %1\z\system\data\wsini.ini %2 %3 %4
@@ -159,15 +128,27 @@
 	call :douninstall %EMULATOR_DATA_DIR%
 )
 
-echo Restoring EPOC.INI.
-if exist %EPOC_INI%.backup xcopy /r /y %EPOC_INI%.backup %EPOC_INI% >nul
+echo If EPOC.INI was already backuped then restore EPOC.INI from EPOC.INI.bak
+if exist %EPOC_INI%.bak (
+	echo Restore EPOC.INI from backup
+	copy /y %EPOC_INI%.bak %EPOC_INI% >nul
+	del /f /q %EPOC_INI%.bak >nul
+)
 goto :EOF
 
 
 :douninstall
-rem Restore WSINI.INI
-if exist %1\z\system\data\wsini.bak   xcopy /r /y %1\z\system\data\wsini.bak   %1\z\system\data\wsini.ini >nul
-if exist %1\z\resource\data\wsini.bak xcopy /r /y %1\z\resource\data\wsini.bak %1\z\resource\data\wsini.ini >nul
+
+rem If WSINI.INI(s) were already backuped then restore WSINI.INI
+if exist %1\z\system\data\wsini.bak (
+copy /y %1\z\system\data\wsini.bak   %1\z\system\data\wsini.ini >nul
+del  /f /q %1\z\system\data\wsini.bak >nul
+)
+if exist %1\z\resource\data\wsini.bak (
+copy /y %1\z\resource\data\wsini.bak %1\z\resource\data\wsini.ini >nul
+del  /f /q %1\z\resource\data\wsini.bak >nul
+)
+
 echo Restoring backedup ECONS.DLL
 if exist %1\econs-temp.dll copy /y %1\econs-temp.dll %1\econs.dll
 goto :EOF
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/t_nativeorientation/data/ini/graphics-wserv-nativeorientation.ini	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,23 @@
+[default]
+testId = 0
+[graphics-wserv-0733]
+testId = 733
+[graphics-wserv-0734]
+testId = 734
+[graphics-wserv-0735]
+testId = 735
+[graphics-wserv-0736]
+testId = 736
+[graphics-wserv-0737]
+testId = 737
+[graphics-wserv-0738]
+testId = 738
+[graphics-wserv-0739]
+testId = 739
+[graphics-wserv-0740]
+testId = 740
+[graphics-wserv-0741]
+testId = 741
+[graphics-wserv-0742]
+testId = 742
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/t_nativeorientation/group/bld.inf	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,27 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+//@file
+//@test
+//@internalComponent
+
+PRJ_TESTEXPORTS
+../rom/t_nativeorientation.iby					/epoc32/rom/include/t_nativeorientation.iby
+
+../scripts/graphics-wserv-nativeorientation-test.script	z:/wstest/tnativeorientation/graphics-wserv-nativeorientation-test.script
+../data/ini/graphics-wserv-nativeorientation.ini	z:/wstest/tnativeorientation/graphics-wserv-nativeorientation.ini
+
+PRJ_TESTMMPFILES
+t_nativeorientationserver.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/t_nativeorientation/group/t_nativeorientationserver.mmp	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,44 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+@file
+@test
+@internalComponent
+*/
+
+TARGET			t_nativeorientationserver.exe
+TARGETTYPE		exe
+UID				0x1000007A 0xA000E629
+VENDORID		0x70000001
+
+SOURCEPATH		../src
+SOURCE			t_nativeorientationserver.cpp
+SOURCE			t_nativeorientationtest.cpp
+
+USERINCLUDE		../inc
+
+OS_LAYER_SYSTEMINCLUDE
+
+LIBRARY			euser.lib
+LIBRARY			testexecuteutils.lib
+LIBRARY			testexecutelogclient.lib
+LIBRARY			efsrv.lib
+LIBRARY			ws32.lib
+LIBRARY			surfacemanager.lib
+LIBRARY			surfaceupdateclient.lib
+LIBRARY			gdi.lib
+
+SMPSAFE
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/t_nativeorientation/inc/t_nativeorientationserver.h	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,40 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+@file
+@test
+@internalComponent
+*/
+
+#ifndef __T_NATIVEORIENTATION_SERVER_H__
+#define __T_NATIVEORIENTATION_SERVER_H__
+
+#include <test/testexecuteserverbase.h>
+
+// Entry point
+GLDEF_C TInt E32Main(void);
+
+class CT_NativeOrientationServer : public CTestServer
+	{
+public:
+	static CT_NativeOrientationServer*	NewL();
+	virtual CTestStep*		CreateTestStep(const TDesC& aStepName);
+
+protected:
+	void	ConstructL();
+	};
+
+#endif // __T_NATIVEORIENTATION_SERVER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/t_nativeorientation/inc/t_nativeorientationtest.h	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,63 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+@file
+@test
+@internalComponent
+*/
+
+#ifndef __T_NATIVEORIENTATIONTEST_H__
+#define __T_NATIVEORIENTATIONTEST_H__
+
+#include <w32std.h>
+#include <test/testexecutestepbase.h>
+#include <graphics/surfacemanager.h>
+#include <graphics/surfaceupdateclient.h>
+#include <graphics/surfaceconfiguration.h>
+
+_LIT(KT_NativeOrientationTestStep,"T_NativeOrientationTestStep");
+
+class CT_NativeOrientationTest : public CTestStep
+	{
+public:
+	CT_NativeOrientationTest();
+	~CT_NativeOrientationTest();
+	// from CTestStep
+	virtual enum TVerdict doTestStepPreambleL();
+	virtual enum TVerdict doTestStepL();
+	virtual enum TVerdict doTestStepPostambleL();
+
+private:
+	// Test cases
+    void GRAPHICS_WSERV_0733L();
+    void GRAPHICS_WSERV_0734L();
+    void GRAPHICS_WSERV_0735L();
+    void GRAPHICS_WSERV_0736L();
+    void GRAPHICS_WSERV_0737L();
+    void GRAPHICS_WSERV_0738L();
+    void GRAPHICS_WSERV_0739L();
+    void GRAPHICS_WSERV_0740L();
+	void GRAPHICS_WSERV_0741L();
+    void GRAPHICS_WSERV_0742L();
+	void CreateSurfaceAttributes(RSurfaceManager::TSurfaceCreationAttributesBuf&, const TSize&);
+	void FillSurfaceL(TSurfaceId&, const TRgb&, RSurfaceManager&, RSurfaceUpdateSession&);
+	
+private:	// Data members
+	TInt iTestId;
+	RWsSession iWs;
+	};
+
+#endif	// __T_NATIVEORIENTATIONTEST_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/t_nativeorientation/rom/t_nativeorientation.iby	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,27 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+#if (!defined __T_NATIVEORIENTATION_IBY__)
+#define __T_NATIVEORIENTATION_IBY__
+
+#include <testexecute.iby>
+#ifdef SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+file=ABI_DIR\DEBUG_DIR\t_nativeorientationserver.exe                                      \sys\bin\t_nativeorientationserver.exe
+
+data=EPOCROOT##epoc32\data\z\wstest\tnativeorientation\graphics-wserv-nativeorientation-test.script     \wstest\tnativeorientation\graphics-wserv-nativeorientation-test.script
+data=EPOCROOT##epoc32\data\z\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini             \wstest\tnativeorientation\graphics-wserv-nativeorientation.ini
+#endif // SYMBIAN_GRAPHICS_FIXNATIVEORIENTATION
+
+#endif // __T_NATIVEORIENTATION_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/t_nativeorientation/scripts/graphics-wserv-nativeorientation-test.script	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,58 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+LOAD_SUITE t_nativeorientationserver
+DELAY 10
+
+START_TESTCASE 	GRAPHICS-WSERV-0733
+RUN_TEST_STEP !Heap=0x200000 !PanicCode=85	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0733
+END_TESTCASE 	GRAPHICS-WSERV-0733
+
+START_TESTCASE 	GRAPHICS-WSERV-0734
+RUN_TEST_STEP !Heap=0x200000 !PanicCode=85	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0734
+END_TESTCASE 	GRAPHICS-WSERV-0734
+
+START_TESTCASE 	GRAPHICS-WSERV-0735
+RUN_TEST_STEP !Heap=0x200000 !PanicCode=85	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0735
+END_TESTCASE 	GRAPHICS-WSERV-0735
+
+START_TESTCASE 	GRAPHICS-WSERV-0736
+RUN_TEST_STEP !Heap=0x200000 !PanicCode=85	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0736
+END_TESTCASE 	GRAPHICS-WSERV-0736
+
+START_TESTCASE 	GRAPHICS-WSERV-0737
+RUN_TEST_STEP !Heap=0x200000 !PanicCode=85	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0737
+END_TESTCASE 	GRAPHICS-WSERV-0737
+
+START_TESTCASE 	GRAPHICS-WSERV-0738
+RUN_TEST_STEP !Heap=0x200000 50	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0738
+END_TESTCASE 	GRAPHICS-WSERV-0738
+
+START_TESTCASE 	GRAPHICS-WSERV-0739
+RUN_TEST_STEP !Heap=0x200000 !PanicCode=85	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0739
+END_TESTCASE 	GRAPHICS-WSERV-0739
+
+START_TESTCASE 	GRAPHICS-WSERV-0740
+RUN_TEST_STEP !Heap=0x200000 50	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0740
+END_TESTCASE 	GRAPHICS-WSERV-0740
+
+START_TESTCASE 	GRAPHICS-WSERV-0741
+RUN_TEST_STEP !Heap=0x200000 !PanicCode=85	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0741
+END_TESTCASE 	GRAPHICS-WSERV-0741
+
+START_TESTCASE 	GRAPHICS-WSERV-0742
+RUN_TEST_STEP !Heap=0x200000 !PanicCode=3	t_nativeorientationserver	T_NativeOrientationTestStep	z:\wstest\tnativeorientation\graphics-wserv-nativeorientation.ini	graphics-wserv-0742
+END_TESTCASE 	GRAPHICS-WSERV-0742
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/t_nativeorientation/src/t_nativeorientationserver.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,113 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+@file
+@test
+@internalComponent
+*/
+
+//	User Includes
+#include "t_nativeorientationserver.h"
+#include "t_nativeorientationtest.h"
+
+_LIT(KTestServerName, "NativeOrientationTestServer");
+
+CT_NativeOrientationServer* CT_NativeOrientationServer::NewL()
+/**
+ * @return - Instance of the test server
+ * Same code for Secure and non-secure variants
+ * Called inside the MainL() function to create and start the
+ * CTestServer derived server.
+ */
+	{
+	CT_NativeOrientationServer*	server = new (ELeave) CT_NativeOrientationServer;
+	CleanupStack::PushL(server);
+	server->ConstructL();
+	CleanupStack::Pop(server);
+	return server;
+	}
+
+void CT_NativeOrientationServer::ConstructL()
+	{
+	RProcess	handle = RProcess();
+	TParsePtrC	serverName(handle.FileName());
+	CTestServer::ConstructL(serverName.Name());
+	}
+
+LOCAL_C void MainL()
+	{
+	CActiveScheduler*		sched=NULL;
+	sched=new(ELeave) CActiveScheduler;
+	CActiveScheduler::Install(sched);
+	CT_NativeOrientationServer*	server = NULL;
+	// Create the CTestServer derived server
+	TRAPD(err,server = CT_NativeOrientationServer::NewL());
+	if(!err)
+		{
+		// Sync with the client and enter the active scheduler
+		RProcess::Rendezvous(KErrNone);
+		sched->Start();
+		}
+	else
+	    {
+        RDebug::Print(_L("Server error=%d"), err);
+	    }
+	delete server;
+	delete sched;
+	}
+
+/**
+ * @return - Standard Epoc error code on process exit
+ * Process entry point. Called by client using RProcess Integ
+ */
+GLDEF_C TInt E32Main()
+	{
+	__UHEAP_MARK;
+	CTrapCleanup* cleanup = CTrapCleanup::New();
+	if(cleanup == NULL)
+		{
+		return KErrNoMemory;
+		}
+	
+    TRAPD(err,MainL()); 
+    if (err)
+        {
+        _LIT(KMainErrorStatement, "CNativeOrientationTestServer MainL - Error: %d");
+        RDebug::Print(KMainErrorStatement, err);
+        User::Panic(KTestServerName, err);
+        }       
+    
+	delete cleanup;
+	__UHEAP_MARKEND;
+	return KErrNone;
+    }
+
+CTestStep* CT_NativeOrientationServer::CreateTestStep(const TDesC& aStepName)
+/**
+ * @return - A CTestStep derived instance
+ * Secure and non-secure variants
+ * Implementation of CTestServer pure virtual
+ */
+	{
+	CTestStep*	testStep = NULL;
+
+	if ( aStepName==KT_NativeOrientationTestStep )
+		{
+		testStep=new CT_NativeOrientationTest();
+		}
+
+	return testStep;
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/windowing/windowserver/test/t_nativeorientation/src/t_nativeorientationtest.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -0,0 +1,753 @@
+// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// All rights reserved.
+// This component and the accompanying materials are made available
+// under the terms of "Eclipse Public License v1.0"
+// which accompanies this distribution, and is available
+// at the URL "http://www.eclipse.org/legal/epl-v10.html".
+//
+// Initial Contributors:
+// Nokia Corporation - initial contribution.
+//
+// Contributors:
+//
+// Description:
+//
+
+/**
+@file
+@test
+@internalComponent
+*/
+
+#include "t_nativeorientationtest.h"
+
+_LIT(KT_NativeOrientationTestId,"testId");
+
+CT_NativeOrientationTest::CT_NativeOrientationTest()
+	{
+	SetTestStepName(KT_NativeOrientationTestStep);
+	}
+
+
+CT_NativeOrientationTest::~CT_NativeOrientationTest()
+	{
+	}
+
+
+enum TVerdict CT_NativeOrientationTest::doTestStepPreambleL()
+	{
+	TVerdict ret=CTestStep::doTestStepPreambleL();
+
+	User::LeaveIfError(iWs.Connect()); // Setup session to wserv
+	iWs.SetAutoFlush(EFalse);
+	    
+	if ( !GetIntFromConfig( ConfigSection(), KT_NativeOrientationTestId, iTestId ) )
+		{
+        INFO_PRINTF1(_L("ERROR: GetIntFromConfig() Failed!"));
+		User::Leave(KErrNotFound);
+		}
+	return ret;
+	}
+
+enum TVerdict CT_NativeOrientationTest::doTestStepPostambleL()
+	{
+	return TestStepResult();
+	}
+
+
+/**
+Starts test step
+@internalComponent
+@return TVerdict pass / fail
+@pre N/A
+@post N/A
+*/
+enum TVerdict CT_NativeOrientationTest::doTestStepL()
+	{
+    INFO_PRINTF1(_L("CT_NativeOrientation started"));
+    RDebug::Printf("CT_NativeOrientation started");
+    
+    __UHEAP_MARK;
+        
+    switch (iTestId)
+        {
+        case 733:
+            GRAPHICS_WSERV_0733L();
+            break;
+        case 734:
+            GRAPHICS_WSERV_0734L();
+            break;
+        case 735:
+            GRAPHICS_WSERV_0735L();
+            break;
+        case 736:
+            GRAPHICS_WSERV_0736L();
+            break;
+        case 737:
+            GRAPHICS_WSERV_0737L();
+            break;
+        case 738:
+            GRAPHICS_WSERV_0738L();
+            break;
+        case 739:
+            GRAPHICS_WSERV_0739L();
+            break;
+        case 740:
+            GRAPHICS_WSERV_0740L();
+            break;
+        case 741:
+            GRAPHICS_WSERV_0741L();
+            break;
+        case 742:
+            GRAPHICS_WSERV_0742L();
+            break;
+        default:
+            INFO_PRINTF1(_L("Bad Test Case Id"));
+            User::Panic(_L("Bad Test Case Id"), 999);
+            break;
+        }
+
+    iWs.Close();
+    __UHEAP_MARKEND;
+
+    INFO_PRINTF1(_L("CT_NativeOrientation completed!"));
+    RDebug::Printf("CT_NativeOrientation completed");
+    return TestStepResult();
+	}
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0742
+ @SYMTestCaseDesc   FixNativeOrientation() on a window before Construct()
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create screen device
+                    2. Create group window
+                    3. Create test window
+                    4. Call FixNativeOrientation()
+                    5. Construct test window
+ @SYMTestExpectedResults    Works normally.
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0742L()
+    {
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0742L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0742L")); 
+    CWsScreenDevice* scrDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(scrDevice->Construct());
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+
+    RWindow myWin = RWindow(iWs);
+    TInt nativeErr = myWin.FixNativeOrientation();
+    TEST(nativeErr==KErrNone);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+    myWin.SetExtent(TPoint(0,0), scrDevice->SizeInPixels());
+    myWin.Activate();
+    iWs.Finish();
+
+    delete scrDevice;
+
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0742L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0742L"));
+    }
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0741
+ @SYMTestCaseDesc   FixNativeOrientation() on a window after Activate()
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create screen device
+                    2. Create group window
+                    3. Create test window
+                    4. Activate test window
+                    5. Call FixNativeOrientation()
+ @SYMTestExpectedResults    EWsWinOpFixNativeOrientation panic.
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0741L()
+	{
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0741L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0741L")); 
+    CWsScreenDevice* scrDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(scrDevice->Construct());
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+
+    RWindow myWin = RWindow(iWs);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+    myWin.SetExtent(TPoint(0,0), scrDevice->SizeInPixels());
+    myWin.Activate();
+
+    TInt nativeErr = myWin.FixNativeOrientation();
+    TEST(nativeErr==KErrNone);
+    iWs.Finish();
+
+    delete scrDevice;
+
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0741L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0741L"));
+	}
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0740
+ @SYMTestCaseDesc   SizeForEgl() returns same size as configured by SetSize()
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create screen device
+                    2. Create group window
+                    3. Create test window
+                    4. Activate test window
+                    5. Call SetSize(20,20)
+                    6. Call SizeForEgl()
+ @SYMTestExpectedResults    SizeForEgl() returns same size as configured by SetSize()
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0740L()
+    {
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0740L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0740L")); 
+    CWsScreenDevice* scrDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(scrDevice->Construct());
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+    
+    RWindow myWin = RWindow(iWs);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+    myWin.SetExtent(TPoint(0,0), scrDevice->SizeInPixels());
+    myWin.Activate();
+    
+    TSize setSize(20,20);
+    myWin.SetSize(setSize);
+    TSize eglSize = myWin.SizeForEgl();
+    TEST(eglSize==setSize);
+    iWs.Finish();
+
+    delete scrDevice;
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0740L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0740L"));
+    }
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0739
+ @SYMTestCaseDesc   FixNativeOrientation() called twice on same window
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create screen device
+                    2. Create group window
+                    3. Create test window
+                    4. Call FixNativeOrientation()
+                    5. Call FixNativeOrientation()
+ @SYMTestExpectedResults    EWsWinOpFixNativeOrientation panic.
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0739L()
+    {
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0739L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0739L")); 
+    CWsScreenDevice* scrDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(scrDevice->Construct());
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+    
+    RWindow myWin = RWindow(iWs);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+    myWin.SetExtent(TPoint(0,0), scrDevice->SizeInPixels());
+
+    TInt nativeErr = myWin.FixNativeOrientation();
+    TEST(nativeErr==KErrNone);
+    iWs.Finish();
+    nativeErr = myWin.FixNativeOrientation(); // Panic
+    iWs.Finish();
+
+    delete scrDevice;
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0739L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0739L"));
+    }
+
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0738
+ @SYMTestCaseDesc   SizeForEgl() returns same size as configured by SetSize()
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create screen device
+                    2. Create group window
+                    3. Create test window
+                    4. Activate test window
+                    5. Call SetSize(60,40)
+                    6. Call SizeForEgl() (check size is (60,40)
+                    7. Call FixNativeOrientation()
+                    8. Call SetSize(40,60)
+                    9. Call SizeForEgl() (check size is (60,40)
+ @SYMTestExpectedResults    SizeForEgl() returns same size as configured by SetSize()
+                            prior to FixNativeOrientation(), i.e. subsequent SetSize()
+                            does not affect SizeForEgl()
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0738L()
+    {
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0738L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0738L")); 
+    CWsScreenDevice* scrDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(scrDevice->Construct());
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+    
+    RWindow myWin = RWindow(iWs);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+    myWin.SetExtent(TPoint(0,0), scrDevice->SizeInPixels());
+    
+    TSize setSize(60,40);
+    myWin.SetSize(setSize);
+    TSize eglSize = myWin.SizeForEgl();
+    TEST(eglSize==setSize);
+    TSize winSize = myWin.Size();
+    TEST(winSize==setSize);
+
+    TInt nativeErr = myWin.FixNativeOrientation();
+    TEST(nativeErr==KErrNone);
+    
+    eglSize = myWin.SizeForEgl();
+    TEST(eglSize==setSize);
+    winSize = myWin.Size();
+    TEST(winSize==setSize);
+    
+    TSize setSize2(40,60);
+    myWin.SetSize(setSize2);
+    eglSize = myWin.SizeForEgl();
+    TEST(eglSize==setSize);
+    winSize = myWin.Size();
+    TEST(winSize==setSize2);
+    
+    iWs.Finish();
+    myWin.Close();
+    grpWin.Close();
+    delete scrDevice;
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0738L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0738L"));
+    }
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0737
+ @SYMTestCaseDesc   FixNativeOrientation() without primary screen device
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create group window
+                    2. Create test window
+                    3. Call FixNativeOrientation()
+ @SYMTestExpectedResults    EWsWinOpFixNativeOrientation panic.
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0737L()
+    {
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0737L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0737L")); 
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+    
+    RWindow myWin = RWindow(iWs);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+
+    TInt nativeErr = myWin.FixNativeOrientation();
+    TEST(nativeErr==KErrNone);
+    iWs.Finish();
+
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0737L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0737L"));
+    }
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0736
+ @SYMTestCaseDesc   SetBackgroundSurface() without primary screen device
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create group window
+                    2. Create test window
+                    3. Call FixNativeOrientation()
+                    4. Create Surface
+                    5. Delete screen device
+                    6. SetBackgroundSurface()
+ @SYMTestExpectedResults    EWsWinOpFixNativeOrientation panic.
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0736L()
+    {
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0736L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0736L")); 
+    CWsScreenDevice* scrDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(scrDevice->Construct());
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+
+    RWindow myWin = RWindow(iWs);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+    myWin.SetExtent(TPoint(0,0), scrDevice->SizeInPixels());
+
+    TInt nativeErr = myWin.FixNativeOrientation();
+    TEST(nativeErr==KErrNone);
+    myWin.Activate();
+    iWs.Finish();
+    
+    RSurfaceManager surfaceManager;
+    User::LeaveIfError(surfaceManager.Open());
+    
+    RSurfaceManager::TSurfaceCreationAttributesBuf backgroundBuf;
+    CreateSurfaceAttributes(backgroundBuf,myWin.Size());
+          
+    RSurfaceUpdateSession surfaceUpdateSession;
+    User::LeaveIfError(surfaceUpdateSession.Connect());
+    
+    TSurfaceId surfaceId = TSurfaceId::CreateNullId();
+    User::LeaveIfError(surfaceManager.CreateSurface(backgroundBuf, surfaceId));
+   
+    TSurfaceConfiguration surfaceConfig;
+    surfaceConfig.SetSurfaceId(surfaceId);
+    surfaceConfig.SetViewport(TRect(TPoint(0,0),scrDevice->SizeInPixels()));
+    surfaceConfig.SetExtent(TRect(TPoint(0,0),scrDevice->SizeInPixels()));
+    surfaceConfig.SetOrientation(CFbsBitGc::EGraphicsOrientationNormal);
+
+    TRgb backgroundColor = TRgb(255,255,255,255);
+    FillSurfaceL(surfaceId, backgroundColor, surfaceManager, surfaceUpdateSession);
+
+    delete scrDevice;
+    User::LeaveIfError(myWin.SetBackgroundSurface(surfaceConfig, ETrue));
+
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0736L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0736L"));
+    }
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0735
+ @SYMTestCaseDesc   Trigger background color draw without primary screen device
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create group window
+                    2. Create test window
+                    3. Call FixNativeOrientation()
+                    4. Create Surface
+                    5. SetBackgroundSurface()
+                    6. Delete screen device
+                    7. Trigger background color draw
+ @SYMTestExpectedResults    EWsWinOpFixNativeOrientation panic.
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0735L()
+    {
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0735L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0735L")); 
+    CWsScreenDevice* scrDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(scrDevice->Construct());
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+
+    RWindow myWin = RWindow(iWs);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+    myWin.SetExtent(TPoint(0,0), scrDevice->SizeInPixels());
+    
+    TInt nativeErr = myWin.FixNativeOrientation();
+    TEST(nativeErr==KErrNone);
+    myWin.Activate();
+    iWs.Finish();
+    
+    RSurfaceManager surfaceManager;
+    User::LeaveIfError(surfaceManager.Open());
+    
+    RSurfaceManager::TSurfaceCreationAttributesBuf backgroundBuf;
+    CreateSurfaceAttributes(backgroundBuf,myWin.Size());
+          
+    RSurfaceUpdateSession surfaceUpdateSession;
+    User::LeaveIfError(surfaceUpdateSession.Connect());
+    
+    TSurfaceId surfaceId = TSurfaceId::CreateNullId();
+    User::LeaveIfError(surfaceManager.CreateSurface(backgroundBuf, surfaceId));
+   
+    TSurfaceConfiguration surfaceConfig;
+    surfaceConfig.SetSurfaceId(surfaceId);
+    surfaceConfig.SetViewport(TRect(TPoint(0,0),scrDevice->SizeInPixels()));
+    surfaceConfig.SetExtent(TRect(TPoint(0,0),scrDevice->SizeInPixels()));
+    surfaceConfig.SetOrientation(CFbsBitGc::EGraphicsOrientationNormal);
+
+    TRgb backgroundColor = TRgb(255,255,255,255);
+    FillSurfaceL(surfaceId, backgroundColor, surfaceManager, surfaceUpdateSession);
+    User::LeaveIfError(myWin.SetBackgroundSurface(surfaceConfig, ETrue));
+
+    delete scrDevice;
+    myWin.Invalidate();
+    myWin.BeginRedraw();
+    myWin.EndRedraw();
+    iWs.Finish();
+    
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0735L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0735L"));
+    }
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0734
+ @SYMTestCaseDesc   Change window position without primary screen device
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create group window
+                    2. Create test window
+                    3. Call FixNativeOrientation()
+                    4. Create Surface
+                    5. SetBackgroundSurface()
+                    6. Delete screen device
+                    7. Change window position
+ @SYMTestExpectedResults    EWsWinOpFixNativeOrientation panic.
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0734L()
+    {
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0734L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0734L")); 
+    CWsScreenDevice* scrDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(scrDevice->Construct());
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+
+    RWindow myWin = RWindow(iWs);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+    myWin.SetExtent(TPoint(0,0), scrDevice->SizeInPixels());
+    
+    TInt nativeErr = myWin.FixNativeOrientation();
+    TEST(nativeErr==KErrNone);
+    myWin.Activate();
+    iWs.Finish();
+    
+    RSurfaceManager surfaceManager;
+    User::LeaveIfError(surfaceManager.Open());
+    
+    RSurfaceManager::TSurfaceCreationAttributesBuf backgroundBuf;
+    CreateSurfaceAttributes(backgroundBuf,myWin.Size());
+          
+    RSurfaceUpdateSession surfaceUpdateSession;
+    User::LeaveIfError(surfaceUpdateSession.Connect());
+    
+    TSurfaceId surfaceId = TSurfaceId::CreateNullId();
+    User::LeaveIfError(surfaceManager.CreateSurface(backgroundBuf, surfaceId));
+   
+    TSurfaceConfiguration surfaceConfig;
+    surfaceConfig.SetSurfaceId(surfaceId);
+    surfaceConfig.SetViewport(TRect(TPoint(0,0),scrDevice->SizeInPixels()));
+    surfaceConfig.SetExtent(TRect(TPoint(0,0),scrDevice->SizeInPixels()));
+    surfaceConfig.SetOrientation(CFbsBitGc::EGraphicsOrientationNormal);
+
+    TRgb backgroundColor = TRgb(255,255,255,255);
+    FillSurfaceL(surfaceId, backgroundColor, surfaceManager, surfaceUpdateSession);
+    User::LeaveIfError(myWin.SetBackgroundSurface(surfaceConfig, ETrue));
+
+    delete scrDevice;
+    myWin.SetPosition(TPoint(40,40));
+    iWs.Finish();
+    
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0734L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0734L"));
+    }
+
+/**
+ @SYMTestCaseID     GRAPHICS-WSERV-0733
+ @SYMTestCaseDesc   Change window size without primary screen device
+ @SYMPREQ           66527  
+ @SYMREQ            417-66527
+ @SYMPrerequisites  
+ @SYMTestType       CT (Component Test)
+ @SYMTestActions    1. Create group window
+                    2. Create test window
+                    3. Call FixNativeOrientation()
+                    4. Create Surface
+                    5. SetBackgroundSurface()
+                    6. Delete screen device
+                    7. Change window size
+ @SYMTestExpectedResults    EWsWinOpFixNativeOrientation panic.
+*/
+void CT_NativeOrientationTest::GRAPHICS_WSERV_0733L()
+    {
+    RDebug::Printf("Entering test GRAPHICS_WSERV_0733L");
+    INFO_PRINTF1(_L("Entering test GRAPHICS_WSERV_0733L")); 
+    CWsScreenDevice* scrDevice = new (ELeave) CWsScreenDevice(iWs);
+    User::LeaveIfError(scrDevice->Construct());
+
+    RWindowGroup grpWin = RWindowGroup(iWs);
+    User::LeaveIfError(grpWin.Construct((TUint32)&grpWin));
+
+    RWindow myWin = RWindow(iWs);
+    User::LeaveIfError(myWin.Construct(grpWin, (TUint32)&myWin));
+    myWin.SetExtent(TPoint(0,0), scrDevice->SizeInPixels());
+    
+    TInt nativeErr = myWin.FixNativeOrientation();
+    TEST(nativeErr==KErrNone);
+    myWin.Activate();
+    iWs.Finish();
+    
+    RSurfaceManager surfaceManager;
+    User::LeaveIfError(surfaceManager.Open());
+    
+    RSurfaceManager::TSurfaceCreationAttributesBuf backgroundBuf;
+    CreateSurfaceAttributes(backgroundBuf,myWin.Size());
+          
+    RSurfaceUpdateSession surfaceUpdateSession;
+    User::LeaveIfError(surfaceUpdateSession.Connect());
+    
+    TSurfaceId surfaceId = TSurfaceId::CreateNullId();
+    User::LeaveIfError(surfaceManager.CreateSurface(backgroundBuf, surfaceId));
+   
+    TSurfaceConfiguration surfaceConfig;
+    surfaceConfig.SetSurfaceId(surfaceId);
+    surfaceConfig.SetViewport(TRect(TPoint(0,0),scrDevice->SizeInPixels()));
+    surfaceConfig.SetExtent(TRect(TPoint(0,0),scrDevice->SizeInPixels()));
+    surfaceConfig.SetOrientation(CFbsBitGc::EGraphicsOrientationNormal);
+
+    TRgb backgroundColor = TRgb(255,255,255,255);
+    FillSurfaceL(surfaceId, backgroundColor, surfaceManager, surfaceUpdateSession);
+    User::LeaveIfError(myWin.SetBackgroundSurface(surfaceConfig, ETrue));
+
+    delete scrDevice;
+    myWin.SetSize(TSize(27,29));
+    iWs.Finish();
+    
+    RDebug::Printf("Completed test GRAPHICS_WSERV_0733L");
+    INFO_PRINTF1(_L("Completed test GRAPHICS_WSERV_0733L"));
+    }
+
+void CT_NativeOrientationTest::CreateSurfaceAttributes(RSurfaceManager::TSurfaceCreationAttributesBuf& aBuffer , const TSize& aSize)
+    {
+    RSurfaceManager::TSurfaceCreationAttributes& b = aBuffer();
+                
+    b.iSize.iWidth = aSize.iWidth;
+    b.iSize.iHeight = aSize.iHeight;
+    b.iBuffers = 1;              // number of buffers in the surface
+    b.iPixelFormat = EUidPixelFormatARGB_8888;
+    b.iStride = aSize.iWidth * 4;        // Number of bytes between start of one line and start of next
+    b.iOffsetToFirstBuffer = 0; // way of reserving space before the surface pixel data
+    b.iAlignment = 4;           // alignment, 1,2,4,8 byte aligned
+    b.iContiguous = EFalse;
+    b.iMappable = ETrue;
+    }
+
+void CT_NativeOrientationTest::FillSurfaceL(TSurfaceId& aSurface, const TRgb& aColor, RSurfaceManager& surfaceManager, RSurfaceUpdateSession& surfaceUpdateSession)
+    {
+    RSurfaceManager::TInfoBuf infoBuf;
+    RSurfaceManager::TSurfaceInfoV01& info = infoBuf();
+
+    User::LeaveIfError(surfaceManager.SurfaceInfo(aSurface, infoBuf));
+    TUint32 color = 0;
+    TBool use16 = EFalse;
+
+    if (info.iSize.iHeight<0 || info.iSize.iWidth<0 || info.iStride<0)
+        {
+        User::Leave(KErrCorrupt);
+        }
+    if (info.iSize.iHeight==0 || info.iSize.iWidth==0 || info.iStride==0)
+        {
+        User::Leave(KErrNotReady);
+        }
+
+    switch (info.iPixelFormat)
+        {
+        case EUidPixelFormatXRGB_8888:
+            {
+            color = aColor.Color16MU();
+#ifdef ALPHA_FIX_24BIT
+            color |= ((ALPHA_FIX_24BIT)&0xff)<<24;
+#endif
+            break;
+            }
+        case EUidPixelFormatARGB_8888:
+            {
+            color = aColor.Color16MA();
+            break;
+            }
+        case EUidPixelFormatARGB_8888_PRE:
+            {
+            color = aColor.Color16MAP();
+            break;
+            }
+        case EUidPixelFormatXRGB_4444:
+        case EUidPixelFormatARGB_4444:
+            {
+            color = aColor.Color4K();
+            use16 = ETrue;
+            break;
+            }
+        case EUidPixelFormatRGB_565:
+            {
+            color = aColor.Color64K();
+            use16 = ETrue;
+            break;
+            }
+        default:
+            {
+            User::Leave(KErrNotSupported);
+            break;
+            }
+        }
+
+    RChunk chunk;
+    User::LeaveIfError(surfaceManager.MapSurface(aSurface, chunk));
+    CleanupClosePushL(chunk);
+
+    TInt offsetToFirstBuffer;
+    User::LeaveIfError(surfaceManager.GetBufferOffset(aSurface, 0, offsetToFirstBuffer));
+    TUint8* surfacePtr = chunk.Base() + offsetToFirstBuffer;
+    TUint8* linePtr = surfacePtr;
+
+    if (use16)
+        {
+        if ( info.iSize.iWidth*2>info.iStride)
+            {
+            User::Leave(KErrOverflow);
+            }
+        TUint16* ptr = reinterpret_cast<TUint16*>(surfacePtr);
+
+        // Fill first line
+        for (TInt xx = 0; xx < info.iSize.iWidth; xx++)
+            {
+            ptr[xx] = (TUint16)color;
+            }
+        }
+    else
+        {
+        if ( info.iSize.iWidth*4>info.iStride)
+            {
+            User::Leave(KErrOverflow);
+            }
+        TUint32* ptr = reinterpret_cast<TUint32*>(surfacePtr);
+
+        // Fill first line
+        for (TInt xx = 0; xx < info.iSize.iWidth; xx++)
+            {
+            ptr[xx] = color;
+            }
+        }
+
+    // Now copy that to the other lines
+    for (TInt yy = 1; yy < info.iSize.iHeight; yy++)
+        {
+        linePtr += info.iStride;
+        Mem::Copy(linePtr, surfacePtr, info.iSize.iWidth * 4);
+        }
+    
+    TInt err = surfaceUpdateSession.SubmitUpdate(0, aSurface, 0, NULL);
+    if (err!=KErrNone)
+        RDebug::Printf("Error submitting update: 0x%X\n", err);
+
+    CleanupStack::PopAndDestroy(/* chunk */);
+    }
--- a/windowing/windowserver/wins_switching/remotegcswitch.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/wins_switching/remotegcswitch.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -39,11 +39,16 @@
 
 FARPROC vector[MAX_ORDINAL+1];
 
-
+#ifdef _DEBUG
 void Stop(char* aErrorMessage)
+#else
+void Stop(char* /*aErrorMessage*/)
+#endif
 	{
 	int err = GetLastError();
+#if _DEBUG
 	RDebug::Printf("%S, (last error = %i)", aErrorMessage, err);
+#endif
 	_asm int 3;
 	}
 
@@ -77,8 +82,10 @@
 	UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty,  (TAny*)"symbian_graphics_use_gce",  &nga);
 	const char* library = nga ? "remotegc_nga.dll" : "remotegc_nonnga.dll";
 
+#ifdef _DEBUG
 	RDebug::Printf("Redirecting remotegc.dll to \"%s\" ...\n", library);
-	
+#endif
+  	
 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
 	// try to load selected DLL
 	HINSTANCE instance = LoadLibraryA(library);
@@ -91,7 +98,9 @@
 	else
 		{
 		fill_vector(instance);
+#ifdef _DEBUG
 		RDebug::Printf("... DLL loaded successfully");
+#endif
 		}
 	}
 
--- a/windowing/windowserver/wins_switching/ws32_stubs.h	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/wins_switching/ws32_stubs.h	Thu Apr 08 12:06:20 2010 +0100
@@ -5202,6 +5202,25 @@
 	_asm mov eax, 576
 	_asm jmp common_dispatch
 	}
+
+__declspec(dllexport)
+__declspec(naked)
+void call_vector_577 ()
+	{
+	// ; class TSize RWindowBase::SizeForEgl(void) const
+	_asm mov eax, 577
+	_asm jmp common_dispatch
+	}
+
+__declspec(dllexport)
+__declspec(naked)
+void call_vector_578 ()
+	{
+	// ; int RWindowBase::FixNativeOrientation(void)
+	_asm mov eax, 578
+	_asm jmp common_dispatch
+	}
+
 }
-#define MAX_ORDINAL 577
-
+#define MAX_ORDINAL 579
+
--- a/windowing/windowserver/wins_switching/ws32switch.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/wins_switching/ws32switch.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -39,11 +39,16 @@
 
 FARPROC vector[MAX_ORDINAL+1];
 
-
+#ifdef _DEBUG
 void Stop(char* aErrorMessage)
+#else
+void Stop(char* /*aErrorMessage*/)
+#endif
 	{
 	int err = GetLastError();
+#ifdef _DEBUG
 	RDebug::Printf("%S, (last error = %i)", aErrorMessage, err);
+#endif
 	_asm int 3;
 	}
 
@@ -76,9 +81,9 @@
 	TBool nga = EFalse;
 	UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty,  (TAny*)"symbian_graphics_use_gce",  &nga);
 	const char* library = nga ? "ws32_nga.dll" : "ws32_nonnga.dll";
-
+#ifdef _DEBUG
 	RDebug::Printf("Redirecting ws32.dll to \"%s\" ...\n", library);
-	
+#endif
 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
 	// try to load selected DLL
 	HINSTANCE instance = LoadLibraryA(library);
@@ -91,7 +96,9 @@
 	else
 		{
 		fill_vector(instance);
+#ifdef _debug
 		RDebug::Printf("... DLL loaded successfully");
+#endif
 		}
 	}
 
--- a/windowing/windowserver/wins_switching/wservswitch.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/wins_switching/wservswitch.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -52,7 +52,11 @@
 
 	// try to launch it
 	const TPtrC exeName = nga ?  KWservSwitchNga() : KWservSwitchNonNga();
+
+#ifdef _DEBUG
 	RDebug::Print(_L("%S: Starting \"%S\" \"%S\""), &KProcessName, &exeName, &argPtr);
+#endif
+
 	RProcess server;
 	TInt err = server.Create(exeName, argPtr, EOwnerThread);
 	delete arg;
@@ -63,7 +67,9 @@
 		}
 
 	// wait for server to start
+#ifdef _DEBUG
 	RDebug::Print(_L("%S: waiting on process ..."), &KProcessName);
+#endif
 	TRequestStatus stat;
 	server.Rendezvous(stat);
 
@@ -87,7 +93,9 @@
 	// propagate error to SysStart
 	if (error)
 		{
+#ifdef _DEBUG
 		RDebug::Print(_L("%S: Failed with error %i"), &KProcessName, error);
+#endif
 		}
 	RProcess::Rendezvous(error);
 	return error;
--- a/windowing/windowserver/wins_switching/wsgraphicdrawerswitch.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserver/wins_switching/wsgraphicdrawerswitch.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -40,10 +40,16 @@
 FARPROC vector[MAX_ORDINAL+1];
 
 
+#ifdef _DEBUG
 void Stop(char* aErrorMessage)
+#else
+void Stop(char* /*aErrorMessage*/)
+#endif
 	{
 	int err = GetLastError();
+#ifdef _DEBUG
 	RDebug::Printf("%S, (last error = %i)", aErrorMessage, err);
+#endif
 	_asm int 3;
 	}
 
@@ -77,7 +83,9 @@
 	UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalBoolProperty,  (TAny*)"symbian_graphics_use_gce",  &nga);
 	const char* library = nga ? "wsgraphicdrawer_nga.dll" : "wsgraphicdrawer_nonnga.dll";
 
+#ifdef _DEBUG
 	RDebug::Printf("Redirecting wsgraphicdrawer.dll to \"%s\" ...\n", library);
+#endif
 	
 	Emulator::Escape();		// prevent deadlock between EKA2 scheduler and MS kernel
 	// try to load selected DLL
@@ -91,7 +99,9 @@
 	else
 		{
 		fill_vector(instance);
+#ifdef _DEBUG
 		RDebug::Printf("... DLL loaded successfully");
+#endif
 		}
 	}
 
--- a/windowing/windowserverplugins/openwfc/src/openwfcwrapper.cpp	Thu Apr 08 12:02:10 2010 +0100
+++ b/windowing/windowserverplugins/openwfc/src/openwfcwrapper.cpp	Thu Apr 08 12:06:20 2010 +0100
@@ -138,8 +138,10 @@
 
 void COpenWfcWrapper::ConstructL(TInt aScreenId)
 	{
+#ifdef _DEBUG
     _LIT(KOpenWfcLog, "+ COpenWfcWrapper::ConstructL");
     RDebug::Print(KOpenWfcLog);
+#endif
 
     iScreenNumber = aScreenId;
     WFCint filterList[] = { WFC_DEVICE_FILTER_SCREEN_NUMBER, iScreenNumber, WFC_NONE};