os/graphics/graphicscomposition/openwftest/src/openwftest.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicscomposition/openwftest/src/openwftest.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2763 @@
     1.4 +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// OpenWF tests
    1.18 +//
    1.19 +#include <test/extendtef.h>
    1.20 +#include <hal.h>
    1.21 +#include "openwftest.h"
    1.22 +
    1.23 +#define KCompositorVersion	0x01023456
    1.24 +#define KGrowCleanupStack	12
    1.25 +#define KMaxNotificationDelay   5000000 //5 seconds
    1.26 +#define KNotificationWarning    100000  //100 ms
    1.27 +
    1.28 +_LIT(KTestSectionName, "TestInfo");
    1.29 +_LIT(KImageSectionName, "ImageInfo");
    1.30 +_LIT(KContiguousFlag, "ContiguousFlag");
    1.31 +_LIT(KTolerance, "Tolerance");
    1.32 +_LIT(KTestMode, "TestMode");
    1.33 +_LIT(KSaveImage, "SaveImage");
    1.34 +_LIT(KDir, "Dir");
    1.35 +_LIT(KDefaultDir, "c:\\openwftest\\img\\");
    1.36 +_LIT(KCompositionPause, "CompositionPause");
    1.37 +_LIT(KManualPause, "ManualPause");
    1.38 +
    1.39 +//Uncomment this and rebuild if you wish to test if fastpath is enabled using breakpoints
    1.40 +//#define BREAKPOINT_FASTPATH
    1.41 +
    1.42 +/*
    1.43 + * COpenwfTest implementation
    1.44 + */
    1.45 +COpenwfTest::COpenwfTest()
    1.46 +:iFastpathablePixelFormat(EUidPixelFormatXRGB_8888),
    1.47 + iNonFastpathablePixelFormat(EUidPixelFormatRGB_565),
    1.48 + iMappable(ETrue),
    1.49 + iMaxBuffers(2),
    1.50 + iMinBuffers(1),
    1.51 + iCacheAttrib(ECacheNotlisted),
    1.52 + iDeviceId(WFC_INVALID_HANDLE),
    1.53 + iSync(EGL_NO_SYNC_KHR),
    1.54 + iDevice(WFC_INVALID_HANDLE),
    1.55 + iContext(WFC_INVALID_HANDLE)
    1.56 +	{
    1.57 +	}
    1.58 +
    1.59 +COpenwfTest::~COpenwfTest()
    1.60 +	{
    1.61 +    TearDown();
    1.62 +	}
    1.63 +
    1.64 +void COpenwfTest::SetupL()
    1.65 +    {    
    1.66 +    iScheduler = new(ELeave) CActiveScheduler;
    1.67 +    CActiveScheduler::Install(iScheduler);
    1.68 +
    1.69 +    ReadIniData();
    1.70 +    
    1.71 +    iEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    1.72 +    ASSERT_FALSE(iEGLDisplay == EGL_NO_DISPLAY);
    1.73 +    ASSERT_FALSE(iEGLDisplay == EGL_BAD_ALLOC);
    1.74 +    ASSERT_EQUALS(eglGetError(),EGL_SUCCESS);
    1.75 +    eglInitialize(iEGLDisplay, NULL, NULL);
    1.76 +    ASSERT_EQUALS(eglGetError(),EGL_SUCCESS);
    1.77 +    
    1.78 +    WFCint filterList[] = { WFC_DEVICE_FILTER_SCREEN_NUMBER, WFC_DEFAULT_SCREEN_NUMBER, WFC_NONE};
    1.79 +    ASSERT_TRUE(wfcEnumerateDevices(&iDeviceId, 1, filterList) == 1);
    1.80 +    ASSERT_TRUE(iDeviceId != WFC_INVALID_HANDLE);    
    1.81 +
    1.82 +    iDevice = wfcCreateDevice(iDeviceId, NULL);
    1.83 +    ASSERT_TRUE(iDevice != WFC_INVALID_HANDLE);  
    1.84 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
    1.85 +    iContext = wfcCreateOnScreenContext(iDevice, WFC_DEFAULT_SCREEN_NUMBER, NULL);
    1.86 +    ASSERT_TRUE(iContext != WFC_INVALID_HANDLE);  
    1.87 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
    1.88 +
    1.89 +    iFastpathableHeight = wfcGetContextAttribi(iDevice, iContext, WFC_CONTEXT_TARGET_HEIGHT);
    1.90 +    iFastpathableWidth = wfcGetContextAttribi(iDevice, iContext, WFC_CONTEXT_TARGET_WIDTH);
    1.91 +    iStride = iFastpathableWidth * 4;
    1.92 +
    1.93 +    iFullScreenTRect = TRect(0,0,iFastpathableWidth,iFastpathableHeight);
    1.94 +    iFullScreenRect[0] = 0;
    1.95 +    iFullScreenRect[1] = 0;
    1.96 +    iFullScreenRect[2] = iFullScreenTRect.Width();
    1.97 +    iFullScreenRect[3] = iFullScreenTRect.Height();
    1.98 +    
    1.99 +    iCenterTRect = TRect(iFastpathableWidth/4,iFastpathableHeight/4,
   1.100 +            3*iFastpathableWidth/4,3*iFastpathableHeight/4);
   1.101 +    iCenterRect[0] = iCenterTRect.iTl.iX;
   1.102 +    iCenterRect[1] = iCenterTRect.iTl.iY;
   1.103 +    iCenterRect[2] = iCenterTRect.Width();
   1.104 +    iCenterRect[3] = iCenterTRect.Height();
   1.105 +    
   1.106 +    iHalfSizeRect[0] = 0;
   1.107 +    iHalfSizeRect[1] = 0;
   1.108 +    iHalfSizeRect[2] = iFastpathableWidth/2;
   1.109 +    iHalfSizeRect[3] = iFastpathableHeight/2;
   1.110 +    
   1.111 +    iUtility = CSurfaceUtility::NewL();
   1.112 +
   1.113 +    if((iTestMode == EAutomatic) || iSaveImage)
   1.114 +        {
   1.115 +        // Need to initialise the on screen stream before composition
   1.116 +        // to ensure the content is available later 
   1.117 +        iUtility->GetOnScreenStream(iDevice, iContext);
   1.118 +        }
   1.119 +    if (iSaveImage)
   1.120 +        {   // Create a directory to save images
   1.121 +        iUtility->CreateImagePath(iImageDirectory);                
   1.122 +        }
   1.123 +    iAllowManualPause = ETrue; //tests can stop it (eg dispXtimes tests) 
   1.124 +    
   1.125 +    EGLint attrib_list[1] = {EGL_NONE};
   1.126 +    iSync = eglCreateSyncKHR(iEGLDisplay,EGL_SYNC_REUSABLE_KHR, attrib_list);
   1.127 +    ASSERT_NOT_EQUALS(iSync,EGL_NO_SYNC_KHR);
   1.128 +    ASSERT_EQUALS(eglGetError(),EGL_SUCCESS);
   1.129 +    }
   1.130 +
   1.131 +/**
   1.132 + * test Suite furniture 
   1.133 + **/
   1.134 +void COpenwfTest::TearDownL()
   1.135 +    {
   1.136 +    // Nothing leaves in this function, 
   1.137 +    // but TearDownL() is needed for the CTestFixture (TEF) interface
   1.138 +    TearDown();
   1.139 +    }
   1.140 +
   1.141 +void COpenwfTest::TearDown()
   1.142 +    {
   1.143 +    WFCErrorCode wfcError;
   1.144 +    if (iDevice != WFC_INVALID_HANDLE)
   1.145 +        {
   1.146 +        wfcError = wfcGetError(iDevice);
   1.147 +        if (wfcError != WFC_ERROR_NONE)
   1.148 +            {
   1.149 +            INFO_PRINTF2(_L("TearDown: There was a failure in the test. error=%d"),wfcError);
   1.150 +            }
   1.151 +        }
   1.152 +    if (iOnScreenStream != WFC_INVALID_HANDLE)
   1.153 +        {
   1.154 +        (void)SymbianStreamReleaseReadBuffer(iOnScreenStream, iOnScreenBuffer); //ignore the error
   1.155 +        iOnScreenStream = WFC_INVALID_HANDLE;
   1.156 +        }
   1.157 +    delete iUtility;
   1.158 +    iUtility = NULL;
   1.159 +    if (iContext != WFC_INVALID_HANDLE)
   1.160 +        {
   1.161 +        wfcDestroyContext(iDevice, iContext);
   1.162 +        iContext = WFC_INVALID_HANDLE;
   1.163 +        WFCErrorCode wfcError = wfcGetError(iDevice);
   1.164 +        if (wfcError != WFC_ERROR_NONE)
   1.165 +            {
   1.166 +            INFO_PRINTF2(_L("TearDown: wfcDestroyContext error=%d"),wfcError);
   1.167 +            }
   1.168 +        }
   1.169 +    if (iDevice != WFC_INVALID_HANDLE)
   1.170 +        {
   1.171 +        WFCErrorCode deviceError = wfcDestroyDevice(iDevice);
   1.172 +        iDevice = WFC_INVALID_HANDLE;
   1.173 +        if (deviceError != WFC_ERROR_NONE)
   1.174 +            {
   1.175 +            INFO_PRINTF2(_L("TearDown: wfcDestroyDevice error=%d"),deviceError);
   1.176 +            }
   1.177 +        }
   1.178 +    if (iSync != EGL_NO_SYNC_KHR)
   1.179 +        {
   1.180 +        EGLBoolean eglSyncError = eglDestroySyncKHR(iEGLDisplay, iSync);
   1.181 +        iSync = EGL_NO_SYNC_KHR;
   1.182 +        if (eglSyncError != EGL_TRUE)
   1.183 +            {
   1.184 +            INFO_PRINTF2(_L("TearDown: eglSyncError line %d"),__LINE__);
   1.185 +            }
   1.186 +        }
   1.187 +    if (iEGLDisplay != EGL_NO_DISPLAY)
   1.188 +        {
   1.189 +        EGLBoolean eglTerminateError = eglTerminate(iEGLDisplay);
   1.190 +        iEGLDisplay = EGL_NO_DISPLAY;
   1.191 +        if (eglTerminateError != EGL_TRUE)
   1.192 +            {
   1.193 +            INFO_PRINTF2(_L("TearDown: eglTerminateError line %d"),__LINE__);
   1.194 +            }
   1.195 +        }
   1.196 +    delete iScheduler;
   1.197 +    iScheduler = NULL;
   1.198 +    }
   1.199 +
   1.200 +/**
   1.201 + * To be called at the beginning of tests
   1.202 + * aActivate default is ON
   1.203 + */
   1.204 +void COpenwfTest::SetupEmptySceneL(TBool aActivate)
   1.205 +    {
   1.206 +#ifdef BREAKPOINT_FASTPATH
   1.207 +    __BREAKPOINT();
   1.208 +#endif
   1.209 +    wfcSetContextAttribi(iDevice, iContext, WFC_CONTEXT_ROTATION, WFC_ROTATION_0);
   1.210 +    wfcSetContextAttribi(iDevice, iContext, WFC_CONTEXT_BG_COLOR, 0xFFFFFFFF);
   1.211 +    if (aActivate)
   1.212 +        {
   1.213 +        LOG(("OpenWFTest: Running in autonomous composition mode"));
   1.214 +        wfcActivate(iDevice,iContext);
   1.215 +        }
   1.216 +    else
   1.217 +        {
   1.218 +        LOG(("OpenWFTest: Running in non autonomous composition mode"));
   1.219 +        wfcDeactivate(iDevice,iContext);
   1.220 +        }
   1.221 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
   1.222 +    wfcCommit(iDevice, iContext, WFC_TRUE);   // Compose the scene
   1.223 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
   1.224 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
   1.225 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
   1.226 +    LOG(("OpenWFTest: Fastpath - setting up scene - fastpath now off"));
   1.227 +    }
   1.228 +
   1.229 +void COpenwfTest::ReadIniData()
   1.230 +    {
   1.231 +	//test mode
   1.232 +    TBool returnValue = iConfig.GetInt(KTestSectionName, KTestMode, iTestMode);
   1.233 +    ASSERT_TRUE(returnValue);
   1.234 +    
   1.235 +    //save images
   1.236 +	iSaveImage=EFalse;
   1.237 +    if (iTestMode == EAutomatic)
   1.238 +        {
   1.239 +        returnValue = iConfig.GetBool(KTestSectionName, KSaveImage, iSaveImage);
   1.240 +        }
   1.241 +    
   1.242 +    // Get path for the images to be saved to
   1.243 +    TPtrC dir;
   1.244 +    returnValue = iConfig.GetString(KTestSectionName, KDir, dir);
   1.245 +    if (returnValue)
   1.246 +        {
   1.247 +		iImageDirectory.Set(dir);
   1.248 +        }
   1.249 +    else
   1.250 +        {
   1.251 +		iImageDirectory.Set(KDefaultDir);
   1.252 +        }
   1.253 +    
   1.254 +    // Composition pause in microseconds
   1.255 +    TInt compositionPause;
   1.256 +    returnValue = iConfig.GetInt(KTestSectionName, KCompositionPause, compositionPause);
   1.257 +    ASSERT_TRUE(returnValue);
   1.258 +    iCompositionPause = compositionPause;
   1.259 +    
   1.260 +    // Manual pause in microseconds
   1.261 +    iManualPause = 0;
   1.262 +    if (iTestMode != EAutomatic)
   1.263 +        {
   1.264 +		TInt manualPause;
   1.265 +		returnValue = iConfig.GetInt(KTestSectionName, KManualPause, manualPause);
   1.266 +		ASSERT_TRUE(returnValue);
   1.267 +		iManualPause = manualPause;
   1.268 +        }
   1.269 +    
   1.270 +    // Force contiguous
   1.271 +    TBool contiguousFlag;
   1.272 +    returnValue = iConfig.GetBool(KImageSectionName, KContiguousFlag, contiguousFlag);
   1.273 +    if (returnValue && contiguousFlag)
   1.274 +        {
   1.275 +        iContiguous = EContiguous;
   1.276 +        }
   1.277 +    
   1.278 +    // Test tolerance
   1.279 +    TInt tolerance;
   1.280 +    returnValue = iConfig.GetInt(KImageSectionName, KTolerance, tolerance);
   1.281 +    if (returnValue)
   1.282 +        {
   1.283 +        iTolerance = tolerance;
   1.284 +        }
   1.285 +    }
   1.286 +
   1.287 +/**
   1.288 + * Acquires the on screen stream and buffer number
   1.289 + * NOTE: this function should be paired with a ReleaseOnScreenStream call
   1.290 + * Returns ETrue on success
   1.291 + */
   1.292 +TBool COpenwfTest::AcquireOnScreenStream()
   1.293 +	{
   1.294 +	TInt error = KErrNone;
   1.295 +	ASSERT_TRUE(iOnScreenStream == WFC_INVALID_HANDLE);
   1.296 +    if(iTestMode == EAutomatic)
   1.297 +    	{	//need to get the on screen stream
   1.298 +		iOnScreenStream = iUtility->GetOnScreenStream(iDevice, iContext);
   1.299 +		if(iOnScreenStream == WFC_INVALID_HANDLE)
   1.300 +			{
   1.301 +			INFO_PRINTF1(_L("Failed getting on screen stream"));
   1.302 +			LOG(("OpenWFTest: *** Failed getting on screen stream"));
   1.303 +			return EFalse;
   1.304 +			}
   1.305 +		error = SymbianStreamAcquireReadBuffer(iOnScreenStream, &iOnScreenBuffer);
   1.306 +		if (error != KErrNone)
   1.307 +			{
   1.308 +			LOG(("OpenWFTest: *** Unable to acquire read buffer. error = %d",error));
   1.309 +			INFO_PRINTF2(_L("Unable to acquire read buffer. error = %d"),error);
   1.310 +			}
   1.311 +		return (error == KErrNone);
   1.312 +    	}
   1.313 +	else
   1.314 +		{
   1.315 +		INFO_PRINTF1(_L("No need to get the on screen stream, probably manual checking mode"));
   1.316 +		LOG(("OpenWFTest: *** No need to get the on screen stream, probably manual checking mode"));
   1.317 +		return ETrue;
   1.318 +		}
   1.319 +	}
   1.320 +
   1.321 +/**
   1.322 + * Releases the on screen stream
   1.323 + */
   1.324 +void COpenwfTest::ReleaseOnScreenStream()
   1.325 +	{
   1.326 +	if (iOnScreenStream != WFC_INVALID_HANDLE)
   1.327 +		{
   1.328 +		(void)SymbianStreamReleaseReadBuffer(iOnScreenStream, iOnScreenBuffer);	//ignore the error
   1.329 +		iOnScreenStream = WFC_INVALID_HANDLE;
   1.330 +		}
   1.331 +	if(iTestMode != EAutomatic && iAllowManualPause)
   1.332 +		{
   1.333 +		INFO_PRINTF1(_L("Performing manual wait"));
   1.334 +		LOG(("OpenWFTest: *** Performing manual wait"));
   1.335 +		TRAP_IGNORE(WaitL(iManualPause));
   1.336 +		}
   1.337 +	if(iTestMode != EAutomatic && !iAllowManualPause)
   1.338 +	    {
   1.339 +        INFO_PRINTF1(_L("Test not allowing a manual wait"));
   1.340 +        LOG(("OpenWFTest: *** Test not allowing a manual wait"));
   1.341 +	    }
   1.342 +	}
   1.343 +
   1.344 +/**
   1.345 + * Checks the rect of the on screen stream
   1.346 + * Returns ETrue on success
   1.347 + */
   1.348 +TBool COpenwfTest::CheckOnScreenStreamRect(TRect aRect, const TRgb& aExpectedColor, TInt aTolerance)
   1.349 +	{
   1.350 +    if(iTestMode == EAutomatic)
   1.351 +    	{
   1.352 +		if (iOnScreenStream == WFC_INVALID_HANDLE)
   1.353 +			{
   1.354 +			LOG(("OpenWFTest: *** We don't have access to the on screen stream"));
   1.355 +			INFO_PRINTF1(_L("We don't have access to the on screen stream"));
   1.356 +			return EFalse;
   1.357 +			}
   1.358 +		const TSurfaceId* surfaceId = NULL;
   1.359 +		long bufferIndex;
   1.360 +		TInt error = SymbianStreamGetBufferId(iOnScreenStream,iOnScreenBuffer,&bufferIndex,&surfaceId);
   1.361 +		if (error == KErrNone)
   1.362 +			{
   1.363 +			return CheckRect(*surfaceId,bufferIndex,aRect,aExpectedColor,aTolerance);
   1.364 +			}
   1.365 +		else
   1.366 +			{
   1.367 +			LOG(("OpenWFTest: *** Unable to get stream buffer id. error = %d",error));
   1.368 +			INFO_PRINTF2(_L("Unable to get stream buffer id. error = %d"),error);
   1.369 +			return EFalse;
   1.370 +			}
   1.371 +    	}
   1.372 +    else
   1.373 +    	{	//print out what we're hoping to see for manual testing
   1.374 +		LOG(("OpenWFTest: For rect %d %d %d %d",aRect.iTl.iX,aRect.iTl.iY,aRect.iBr.iX,aRect.iBr.iY));
   1.375 +		LOG(("OpenWFTest: The expected color is r=%d g=%d b=%d",aExpectedColor.Red(),aExpectedColor.Green(),
   1.376 +				aExpectedColor.Blue()));
   1.377 +		INFO_PRINTF5(_L("For rect %d %d %d %d"),aRect.iTl.iX,aRect.iTl.iY,aRect.iBr.iX,aRect.iBr.iY);
   1.378 +		INFO_PRINTF4(_L("The expected color is r=%d g=%d b=%d"),aExpectedColor.Red(),aExpectedColor.Green(),
   1.379 +				aExpectedColor.Blue());
   1.380 +		return ETrue;
   1.381 +    	}
   1.382 +	}
   1.383 +
   1.384 +/**
   1.385 + * checks the color within the given rectangle of the given surface
   1.386 + * returns ETrue on success
   1.387 + */
   1.388 +TBool COpenwfTest::CheckRect(const TSurfaceId& aSurface, TInt aBuffer,  TRect aRect,
   1.389 +		const TRgb& aExpectedColor, TInt aTolerance)
   1.390 +	{
   1.391 +	INFO_PRINTF1(_L("Starting pixel checking"));
   1.392 +	LOG(("OpenWFTest: *** Starting pixel checking"));
   1.393 +	// Check pixel data
   1.394 +	
   1.395 +	TBool success = iUtility->CheckRectColor(aSurface, aRect, aBuffer, aExpectedColor, aTolerance);
   1.396 +	if (success)
   1.397 +		{
   1.398 +		INFO_PRINTF1(_L("Finished pixel checking - pass"));
   1.399 +		LOG(("OpenWFTest: *** Finished pixel checking - pass"));
   1.400 +		}
   1.401 +	else
   1.402 +		{
   1.403 +		INFO_PRINTF1(_L("Finished pixel checking - fail"));
   1.404 +		LOG(("OpenWFTest: *** Finished pixel checking - fail"));
   1.405 +		}
   1.406 +    return success;
   1.407 +	}
   1.408 +
   1.409 +/**
   1.410 + * If in automatic mode it will save a TGA image of the on screen stream.
   1.411 + * It will also print the name of the reference image.
   1.412 + * Returns ETrue on success
   1.413 + */
   1.414 +TBool COpenwfTest::CheckOnScreenReferenceImage()
   1.415 +	{
   1.416 +	TInt error = KErrNone;
   1.417 +	//Create image file name
   1.418 +	_LIT(KSeparator, "_");
   1.419 +	_LIT(KTGAImgFormat, ".tga");
   1.420 +	iImageAddress.Zero();
   1.421 +	iImageAddress.Append(iTestName);
   1.422 +	iImageAddress.Append(KSeparator);
   1.423 +	iImageAddress.AppendNum(iImageCounter);
   1.424 +	iImageAddress.Append(KTGAImgFormat);
   1.425 +    
   1.426 +	LOGL((_L("Reference Image:%S"),&iImageAddress));
   1.427 +	INFO_PRINTF2(_L("Reference Image:%S"),&iImageAddress);
   1.428 +	//Add file path
   1.429 +	iImageAddress.Insert(0,iImageDirectory);
   1.430 +	iImageCounter++;
   1.431 +	
   1.432 +    if(iTestMode == EAutomatic && iSaveImage)
   1.433 +    	{
   1.434 +		if (iOnScreenStream == WFC_INVALID_HANDLE)
   1.435 +			{
   1.436 +			LOG(("OpenWFTest: *** We don't have access to the on screen stream",error));
   1.437 +			INFO_PRINTF1(_L("We don't have access to the on screen stream"));
   1.438 +			return EFalse;
   1.439 +			}
   1.440 +		const TSurfaceId* surfaceId = NULL;
   1.441 +		long bufferIndex;
   1.442 +		error = SymbianStreamGetBufferId(iOnScreenStream,iOnScreenBuffer,&bufferIndex,&surfaceId);
   1.443 +		if (error == KErrNone)
   1.444 +			{
   1.445 +			return SaveImage(*surfaceId,bufferIndex);
   1.446 +			}
   1.447 +		else
   1.448 +			{
   1.449 +			LOG(("OpenWFTest: *** Unable to get stream buffer id. error = %d",error));
   1.450 +			INFO_PRINTF2(_L("Unable to get stream buffer id. error = %d"),error);
   1.451 +			return EFalse;
   1.452 +			}
   1.453 +    	}
   1.454 +    return ETrue;
   1.455 +	}
   1.456 +
   1.457 +/**
   1.458 + *  helper function for saving images to files
   1.459 + *  returns ETrue on success
   1.460 + */
   1.461 +TBool COpenwfTest::SaveImage(const TSurfaceId& aSurface, TInt aNumOfBuffer)
   1.462 +    {
   1.463 +	if(iTestMode == EAutomatic && iSaveImage)
   1.464 +		{
   1.465 +		INFO_PRINTF1(_L("Start to save image"));
   1.466 +		LOG(("OpenWFTest: *** Start to save image"));
   1.467 +		TBool success = EFalse;
   1.468 +		TRAPD(error, success = iUtility->SaveResultImageTGAL(aSurface, aNumOfBuffer, iImageAddress));
   1.469 +		if(error != KErrNone || !success)
   1.470 +			{
   1.471 +			INFO_PRINTF1(_L("Failed saving image"));
   1.472 +			LOG(("OpenWFTest: *** Failed saving image"));
   1.473 +			return EFalse;
   1.474 +			}
   1.475 +		INFO_PRINTF1(_L("Saved image"));
   1.476 +		LOG(("OpenWFTest: *** Saved image"));
   1.477 +		}
   1.478 +    return ETrue;
   1.479 +    }
   1.480 +
   1.481 +/**
   1.482 + * Basic wait function call. Return amount of other active objects that stopped the scheduler
   1.483 +*/
   1.484 +TInt COpenwfTest::WaitL(TTimeIntervalMicroSeconds32 aDelay)	//aDelay in microseconds
   1.485 +	{
   1.486 +	CActiveWaiter* waiter = NULL;
   1.487 +	waiter = CActiveWaiter::NewL();
   1.488 +    TInt counter = waiter->Wait(aDelay);
   1.489 +	delete waiter;
   1.490 +	return counter;
   1.491 +	}
   1.492 +
   1.493 +/**
   1.494 + * aMaxDelay    The maximum time we are willing to wait in microseconds
   1.495 + * aNotifications   The amount of notifications we expect to complete, must be >0
   1.496 + * Returns ETrue on success
   1.497 +*/
   1.498 +TBool COpenwfTest::WaitForNotifications(TTimeIntervalMicroSeconds32 aMaxDelay,TInt aNotificatons)
   1.499 +    {
   1.500 +    if (aNotificatons == 0)
   1.501 +        {   //use WaitL if no notifications are expected
   1.502 +        return EFalse;
   1.503 +        }
   1.504 +    TTime before;
   1.505 +    TTime after;
   1.506 +    before.UniversalTime();
   1.507 +    TTimeIntervalMicroSeconds diff;
   1.508 +    TInt counter = aNotificatons;
   1.509 +    CActiveWaiter* waiter = NULL;
   1.510 +    TRAP_IGNORE(waiter = CActiveWaiter::NewL());
   1.511 +    if (!waiter)
   1.512 +        {
   1.513 +        INFO_PRINTF1(_L("Failed creating CActiveWaiter"));
   1.514 +        LOG(("OpenWFTest: *** Failed creating CActiveWaiter"));
   1.515 +        return EFalse;
   1.516 +        }
   1.517 +    waiter->StartWait(aMaxDelay);
   1.518 +    CActiveScheduler::Start();
   1.519 +    while(!waiter->iRun)
   1.520 +        {
   1.521 +        after.UniversalTime();
   1.522 +        diff = after.MicroSecondsFrom(before);
   1.523 +        if (diff > KNotificationWarning)
   1.524 +            {
   1.525 +            INFO_PRINTF2(_L("note: Notification took a long time to complete: %ld microseconds"),diff.Int64());
   1.526 +            LOG(("OpenWFTest: *** note: Notification took a long time to complete: %ld microseconds",diff.Int64()));
   1.527 +            }
   1.528 +        counter--;
   1.529 +        if (counter == 0)
   1.530 +            {   //all expected notifications were completed
   1.531 +            delete waiter;
   1.532 +            return ETrue;
   1.533 +            }
   1.534 +        CActiveScheduler::Start();
   1.535 +        }
   1.536 +    INFO_PRINTF2(_L("Not all notifications completed, counter=%d"),counter);
   1.537 +    LOG(("OpenWFTest: *** Not all notifications completed, counter=%d",counter));
   1.538 +    delete waiter;
   1.539 +    //the notifications didn't complete in time
   1.540 +    return EFalse;
   1.541 +    }
   1.542 +
   1.543 +// Create a suite of all the tests
   1.544 +CTestSuite* COpenwfTest::CreateSuiteL(const TDesC& aName)
   1.545 +	{
   1.546 +	SUB_SUITE_OPT(COpenwfTest,NULL);
   1.547 +		//positive fastpath tests
   1.548 +		ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0000L);
   1.549 +		ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0001L);
   1.550 +		ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0002L);
   1.551 +		ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0003L);
   1.552 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0004L);
   1.553 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0005L);
   1.554 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0006L);
   1.555 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0007L);
   1.556 +        //fastpath with notification tests
   1.557 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0010L);
   1.558 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0011L);
   1.559 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0012L);
   1.560 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0013L);
   1.561 +        //negative fastpath tests
   1.562 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0020L);
   1.563 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0021L);
   1.564 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0022L);
   1.565 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0023L);
   1.566 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0024L);
   1.567 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0025L);
   1.568 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0026L);
   1.569 +        ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0027L);
   1.570 +		
   1.571 +	END_SUITE;
   1.572 +	}
   1.573 +
   1.574 +void TefUnitFailLeaveL()
   1.575 +	{
   1.576 +	User::Leave(KErrTEFUnitFail);
   1.577 +	}
   1.578 +
   1.579 +CActiveNotification* CActiveNotification::NewL(RSurfaceUpdateSession& aSurfaceUpdateSession,TBool aActivate)
   1.580 +	{
   1.581 +	CActiveNotification* self = new (ELeave) CActiveNotification;
   1.582 +	CleanupStack::PushL(self);
   1.583 +	self->ConstructL(aSurfaceUpdateSession);
   1.584 +	CleanupStack::Pop(self);
   1.585 +	if (aActivate)
   1.586 +		{
   1.587 +		self->SetActive();
   1.588 +		}
   1.589 +	return self;
   1.590 +	}
   1.591 +
   1.592 +void CActiveNotification::ConstructL(RSurfaceUpdateSession& aSurfaceUpdateSession)
   1.593 +	{
   1.594 +	CActiveScheduler::Add(this);
   1.595 +	iSurfaceUpdateSession = aSurfaceUpdateSession;
   1.596 +	}
   1.597 +	
   1.598 +CActiveNotification::CActiveNotification() : CActive(EPriorityNormal)
   1.599 +	{}
   1.600 +
   1.601 +CActiveNotification::~CActiveNotification()
   1.602 +	{
   1.603 +	Cancel();
   1.604 +	}
   1.605 +
   1.606 +void CActiveNotification::DoCancel()
   1.607 +	{  //we need to cancel all notifications - this will impact other notifications in this sus session!
   1.608 +    iSurfaceUpdateSession.CancelAllUpdateNotifications();
   1.609 +	}
   1.610 +
   1.611 +void CActiveNotification::RunL()
   1.612 +	{
   1.613 +	CActiveScheduler::Stop();
   1.614 +	}
   1.615 +	
   1.616 +TInt CActiveNotification::RunError(TInt aError)
   1.617 +	{
   1.618 +	return aError; // exists so a break point can be placed on it.
   1.619 +	}
   1.620 +
   1.621 +void CActiveNotification::Activate()
   1.622 +	{
   1.623 +	SetActive();
   1.624 +	}
   1.625 +
   1.626 +CActiveWaiter* CActiveWaiter::NewL()
   1.627 +    {
   1.628 +	CActiveWaiter* self = new (ELeave) CActiveWaiter;
   1.629 +    CleanupStack::PushL(self);
   1.630 +    self->ConstructL();
   1.631 +    CleanupStack::Pop(self);
   1.632 +    return self;
   1.633 +    }
   1.634 +    
   1.635 +void CActiveWaiter::ConstructL()
   1.636 +    {
   1.637 +    User::LeaveIfError(iTimer.CreateLocal());
   1.638 +    CActiveScheduler::Add(this);
   1.639 +    }
   1.640 +    
   1.641 +CActiveWaiter::CActiveWaiter() : CActive(CActive::EPriorityStandard)
   1.642 +    {}
   1.643 +
   1.644 +CActiveWaiter::~CActiveWaiter()
   1.645 +    {
   1.646 +    Cancel();
   1.647 +    iTimer.Close();
   1.648 +    }
   1.649 +
   1.650 +void CActiveWaiter::DoCancel()
   1.651 +    {
   1.652 +    iTimer.Cancel();
   1.653 +    }
   1.654 +
   1.655 +void CActiveWaiter::RunL()
   1.656 +    {
   1.657 +	iRun = ETrue;
   1.658 +    CActiveScheduler::Stop();
   1.659 +    }
   1.660 +    
   1.661 +TInt CActiveWaiter::RunError(TInt aError)
   1.662 +    {
   1.663 +    return aError; // exists so a break point can be placed on it.
   1.664 +    }
   1.665 +
   1.666 +/**
   1.667 + * Waits the set amount of time. Returns the amount of times the active scheduler 
   1.668 + * was stopped (not including its own active scheduler stop)
   1.669 + */
   1.670 +TInt CActiveWaiter::Wait(TTimeIntervalMicroSeconds32 aDelay)   //microseconds
   1.671 +    {
   1.672 +	TInt counter = 0;
   1.673 +    SetActive();
   1.674 +    iTimer.After(iStatus, aDelay);
   1.675 +    iRun = EFalse;
   1.676 +    CActiveScheduler::Start();
   1.677 +    while (!iRun)
   1.678 +    	{//may be another object that stops the scheduler running in these tests.
   1.679 +		counter++;
   1.680 +		CActiveScheduler::Start();
   1.681 +    	}
   1.682 +    return counter;
   1.683 +    }
   1.684 +
   1.685 +/**
   1.686 + * Starts an AO with the given delay. Remember the RunL will stop the active scheduler.
   1.687 + */
   1.688 +void CActiveWaiter::StartWait(TTimeIntervalMicroSeconds32 aDelay)   //microseconds
   1.689 +    {
   1.690 +    SetActive();
   1.691 +    iTimer.After(iStatus, aDelay);
   1.692 +    }
   1.693 +
   1.694 +/*
   1.695 +@SYMTestCaseID          GRAPHICS-OPENWFC-FASTPATH-0000
   1.696 +@SYMTestCaseDesc        Positive testing - Fastpath one-element scene
   1.697 +@SYMREQ                 
   1.698 +@SYMPREQ                PREQ417-54885
   1.699 +@SYMTestType            Unit Test
   1.700 +@SYMTestPriority        High
   1.701 +@SYMTestPurpose         Check a scene meeting fastpath criteria can be fastpathed
   1.702 +@SYMTestActions         
   1.703 +    All compositions are autonomous:
   1.704 +    Compose an empty scene
   1.705 +    Create a scene containing a screen sized element with no scaling, no alpha, no mask, no rotation
   1.706 +    Compose the scene
   1.707 +@SYMTestExpectedResults
   1.708 +    The final scene should be fastpathed    
   1.709 +*/
   1.710 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0000L()
   1.711 +	{
   1.712 +    iTestName = _L("FASTPATH_0000");
   1.713 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
   1.714 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
   1.715 +    SetupEmptySceneL();
   1.716 +    
   1.717 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
   1.718 +                                                iFastpathablePixelFormat,
   1.719 +                                                iStride, iContiguous, iMaxBuffers);
   1.720 +    ASSERT_FALSE(surface.IsNull());
   1.721 +
   1.722 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
   1.723 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
   1.724 +    ASSERT_EQUALS(err,KErrNone);
   1.725 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
   1.726 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
   1.727 +    
   1.728 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
   1.729 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
   1.730 +    
   1.731 +#ifdef BREAKPOINT_FASTPATH
   1.732 +    __BREAKPOINT();
   1.733 +#endif
   1.734 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
   1.735 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
   1.736 +    wfcCommit(iDevice, iContext, WFC_TRUE);
   1.737 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
   1.738 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
   1.739 +    LOG(("OpenWFTest: Fastpath - Now ON"));
   1.740 +    
   1.741 +    iUtility->FillSurfaceL(surface, 0, KGreen);
   1.742 +    err = iUtility->SubmitUpdate(surface, 0, NULL);
   1.743 +    ASSERT_EQUALS(err,KErrNone);
   1.744 +    WaitL(iCompositionPause);
   1.745 +    
   1.746 +    ASSERT_TRUE(AcquireOnScreenStream());
   1.747 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
   1.748 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
   1.749 +    ReleaseOnScreenStream();
   1.750 +
   1.751 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
   1.752 +    wfcDestroySource(iDevice, fpSource);
   1.753 +	}
   1.754 +
   1.755 +/*
   1.756 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0001
   1.757 +@SYMTestCaseDesc		Positive testing - Fastpath one-element scene  
   1.758 +@SYMREQ					
   1.759 +@SYMPREQ						PREQ417-54885
   1.760 +@SYMTestType				Unit Test
   1.761 +@SYMTestPriority		High	
   1.762 +@SYMTestPurpose			Check a scene including a full screen element with global alpha at opaque level 
   1.763 +										can be fastpathed
   1.764 +@SYMTestActions			
   1.765 +	All compositions are autonomous:
   1.766 +	Compose an empty scene
   1.767 +	Create a scene containing a screen sized element with 2 buffers
   1.768 +	Enable WFC_TRANPARENCY_GLOBAL_ALPHA 
   1.769 +	Set WFC_ELEMENT_GLOBAL_ALPHA to be 255 (opaque)
   1.770 +	Compose the scene
   1.771 +@SYMTestExpectedResults
   1.772 +	The final scene should be fastpathed
   1.773 +*/
   1.774 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0001L()
   1.775 +	{
   1.776 +    iTestName = _L("FASTPATH_0001");
   1.777 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
   1.778 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
   1.779 +    SetupEmptySceneL();
   1.780 +    
   1.781 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
   1.782 +                                                iFastpathablePixelFormat,
   1.783 +                                                iStride, iContiguous, iMaxBuffers);
   1.784 +    ASSERT_FALSE(surface.IsNull());
   1.785 +
   1.786 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
   1.787 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
   1.788 +    ASSERT_EQUALS(err,KErrNone);
   1.789 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
   1.790 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
   1.791 +    
   1.792 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
   1.793 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
   1.794 +    //set element global alpha
   1.795 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA);
   1.796 +    wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 1.0f);
   1.797 +    
   1.798 +#ifdef BREAKPOINT_FASTPATH
   1.799 +    __BREAKPOINT();
   1.800 +#endif
   1.801 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
   1.802 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element alpha"));
   1.803 +    wfcCommit(iDevice, iContext, WFC_TRUE);
   1.804 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
   1.805 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
   1.806 +    LOG(("OpenWFTest: Fastpath - now ON - using element alpha"));
   1.807 +    
   1.808 +    iUtility->FillSurfaceL(surface, 0, KGreen);
   1.809 +    err = iUtility->SubmitUpdate(surface, 0, NULL);
   1.810 +    ASSERT_EQUALS(err,KErrNone);
   1.811 +    WaitL(iCompositionPause);	
   1.812 + 
   1.813 +    ASSERT_TRUE(AcquireOnScreenStream());
   1.814 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
   1.815 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
   1.816 +    ReleaseOnScreenStream();
   1.817 +
   1.818 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
   1.819 +    wfcDestroySource(iDevice, fpSource);  
   1.820 +	}
   1.821 +
   1.822 +/*
   1.823 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0002
   1.824 +@SYMTestCaseDesc		Positive testing - Fastpath one-element scene  
   1.825 +@SYMREQ					
   1.826 +@SYMPREQ						PREQ417-54885
   1.827 +@SYMTestType				Unit Test
   1.828 +@SYMTestPriority		High
   1.829 +@SYMTestPurpose			Check a scene including a full screen element with source alpha flagged but an 
   1.830 +										opaque data format can be fastpathed
   1.831 +@SYMTestActions			
   1.832 +	All compositions are autonomous:
   1.833 +	Compose an empty scene
   1.834 +	Create a scene containing a screen sized element 
   1.835 +	Enable WFC_TRANSPARENCY_SOURCE, but the source format has no alpha value 
   1.836 +	Compose the scene
   1.837 +@SYMTestExpectedResults
   1.838 +	The final scene should be fastpathed
   1.839 +*/	
   1.840 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0002L()
   1.841 +	{
   1.842 +    iTestName = _L("FASTPATH_0002");
   1.843 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
   1.844 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
   1.845 +    SetupEmptySceneL();
   1.846 +    
   1.847 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
   1.848 +												EUidPixelFormatXRGB_8888,
   1.849 +                                                iStride, iContiguous, iMaxBuffers);
   1.850 +    ASSERT_FALSE(surface.IsNull());
   1.851 +
   1.852 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
   1.853 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
   1.854 +    ASSERT_EQUALS(err,KErrNone);
   1.855 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
   1.856 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
   1.857 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
   1.858 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
   1.859 +    //set pixel alpha on XRGB element
   1.860 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_SOURCE);
   1.861 +    
   1.862 +#ifdef BREAKPOINT_FASTPATH
   1.863 +    __BREAKPOINT();
   1.864 +#endif
   1.865 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
   1.866 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit - using pixel alpha"));
   1.867 +    wfcCommit(iDevice, iContext, WFC_TRUE);
   1.868 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
   1.869 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
   1.870 +    LOG(("OpenWFTest: Fastpath - now ON - using pixel alpha"));
   1.871 +    
   1.872 +    iUtility->FillSurfaceL(surface, 0, KGreen);
   1.873 +    err = iUtility->SubmitUpdate(surface, 0, NULL);
   1.874 +    ASSERT_EQUALS(err,KErrNone);
   1.875 +    WaitL(iCompositionPause);
   1.876 + 
   1.877 +    ASSERT_TRUE(AcquireOnScreenStream());
   1.878 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
   1.879 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
   1.880 +    ReleaseOnScreenStream();
   1.881 +
   1.882 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
   1.883 +    wfcDestroySource(iDevice, fpSource);  
   1.884 +	}
   1.885 +
   1.886 +/*
   1.887 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0003
   1.888 +@SYMTestCaseDesc		Positive testing - Fastpath scene with a double buffered element
   1.889 +@SYMREQ					
   1.890 +@SYMPREQ						PREQ417-54885
   1.891 +@SYMTestType				Unit Test
   1.892 +@SYMTestPriority		High
   1.893 +@SYMTestPurpose			Check if a scene is fastpathed using the second buffer
   1.894 +@SYMTestActions			
   1.895 +	All compositions are autonomous:
   1.896 +	Compose an empty scene
   1.897 +	A) Create a scene containing an element with 2 buffers
   1.898 +	Set the element screen size
   1.899 +	Set destination and source rectangle to screen size
   1.900 +	Compose the scene
   1.901 +	B) Send an update to buffer 1 with change of colour
   1.902 +	Wait for notification
   1.903 +@SYMTestExpectedResults
   1.904 +	The scene should be fastpathed for A and B
   1.905 +	Screen colour should change after B
   1.906 +*/
   1.907 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0003L()
   1.908 +	{
   1.909 +    iTestName = _L("FASTPATH_0003");
   1.910 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
   1.911 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
   1.912 +    SetupEmptySceneL();
   1.913 +    
   1.914 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
   1.915 +                                                iFastpathablePixelFormat,
   1.916 +                                                iStride, iContiguous, iMaxBuffers);
   1.917 +    ASSERT_FALSE(surface.IsNull());
   1.918 +
   1.919 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
   1.920 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
   1.921 +    ASSERT_EQUALS(err,KErrNone);
   1.922 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
   1.923 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
   1.924 +    
   1.925 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
   1.926 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
   1.927 +    
   1.928 +#ifdef BREAKPOINT_FASTPATH
   1.929 +    __BREAKPOINT();
   1.930 +#endif
   1.931 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
   1.932 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
   1.933 +    wfcCommit(iDevice, iContext, WFC_TRUE);
   1.934 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
   1.935 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
   1.936 +    LOG(("OpenWFTest: Fastpath - now ON"));
   1.937 +    
   1.938 +    iUtility->FillSurfaceL(surface, 0, KGreen);
   1.939 +    err = iUtility->SubmitUpdate(surface, 0, NULL);
   1.940 +    ASSERT_EQUALS(err,KErrNone);
   1.941 +    WaitL(iCompositionPause);	
   1.942 + 
   1.943 +    ASSERT_TRUE(AcquireOnScreenStream());
   1.944 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
   1.945 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
   1.946 +    ReleaseOnScreenStream();
   1.947 +    
   1.948 +    //Fill surface is blue
   1.949 +    iUtility->FillSurfaceL(surface, 1, KBlue);
   1.950 +	//Do content update for surface buff1
   1.951 +    CActiveNotification* buff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
   1.952 +    CleanupStack::PushL(buff1disp);
   1.953 +    TTimeStamp buff1time;
   1.954 +    iUtility->NotifyWhenDisplayed(buff1disp->iStatus,buff1time);
   1.955 +    
   1.956 +    LOG(("OpenWFTest: Fastpath - staying ON..."));
   1.957 +    err = iUtility->SubmitUpdate(surface, 1, NULL);
   1.958 +	ASSERT_EQUALS(err,KErrNone);
   1.959 +    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1));	//1 AO should have completed
   1.960 +    
   1.961 +    //create ref image/check on screen content
   1.962 +    ASSERT_TRUE(AcquireOnScreenStream());
   1.963 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
   1.964 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBlue,iTolerance));
   1.965 +    ReleaseOnScreenStream();
   1.966 +
   1.967 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
   1.968 +    wfcDestroySource(iDevice, fpSource);
   1.969 +    CleanupStack::PopAndDestroy(buff1disp);
   1.970 +	}
   1.971 +
   1.972 +/*
   1.973 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0004
   1.974 +@SYMTestCaseDesc		Positive testing - Fastpath two-element scene 
   1.975 +@SYMREQ					
   1.976 +@SYMPREQ						PREQ417-54885
   1.977 +@SYMTestType				Unit Test
   1.978 +@SYMTestPriority		Medium
   1.979 +@SYMTestPurpose			Check a scene including a full screen opaque element as the top layer can be 
   1.980 +										fastpathed
   1.981 +@SYMTestActions			
   1.982 +	All compositions are autonomous:
   1.983 +	Compose an empty scene
   1.984 +	A) Create a scene containing a screen sized element with WFC_TRANSPARENCY_NONE enabled
   1.985 +	Compose the scene
   1.986 +  B) Create a small rectangle behind the first element
   1.987 +	Compose the scene
   1.988 +*/
   1.989 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0004L()
   1.990 +	{
   1.991 +    iTestName = _L("FASTPATH_0004");
   1.992 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
   1.993 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
   1.994 +    SetupEmptySceneL();
   1.995 +	
   1.996 +	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
   1.997 +												iFastpathablePixelFormat,
   1.998 +												iStride, iContiguous, iMaxBuffers);
   1.999 +	ASSERT_FALSE(surface.IsNull());
  1.1000 +
  1.1001 +	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.1002 +	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.1003 +	ASSERT_EQUALS(err,KErrNone);
  1.1004 +	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.1005 +	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);	
  1.1006 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.1007 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.1008 +	
  1.1009 +    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
  1.1010 +                                                iFastpathablePixelFormat,
  1.1011 +                                                iStride, iContiguous, iMaxBuffers);
  1.1012 +    ASSERT_FALSE(surfaceB.IsNull());
  1.1013 +    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
  1.1014 +    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1015 +    ASSERT_EQUALS(err,KErrNone);
  1.1016 +    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
  1.1017 +    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
  1.1018 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
  1.1019 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
  1.1020 +	
  1.1021 +#ifdef BREAKPOINT_FASTPATH
  1.1022 +    __BREAKPOINT();
  1.1023 +#endif
  1.1024 +	wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.1025 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.1026 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1027 +	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1028 +	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1029 +	LOG(("OpenWFTest: Fastpath - now ON"));
  1.1030 +	
  1.1031 +	iUtility->FillSurfaceL(surface, 0, KGreen);
  1.1032 +	err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.1033 +	ASSERT_EQUALS(err,KErrNone);
  1.1034 +	WaitL(iCompositionPause);
  1.1035 + 
  1.1036 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1037 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1038 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
  1.1039 +    ReleaseOnScreenStream();
  1.1040 +	
  1.1041 +    LOG(("OpenWFTest: Fastpath - staying ON..."));
  1.1042 +#ifdef BREAKPOINT_FASTPATH
  1.1043 +    __BREAKPOINT();
  1.1044 +#endif
  1.1045 +	wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE);
  1.1046 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.1047 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1048 +	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1049 +	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1050 +	
  1.1051 +	iUtility->FillSurfaceL(surfaceB, 0, KBlue);
  1.1052 +	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1053 +	ASSERT_EQUALS(err,KErrNone);
  1.1054 +	WaitL(iCompositionPause);
  1.1055 + 
  1.1056 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1057 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1058 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
  1.1059 +    ReleaseOnScreenStream();
  1.1060 +
  1.1061 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.1062 +	wfcDestroySource(iDevice, fpSource);
  1.1063 +	wfcDestroySource(iDevice, sourceB);  
  1.1064 +	}
  1.1065 +
  1.1066 +/*
  1.1067 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0005
  1.1068 +@SYMTestCaseDesc		Positive testing - Fastpath two-element scene 
  1.1069 +@SYMREQ					
  1.1070 +@SYMPREQ						PREQ417-54885
  1.1071 +@SYMTestType				Unit Test
  1.1072 +@SYMTestPriority		Medium	
  1.1073 +@SYMTestPurpose			Check a scene including a full screen element with global alpha as the top layer 
  1.1074 +										can be fastpathed
  1.1075 +@SYMTestActions			
  1.1076 +	All compositions are autonomous:
  1.1077 +	Compose an empty scene
  1.1078 +	A) Create a scene containing a screen sized element 
  1.1079 +	Enable WFC_TRANPARENCY_GLOBAL_ALPHA and set WFC_ELEMENT_GLOBAL_ALPHA to be 255 (opaque)
  1.1080 +	Compose the scene
  1.1081 +	B) Create a smaller element behind the first element
  1.1082 +	Compose the scene
  1.1083 +@SYMTestExpectedResults
  1.1084 +	Both compositions should trigger fastpathing.
  1.1085 +*/
  1.1086 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0005L()
  1.1087 +	{
  1.1088 +    iTestName = _L("FASTPATH_0005");
  1.1089 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.1090 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.1091 +    SetupEmptySceneL();
  1.1092 +	
  1.1093 +	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.1094 +												iFastpathablePixelFormat,
  1.1095 +												iStride, iContiguous, iMaxBuffers);
  1.1096 +	ASSERT_FALSE(surface.IsNull());
  1.1097 +
  1.1098 +	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.1099 +	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.1100 +	ASSERT_EQUALS(err,KErrNone);
  1.1101 +	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.1102 +	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);	
  1.1103 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.1104 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.1105 +//set element global alpha
  1.1106 +	wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 1.0f);
  1.1107 +	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA);
  1.1108 +	
  1.1109 +    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
  1.1110 +                                                iFastpathablePixelFormat,
  1.1111 +                                                iStride, iContiguous, iMaxBuffers);
  1.1112 +    ASSERT_FALSE(surfaceB.IsNull());
  1.1113 +    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
  1.1114 +    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1115 +    ASSERT_EQUALS(err,KErrNone);
  1.1116 +    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
  1.1117 +    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
  1.1118 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
  1.1119 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
  1.1120 +	
  1.1121 +#ifdef BREAKPOINT_FASTPATH
  1.1122 +    __BREAKPOINT();
  1.1123 +#endif
  1.1124 +	wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.1125 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element global alpha"));
  1.1126 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1127 +	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1128 +	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1129 +	LOG(("OpenWFTest: Fastpath - now ON... - using element global alpha"));
  1.1130 +	
  1.1131 +	iUtility->FillSurfaceL(surface, 0, KGreen);
  1.1132 +	ASSERT_EQUALS(iUtility->SubmitUpdate(surface, 0, NULL),KErrNone);
  1.1133 +	WaitL(iCompositionPause);
  1.1134 + 
  1.1135 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1136 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1137 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
  1.1138 +    ReleaseOnScreenStream();
  1.1139 +	
  1.1140 +
  1.1141 +#ifdef BREAKPOINT_FASTPATH
  1.1142 +    __BREAKPOINT();
  1.1143 +#endif
  1.1144 +	wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE);
  1.1145 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element global alpha"));
  1.1146 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1147 +	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1148 +	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1149 +	
  1.1150 +	iUtility->FillSurfaceL(surfaceB, 0, KBlue);
  1.1151 +	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1152 +	ASSERT_EQUALS(err,KErrNone);
  1.1153 +	WaitL(iCompositionPause);	
  1.1154 + 
  1.1155 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1156 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1157 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
  1.1158 +    ReleaseOnScreenStream();
  1.1159 +
  1.1160 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.1161 +	wfcDestroySource(iDevice, fpSource);
  1.1162 +	wfcDestroySource(iDevice, sourceB);  
  1.1163 +	}
  1.1164 +
  1.1165 +/*
  1.1166 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0006
  1.1167 +@SYMTestCaseDesc		Positive testing - Fastpath two-element scene 
  1.1168 +@SYMREQ					
  1.1169 +@SYMPREQ						PREQ417-54885
  1.1170 +@SYMTestType				Unit Test
  1.1171 +@SYMTestPriority		Low
  1.1172 +@SYMTestPurpose			Check a scene including a full screen opaque element behind a transparent element 
  1.1173 +										can be fastpathed
  1.1174 +@SYMTestActions			
  1.1175 +	All compositions are autonomous:
  1.1176 +	Compose an empty scene
  1.1177 +	A) Create a scene containing an element of any size 
  1.1178 +	Enable WFC_TRANPARENCY_GLOBAL_ALPHA and set WFC_ELEMENT_GLOBAL_ALPHA to 0 (transparent)
  1.1179 +	Compose the scene
  1.1180 +	B) Create another screen sized opaque element behind the frist 
  1.1181 +	Compose the scene
  1.1182 +@SYMTestExpectedResults
  1.1183 +	The final scene should fastpath for B), not for A)	
  1.1184 +	(The current implementation does not support this fastpath behaviour. This test can be ignored at 
  1.1185 +	the moment.)
  1.1186 +*/
  1.1187 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0006L()
  1.1188 +	{
  1.1189 +    iTestName = _L("FASTPATH_0006");
  1.1190 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.1191 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.1192 +    SetupEmptySceneL();
  1.1193 +	
  1.1194 +	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
  1.1195 +												iFastpathablePixelFormat,
  1.1196 +												iStride, iContiguous, iMaxBuffers);
  1.1197 +	ASSERT_FALSE(surface.IsNull());
  1.1198 +
  1.1199 +	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.1200 +	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.1201 +	ASSERT_EQUALS(err,KErrNone);
  1.1202 +	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.1203 +	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);	
  1.1204 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
  1.1205 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
  1.1206 +	//set element global alpha fully transparent
  1.1207 +	wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 0.0f);
  1.1208 +	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA);
  1.1209 +	
  1.1210 +    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.1211 +													iFastpathablePixelFormat,
  1.1212 +													iStride, iContiguous, iMaxBuffers);
  1.1213 +    ASSERT_FALSE(surfaceB.IsNull());
  1.1214 +    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
  1.1215 +    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1216 +    ASSERT_EQUALS(err,KErrNone);
  1.1217 +    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
  1.1218 +    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
  1.1219 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.1220 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.1221 +	
  1.1222 +#ifdef BREAKPOINT_FASTPATH
  1.1223 +    __BREAKPOINT();
  1.1224 +#endif
  1.1225 +	wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.1226 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit -single fully transparent element using global alpha"));
  1.1227 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1228 +	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1229 +	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1230 +	LOG(("OpenWFTest: Fastpath - now ON - single fully transparent element using global alpha"));
  1.1231 +	
  1.1232 +	iUtility->FillSurfaceL(surface, 0, KGreen);
  1.1233 +	err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.1234 +	ASSERT_EQUALS(err,KErrNone);
  1.1235 +	WaitL(iCompositionPause);	
  1.1236 + 
  1.1237 +#ifdef BREAKPOINT_FASTPATH
  1.1238 +    __BREAKPOINT();
  1.1239 +#endif
  1.1240 +	wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE);
  1.1241 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit -fullscreen opaque element behind fully transparent element"));
  1.1242 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1243 +	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1244 +	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1245 +	LOG(("OpenWFTest: Fastpath - now ON - fullscreen opaque element behind transparent element"));
  1.1246 +	
  1.1247 +	iUtility->FillSurfaceL(surfaceB, 0, KBlue);
  1.1248 +	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1249 +	ASSERT_EQUALS(err,KErrNone);
  1.1250 +	WaitL(iCompositionPause);	
  1.1251 + 
  1.1252 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1253 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1254 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBlue,iTolerance));
  1.1255 +    ReleaseOnScreenStream();
  1.1256 +
  1.1257 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.1258 +	wfcDestroySource(iDevice, fpSource);
  1.1259 +	wfcDestroySource(iDevice, sourceB);  
  1.1260 +	}
  1.1261 +
  1.1262 +/*
  1.1263 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0007
  1.1264 +@SYMTestCaseDesc		Positive testing - Fastpath one-element scene  
  1.1265 +@SYMREQ					
  1.1266 +@SYMPREQ						PREQ417-54885
  1.1267 +@SYMTestType				Unit Test
  1.1268 +@SYMTestPriority		High
  1.1269 +@SYMTestPurpose			Check a scene including destination rectangle changes can trigger fastpath on and off
  1.1270 +@SYMTestActions			
  1.1271 +	All compositions are autonomous:
  1.1272 +	Compose an empty scene
  1.1273 +	Create a scene containing a screen sized element 
  1.1274 +	Compose scene
  1.1275 +	Set the destination rectangle smaller than screen size
  1.1276 +	Compose the scene
  1.1277 +	Set the destination rectangle back to screen size
  1.1278 +	Compose the scene
  1.1279 +@SYMTestExpectedResults
  1.1280 +	The scenes with the element of full screen destination rectangle should be fastpathed	
  1.1281 +	The scene with the element of smaller destination rectangle should not be fastpathed
  1.1282 +*/
  1.1283 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0007L()
  1.1284 +	{
  1.1285 +    iTestName = _L("FASTPATH_0007");
  1.1286 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.1287 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.1288 +    SetupEmptySceneL();
  1.1289 +	
  1.1290 +	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.1291 +												iFastpathablePixelFormat,
  1.1292 +												iStride, iContiguous, iMaxBuffers);
  1.1293 +	ASSERT_FALSE(surface.IsNull());
  1.1294 +
  1.1295 +	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.1296 +	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.1297 +	ASSERT_EQUALS(err,KErrNone);
  1.1298 +	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.1299 +	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);	
  1.1300 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.1301 +	//NOT full screen destination
  1.1302 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
  1.1303 +	
  1.1304 +#ifdef BREAKPOINT_FASTPATH
  1.1305 +    __BREAKPOINT();
  1.1306 +#endif
  1.1307 +	wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.1308 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
  1.1309 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1310 +	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1311 +	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1312 +	LOG(("OpenWFTest: Fastpath - still OFF"));
  1.1313 +	
  1.1314 +	iUtility->FillSurfaceL(surface, 0, KGreen);
  1.1315 +	err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.1316 +	ASSERT_EQUALS(err,KErrNone);
  1.1317 +	WaitL(iCompositionPause);	
  1.1318 + 
  1.1319 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1320 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1321 +    ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KGreen,iTolerance));
  1.1322 +    ReleaseOnScreenStream();
  1.1323 +	
  1.1324 +	//NOW set full screen
  1.1325 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.1326 +	
  1.1327 +#ifdef BREAKPOINT_FASTPATH
  1.1328 +    __BREAKPOINT();
  1.1329 +#endif
  1.1330 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.1331 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1332 +	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1333 +	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1334 +	WaitL(iCompositionPause);
  1.1335 + 
  1.1336 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1337 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1338 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
  1.1339 +    ReleaseOnScreenStream();
  1.1340 +
  1.1341 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.1342 +	wfcDestroySource(iDevice, fpSource);  
  1.1343 +	}
  1.1344 +
  1.1345 +//NOTIFICATION TESTS
  1.1346 +void COpenwfTest::FastpathNotificationsTestL(TBool aAutonomous)
  1.1347 +	{
  1.1348 +    SetupEmptySceneL(aAutonomous);
  1.1349 +
  1.1350 +    //Create 3 elements A+C fastpathable, B centered
  1.1351 +    TSurfaceId surfaceA = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.1352 +                                                iFastpathablePixelFormat,
  1.1353 +                                                iStride, iContiguous, iMaxBuffers);
  1.1354 +    ASSERT_FALSE(surfaceA.IsNull());
  1.1355 +    WFCSource sourceA = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceA), NULL);
  1.1356 +    TInt err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
  1.1357 +    ASSERT_EQUALS(err,KErrNone);
  1.1358 +    WFCElement elementA = wfcCreateElement(iDevice, iContext, NULL);
  1.1359 +    wfcSetElementAttribi(iDevice, elementA, WFC_ELEMENT_SOURCE, sourceA);
  1.1360 +    wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.1361 +    wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.1362 +    
  1.1363 +    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
  1.1364 +                                                iFastpathablePixelFormat,
  1.1365 +                                                iStride, iContiguous, iMaxBuffers);
  1.1366 +    ASSERT_FALSE(surfaceB.IsNull());
  1.1367 +    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
  1.1368 +    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1369 +    ASSERT_EQUALS(err,KErrNone);
  1.1370 +    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
  1.1371 +    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
  1.1372 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
  1.1373 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
  1.1374 +    
  1.1375 +    TSurfaceId surfaceC = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.1376 +                                                iFastpathablePixelFormat,
  1.1377 +                                                iStride, iContiguous, iMaxBuffers);
  1.1378 +    ASSERT_FALSE(surfaceC.IsNull());
  1.1379 +    WFCSource sourceC = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceC), NULL);
  1.1380 +    err = iUtility->SubmitUpdate(surfaceC, 0, NULL);
  1.1381 +    ASSERT_EQUALS(err,KErrNone);
  1.1382 +    WFCElement elementC = wfcCreateElement(iDevice, iContext, NULL);
  1.1383 +    wfcSetElementAttribi(iDevice, elementC, WFC_ELEMENT_SOURCE, sourceC);
  1.1384 +    wfcSetElementAttribiv(iDevice, elementC, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.1385 +    wfcSetElementAttribiv(iDevice, elementC, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.1386 +
  1.1387 +    //**********STARTING ACTUAL TEST!**********
  1.1388 +    //**********SURFACE A FASTPATHABLE**********
  1.1389 +	//Add A to scene
  1.1390 +    wfcInsertElement(iDevice, elementA, WFC_INVALID_HANDLE);
  1.1391 +#ifdef BREAKPOINT_FASTPATH
  1.1392 +    __BREAKPOINT();
  1.1393 +#endif
  1.1394 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.1395 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1396 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1397 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1398 +    LOG(("OpenWFTest: Fastpath - now ON"));
  1.1399 +	//Set A buffer0 red
  1.1400 +    iUtility->FillSurfaceL(surfaceA, 0, KRed);
  1.1401 +	//Do content update Abuff0 idisp iavail
  1.1402 +    CActiveNotification* surfAbuff0disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1403 +    CleanupStack::PushL(surfAbuff0disp);
  1.1404 +    TTimeStamp surfAbuff0time;
  1.1405 +    CActiveNotification* surfAbuff0avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1406 +    CleanupStack::PushL(surfAbuff0avail);
  1.1407 +    //iUtility->NotifyWhenDisplayed(surfAbuff0disp,surfAbuff0time);
  1.1408 +    iUtility->NotifyWhenDisplayed(surfAbuff0disp->iStatus,surfAbuff0time);
  1.1409 +    iUtility->NotifyWhenAvailable(surfAbuff0avail->iStatus); 
  1.1410 +    err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
  1.1411 +	ASSERT_EQUALS(err,KErrNone);
  1.1412 +	
  1.1413 +    if(!aAutonomous)
  1.1414 +    	{
  1.1415 +        WaitL(iCompositionPause);
  1.1416 +		//Check A buff0 iDisp doesnt complete
  1.1417 +		ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KRequestPending);
  1.1418 +		//Check A buff0 iAvail doesnt complete
  1.1419 +		ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
  1.1420 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1421 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1422 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1423 +    	}
  1.1424 +    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1));
  1.1425 +	
  1.1426 +	//Check A buff0 iDisp completes
  1.1427 +    ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KErrNone);
  1.1428 +	//Check A buff0 iAvail doesnt complete
  1.1429 +    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
  1.1430 +    
  1.1431 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1432 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1433 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KRed,iTolerance));
  1.1434 +    ReleaseOnScreenStream();
  1.1435 +
  1.1436 +	//Set A buffer1 Yellow
  1.1437 +    iUtility->FillSurfaceL(surfaceA, 1, KYellow);
  1.1438 +	
  1.1439 +	//Check A buff0 iavail doesnt complete
  1.1440 +    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
  1.1441 +    
  1.1442 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1443 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1444 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KRed,iTolerance));
  1.1445 +	ReleaseOnScreenStream();
  1.1446 +	
  1.1447 +	//Do content update Abuff1 idisp iavail
  1.1448 +    CActiveNotification* surfAbuff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1449 +    CleanupStack::PushL(surfAbuff1disp);
  1.1450 +    TTimeStamp surfAbuff1time;
  1.1451 +    CActiveNotification* surfAbuff1avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1452 +    CleanupStack::PushL(surfAbuff1avail);
  1.1453 +    iUtility->NotifyWhenDisplayed(surfAbuff1disp->iStatus,surfAbuff1time);
  1.1454 +    iUtility->NotifyWhenAvailable(surfAbuff1avail->iStatus); 
  1.1455 +    err = iUtility->SubmitUpdate(surfaceA, 1, NULL);
  1.1456 +    ASSERT_EQUALS(err,KErrNone);
  1.1457 +    
  1.1458 +    if(!aAutonomous)
  1.1459 +    	{
  1.1460 +        WaitL(iCompositionPause);
  1.1461 +		//Check A buff1 iDisp doesnt complete
  1.1462 +		ASSERT_EQUALS(surfAbuff1disp->iStatus.Int(),KRequestPending);
  1.1463 +		//Check A buff1 iAvail doesnt complete
  1.1464 +		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1465 +		//Check A buff0 iAvail doesnt complete
  1.1466 +	    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
  1.1467 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1468 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1469 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1470 +    	}
  1.1471 +    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
  1.1472 +	
  1.1473 +	//Check A buff1 idisp completes
  1.1474 +    ASSERT_EQUALS(surfAbuff1disp->iStatus.Int(),KErrNone);
  1.1475 +	//Check A buff0 iAvail completes
  1.1476 +    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KErrNone);
  1.1477 +	//Check A buff1 iAvail doesnt complete
  1.1478 +    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1479 +    
  1.1480 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1481 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1482 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KYellow,iTolerance));
  1.1483 +	ReleaseOnScreenStream();
  1.1484 +	
  1.1485 +	//**********SURFACE B NOT VISIBLE**********
  1.1486 +	//Add surfaceB to scene behind surfaceA
  1.1487 +    wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE);
  1.1488 +#ifdef BREAKPOINT_FASTPATH
  1.1489 +    __BREAKPOINT();
  1.1490 +#endif
  1.1491 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.1492 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1493 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1494 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1495 +    LOG(("OpenWFTest: Fastpath - still ON"));
  1.1496 +	//Set B buffer0 green
  1.1497 +    iUtility->FillSurfaceL(surfaceB, 0, KGreen);
  1.1498 +	//Do content update idisp iavail
  1.1499 +    CActiveNotification* surfBbuff0disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1500 +    CleanupStack::PushL(surfBbuff0disp);
  1.1501 +    TTimeStamp surfBbuff0time;
  1.1502 +    CActiveNotification* surfBbuff0avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1503 +    CleanupStack::PushL(surfBbuff0avail);
  1.1504 +    iUtility->NotifyWhenDisplayed(surfBbuff0disp->iStatus,surfBbuff0time);
  1.1505 +    iUtility->NotifyWhenAvailable(surfBbuff0avail->iStatus); 
  1.1506 +    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1507 +	ASSERT_EQUALS(err,KErrNone);
  1.1508 +	
  1.1509 +    if(!aAutonomous)
  1.1510 +    	{
  1.1511 +        WaitL(iCompositionPause);
  1.1512 +		//Check B buff0 iAvail doesnt complete
  1.1513 +		ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
  1.1514 +		//Check B buff0 iDisp doesnt complete
  1.1515 +		ASSERT_EQUALS(surfBbuff0disp->iStatus.Int(),KRequestPending);
  1.1516 +		//Check A buff1 iAvail doesnt complete
  1.1517 +		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1518 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1519 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1520 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1521 +    	}
  1.1522 +    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1));
  1.1523 +    
  1.1524 +	//Check B buff0 idisp completes - could be no error or not visible
  1.1525 +    ASSERT_TRUE((surfBbuff0disp->iStatus.Int()==KErrNotVisible)||(surfBbuff0disp->iStatus.Int()==KErrNone));
  1.1526 +	//Check B buff0 iavail doesnt complete
  1.1527 +    ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
  1.1528 +	//Check A buff1 iavail doesnt complete
  1.1529 +    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1530 +	
  1.1531 +	//Set B buffer1 blue
  1.1532 +	iUtility->FillSurfaceL(surfaceB, 1, KBlue);
  1.1533 +	//Do content update idisp iavail
  1.1534 +    CActiveNotification* surfBbuff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1535 +    CleanupStack::PushL(surfBbuff1disp);
  1.1536 +    TTimeStamp surfBbuff1time;
  1.1537 +    CActiveNotification* surfBbuff1avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1538 +    CleanupStack::PushL(surfBbuff1avail);
  1.1539 +    iUtility->NotifyWhenDisplayed(surfBbuff1disp->iStatus,surfBbuff1time);
  1.1540 +    iUtility->NotifyWhenAvailable(surfBbuff1avail->iStatus); 
  1.1541 +    err = iUtility->SubmitUpdate(surfaceB, 1, NULL);
  1.1542 +    ASSERT_EQUALS(err,KErrNone);
  1.1543 +    
  1.1544 +    if(!aAutonomous)
  1.1545 +    	{
  1.1546 +        WaitL(iCompositionPause);
  1.1547 +		//Check B buff1 iAvail doesnt complete
  1.1548 +		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
  1.1549 +		//Check B buff1 iDisp doesnt complete
  1.1550 +		ASSERT_EQUALS(surfBbuff1disp->iStatus.Int(),KRequestPending);
  1.1551 +		//Check B buff0 iAvail doesnt complete
  1.1552 +		ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
  1.1553 +		//Check A buff1 iAvail doesnt complete
  1.1554 +		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1555 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1556 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1557 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1558 +    	}
  1.1559 +    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
  1.1560 +    
  1.1561 +    //Check B buff1 idisp completes - could be no error or not visible
  1.1562 +    ASSERT_TRUE((surfBbuff1disp->iStatus.Int()==KErrNotVisible)||(surfBbuff1disp->iStatus.Int()==KErrNone));
  1.1563 +	//Check B buff1 iavail doesnt complete
  1.1564 +    ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
  1.1565 +	//Check B buff0 iavail completes - could be no error or not visible
  1.1566 +    ASSERT_TRUE((surfBbuff0avail->iStatus.Int()==KErrNotVisible)||(surfBbuff0avail->iStatus.Int()==KErrNone));
  1.1567 +	//Check A buff1 iavail doesnt complete
  1.1568 +    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1569 +    
  1.1570 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1571 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1572 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KYellow,iTolerance));
  1.1573 +	ReleaseOnScreenStream();
  1.1574 +	
  1.1575 +	//**********SURFACE C ALSO FASTPATHABLE**********
  1.1576 +	//Add C to scene in front of surfaceA
  1.1577 +    wfcInsertElement(iDevice, elementC, elementA);
  1.1578 +#ifdef BREAKPOINT_FASTPATH
  1.1579 +    __BREAKPOINT();
  1.1580 +#endif
  1.1581 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.1582 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1583 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1584 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1585 +    LOG(("OpenWFTest: Fastpath - still ON"));
  1.1586 +	//Set C to brown
  1.1587 +    iUtility->FillSurfaceL(surfaceC, 0, KBrown);
  1.1588 +	//Do content update Cbuff0 idisp iavail
  1.1589 +    CActiveNotification* surfCbuff0disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1590 +    CleanupStack::PushL(surfCbuff0disp);
  1.1591 +    TTimeStamp surfCbuff0time;
  1.1592 +    CActiveNotification* surfCbuff0avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1593 +    CleanupStack::PushL(surfCbuff0avail);
  1.1594 +    iUtility->NotifyWhenDisplayed(surfCbuff0disp->iStatus,surfCbuff0time);
  1.1595 +    iUtility->NotifyWhenAvailable(surfCbuff0avail->iStatus); 
  1.1596 +    err = iUtility->SubmitUpdate(surfaceC, 0, NULL);
  1.1597 +	ASSERT_EQUALS(err,KErrNone);
  1.1598 +	
  1.1599 +    if(!aAutonomous)
  1.1600 +    	{
  1.1601 +        WaitL(iCompositionPause);
  1.1602 +		//Check C buff0 iAvail doesnt complete
  1.1603 +		ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KRequestPending);
  1.1604 +		//Check C buff0 iDisp doesnt complete
  1.1605 +		ASSERT_EQUALS(surfCbuff0disp->iStatus.Int(),KRequestPending);
  1.1606 +		//Check B buff1 iAvail doesnt complete
  1.1607 +		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
  1.1608 +		//Check A buff1 iAvail doesnt complete
  1.1609 +		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1610 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1611 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1612 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1613 +    	}
  1.1614 +    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1));
  1.1615 +    
  1.1616 +	//Check C buff0 idisp completes
  1.1617 +    ASSERT_EQUALS(surfCbuff0disp->iStatus.Int(),KErrNone);
  1.1618 +	//Check C buff0 iavail does not complete
  1.1619 +    ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KRequestPending);
  1.1620 +	//Check B buff1 iavail doesnt complete
  1.1621 +    ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
  1.1622 +	//Check A buff1 iavail doesnt complete
  1.1623 +    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1624 +    
  1.1625 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1626 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1627 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBrown,iTolerance));
  1.1628 +	ReleaseOnScreenStream();
  1.1629 +	
  1.1630 +	//Set C buffer1 grey
  1.1631 +    iUtility->FillSurfaceL(surfaceC, 1, KGray);
  1.1632 +	//Do content update Cbuff1 idisp iavail
  1.1633 +    CActiveNotification* surfCbuff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1634 +    CleanupStack::PushL(surfCbuff1disp);
  1.1635 +    TTimeStamp surfCbuff1time;
  1.1636 +    CActiveNotification* surfCbuff1avail = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.1637 +    CleanupStack::PushL(surfCbuff1avail);
  1.1638 +    iUtility->NotifyWhenDisplayed(surfCbuff1disp->iStatus,surfCbuff1time);
  1.1639 +    iUtility->NotifyWhenAvailable(surfCbuff1avail->iStatus); 
  1.1640 +    err = iUtility->SubmitUpdate(surfaceC, 1, NULL);
  1.1641 +    ASSERT_EQUALS(err,KErrNone);
  1.1642 +    
  1.1643 +    if(!aAutonomous)
  1.1644 +    	{
  1.1645 +        WaitL(iCompositionPause);
  1.1646 +		//Check C buff1 iAvail doesnt complete
  1.1647 +		ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
  1.1648 +		//Check C buff1 iDisp doesnt complete
  1.1649 +		ASSERT_EQUALS(surfCbuff1disp->iStatus.Int(),KRequestPending);
  1.1650 +		//Check C buff0 iAvail doesnt complete
  1.1651 +		ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KRequestPending);
  1.1652 +		//Check B buff1 iAvail doesnt complete
  1.1653 +		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
  1.1654 +		//Check A buff1 iAvail doesnt complete
  1.1655 +		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1656 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1657 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1658 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1659 +    	}
  1.1660 +    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
  1.1661 +    
  1.1662 +	//Check C buff1 idisp completes
  1.1663 +    ASSERT_EQUALS(surfCbuff1disp->iStatus.Int(),KErrNone);
  1.1664 +	//Check C buff1 iavail does not complete
  1.1665 +    ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
  1.1666 +	//Check C buff0 iavail completes
  1.1667 +    ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KErrNone);
  1.1668 +	//Check B buff1 iavail doesnt complete
  1.1669 +    ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
  1.1670 +	//Check A buff1 iavail doesnt complete
  1.1671 +    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1672 +    
  1.1673 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1674 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1675 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGray,iTolerance));
  1.1676 +	ReleaseOnScreenStream();
  1.1677 +	
  1.1678 +    //**********SURFACE A BACK TO FRONT**********
  1.1679 +	//Move A to the front
  1.1680 +    wfcInsertElement(iDevice, elementA, elementC);
  1.1681 +#ifdef BREAKPOINT_FASTPATH
  1.1682 +    __BREAKPOINT();
  1.1683 +#endif
  1.1684 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.1685 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1686 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1687 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1688 +    LOG(("OpenWFTest: Fastpath - still ON"));
  1.1689 +	//Set A buffer0 magenta
  1.1690 +    iUtility->FillSurfaceL(surfaceA, 0, KMagenta);
  1.1691 +	//Do content update Abuff0 idisp iavail
  1.1692 +    surfAbuff0disp->Activate();
  1.1693 +    surfAbuff0avail->Activate();
  1.1694 +    iUtility->NotifyWhenDisplayed(surfAbuff0disp->iStatus,surfAbuff0time);
  1.1695 +    iUtility->NotifyWhenAvailable(surfAbuff0avail->iStatus); 
  1.1696 +    err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
  1.1697 +	ASSERT_EQUALS(err,KErrNone);
  1.1698 +	
  1.1699 +    if(!aAutonomous)
  1.1700 +    	{
  1.1701 +        WaitL(iCompositionPause);
  1.1702 +		//Check A buff0 iAvail doesnt complete
  1.1703 +		ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
  1.1704 +		//Check A buff0 iDisp doesnt complete
  1.1705 +		ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KRequestPending);
  1.1706 +		//Check C buff1 iAvail doesnt complete
  1.1707 +		ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
  1.1708 +		//Check B buff1 iAvail doesnt complete
  1.1709 +		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
  1.1710 +		//Check A buff1 iAvail doesnt complete
  1.1711 +		ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending);
  1.1712 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1713 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1714 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1715 +    	}
  1.1716 +    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
  1.1717 +    
  1.1718 +	//Check A buff0 idisp completes
  1.1719 +    ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KErrNone);
  1.1720 +	//Check A buff0 iavail does not complete
  1.1721 +    ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
  1.1722 +	//Check A buff1 iavail does complete
  1.1723 +    ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KErrNone);
  1.1724 +	//Check C buff1 iavail does not complete
  1.1725 +    ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
  1.1726 +	//Check B buff1 iavail doesnt complete
  1.1727 +    ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
  1.1728 +    
  1.1729 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1730 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1731 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KMagenta,iTolerance));
  1.1732 +	ReleaseOnScreenStream();
  1.1733 +    
  1.1734 +    //**********SURFACE B TO FRONT - STOPS FASTPATH HAPPENING**********
  1.1735 +    //Move B to the front
  1.1736 +	wfcInsertElement(iDevice, elementB, elementA);
  1.1737 +#ifdef BREAKPOINT_FASTPATH
  1.1738 +    __BREAKPOINT();
  1.1739 +#endif
  1.1740 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
  1.1741 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1742 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1743 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1744 +    LOG(("OpenWFTest: Fastpath - now OFF..."));
  1.1745 +	//Set B buffer0 dark red
  1.1746 +	iUtility->FillSurfaceL(surfaceB, 0, KDarkRed);
  1.1747 +	//Do content update Abuff0 idisp iavail
  1.1748 +	surfBbuff0disp->Activate();
  1.1749 +	surfBbuff0avail->Activate();
  1.1750 +	iUtility->NotifyWhenDisplayed(surfBbuff0disp->iStatus,surfBbuff0time);
  1.1751 +	iUtility->NotifyWhenAvailable(surfBbuff0avail->iStatus); 
  1.1752 +	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1753 +	ASSERT_EQUALS(err,KErrNone);
  1.1754 +	
  1.1755 +    if(!aAutonomous)
  1.1756 +    	{
  1.1757 +        WaitL(iCompositionPause);
  1.1758 +		//Check B buff0 iAvail doesnt complete
  1.1759 +		ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
  1.1760 +		//Check B buff0 iDisp doesnt complete
  1.1761 +		ASSERT_EQUALS(surfBbuff0disp->iStatus.Int(),KRequestPending);
  1.1762 +		//Check A buff0 iAvail doesnt complete
  1.1763 +		ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
  1.1764 +		//Check C buff1 iAvail doesnt complete
  1.1765 +		ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
  1.1766 +		//Check B buff1 iAvail doesnt complete
  1.1767 +		ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending);
  1.1768 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1769 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1770 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1771 +    	}
  1.1772 +    ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2));
  1.1773 +	
  1.1774 +	//Check B buff0 iAvail doesnt complete
  1.1775 +	ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending);
  1.1776 +	//Check B buff0 iDisp completes
  1.1777 +	ASSERT_EQUALS(surfBbuff0disp->iStatus.Int(),KErrNone);
  1.1778 +	//Check A buff0 iAvail doesnt complete
  1.1779 +	ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending);
  1.1780 +	//Check C buff1 iAvail doesnt complete
  1.1781 +	ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending);
  1.1782 +	//Check B buff1 iAvail completes
  1.1783 +	ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KErrNone);
  1.1784 +	
  1.1785 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1786 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1787 +	//Check dark red center of screen
  1.1788 +	ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KDarkRed,iTolerance));
  1.1789 +	//Check magenta around the borders
  1.1790 +	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(0,0,iCenterTRect.iTl.iX,iCenterTRect.iTl.iY),KMagenta,iTolerance));
  1.1791 +	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(iCenterTRect.iBr.iX+1,iCenterTRect.iBr.iY+1,
  1.1792 +			iFastpathableWidth,iFastpathableHeight),KMagenta,iTolerance));
  1.1793 +	ReleaseOnScreenStream();
  1.1794 +	
  1.1795 +	ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.1796 +    
  1.1797 +    wfcDestroySource(iDevice, sourceA);
  1.1798 +    wfcDestroySource(iDevice, sourceB);
  1.1799 +    wfcDestroySource(iDevice, sourceC);
  1.1800 +    
  1.1801 +	CleanupStack::PopAndDestroy(12,surfAbuff0disp);
  1.1802 +	}
  1.1803 +/*
  1.1804 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0010
  1.1805 +@SYMTestCaseDesc		Positive testing - Fastpath with notification checking for autonomous composition
  1.1806 +@SYMREQ					
  1.1807 +@SYMPREQ						PREQ417-54885
  1.1808 +@SYMTestType				Integration Test
  1.1809 +@SYMTestPriority		High
  1.1810 +@SYMTestPurpose			Check fastpath does not cause any problem to notifications
  1.1811 +@SYMTestActions			
  1.1812 +	Autonomous composition
  1.1813 +	All elements created are double buffered and opaque:
  1.1814 +	Compose an empty scene
  1.1815 +	
  1.1816 +	A) Create a scene containing a screen sized element A
  1.1817 +	Fill buffer 0 of element A with red colour 
  1.1818 +	Submit the scene
  1.1819 +	Do content update of buffer 0 for available (iAvailable) and display time (iDisplayed)
  1.1820 +	Compose the scene, iDisplayed for buffer 0 should complete
  1.1821 +	
  1.1822 +	Fill buffer 1 of element A with yellow colour
  1.1823 +	Do content update of buffer 1 
  1.1824 +	Compose the scene, iDisplayed for buffer 1 should complete
  1.1825 +	Wait for iAvailable of buffer 0 to complete	
  1.1826 +	(iAvailable of buffer 1 will not complete until further content update)	
  1.1827 +	
  1.1828 +	B) Add a new element B of smaller non fastpathable size behind element A
  1.1829 +	Fill buffer 0 of element B with green colour
  1.1830 +	Submit the scene
  1.1831 +	Do content update of buffer 0 of element B 
  1.1832 +	Compose the scene, iDisplayed for buffer 0 of element B should not complete
  1.1833 +	iAvailable for buffer 1 of element A should not complete
  1.1834 +		
  1.1835 +	Fill buffer 1 of element B with blue colour
  1.1836 +	Do content update of buffer 1 of element B 
  1.1837 +	Wait for iDisplay to complete (possibly with KErrNotVisible)
  1.1838 +	Wait for iAvailable for buffer 0 of element B to complete (possibly with KErrNotVisible)
  1.1839 +	
  1.1840 +	C) Add a new screen size element C in front of A and B
  1.1841 +	Fill buffer 0 of element C to be brown
  1.1842 +	Do content update of buffer 0 of element C 
  1.1843 +	Compose the scene, iDisplayed of buffer 0 of element C should complete
  1.1844 +	iAvailable of buffer 1 of element B should not complete
  1.1845 +	
  1.1846 +	Fill buffer 1 of element C with grey colour
  1.1847 +	Do content update of buffer 1 of element C 
  1.1848 +	Compose the scene, iDisplayed of buffer 1 of element C should complete
  1.1849 +	Wait for iAvailable of buffer 0 of element C to complete
  1.1850 +		
  1.1851 +	D) Move element A to the front
  1.1852 +	Fill buffer 0 of element A with magenta colour
  1.1853 +	Do content update of buffer 0 of element A 
  1.1854 +	Compose the scene, iDisplayed for buffer 0 of element A should complete
  1.1855 +	Wait for iAvailable of buffer 1 of element A to complete
  1.1856 +	iAvailable of buffer 1 of element C should not complete
  1.1857 +	
  1.1858 +	E) Move element B to the front *NOW NOT FASTPATHING*
  1.1859 +	Fill buffer 0 of element B with dark red colour
  1.1860 +	Do content update of buffer 0 of element B
  1.1861 +	Compose the scene, iDisplayed for buffer 0 of element B should complete
  1.1862 +	Wait for iAvailable of buffer 1 of element B to complete
  1.1863 +	iAvailable of buffer 1 of element C should not complete
  1.1864 +	iAvailable of buffer 0 of element A should not complete
  1.1865 +		
  1.1866 +@SYMTestExpectedResults
  1.1867 +	All composition should trigger fastpath 
  1.1868 +	Request status checks iAvailable and iDisplayed should be set to KErrNone every time.	
  1.1869 +	Screen colour should change in the sequence of red, yellow, brown, grey, magenta
  1.1870 +*/
  1.1871 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0010L()
  1.1872 +	{
  1.1873 +    iTestName = _L("FASTPATH_0010");
  1.1874 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.1875 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.1876 +    FastpathNotificationsTestL(ETrue);
  1.1877 +	}
  1.1878 +
  1.1879 +/*
  1.1880 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0011
  1.1881 +@SYMTestCaseDesc		Positive testing - Fastpath with notification checking for non-autonomous composition
  1.1882 +@SYMREQ					
  1.1883 +@SYMPREQ						PREQ417-54885
  1.1884 +@SYMTestType				Integration Test
  1.1885 +@SYMTestPriority		High
  1.1886 +@SYMTestPurpose			Check fastpath does not cause any problem to notifications
  1.1887 +@SYMTestActions			
  1.1888 +	A repeat of GRAPHICS-OPENWFC-FASTPATH-0010 but with non autonomous composition
  1.1889 +	
  1.1890 +	Where possible TRequestStatuses are additionally checked after submit updates and before
  1.1891 +	explicit wfcCompose calls are made.
  1.1892 +	
  1.1893 +@SYMTestExpectedResults
  1.1894 +	Just commit should not trigger any changes to the scene or notifications to complete
  1.1895 +	Just content updates should not trigger any changes to the scene or notifications to complete
  1.1896 +	Only after Commit, Content update and Force compose should things happen.
  1.1897 +	Request status checks iAvailable and iDisplayed should be completed.
  1.1898 +	Screen colour should change in the sequence of red, yellow, green, blue, brown and grey
  1.1899 +*/
  1.1900 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0011L()
  1.1901 +	{
  1.1902 +    iTestName = _L("FASTPATH_0011");
  1.1903 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.1904 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.1905 +    FastpathNotificationsTestL(EFalse);
  1.1906 +	}
  1.1907 +
  1.1908 +//NOTIFICATION TESTS
  1.1909 +void COpenwfTest::FastpathDispXNotificationsTestL(TBool aAutonomous)
  1.1910 +	{
  1.1911 +    SetupEmptySceneL(aAutonomous);
  1.1912 +    if (aAutonomous)
  1.1913 +        {   //if we have manual pauses the test will complete early
  1.1914 +        iAllowManualPause = EFalse;
  1.1915 +        }
  1.1916 +	
  1.1917 +	//Create 2 fastpathable elements
  1.1918 +    TSurfaceId surfaceA = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.1919 +                                                iFastpathablePixelFormat,
  1.1920 +                                                iStride, iContiguous, iMaxBuffers);
  1.1921 +
  1.1922 +    ASSERT_FALSE(surfaceA.IsNull());
  1.1923 +    WFCSource sourceA = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceA), NULL);
  1.1924 +    TInt err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
  1.1925 +    ASSERT_EQUALS(err,KErrNone);
  1.1926 +    WFCElement elementA = wfcCreateElement(iDevice, iContext, NULL);
  1.1927 +    wfcSetElementAttribi(iDevice, elementA, WFC_ELEMENT_SOURCE, sourceA);
  1.1928 +    wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.1929 +    wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.1930 +    
  1.1931 +    TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
  1.1932 +                                                iFastpathablePixelFormat,
  1.1933 +                                                iStride, iContiguous, iMaxBuffers);
  1.1934 +    ASSERT_FALSE(surfaceB.IsNull());
  1.1935 +    WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL);
  1.1936 +    err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1937 +    ASSERT_EQUALS(err,KErrNone);
  1.1938 +    WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL);
  1.1939 +    wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB);
  1.1940 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
  1.1941 +    wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect);
  1.1942 +	
  1.1943 +	//**********STARTING ACTUAL TEST!**********
  1.1944 +	//Add A to scene
  1.1945 +	wfcInsertElement(iDevice, elementA, WFC_INVALID_HANDLE);
  1.1946 +#ifdef BREAKPOINT_FASTPATH
  1.1947 +    __BREAKPOINT();
  1.1948 +#endif
  1.1949 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.1950 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1951 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1952 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1953 +    LOG(("OpenWFTest: Fastpath - now ON"));
  1.1954 +	//Set A buffer0 red
  1.1955 +	iUtility->FillSurfaceL(surfaceA, 0, KRed);
  1.1956 +	err = iUtility->SubmitUpdate(surfaceA, 0, NULL);
  1.1957 +	ASSERT_EQUALS(err,KErrNone);
  1.1958 +    if(!aAutonomous)
  1.1959 +    	{
  1.1960 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1961 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1962 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1963 +    	}
  1.1964 +    WaitL(iCompositionPause);
  1.1965 +    
  1.1966 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1967 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1968 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KRed,iTolerance));
  1.1969 +	ReleaseOnScreenStream();
  1.1970 +	
  1.1971 +	//Add surfaceB to scene infront of surfaceA
  1.1972 +	wfcInsertElement(iDevice, elementB, elementA);
  1.1973 +#ifdef BREAKPOINT_FASTPATH
  1.1974 +    __BREAKPOINT();
  1.1975 +#endif
  1.1976 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
  1.1977 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.1978 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1979 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1980 +    LOG(("OpenWFTest: Fastpath - now OFF"));
  1.1981 +	//Set B buffer0 green
  1.1982 +	iUtility->FillSurfaceL(surfaceB, 0, KBlue);
  1.1983 +	err = iUtility->SubmitUpdate(surfaceB, 0, NULL);
  1.1984 +	ASSERT_EQUALS(err,KErrNone);
  1.1985 +    if(!aAutonomous)
  1.1986 +    	{
  1.1987 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.1988 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.1989 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.1990 +    	}
  1.1991 +    WaitL(iCompositionPause);
  1.1992 +    
  1.1993 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.1994 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.1995 +	//Check blue center of screen
  1.1996 +    ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KBlue,iTolerance));
  1.1997 +	//Check red around the borders
  1.1998 +	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(0,0,iCenterTRect.iTl.iX,iCenterTRect.iTl.iY),KRed,iTolerance));
  1.1999 +	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(iCenterTRect.iBr.iX+1,iCenterTRect.iBr.iY+1,
  1.2000 +			iFastpathableWidth,iFastpathableHeight),KRed,iTolerance));
  1.2001 +	ReleaseOnScreenStream();
  1.2002 +	
  1.2003 +	//Set A buffer1 yellow
  1.2004 +	iUtility->FillSurfaceL(surfaceA, 1, KYellow);
  1.2005 +	//Set B buffer1 KGreen
  1.2006 +	iUtility->FillSurfaceL(surfaceB, 1, KGreen);
  1.2007 +	
  1.2008 +	//Do content updated surfaceA dispXtimes 10
  1.2009 +	CActiveNotification* surfAbuff1dispX = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.2010 +	CleanupStack::PushL(surfAbuff1dispX);
  1.2011 +	iUtility->NotifyWhenDisplayedXTimes(10,surfAbuff1dispX->iStatus);
  1.2012 +	err = iUtility->SubmitUpdate(surfaceA, 1, NULL);
  1.2013 +	//Do content updated surfaceB dispXtimes 5
  1.2014 +	CActiveNotification* surfBbuff1dispX = CActiveNotification::NewL(iUtility->Session(),ETrue);
  1.2015 +	CleanupStack::PushL(surfBbuff1dispX);
  1.2016 +	iUtility->NotifyWhenDisplayedXTimes(5,surfBbuff1dispX->iStatus);
  1.2017 +	err = iUtility->SubmitUpdate(surfaceB, 1, NULL);
  1.2018 +	
  1.2019 +    if(!aAutonomous)
  1.2020 +    	{
  1.2021 +		for(TInt i=0;i<4;i++)
  1.2022 +			{
  1.2023 +			wfcCompose(iDevice, iContext, WFC_TRUE);
  1.2024 +		    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2025 +		    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2026 +		    WaitL(iCompositionPause);
  1.2027 +			//Check A has not completed yet
  1.2028 +			ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending);
  1.2029 +			//Check B has not completed yet
  1.2030 +			ASSERT_EQUALS(surfBbuff1dispX->iStatus.Int(),KRequestPending);
  1.2031 +			}
  1.2032 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.2033 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2034 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2035 +    	}
  1.2036 +	//surfBbuff1dispX should complete, and its RunL will stop the scheduler
  1.2037 +    CActiveScheduler::Start();
  1.2038 +	//Check B has completed
  1.2039 +    ASSERT_EQUALS(surfBbuff1dispX->iStatus.Int(),KErrNone);
  1.2040 +	//Check A has not completed yet
  1.2041 +	ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending);
  1.2042 +	
  1.2043 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.2044 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.2045 +	//Check green center of screen
  1.2046 +    ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KGreen,iTolerance));
  1.2047 +	//Check yellow around the borders
  1.2048 +	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(0,0,iCenterTRect.iTl.iX,iCenterTRect.iTl.iY),KYellow,iTolerance));
  1.2049 +	ASSERT_TRUE(CheckOnScreenStreamRect(TRect(iCenterTRect.iBr.iX+1,iCenterTRect.iBr.iY+1,
  1.2050 +			iFastpathableWidth,iFastpathableHeight),KYellow,iTolerance));
  1.2051 +	ReleaseOnScreenStream();
  1.2052 +	
  1.2053 +    //check it hasn't completed unexpectedly early while using on screen stream
  1.2054 +    ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending);
  1.2055 +    
  1.2056 +	//Remove surfaceB from the scene
  1.2057 +	wfcRemoveElement(iDevice, elementB);
  1.2058 +#ifdef BREAKPOINT_FASTPATH
  1.2059 +    __BREAKPOINT();
  1.2060 +#endif
  1.2061 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.2062 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2063 +    if(!aAutonomous)
  1.2064 +    	{
  1.2065 +		for(TInt i=0;i<4;i++)
  1.2066 +			{
  1.2067 +			wfcCompose(iDevice, iContext, WFC_TRUE);
  1.2068 +		    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2069 +		    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2070 +		    LOG(("OpenWFTest: Fastpath - now ON"));
  1.2071 +		    WaitL(iCompositionPause);
  1.2072 +			//Check A has not completed yet
  1.2073 +			ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending);
  1.2074 +			}
  1.2075 +		wfcCompose(iDevice, iContext, WFC_TRUE);
  1.2076 +    	}
  1.2077 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2078 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2079 +
  1.2080 +	//surfAbuff1dispX should complete, and its RunL will stop the scheduler
  1.2081 +    CActiveScheduler::Start();
  1.2082 +    ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KErrNone);
  1.2083 +
  1.2084 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.2085 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.2086 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KYellow,iTolerance));
  1.2087 +	ReleaseOnScreenStream();
  1.2088 +	
  1.2089 +	ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.2090 +	//Shutdown
  1.2091 +    wfcDestroySource(iDevice, sourceA);
  1.2092 +    wfcDestroySource(iDevice, sourceB);
  1.2093 +    
  1.2094 +	CleanupStack::PopAndDestroy(2,surfAbuff1dispX);
  1.2095 +	}
  1.2096 +
  1.2097 +/*
  1.2098 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0012
  1.2099 +@SYMTestCaseDesc		Positive testing - Fastpath with notification checking DisplayXTime
  1.2100 +@SYMREQ					
  1.2101 +@SYMPREQ						PREQ417-54885
  1.2102 +@SYMTestType				Integration Test
  1.2103 +@SYMTestPriority		High
  1.2104 +@SYMTestPurpose			Check fastpath does not cause any problem to notifications
  1.2105 +@SYMTestActions			
  1.2106 +	All compositions are autonomous:
  1.2107 +	Compose an empty scene
  1.2108 +	A) Create a scene containing a screen sized opaque element A
  1.2109 +	Commit the scene
  1.2110 +	Make a content update for available (iAvailable) and display time (aDisplayed)
  1.2111 +	Wait for the request status objects to complete
  1.2112 +	
  1.2113 +	B) Add a small element B in front of A
  1.2114 +	Compose the scene
  1.2115 +	Content update for both A and B, set display 10 times to A, set display 5 times to B 
  1.2116 +	Wait for the 5 times
  1.2117 +	
  1.2118 +	C) Remove element B
  1.2119 +	Commit the scene
  1.2120 +	Compose the scene
  1.2121 +	Wait for the 10 times
  1.2122 +@SYMTestExpectedResults
  1.2123 +	Composition should fastpath in sections A and C
  1.2124 +	Elements A's 10 times should not complete before element B's 5 times
  1.2125 +*/
  1.2126 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0012L()
  1.2127 +	{
  1.2128 +    iTestName = _L("FASTPATH_0012");
  1.2129 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2130 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2131 +	FastpathDispXNotificationsTestL(ETrue);
  1.2132 +	}
  1.2133 +
  1.2134 +/*
  1.2135 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0013
  1.2136 +@SYMTestCaseDesc		Positive testing - Fastpath with notification checking DisplayXTime
  1.2137 +@SYMREQ					
  1.2138 +@SYMPREQ						PREQ417-54885
  1.2139 +@SYMTestType				Integration Test
  1.2140 +@SYMTestPriority		High
  1.2141 +@SYMTestPurpose			Check fastpath does not cause any problem to notifications
  1.2142 +@SYMTestActions			
  1.2143 +	Repeats GRAPHICS-OPENWFC-FASTPATH-0013 in non autonomous mode.
  1.2144 +	This allows gives the added benefit of accurate counting of wfcCompose calls, checking the displayXtimes
  1.2145 +	notifications only complete after the correct number of composes.
  1.2146 +@SYMTestExpectedResults
  1.2147 +	Composition should fastpath in sections A and C
  1.2148 +	Both should complete after their expect amount of compose calls with no errors
  1.2149 +*/
  1.2150 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0013L()
  1.2151 +	{
  1.2152 +    iTestName = _L("FASTPATH_0013");
  1.2153 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2154 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2155 +    FastpathDispXNotificationsTestL(EFalse);
  1.2156 +	}
  1.2157 +
  1.2158 +/*
  1.2159 + *	NEGATIVE TESTING
  1.2160 + * */
  1.2161 +/*
  1.2162 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0020
  1.2163 +@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
  1.2164 +@SYMREQ					
  1.2165 +@SYMPREQ						PREQ417-54885
  1.2166 +@SYMTestType				Unit Test
  1.2167 +@SYMTestPriority		High
  1.2168 +@SYMTestPurpose			Check a scene including a full screen element with source alpha cannot be fastpathed
  1.2169 +@SYMTestActions			
  1.2170 +	All compositions are autonomous:
  1.2171 +	Create a scene containing a screen sized element 
  1.2172 +	Enable WFC_TRANSPARENCY_SOURCE  
  1.2173 +	Set the value of WFC_ELEMENT_SOURCE between 0 and 255 (non-inclusive).
  1.2174 +	Compose the scene
  1.2175 +@SYMTestExpectedResults
  1.2176 +	The scene cannot be fastpathed.
  1.2177 +*/
  1.2178 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0020L()
  1.2179 +	{
  1.2180 +    iTestName = _L("FASTPATH_0020");
  1.2181 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2182 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2183 +    SetupEmptySceneL();
  1.2184 +    
  1.2185 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.2186 +												EUidPixelFormatARGB_8888,
  1.2187 +                                                iStride, iContiguous, iMaxBuffers);
  1.2188 +    ASSERT_FALSE(surface.IsNull());
  1.2189 +
  1.2190 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.2191 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2192 +    ASSERT_EQUALS(err,KErrNone);
  1.2193 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.2194 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
  1.2195 +    
  1.2196 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.2197 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.2198 +    //set per pixel alpha
  1.2199 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_SOURCE);
  1.2200 +    
  1.2201 +#ifdef BREAKPOINT_FASTPATH
  1.2202 +    __BREAKPOINT();
  1.2203 +#endif
  1.2204 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.2205 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using source alpha"));
  1.2206 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2207 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2208 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2209 +    
  1.2210 +    for (TInt i=0;i<=256;i+=64)
  1.2211 +    	{
  1.2212 +		i=(i==256)?255:i;
  1.2213 +		iUtility->FillSurfaceL(surface, 0, TRgb(0,255,0,i));
  1.2214 +		err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2215 +		ASSERT_EQUALS(err,KErrNone);
  1.2216 +		WaitL(iCompositionPause);
  1.2217 +    	}
  1.2218 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.2219 +    wfcDestroySource(iDevice, fpSource);  
  1.2220 +	}
  1.2221 +
  1.2222 +/*
  1.2223 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0021
  1.2224 +@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
  1.2225 +@SYMREQ					
  1.2226 +@SYMPREQ						PREQ417-54885
  1.2227 +@SYMTestType				Unit Test
  1.2228 +@SYMTestPriority		High	
  1.2229 +@SYMTestPurpose			Check a scene including a full screen element with global alpha cannot be fastpathed
  1.2230 +@SYMTestActions			
  1.2231 +	All compositions are autonomous:
  1.2232 +	Create a scene containing a screen sized element 
  1.2233 +	Enable WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA
  1.2234 +	Set the value of WFC_ELEMENT_GLOBAL_ALPHA between 0 and 255 (non-inclusive)
  1.2235 +	Compose the scene
  1.2236 +@SYMTestExpectedResults
  1.2237 +	The scene cannot be fastpathed.
  1.2238 +*/
  1.2239 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0021L()
  1.2240 +	{
  1.2241 +    iTestName = _L("FASTPATH_0021");
  1.2242 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2243 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2244 +    SetupEmptySceneL();
  1.2245 +    
  1.2246 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.2247 +												EUidPixelFormatXRGB_8888,
  1.2248 +                                                iStride, iContiguous, iMaxBuffers);
  1.2249 +    ASSERT_FALSE(surface.IsNull());
  1.2250 +
  1.2251 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.2252 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2253 +    ASSERT_EQUALS(err,KErrNone);
  1.2254 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.2255 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
  1.2256 +    
  1.2257 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.2258 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.2259 +    //set element global alpha
  1.2260 +	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA);
  1.2261 +	wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 0.0f);
  1.2262 +	
  1.2263 +#ifdef BREAKPOINT_FASTPATH
  1.2264 +    __BREAKPOINT();
  1.2265 +#endif
  1.2266 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.2267 +	iUtility->FillSurfaceL(surface, 0, KGreen);
  1.2268 +	err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2269 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using element global alpha not fully opaque"));
  1.2270 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2271 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2272 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2273 +    
  1.2274 +    for (TInt i=0;i<=256;i+=64)
  1.2275 +    	{
  1.2276 +		i=(i==256)?255:i;
  1.2277 +		wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, (TReal32)i/255);
  1.2278 +		if(i == 255)
  1.2279 +			{
  1.2280 +#ifdef BREAKPOINT_FASTPATH
  1.2281 +			__BREAKPOINT();
  1.2282 +#endif
  1.2283 +			}
  1.2284 +        if(i == 255)
  1.2285 +            {
  1.2286 +            LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element global alpha fully opaque"));
  1.2287 +            }
  1.2288 +        else
  1.2289 +            {
  1.2290 +            LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using element global alpha not fully opaque"));
  1.2291 +            }
  1.2292 +	    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2293 +	    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2294 +	    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2295 +		WaitL(iCompositionPause);
  1.2296 +    	}
  1.2297 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.2298 +    wfcDestroySource(iDevice, fpSource);  
  1.2299 +	}
  1.2300 +
  1.2301 +/*
  1.2302 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0022
  1.2303 +@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
  1.2304 +@SYMREQ					
  1.2305 +@SYMPREQ						PREQ417-54885
  1.2306 +@SYMTestType				Unit Test
  1.2307 +@SYMTestPriority		High	
  1.2308 +@SYMTestPurpose			Check a scene with RGB 565 format cannot be fastpathed
  1.2309 +@SYMTestActions			
  1.2310 +	Create a scene containing a screen sized element with an unsupported source format, such as 565
  1.2311 +	Compose the scene
  1.2312 +@SYMTestExpectedResults
  1.2313 +	The scene cannot be fastpathed.	
  1.2314 +*/
  1.2315 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0022L()
  1.2316 +	{
  1.2317 +    iTestName = _L("FASTPATH_0022");
  1.2318 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2319 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2320 +    SetupEmptySceneL();
  1.2321 +    
  1.2322 +    //NON fastpathable pixel format
  1.2323 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.2324 +												iNonFastpathablePixelFormat,
  1.2325 +                                                iStride, iContiguous, iMaxBuffers);
  1.2326 +    ASSERT_FALSE(surface.IsNull());
  1.2327 +
  1.2328 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.2329 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2330 +    ASSERT_EQUALS(err,KErrNone);
  1.2331 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.2332 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
  1.2333 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.2334 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.2335 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.2336 +    
  1.2337 +#ifdef BREAKPOINT_FASTPATH
  1.2338 +    __BREAKPOINT();
  1.2339 +#endif
  1.2340 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using non fastpathable pixel format"));
  1.2341 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2342 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2343 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2344 +    
  1.2345 +    iUtility->FillSurfaceL(surface, 0, KGreen);
  1.2346 +    err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2347 +    ASSERT_EQUALS(err,KErrNone);
  1.2348 +    WaitL(iCompositionPause);
  1.2349 +    
  1.2350 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.2351 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.2352 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
  1.2353 +	ReleaseOnScreenStream();
  1.2354 +
  1.2355 +	ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.2356 +    wfcDestroySource(iDevice, fpSource);  
  1.2357 +	}
  1.2358 +
  1.2359 +/*
  1.2360 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0023
  1.2361 +@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
  1.2362 +@SYMREQ					
  1.2363 +@SYMPREQ						PREQ417-54885
  1.2364 +@SYMTestType				Unit Test
  1.2365 +@SYMTestPriority		High
  1.2366 +@SYMTestPurpose			Check a scene with mask settings cannot be fastpathed
  1.2367 +@SYMTestActions			
  1.2368 +	All compositions are autonomous:
  1.2369 +	Create a scene containing a screen sized element A
  1.2370 +	Enable WFC_TRANSPARENCY_MASK
  1.2371 +	Set a value to WFC_ELEMENT_MASK
  1.2372 +	Create a mask element, set the size to be the same as element A's desitnation rectangle 
  1.2373 +	Compose the scene
  1.2374 +@SYMTestExpectedResults
  1.2375 +	The scene cannot be fastpathed.
  1.2376 +*/
  1.2377 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0023L()
  1.2378 +	{
  1.2379 +    iTestName = _L("FASTPATH_0023");
  1.2380 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2381 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2382 +    SetupEmptySceneL();
  1.2383 +
  1.2384 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.2385 +												iFastpathablePixelFormat,
  1.2386 +                                                iStride, iContiguous, iMaxBuffers);
  1.2387 +    ASSERT_FALSE(surface.IsNull());
  1.2388 +
  1.2389 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.2390 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2391 +    ASSERT_EQUALS(err,KErrNone);
  1.2392 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.2393 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
  1.2394 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.2395 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.2396 +    
  1.2397 +    TSurfaceId surfaceMask = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.2398 +                                                iFastpathablePixelFormat,
  1.2399 +                                                iStride, iContiguous, iMaxBuffers);
  1.2400 +    ASSERT_FALSE(surfaceMask.IsNull());
  1.2401 +    WFCMask mask = wfcCreateMaskFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceMask), NULL);
  1.2402 +    err = iUtility->SubmitUpdate(surfaceMask, 0, NULL);
  1.2403 +    ASSERT_EQUALS(err,KErrNone);
  1.2404 +    
  1.2405 +    //set the mask to fpElement
  1.2406 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_MASK);
  1.2407 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_MASK, mask);
  1.2408 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.2409 +    
  1.2410 +#ifdef BREAKPOINT_FASTPATH
  1.2411 +    __BREAKPOINT();
  1.2412 +#endif
  1.2413 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.2414 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using a mask"));
  1.2415 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2416 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2417 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2418 +    LOG(("OpenWFTest:Fastpath - still off - using a mask"));
  1.2419 +    
  1.2420 +    iUtility->FillSurfaceL(surface, 0, KGreen);
  1.2421 +    err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2422 +    ASSERT_EQUALS(err,KErrNone);
  1.2423 +    iUtility->FillSurfaceL(surfaceMask, 0, KBlack);
  1.2424 +    err = iUtility->SubmitUpdate(surfaceMask, 0, NULL);
  1.2425 +    ASSERT_EQUALS(err,KErrNone);
  1.2426 +    WaitL(iCompositionPause);	
  1.2427 + 
  1.2428 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.2429 +    wfcDestroySource(iDevice, fpSource);
  1.2430 +	}
  1.2431 +
  1.2432 +/*
  1.2433 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0024
  1.2434 +@SYMTestCaseDesc		Negative testing - Fastpath one-element scene
  1.2435 +@SYMREQ					
  1.2436 +@SYMPREQ						PREQ417-54885
  1.2437 +@SYMTestType				Unit Test
  1.2438 +@SYMTestPriority		High
  1.2439 +@SYMTestPurpose			Check a scene with alpha and mask settings cannot be fastpathed
  1.2440 +@SYMTestActions			
  1.2441 +	All compositions are autonomous:
  1.2442 +	Create a scene containing a screen sized element A
  1.2443 +	Enable WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA
  1.2444 +	Set the value of WFC_ELEMENT_GLOBAL_ALPHA to be 255 
  1.2445 +	Enable WFC_TRANSPARENCY_MASK
  1.2446 +	Set a value to WFC_ELEMENT_MASK 	
  1.2447 +	Create a mask element, set it the same size of element A's destination rectangle
  1.2448 +	Compose the scene
  1.2449 +@SYMTestExpectedResults
  1.2450 +	The scene cannot be fastpathed.
  1.2451 +*/
  1.2452 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0024L()
  1.2453 +	{
  1.2454 +    iTestName = _L("FASTPATH_0024");
  1.2455 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2456 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2457 +    SetupEmptySceneL();
  1.2458 +
  1.2459 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.2460 +												iFastpathablePixelFormat,
  1.2461 +                                                iStride, iContiguous, iMaxBuffers);
  1.2462 +    ASSERT_FALSE(surface.IsNull());
  1.2463 +
  1.2464 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.2465 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2466 +    ASSERT_EQUALS(err,KErrNone);
  1.2467 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.2468 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
  1.2469 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.2470 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.2471 +    
  1.2472 +    TSurfaceId surfaceMask = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.2473 +                                                iFastpathablePixelFormat,
  1.2474 +                                                iStride, iContiguous, iMaxBuffers);
  1.2475 +    ASSERT_FALSE(surfaceMask.IsNull());
  1.2476 +    WFCMask mask = wfcCreateMaskFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceMask), NULL);
  1.2477 +    err = iUtility->SubmitUpdate(surfaceMask, 0, NULL);
  1.2478 +    ASSERT_EQUALS(err,KErrNone);
  1.2479 +    
  1.2480 +    //set the mask and global alpha for use with fpElement
  1.2481 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_MASK, mask);
  1.2482 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, 
  1.2483 +    		WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA|WFC_TRANSPARENCY_MASK);
  1.2484 +    //set global alpha to fully opaque
  1.2485 +    wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 1.0f);
  1.2486 +    
  1.2487 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.2488 +#ifdef BREAKPOINT_FASTPATH
  1.2489 +    __BREAKPOINT();
  1.2490 +#endif
  1.2491 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using a mask and global alpha"));
  1.2492 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2493 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2494 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2495 +    LOG(("OpenWFTest: Fastpath - still off - using a mask and global alpha"));
  1.2496 +    
  1.2497 +    iUtility->FillSurfaceL(surface, 0, KGreen);
  1.2498 +    err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2499 +    ASSERT_EQUALS(err,KErrNone);
  1.2500 +    iUtility->FillSurfaceL(surfaceMask, 0, KBlack);
  1.2501 +    err = iUtility->SubmitUpdate(surfaceMask, 0, NULL);
  1.2502 +    ASSERT_EQUALS(err,KErrNone);
  1.2503 +    WaitL(iCompositionPause);	
  1.2504 + 
  1.2505 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.2506 +    wfcDestroySource(iDevice, fpSource);
  1.2507 +	}
  1.2508 +
  1.2509 +/*
  1.2510 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0025
  1.2511 +@SYMTestCaseDesc		Negative testing - Fastpath a scene with scaling element
  1.2512 +@SYMREQ					
  1.2513 +@SYMPREQ						PREQ417-54885
  1.2514 +@SYMTestType				Unit Test
  1.2515 +@SYMTestPriority		High	
  1.2516 +@SYMTestPurpose			Check a scene with scaling cannot be fastpathed
  1.2517 +@SYMTestActions			
  1.2518 +	All compositions are autonomous:
  1.2519 +	Create an element containing source size smaller than full screen destination size
  1.2520 +	Add to scene and compose
  1.2521 +@SYMTestExpectedResults
  1.2522 +	The scene cannot be fastpathed.
  1.2523 +*/
  1.2524 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0025L()
  1.2525 +	{
  1.2526 +    iTestName = _L("FASTPATH_0025");
  1.2527 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2528 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2529 +    SetupEmptySceneL();
  1.2530 +	
  1.2531 +	//create half screen size surface
  1.2532 +	TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2),
  1.2533 +												iFastpathablePixelFormat,
  1.2534 +												iStride, iContiguous, iMaxBuffers);
  1.2535 +	ASSERT_FALSE(surface.IsNull());
  1.2536 +
  1.2537 +	WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.2538 +	TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2539 +	ASSERT_EQUALS(err,KErrNone);
  1.2540 +	WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.2541 +	wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
  1.2542 +	
  1.2543 +	//note the source is only half the size of the screen
  1.2544 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect);
  1.2545 +	//set destination to fullscreen, causing it to stretch
  1.2546 +	wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.2547 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.2548 +#ifdef BREAKPOINT_FASTPATH
  1.2549 +    __BREAKPOINT();
  1.2550 +#endif
  1.2551 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using a mask and global alpha"));
  1.2552 +	wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2553 +	wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2554 +	ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2555 +	LOG(("OpenWFTest: Fastpath - still off... - source not equal to destination"));
  1.2556 +	
  1.2557 +	iUtility->FillSurfaceL(surface, 0, KGreen);
  1.2558 +	err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2559 +	ASSERT_EQUALS(err,KErrNone);
  1.2560 +	WaitL(iCompositionPause);
  1.2561 +	
  1.2562 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.2563 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.2564 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance));
  1.2565 +	ReleaseOnScreenStream();
  1.2566 +
  1.2567 +	ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.2568 +	wfcDestroySource(iDevice, fpSource);  
  1.2569 +	}
  1.2570 +
  1.2571 +/*
  1.2572 +@SYMTestCaseID			GRAPHICS-OPENWFC-FASTPATH-0026
  1.2573 +@SYMTestCaseDesc		Negative testing - Fastpath a scene with rotation
  1.2574 +@SYMREQ					
  1.2575 +@SYMPREQ						PREQ417-54885
  1.2576 +@SYMTestType				Unit Test
  1.2577 +@SYMTestPriority		High	
  1.2578 +@SYMTestPurpose			Check a scene with rotation cannot be fastpathed
  1.2579 +@SYMTestActions			
  1.2580 +	All compositions are autonomous:
  1.2581 +	Create a scene containing a screen size element 
  1.2582 +	Compose the scene
  1.2583 +	Rotate the element with 90, 180 and 270 degrees
  1.2584 +	Compose the scene
  1.2585 +@SYMTestExpectedResults
  1.2586 +	The scene can be fastpathed only for the first scene commited composition.
  1.2587 +*/
  1.2588 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0026L()
  1.2589 +	{
  1.2590 +    iTestName = _L("FASTPATH_0026");
  1.2591 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2592 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2593 +    SetupEmptySceneL();
  1.2594 +    
  1.2595 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.2596 +                                                iFastpathablePixelFormat,
  1.2597 +                                                iStride, iContiguous, iMaxBuffers);
  1.2598 +    ASSERT_FALSE(surface.IsNull());
  1.2599 +
  1.2600 +    WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.2601 +    TInt err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2602 +    ASSERT_EQUALS(err,KErrNone);
  1.2603 +    WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL);
  1.2604 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource);
  1.2605 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect);
  1.2606 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect);
  1.2607 +    
  1.2608 +    wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE);
  1.2609 +#ifdef BREAKPOINT_FASTPATH
  1.2610 +    __BREAKPOINT();
  1.2611 +#endif
  1.2612 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.2613 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2614 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2615 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2616 +    LOG(("OpenWFTest: Fastpath - now ON"));
  1.2617 +    
  1.2618 +    iUtility->FillSurfaceL(surface, 0, KGreen);
  1.2619 +    err = iUtility->SubmitUpdate(surface, 0, NULL);
  1.2620 +    ASSERT_EQUALS(err,KErrNone);
  1.2621 +    WaitL(iCompositionPause);	
  1.2622 + 
  1.2623 +    //Set 90 degree rotation
  1.2624 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE_ROTATION, WFC_ROTATION_90);
  1.2625 +    
  1.2626 +#ifdef BREAKPOINT_FASTPATH
  1.2627 +    __BREAKPOINT();
  1.2628 +#endif
  1.2629 +    iUtility->FillSurfaceL(surface, 0, KBlue);
  1.2630 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
  1.2631 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2632 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2633 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2634 +    LOG(("OpenWFTest: Fastpath - now OFF"));
  1.2635 +    WaitL(iCompositionPause);
  1.2636 +    
  1.2637 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.2638 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.2639 +	ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBlue,iTolerance));
  1.2640 +	ReleaseOnScreenStream();
  1.2641 +
  1.2642 +	
  1.2643 +    //Set 180 degree rotation
  1.2644 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE_ROTATION, WFC_ROTATION_180);
  1.2645 +    
  1.2646 +#ifdef BREAKPOINT_FASTPATH
  1.2647 +    __BREAKPOINT();
  1.2648 +#endif
  1.2649 +    iUtility->FillSurfaceL(surface, 0, KMagenta);
  1.2650 +    LOG(("OpenWFTest: Expecting FASTPATH after next commit"));
  1.2651 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2652 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2653 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2654 +    LOG(("OpenWFTest: Fastpath - now OFF"));
  1.2655 +    WaitL(iCompositionPause);
  1.2656 +    
  1.2657 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.2658 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KMagenta,iTolerance));
  1.2659 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.2660 +    ReleaseOnScreenStream();
  1.2661 +
  1.2662 +    //Set 270 degree rotation
  1.2663 +    wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE_ROTATION, WFC_ROTATION_270);
  1.2664 +    
  1.2665 +#ifdef BREAKPOINT_FASTPATH
  1.2666 +    __BREAKPOINT();
  1.2667 +#endif
  1.2668 +    iUtility->FillSurfaceL(surface, 0, KBrown);
  1.2669 +    LOG(("OpenWFTest: Expecting COMPOSITION after next commit"));
  1.2670 +    wfcCommit(iDevice, iContext, WFC_TRUE);
  1.2671 +    wfcFence(iDevice, iContext, iEGLDisplay, iSync);
  1.2672 +    ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR);
  1.2673 +    LOG(("OpenWFTest: Fastpath - now OFF"));
  1.2674 +    WaitL(iCompositionPause);
  1.2675 +    
  1.2676 +    ASSERT_TRUE(AcquireOnScreenStream());
  1.2677 +    ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBrown,iTolerance));
  1.2678 +    ASSERT_TRUE(CheckOnScreenReferenceImage());
  1.2679 +    ReleaseOnScreenStream();
  1.2680 +
  1.2681 +    ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE);
  1.2682 +    wfcDestroySource(iDevice, fpSource);  
  1.2683 +	}
  1.2684 +
  1.2685 +/*
  1.2686 +@SYMTestCaseID          GRAPHICS-OPENWFC-FASTPATH-0027
  1.2687 +@SYMTestCaseDesc        Negative testing - Pass in bad parameter values 
  1.2688 +@SYMREQ                 
  1.2689 +@SYMPREQ                PREQ417-54885
  1.2690 +@SYMTestType            Unit Test
  1.2691 +@SYMTestPriority        High    
  1.2692 +@SYMTestPurpose         Check invalid parameter values passed in OWF APIs
  1.2693 +@SYMTestActions 
  1.2694 +    Use invalid values to call OWF APIs
  1.2695 +@SYMTestExpectedResults
  1.2696 +    Test should pass without panic.
  1.2697 +*/
  1.2698 +void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0027L()
  1.2699 +    {
  1.2700 +    iTestName = _L("FASTPATH_0027");
  1.2701 +    INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName);
  1.2702 +    LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName));
  1.2703 +    
  1.2704 +    WFCint deviceId;
  1.2705 +    WFCint filterList[] = { WFC_DEVICE_FILTER_SCREEN_NUMBER, WFC_DEFAULT_SCREEN_NUMBER, WFC_NONE};
  1.2706 +    ASSERT_TRUE(wfcEnumerateDevices(&deviceId, 1, filterList) == 1);
  1.2707 +
  1.2708 +    WFCint attribList = 1;
  1.2709 +    WFCDevice device = wfcCreateDevice(deviceId, &attribList);
  1.2710 +    WFCContext onScreenContext = wfcCreateOnScreenContext(NULL, WFC_DEFAULT_SCREEN_NUMBER, NULL);
  1.2711 +    WFCContext offScreenContext = wfcCreateOffScreenContext(NULL, WFC_DEFAULT_SCREEN_NUMBER, NULL);
  1.2712 +
  1.2713 +    WFCfloat value = 1.0;
  1.2714 +    wfcGetContextAttribi(NULL, iContext, WFC_CONTEXT_TARGET_HEIGHT);
  1.2715 +    wfcSetContextAttribi(NULL, iContext, WFC_CONTEXT_ROTATION, WFC_ROTATION_0);
  1.2716 +    wfcGetContextAttribfv(NULL, iContext, WFC_CONTEXT_ROTATION, NULL, &value);
  1.2717 +    wfcSetContextAttribfv(NULL, iContext, WFC_CONTEXT_ROTATION, NULL, &value);
  1.2718 +    
  1.2719 +    TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight),
  1.2720 +                                                iFastpathablePixelFormat,
  1.2721 +                                                iStride, iContiguous, iMaxBuffers);
  1.2722 +    ASSERT_FALSE(surface.IsNull());
  1.2723 +
  1.2724 +    WFCSource fpSource = wfcCreateSourceFromStream(NULL, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.2725 +    wfcCreateMaskFromStream(NULL, iContext, reinterpret_cast<WFCNativeStreamType>(&surface), NULL);
  1.2726 +    WFCElement fpElement = wfcCreateElement(NULL, iContext, NULL);
  1.2727 +    wfcSetElementAttribi(NULL, fpElement, WFC_ELEMENT_SOURCE, fpSource);
  1.2728 +    wfcSetElementAttribf(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL);
  1.2729 +    wfcSetElementAttribiv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
  1.2730 +    wfcSetElementAttribfv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
  1.2731 +    wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
  1.2732 +    wfcSetElementAttribfv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
  1.2733 +    
  1.2734 +    wfcGetElementAttribi(NULL, fpElement, WFC_ELEMENT_SOURCE);
  1.2735 +    wfcGetElementAttribf(NULL, fpElement, WFC_ELEMENT_SOURCE);
  1.2736 +    wfcGetElementAttribiv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
  1.2737 +    wfcGetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
  1.2738 +    wfcGetElementAttribfv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
  1.2739 +    wfcGetElementAttribfv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL);
  1.2740 +    
  1.2741 +    wfcInsertElement(NULL, fpElement, NULL);
  1.2742 +    wfcGetElementAbove(NULL, fpElement);
  1.2743 +    wfcGetElementBelow(NULL, fpElement);
  1.2744 +        
  1.2745 +    WFCDeviceAttrib devAttrib = WFC_DEVICE_ID;
  1.2746 +    wfcGetDeviceAttribi(NULL, devAttrib);
  1.2747 +
  1.2748 +    wfcActivate(NULL, iContext);
  1.2749 +    wfcActivate(iDevice, NULL);
  1.2750 +    wfcDeactivate(NULL, iContext);
  1.2751 +    wfcDeactivate(iDevice, NULL);
  1.2752 +    wfcCompose(NULL, iContext, WFC_TRUE);
  1.2753 +    wfcCompose(iDevice, NULL, WFC_TRUE);
  1.2754 +    wfcCommit(NULL, iContext, WFC_TRUE);
  1.2755 +    wfcCommit(iDevice, NULL, WFC_TRUE);
  1.2756 +    wfcFence(NULL, iContext, iEGLDisplay, iSync);
  1.2757 +    wfcFence(iDevice, NULL, iEGLDisplay, iSync);
  1.2758 +
  1.2759 +    WFCMask mask = WFC_INVALID_HANDLE;
  1.2760 +    wfcDestroyMask(NULL, mask);
  1.2761 +    wfcRemoveElement(NULL, fpElement);
  1.2762 +    wfcDestroyElement(NULL, fpElement);
  1.2763 +    wfcDestroySource(NULL, fpSource);  
  1.2764 +    wfcDestroyContext(NULL, onScreenContext);
  1.2765 +    }
  1.2766 +