|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // OpenWF tests |
|
15 // |
|
16 #include <test/extendtef.h> |
|
17 #include <hal.h> |
|
18 #include "openwftest.h" |
|
19 |
|
20 #define KCompositorVersion 0x01023456 |
|
21 #define KGrowCleanupStack 12 |
|
22 #define KMaxNotificationDelay 5000000 //5 seconds |
|
23 #define KNotificationWarning 100000 //100 ms |
|
24 |
|
25 _LIT(KTestSectionName, "TestInfo"); |
|
26 _LIT(KImageSectionName, "ImageInfo"); |
|
27 _LIT(KContiguousFlag, "ContiguousFlag"); |
|
28 _LIT(KTolerance, "Tolerance"); |
|
29 _LIT(KTestMode, "TestMode"); |
|
30 _LIT(KSaveImage, "SaveImage"); |
|
31 _LIT(KDir, "Dir"); |
|
32 _LIT(KDefaultDir, "c:\\openwftest\\img\\"); |
|
33 _LIT(KCompositionPause, "CompositionPause"); |
|
34 _LIT(KManualPause, "ManualPause"); |
|
35 |
|
36 //Uncomment this and rebuild if you wish to test if fastpath is enabled using breakpoints |
|
37 //#define BREAKPOINT_FASTPATH |
|
38 |
|
39 /* |
|
40 * COpenwfTest implementation |
|
41 */ |
|
42 COpenwfTest::COpenwfTest() |
|
43 :iFastpathablePixelFormat(EUidPixelFormatXRGB_8888), |
|
44 iNonFastpathablePixelFormat(EUidPixelFormatRGB_565), |
|
45 iMappable(ETrue), |
|
46 iMaxBuffers(2), |
|
47 iMinBuffers(1), |
|
48 iCacheAttrib(ECacheNotlisted), |
|
49 iDeviceId(WFC_INVALID_HANDLE), |
|
50 iSync(EGL_NO_SYNC_KHR), |
|
51 iDevice(WFC_INVALID_HANDLE), |
|
52 iContext(WFC_INVALID_HANDLE) |
|
53 { |
|
54 } |
|
55 |
|
56 COpenwfTest::~COpenwfTest() |
|
57 { |
|
58 TearDown(); |
|
59 } |
|
60 |
|
61 void COpenwfTest::SetupL() |
|
62 { |
|
63 iScheduler = new(ELeave) CActiveScheduler; |
|
64 CActiveScheduler::Install(iScheduler); |
|
65 |
|
66 ReadIniData(); |
|
67 |
|
68 iEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); |
|
69 ASSERT_FALSE(iEGLDisplay == EGL_NO_DISPLAY); |
|
70 ASSERT_FALSE(iEGLDisplay == EGL_BAD_ALLOC); |
|
71 ASSERT_EQUALS(eglGetError(),EGL_SUCCESS); |
|
72 eglInitialize(iEGLDisplay, NULL, NULL); |
|
73 ASSERT_EQUALS(eglGetError(),EGL_SUCCESS); |
|
74 |
|
75 WFCint filterList[] = { WFC_DEVICE_FILTER_SCREEN_NUMBER, WFC_DEFAULT_SCREEN_NUMBER, WFC_NONE}; |
|
76 ASSERT_TRUE(wfcEnumerateDevices(&iDeviceId, 1, filterList) == 1); |
|
77 ASSERT_TRUE(iDeviceId != WFC_INVALID_HANDLE); |
|
78 |
|
79 iDevice = wfcCreateDevice(iDeviceId, NULL); |
|
80 ASSERT_TRUE(iDevice != WFC_INVALID_HANDLE); |
|
81 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
82 iContext = wfcCreateOnScreenContext(iDevice, WFC_DEFAULT_SCREEN_NUMBER, NULL); |
|
83 ASSERT_TRUE(iContext != WFC_INVALID_HANDLE); |
|
84 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
85 |
|
86 iFastpathableHeight = wfcGetContextAttribi(iDevice, iContext, WFC_CONTEXT_TARGET_HEIGHT); |
|
87 iFastpathableWidth = wfcGetContextAttribi(iDevice, iContext, WFC_CONTEXT_TARGET_WIDTH); |
|
88 iStride = iFastpathableWidth * 4; |
|
89 |
|
90 iFullScreenTRect = TRect(0,0,iFastpathableWidth,iFastpathableHeight); |
|
91 iFullScreenRect[0] = 0; |
|
92 iFullScreenRect[1] = 0; |
|
93 iFullScreenRect[2] = iFullScreenTRect.Width(); |
|
94 iFullScreenRect[3] = iFullScreenTRect.Height(); |
|
95 |
|
96 iCenterTRect = TRect(iFastpathableWidth/4,iFastpathableHeight/4, |
|
97 3*iFastpathableWidth/4,3*iFastpathableHeight/4); |
|
98 iCenterRect[0] = iCenterTRect.iTl.iX; |
|
99 iCenterRect[1] = iCenterTRect.iTl.iY; |
|
100 iCenterRect[2] = iCenterTRect.Width(); |
|
101 iCenterRect[3] = iCenterTRect.Height(); |
|
102 |
|
103 iHalfSizeRect[0] = 0; |
|
104 iHalfSizeRect[1] = 0; |
|
105 iHalfSizeRect[2] = iFastpathableWidth/2; |
|
106 iHalfSizeRect[3] = iFastpathableHeight/2; |
|
107 |
|
108 iUtility = CSurfaceUtility::NewL(); |
|
109 |
|
110 if((iTestMode == EAutomatic) || iSaveImage) |
|
111 { |
|
112 // Need to initialise the on screen stream before composition |
|
113 // to ensure the content is available later |
|
114 iUtility->GetOnScreenStream(iDevice, iContext); |
|
115 } |
|
116 if (iSaveImage) |
|
117 { // Create a directory to save images |
|
118 iUtility->CreateImagePath(iImageDirectory); |
|
119 } |
|
120 iAllowManualPause = ETrue; //tests can stop it (eg dispXtimes tests) |
|
121 |
|
122 EGLint attrib_list[1] = {EGL_NONE}; |
|
123 iSync = eglCreateSyncKHR(iEGLDisplay,EGL_SYNC_REUSABLE_KHR, attrib_list); |
|
124 ASSERT_NOT_EQUALS(iSync,EGL_NO_SYNC_KHR); |
|
125 ASSERT_EQUALS(eglGetError(),EGL_SUCCESS); |
|
126 } |
|
127 |
|
128 /** |
|
129 * test Suite furniture |
|
130 **/ |
|
131 void COpenwfTest::TearDownL() |
|
132 { |
|
133 // Nothing leaves in this function, |
|
134 // but TearDownL() is needed for the CTestFixture (TEF) interface |
|
135 TearDown(); |
|
136 } |
|
137 |
|
138 void COpenwfTest::TearDown() |
|
139 { |
|
140 WFCErrorCode wfcError; |
|
141 if (iDevice != WFC_INVALID_HANDLE) |
|
142 { |
|
143 wfcError = wfcGetError(iDevice); |
|
144 if (wfcError != WFC_ERROR_NONE) |
|
145 { |
|
146 INFO_PRINTF2(_L("TearDown: There was a failure in the test. error=%d"),wfcError); |
|
147 } |
|
148 } |
|
149 if (iOnScreenStream != WFC_INVALID_HANDLE) |
|
150 { |
|
151 (void)SymbianStreamReleaseReadBuffer(iOnScreenStream, iOnScreenBuffer); //ignore the error |
|
152 iOnScreenStream = WFC_INVALID_HANDLE; |
|
153 } |
|
154 delete iUtility; |
|
155 iUtility = NULL; |
|
156 if (iContext != WFC_INVALID_HANDLE) |
|
157 { |
|
158 wfcDestroyContext(iDevice, iContext); |
|
159 iContext = WFC_INVALID_HANDLE; |
|
160 WFCErrorCode wfcError = wfcGetError(iDevice); |
|
161 if (wfcError != WFC_ERROR_NONE) |
|
162 { |
|
163 INFO_PRINTF2(_L("TearDown: wfcDestroyContext error=%d"),wfcError); |
|
164 } |
|
165 } |
|
166 if (iDevice != WFC_INVALID_HANDLE) |
|
167 { |
|
168 WFCErrorCode deviceError = wfcDestroyDevice(iDevice); |
|
169 iDevice = WFC_INVALID_HANDLE; |
|
170 if (deviceError != WFC_ERROR_NONE) |
|
171 { |
|
172 INFO_PRINTF2(_L("TearDown: wfcDestroyDevice error=%d"),deviceError); |
|
173 } |
|
174 } |
|
175 if (iSync != EGL_NO_SYNC_KHR) |
|
176 { |
|
177 EGLBoolean eglSyncError = eglDestroySyncKHR(iEGLDisplay, iSync); |
|
178 iSync = EGL_NO_SYNC_KHR; |
|
179 if (eglSyncError != EGL_TRUE) |
|
180 { |
|
181 INFO_PRINTF2(_L("TearDown: eglSyncError line %d"),__LINE__); |
|
182 } |
|
183 } |
|
184 if (iEGLDisplay != EGL_NO_DISPLAY) |
|
185 { |
|
186 EGLBoolean eglTerminateError = eglTerminate(iEGLDisplay); |
|
187 iEGLDisplay = EGL_NO_DISPLAY; |
|
188 if (eglTerminateError != EGL_TRUE) |
|
189 { |
|
190 INFO_PRINTF2(_L("TearDown: eglTerminateError line %d"),__LINE__); |
|
191 } |
|
192 } |
|
193 delete iScheduler; |
|
194 iScheduler = NULL; |
|
195 } |
|
196 |
|
197 /** |
|
198 * To be called at the beginning of tests |
|
199 * aActivate default is ON |
|
200 */ |
|
201 void COpenwfTest::SetupEmptySceneL(TBool aActivate) |
|
202 { |
|
203 #ifdef BREAKPOINT_FASTPATH |
|
204 __BREAKPOINT(); |
|
205 #endif |
|
206 wfcSetContextAttribi(iDevice, iContext, WFC_CONTEXT_ROTATION, WFC_ROTATION_0); |
|
207 wfcSetContextAttribi(iDevice, iContext, WFC_CONTEXT_BG_COLOR, 0xFFFFFFFF); |
|
208 if (aActivate) |
|
209 { |
|
210 LOG(("OpenWFTest: Running in autonomous composition mode")); |
|
211 wfcActivate(iDevice,iContext); |
|
212 } |
|
213 else |
|
214 { |
|
215 LOG(("OpenWFTest: Running in non autonomous composition mode")); |
|
216 wfcDeactivate(iDevice,iContext); |
|
217 } |
|
218 LOG(("OpenWFTest: Expecting COMPOSITION after next commit")); |
|
219 wfcCommit(iDevice, iContext, WFC_TRUE); // Compose the scene |
|
220 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
221 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
222 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
223 LOG(("OpenWFTest: Fastpath - setting up scene - fastpath now off")); |
|
224 } |
|
225 |
|
226 void COpenwfTest::ReadIniData() |
|
227 { |
|
228 //test mode |
|
229 TBool returnValue = iConfig.GetInt(KTestSectionName, KTestMode, iTestMode); |
|
230 ASSERT_TRUE(returnValue); |
|
231 |
|
232 //save images |
|
233 iSaveImage=EFalse; |
|
234 if (iTestMode == EAutomatic) |
|
235 { |
|
236 returnValue = iConfig.GetBool(KTestSectionName, KSaveImage, iSaveImage); |
|
237 } |
|
238 |
|
239 // Get path for the images to be saved to |
|
240 TPtrC dir; |
|
241 returnValue = iConfig.GetString(KTestSectionName, KDir, dir); |
|
242 if (returnValue) |
|
243 { |
|
244 iImageDirectory.Set(dir); |
|
245 } |
|
246 else |
|
247 { |
|
248 iImageDirectory.Set(KDefaultDir); |
|
249 } |
|
250 |
|
251 // Composition pause in microseconds |
|
252 TInt compositionPause; |
|
253 returnValue = iConfig.GetInt(KTestSectionName, KCompositionPause, compositionPause); |
|
254 ASSERT_TRUE(returnValue); |
|
255 iCompositionPause = compositionPause; |
|
256 |
|
257 // Manual pause in microseconds |
|
258 iManualPause = 0; |
|
259 if (iTestMode != EAutomatic) |
|
260 { |
|
261 TInt manualPause; |
|
262 returnValue = iConfig.GetInt(KTestSectionName, KManualPause, manualPause); |
|
263 ASSERT_TRUE(returnValue); |
|
264 iManualPause = manualPause; |
|
265 } |
|
266 |
|
267 // Force contiguous |
|
268 TBool contiguousFlag; |
|
269 returnValue = iConfig.GetBool(KImageSectionName, KContiguousFlag, contiguousFlag); |
|
270 if (returnValue && contiguousFlag) |
|
271 { |
|
272 iContiguous = EContiguous; |
|
273 } |
|
274 |
|
275 // Test tolerance |
|
276 TInt tolerance; |
|
277 returnValue = iConfig.GetInt(KImageSectionName, KTolerance, tolerance); |
|
278 if (returnValue) |
|
279 { |
|
280 iTolerance = tolerance; |
|
281 } |
|
282 } |
|
283 |
|
284 /** |
|
285 * Acquires the on screen stream and buffer number |
|
286 * NOTE: this function should be paired with a ReleaseOnScreenStream call |
|
287 * Returns ETrue on success |
|
288 */ |
|
289 TBool COpenwfTest::AcquireOnScreenStream() |
|
290 { |
|
291 TInt error = KErrNone; |
|
292 ASSERT_TRUE(iOnScreenStream == WFC_INVALID_HANDLE); |
|
293 if(iTestMode == EAutomatic) |
|
294 { //need to get the on screen stream |
|
295 iOnScreenStream = iUtility->GetOnScreenStream(iDevice, iContext); |
|
296 if(iOnScreenStream == WFC_INVALID_HANDLE) |
|
297 { |
|
298 INFO_PRINTF1(_L("Failed getting on screen stream")); |
|
299 LOG(("OpenWFTest: *** Failed getting on screen stream")); |
|
300 return EFalse; |
|
301 } |
|
302 error = SymbianStreamAcquireReadBuffer(iOnScreenStream, &iOnScreenBuffer); |
|
303 if (error != KErrNone) |
|
304 { |
|
305 LOG(("OpenWFTest: *** Unable to acquire read buffer. error = %d",error)); |
|
306 INFO_PRINTF2(_L("Unable to acquire read buffer. error = %d"),error); |
|
307 } |
|
308 return (error == KErrNone); |
|
309 } |
|
310 else |
|
311 { |
|
312 INFO_PRINTF1(_L("No need to get the on screen stream, probably manual checking mode")); |
|
313 LOG(("OpenWFTest: *** No need to get the on screen stream, probably manual checking mode")); |
|
314 return ETrue; |
|
315 } |
|
316 } |
|
317 |
|
318 /** |
|
319 * Releases the on screen stream |
|
320 */ |
|
321 void COpenwfTest::ReleaseOnScreenStream() |
|
322 { |
|
323 if (iOnScreenStream != WFC_INVALID_HANDLE) |
|
324 { |
|
325 (void)SymbianStreamReleaseReadBuffer(iOnScreenStream, iOnScreenBuffer); //ignore the error |
|
326 iOnScreenStream = WFC_INVALID_HANDLE; |
|
327 } |
|
328 if(iTestMode != EAutomatic && iAllowManualPause) |
|
329 { |
|
330 INFO_PRINTF1(_L("Performing manual wait")); |
|
331 LOG(("OpenWFTest: *** Performing manual wait")); |
|
332 TRAP_IGNORE(WaitL(iManualPause)); |
|
333 } |
|
334 if(iTestMode != EAutomatic && !iAllowManualPause) |
|
335 { |
|
336 INFO_PRINTF1(_L("Test not allowing a manual wait")); |
|
337 LOG(("OpenWFTest: *** Test not allowing a manual wait")); |
|
338 } |
|
339 } |
|
340 |
|
341 /** |
|
342 * Checks the rect of the on screen stream |
|
343 * Returns ETrue on success |
|
344 */ |
|
345 TBool COpenwfTest::CheckOnScreenStreamRect(TRect aRect, const TRgb& aExpectedColor, TInt aTolerance) |
|
346 { |
|
347 if(iTestMode == EAutomatic) |
|
348 { |
|
349 if (iOnScreenStream == WFC_INVALID_HANDLE) |
|
350 { |
|
351 LOG(("OpenWFTest: *** We don't have access to the on screen stream")); |
|
352 INFO_PRINTF1(_L("We don't have access to the on screen stream")); |
|
353 return EFalse; |
|
354 } |
|
355 const TSurfaceId* surfaceId = NULL; |
|
356 long bufferIndex; |
|
357 TInt error = SymbianStreamGetBufferId(iOnScreenStream,iOnScreenBuffer,&bufferIndex,&surfaceId); |
|
358 if (error == KErrNone) |
|
359 { |
|
360 return CheckRect(*surfaceId,bufferIndex,aRect,aExpectedColor,aTolerance); |
|
361 } |
|
362 else |
|
363 { |
|
364 LOG(("OpenWFTest: *** Unable to get stream buffer id. error = %d",error)); |
|
365 INFO_PRINTF2(_L("Unable to get stream buffer id. error = %d"),error); |
|
366 return EFalse; |
|
367 } |
|
368 } |
|
369 else |
|
370 { //print out what we're hoping to see for manual testing |
|
371 LOG(("OpenWFTest: For rect %d %d %d %d",aRect.iTl.iX,aRect.iTl.iY,aRect.iBr.iX,aRect.iBr.iY)); |
|
372 LOG(("OpenWFTest: The expected color is r=%d g=%d b=%d",aExpectedColor.Red(),aExpectedColor.Green(), |
|
373 aExpectedColor.Blue())); |
|
374 INFO_PRINTF5(_L("For rect %d %d %d %d"),aRect.iTl.iX,aRect.iTl.iY,aRect.iBr.iX,aRect.iBr.iY); |
|
375 INFO_PRINTF4(_L("The expected color is r=%d g=%d b=%d"),aExpectedColor.Red(),aExpectedColor.Green(), |
|
376 aExpectedColor.Blue()); |
|
377 return ETrue; |
|
378 } |
|
379 } |
|
380 |
|
381 /** |
|
382 * checks the color within the given rectangle of the given surface |
|
383 * returns ETrue on success |
|
384 */ |
|
385 TBool COpenwfTest::CheckRect(const TSurfaceId& aSurface, TInt aBuffer, TRect aRect, |
|
386 const TRgb& aExpectedColor, TInt aTolerance) |
|
387 { |
|
388 INFO_PRINTF1(_L("Starting pixel checking")); |
|
389 LOG(("OpenWFTest: *** Starting pixel checking")); |
|
390 // Check pixel data |
|
391 |
|
392 TBool success = iUtility->CheckRectColor(aSurface, aRect, aBuffer, aExpectedColor, aTolerance); |
|
393 if (success) |
|
394 { |
|
395 INFO_PRINTF1(_L("Finished pixel checking - pass")); |
|
396 LOG(("OpenWFTest: *** Finished pixel checking - pass")); |
|
397 } |
|
398 else |
|
399 { |
|
400 INFO_PRINTF1(_L("Finished pixel checking - fail")); |
|
401 LOG(("OpenWFTest: *** Finished pixel checking - fail")); |
|
402 } |
|
403 return success; |
|
404 } |
|
405 |
|
406 /** |
|
407 * If in automatic mode it will save a TGA image of the on screen stream. |
|
408 * It will also print the name of the reference image. |
|
409 * Returns ETrue on success |
|
410 */ |
|
411 TBool COpenwfTest::CheckOnScreenReferenceImage() |
|
412 { |
|
413 TInt error = KErrNone; |
|
414 //Create image file name |
|
415 _LIT(KSeparator, "_"); |
|
416 _LIT(KTGAImgFormat, ".tga"); |
|
417 iImageAddress.Zero(); |
|
418 iImageAddress.Append(iTestName); |
|
419 iImageAddress.Append(KSeparator); |
|
420 iImageAddress.AppendNum(iImageCounter); |
|
421 iImageAddress.Append(KTGAImgFormat); |
|
422 |
|
423 LOGL((_L("Reference Image:%S"),&iImageAddress)); |
|
424 INFO_PRINTF2(_L("Reference Image:%S"),&iImageAddress); |
|
425 //Add file path |
|
426 iImageAddress.Insert(0,iImageDirectory); |
|
427 iImageCounter++; |
|
428 |
|
429 if(iTestMode == EAutomatic && iSaveImage) |
|
430 { |
|
431 if (iOnScreenStream == WFC_INVALID_HANDLE) |
|
432 { |
|
433 LOG(("OpenWFTest: *** We don't have access to the on screen stream",error)); |
|
434 INFO_PRINTF1(_L("We don't have access to the on screen stream")); |
|
435 return EFalse; |
|
436 } |
|
437 const TSurfaceId* surfaceId = NULL; |
|
438 long bufferIndex; |
|
439 error = SymbianStreamGetBufferId(iOnScreenStream,iOnScreenBuffer,&bufferIndex,&surfaceId); |
|
440 if (error == KErrNone) |
|
441 { |
|
442 return SaveImage(*surfaceId,bufferIndex); |
|
443 } |
|
444 else |
|
445 { |
|
446 LOG(("OpenWFTest: *** Unable to get stream buffer id. error = %d",error)); |
|
447 INFO_PRINTF2(_L("Unable to get stream buffer id. error = %d"),error); |
|
448 return EFalse; |
|
449 } |
|
450 } |
|
451 return ETrue; |
|
452 } |
|
453 |
|
454 /** |
|
455 * helper function for saving images to files |
|
456 * returns ETrue on success |
|
457 */ |
|
458 TBool COpenwfTest::SaveImage(const TSurfaceId& aSurface, TInt aNumOfBuffer) |
|
459 { |
|
460 if(iTestMode == EAutomatic && iSaveImage) |
|
461 { |
|
462 INFO_PRINTF1(_L("Start to save image")); |
|
463 LOG(("OpenWFTest: *** Start to save image")); |
|
464 TBool success = EFalse; |
|
465 TRAPD(error, success = iUtility->SaveResultImageTGAL(aSurface, aNumOfBuffer, iImageAddress)); |
|
466 if(error != KErrNone || !success) |
|
467 { |
|
468 INFO_PRINTF1(_L("Failed saving image")); |
|
469 LOG(("OpenWFTest: *** Failed saving image")); |
|
470 return EFalse; |
|
471 } |
|
472 INFO_PRINTF1(_L("Saved image")); |
|
473 LOG(("OpenWFTest: *** Saved image")); |
|
474 } |
|
475 return ETrue; |
|
476 } |
|
477 |
|
478 /** |
|
479 * Basic wait function call. Return amount of other active objects that stopped the scheduler |
|
480 */ |
|
481 TInt COpenwfTest::WaitL(TTimeIntervalMicroSeconds32 aDelay) //aDelay in microseconds |
|
482 { |
|
483 CActiveWaiter* waiter = NULL; |
|
484 waiter = CActiveWaiter::NewL(); |
|
485 TInt counter = waiter->Wait(aDelay); |
|
486 delete waiter; |
|
487 return counter; |
|
488 } |
|
489 |
|
490 /** |
|
491 * aMaxDelay The maximum time we are willing to wait in microseconds |
|
492 * aNotifications The amount of notifications we expect to complete, must be >0 |
|
493 * Returns ETrue on success |
|
494 */ |
|
495 TBool COpenwfTest::WaitForNotifications(TTimeIntervalMicroSeconds32 aMaxDelay,TInt aNotificatons) |
|
496 { |
|
497 if (aNotificatons == 0) |
|
498 { //use WaitL if no notifications are expected |
|
499 return EFalse; |
|
500 } |
|
501 TTime before; |
|
502 TTime after; |
|
503 before.UniversalTime(); |
|
504 TTimeIntervalMicroSeconds diff; |
|
505 TInt counter = aNotificatons; |
|
506 CActiveWaiter* waiter = NULL; |
|
507 TRAP_IGNORE(waiter = CActiveWaiter::NewL()); |
|
508 if (!waiter) |
|
509 { |
|
510 INFO_PRINTF1(_L("Failed creating CActiveWaiter")); |
|
511 LOG(("OpenWFTest: *** Failed creating CActiveWaiter")); |
|
512 return EFalse; |
|
513 } |
|
514 waiter->StartWait(aMaxDelay); |
|
515 CActiveScheduler::Start(); |
|
516 while(!waiter->iRun) |
|
517 { |
|
518 after.UniversalTime(); |
|
519 diff = after.MicroSecondsFrom(before); |
|
520 if (diff > KNotificationWarning) |
|
521 { |
|
522 INFO_PRINTF2(_L("note: Notification took a long time to complete: %ld microseconds"),diff.Int64()); |
|
523 LOG(("OpenWFTest: *** note: Notification took a long time to complete: %ld microseconds",diff.Int64())); |
|
524 } |
|
525 counter--; |
|
526 if (counter == 0) |
|
527 { //all expected notifications were completed |
|
528 delete waiter; |
|
529 return ETrue; |
|
530 } |
|
531 CActiveScheduler::Start(); |
|
532 } |
|
533 INFO_PRINTF2(_L("Not all notifications completed, counter=%d"),counter); |
|
534 LOG(("OpenWFTest: *** Not all notifications completed, counter=%d",counter)); |
|
535 delete waiter; |
|
536 //the notifications didn't complete in time |
|
537 return EFalse; |
|
538 } |
|
539 |
|
540 // Create a suite of all the tests |
|
541 CTestSuite* COpenwfTest::CreateSuiteL(const TDesC& aName) |
|
542 { |
|
543 SUB_SUITE_OPT(COpenwfTest,NULL); |
|
544 //positive fastpath tests |
|
545 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0000L); |
|
546 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0001L); |
|
547 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0002L); |
|
548 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0003L); |
|
549 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0004L); |
|
550 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0005L); |
|
551 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0006L); |
|
552 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0007L); |
|
553 //fastpath with notification tests |
|
554 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0010L); |
|
555 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0011L); |
|
556 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0012L); |
|
557 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0013L); |
|
558 //negative fastpath tests |
|
559 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0020L); |
|
560 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0021L); |
|
561 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0022L); |
|
562 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0023L); |
|
563 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0024L); |
|
564 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0025L); |
|
565 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0026L); |
|
566 ADD_THIS_TEST_STEP(GRAPHICS_OPENWFC_FASTPATH_0027L); |
|
567 |
|
568 END_SUITE; |
|
569 } |
|
570 |
|
571 void TefUnitFailLeaveL() |
|
572 { |
|
573 User::Leave(KErrTEFUnitFail); |
|
574 } |
|
575 |
|
576 CActiveNotification* CActiveNotification::NewL(RSurfaceUpdateSession& aSurfaceUpdateSession,TBool aActivate) |
|
577 { |
|
578 CActiveNotification* self = new (ELeave) CActiveNotification; |
|
579 CleanupStack::PushL(self); |
|
580 self->ConstructL(aSurfaceUpdateSession); |
|
581 CleanupStack::Pop(self); |
|
582 if (aActivate) |
|
583 { |
|
584 self->SetActive(); |
|
585 } |
|
586 return self; |
|
587 } |
|
588 |
|
589 void CActiveNotification::ConstructL(RSurfaceUpdateSession& aSurfaceUpdateSession) |
|
590 { |
|
591 CActiveScheduler::Add(this); |
|
592 iSurfaceUpdateSession = aSurfaceUpdateSession; |
|
593 } |
|
594 |
|
595 CActiveNotification::CActiveNotification() : CActive(EPriorityNormal) |
|
596 {} |
|
597 |
|
598 CActiveNotification::~CActiveNotification() |
|
599 { |
|
600 Cancel(); |
|
601 } |
|
602 |
|
603 void CActiveNotification::DoCancel() |
|
604 { //we need to cancel all notifications - this will impact other notifications in this sus session! |
|
605 iSurfaceUpdateSession.CancelAllUpdateNotifications(); |
|
606 } |
|
607 |
|
608 void CActiveNotification::RunL() |
|
609 { |
|
610 CActiveScheduler::Stop(); |
|
611 } |
|
612 |
|
613 TInt CActiveNotification::RunError(TInt aError) |
|
614 { |
|
615 return aError; // exists so a break point can be placed on it. |
|
616 } |
|
617 |
|
618 void CActiveNotification::Activate() |
|
619 { |
|
620 SetActive(); |
|
621 } |
|
622 |
|
623 CActiveWaiter* CActiveWaiter::NewL() |
|
624 { |
|
625 CActiveWaiter* self = new (ELeave) CActiveWaiter; |
|
626 CleanupStack::PushL(self); |
|
627 self->ConstructL(); |
|
628 CleanupStack::Pop(self); |
|
629 return self; |
|
630 } |
|
631 |
|
632 void CActiveWaiter::ConstructL() |
|
633 { |
|
634 User::LeaveIfError(iTimer.CreateLocal()); |
|
635 CActiveScheduler::Add(this); |
|
636 } |
|
637 |
|
638 CActiveWaiter::CActiveWaiter() : CActive(CActive::EPriorityStandard) |
|
639 {} |
|
640 |
|
641 CActiveWaiter::~CActiveWaiter() |
|
642 { |
|
643 Cancel(); |
|
644 iTimer.Close(); |
|
645 } |
|
646 |
|
647 void CActiveWaiter::DoCancel() |
|
648 { |
|
649 iTimer.Cancel(); |
|
650 } |
|
651 |
|
652 void CActiveWaiter::RunL() |
|
653 { |
|
654 iRun = ETrue; |
|
655 CActiveScheduler::Stop(); |
|
656 } |
|
657 |
|
658 TInt CActiveWaiter::RunError(TInt aError) |
|
659 { |
|
660 return aError; // exists so a break point can be placed on it. |
|
661 } |
|
662 |
|
663 /** |
|
664 * Waits the set amount of time. Returns the amount of times the active scheduler |
|
665 * was stopped (not including its own active scheduler stop) |
|
666 */ |
|
667 TInt CActiveWaiter::Wait(TTimeIntervalMicroSeconds32 aDelay) //microseconds |
|
668 { |
|
669 TInt counter = 0; |
|
670 SetActive(); |
|
671 iTimer.After(iStatus, aDelay); |
|
672 iRun = EFalse; |
|
673 CActiveScheduler::Start(); |
|
674 while (!iRun) |
|
675 {//may be another object that stops the scheduler running in these tests. |
|
676 counter++; |
|
677 CActiveScheduler::Start(); |
|
678 } |
|
679 return counter; |
|
680 } |
|
681 |
|
682 /** |
|
683 * Starts an AO with the given delay. Remember the RunL will stop the active scheduler. |
|
684 */ |
|
685 void CActiveWaiter::StartWait(TTimeIntervalMicroSeconds32 aDelay) //microseconds |
|
686 { |
|
687 SetActive(); |
|
688 iTimer.After(iStatus, aDelay); |
|
689 } |
|
690 |
|
691 /* |
|
692 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0000 |
|
693 @SYMTestCaseDesc Positive testing - Fastpath one-element scene |
|
694 @SYMREQ |
|
695 @SYMPREQ PREQ417-54885 |
|
696 @SYMTestType Unit Test |
|
697 @SYMTestPriority High |
|
698 @SYMTestPurpose Check a scene meeting fastpath criteria can be fastpathed |
|
699 @SYMTestActions |
|
700 All compositions are autonomous: |
|
701 Compose an empty scene |
|
702 Create a scene containing a screen sized element with no scaling, no alpha, no mask, no rotation |
|
703 Compose the scene |
|
704 @SYMTestExpectedResults |
|
705 The final scene should be fastpathed |
|
706 */ |
|
707 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0000L() |
|
708 { |
|
709 iTestName = _L("FASTPATH_0000"); |
|
710 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
711 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
712 SetupEmptySceneL(); |
|
713 |
|
714 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
715 iFastpathablePixelFormat, |
|
716 iStride, iContiguous, iMaxBuffers); |
|
717 ASSERT_FALSE(surface.IsNull()); |
|
718 |
|
719 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
720 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
721 ASSERT_EQUALS(err,KErrNone); |
|
722 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
723 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
724 |
|
725 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
726 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
727 |
|
728 #ifdef BREAKPOINT_FASTPATH |
|
729 __BREAKPOINT(); |
|
730 #endif |
|
731 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
732 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
733 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
734 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
735 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
736 LOG(("OpenWFTest: Fastpath - Now ON")); |
|
737 |
|
738 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
739 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
740 ASSERT_EQUALS(err,KErrNone); |
|
741 WaitL(iCompositionPause); |
|
742 |
|
743 ASSERT_TRUE(AcquireOnScreenStream()); |
|
744 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
745 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
746 ReleaseOnScreenStream(); |
|
747 |
|
748 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
749 wfcDestroySource(iDevice, fpSource); |
|
750 } |
|
751 |
|
752 /* |
|
753 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0001 |
|
754 @SYMTestCaseDesc Positive testing - Fastpath one-element scene |
|
755 @SYMREQ |
|
756 @SYMPREQ PREQ417-54885 |
|
757 @SYMTestType Unit Test |
|
758 @SYMTestPriority High |
|
759 @SYMTestPurpose Check a scene including a full screen element with global alpha at opaque level |
|
760 can be fastpathed |
|
761 @SYMTestActions |
|
762 All compositions are autonomous: |
|
763 Compose an empty scene |
|
764 Create a scene containing a screen sized element with 2 buffers |
|
765 Enable WFC_TRANPARENCY_GLOBAL_ALPHA |
|
766 Set WFC_ELEMENT_GLOBAL_ALPHA to be 255 (opaque) |
|
767 Compose the scene |
|
768 @SYMTestExpectedResults |
|
769 The final scene should be fastpathed |
|
770 */ |
|
771 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0001L() |
|
772 { |
|
773 iTestName = _L("FASTPATH_0001"); |
|
774 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
775 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
776 SetupEmptySceneL(); |
|
777 |
|
778 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
779 iFastpathablePixelFormat, |
|
780 iStride, iContiguous, iMaxBuffers); |
|
781 ASSERT_FALSE(surface.IsNull()); |
|
782 |
|
783 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
784 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
785 ASSERT_EQUALS(err,KErrNone); |
|
786 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
787 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
788 |
|
789 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
790 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
791 //set element global alpha |
|
792 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA); |
|
793 wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 1.0f); |
|
794 |
|
795 #ifdef BREAKPOINT_FASTPATH |
|
796 __BREAKPOINT(); |
|
797 #endif |
|
798 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
799 LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element alpha")); |
|
800 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
801 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
802 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
803 LOG(("OpenWFTest: Fastpath - now ON - using element alpha")); |
|
804 |
|
805 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
806 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
807 ASSERT_EQUALS(err,KErrNone); |
|
808 WaitL(iCompositionPause); |
|
809 |
|
810 ASSERT_TRUE(AcquireOnScreenStream()); |
|
811 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
812 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
813 ReleaseOnScreenStream(); |
|
814 |
|
815 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
816 wfcDestroySource(iDevice, fpSource); |
|
817 } |
|
818 |
|
819 /* |
|
820 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0002 |
|
821 @SYMTestCaseDesc Positive testing - Fastpath one-element scene |
|
822 @SYMREQ |
|
823 @SYMPREQ PREQ417-54885 |
|
824 @SYMTestType Unit Test |
|
825 @SYMTestPriority High |
|
826 @SYMTestPurpose Check a scene including a full screen element with source alpha flagged but an |
|
827 opaque data format can be fastpathed |
|
828 @SYMTestActions |
|
829 All compositions are autonomous: |
|
830 Compose an empty scene |
|
831 Create a scene containing a screen sized element |
|
832 Enable WFC_TRANSPARENCY_SOURCE, but the source format has no alpha value |
|
833 Compose the scene |
|
834 @SYMTestExpectedResults |
|
835 The final scene should be fastpathed |
|
836 */ |
|
837 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0002L() |
|
838 { |
|
839 iTestName = _L("FASTPATH_0002"); |
|
840 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
841 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
842 SetupEmptySceneL(); |
|
843 |
|
844 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
845 EUidPixelFormatXRGB_8888, |
|
846 iStride, iContiguous, iMaxBuffers); |
|
847 ASSERT_FALSE(surface.IsNull()); |
|
848 |
|
849 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
850 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
851 ASSERT_EQUALS(err,KErrNone); |
|
852 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
853 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
854 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
855 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
856 //set pixel alpha on XRGB element |
|
857 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_SOURCE); |
|
858 |
|
859 #ifdef BREAKPOINT_FASTPATH |
|
860 __BREAKPOINT(); |
|
861 #endif |
|
862 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
863 LOG(("OpenWFTest: Expecting FASTPATH after next commit - using pixel alpha")); |
|
864 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
865 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
866 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
867 LOG(("OpenWFTest: Fastpath - now ON - using pixel alpha")); |
|
868 |
|
869 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
870 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
871 ASSERT_EQUALS(err,KErrNone); |
|
872 WaitL(iCompositionPause); |
|
873 |
|
874 ASSERT_TRUE(AcquireOnScreenStream()); |
|
875 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
876 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
877 ReleaseOnScreenStream(); |
|
878 |
|
879 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
880 wfcDestroySource(iDevice, fpSource); |
|
881 } |
|
882 |
|
883 /* |
|
884 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0003 |
|
885 @SYMTestCaseDesc Positive testing - Fastpath scene with a double buffered element |
|
886 @SYMREQ |
|
887 @SYMPREQ PREQ417-54885 |
|
888 @SYMTestType Unit Test |
|
889 @SYMTestPriority High |
|
890 @SYMTestPurpose Check if a scene is fastpathed using the second buffer |
|
891 @SYMTestActions |
|
892 All compositions are autonomous: |
|
893 Compose an empty scene |
|
894 A) Create a scene containing an element with 2 buffers |
|
895 Set the element screen size |
|
896 Set destination and source rectangle to screen size |
|
897 Compose the scene |
|
898 B) Send an update to buffer 1 with change of colour |
|
899 Wait for notification |
|
900 @SYMTestExpectedResults |
|
901 The scene should be fastpathed for A and B |
|
902 Screen colour should change after B |
|
903 */ |
|
904 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0003L() |
|
905 { |
|
906 iTestName = _L("FASTPATH_0003"); |
|
907 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
908 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
909 SetupEmptySceneL(); |
|
910 |
|
911 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
912 iFastpathablePixelFormat, |
|
913 iStride, iContiguous, iMaxBuffers); |
|
914 ASSERT_FALSE(surface.IsNull()); |
|
915 |
|
916 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
917 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
918 ASSERT_EQUALS(err,KErrNone); |
|
919 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
920 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
921 |
|
922 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
923 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
924 |
|
925 #ifdef BREAKPOINT_FASTPATH |
|
926 __BREAKPOINT(); |
|
927 #endif |
|
928 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
929 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
930 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
931 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
932 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
933 LOG(("OpenWFTest: Fastpath - now ON")); |
|
934 |
|
935 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
936 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
937 ASSERT_EQUALS(err,KErrNone); |
|
938 WaitL(iCompositionPause); |
|
939 |
|
940 ASSERT_TRUE(AcquireOnScreenStream()); |
|
941 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
942 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
943 ReleaseOnScreenStream(); |
|
944 |
|
945 //Fill surface is blue |
|
946 iUtility->FillSurfaceL(surface, 1, KBlue); |
|
947 //Do content update for surface buff1 |
|
948 CActiveNotification* buff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
949 CleanupStack::PushL(buff1disp); |
|
950 TTimeStamp buff1time; |
|
951 iUtility->NotifyWhenDisplayed(buff1disp->iStatus,buff1time); |
|
952 |
|
953 LOG(("OpenWFTest: Fastpath - staying ON...")); |
|
954 err = iUtility->SubmitUpdate(surface, 1, NULL); |
|
955 ASSERT_EQUALS(err,KErrNone); |
|
956 ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1)); //1 AO should have completed |
|
957 |
|
958 //create ref image/check on screen content |
|
959 ASSERT_TRUE(AcquireOnScreenStream()); |
|
960 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
961 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBlue,iTolerance)); |
|
962 ReleaseOnScreenStream(); |
|
963 |
|
964 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
965 wfcDestroySource(iDevice, fpSource); |
|
966 CleanupStack::PopAndDestroy(buff1disp); |
|
967 } |
|
968 |
|
969 /* |
|
970 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0004 |
|
971 @SYMTestCaseDesc Positive testing - Fastpath two-element scene |
|
972 @SYMREQ |
|
973 @SYMPREQ PREQ417-54885 |
|
974 @SYMTestType Unit Test |
|
975 @SYMTestPriority Medium |
|
976 @SYMTestPurpose Check a scene including a full screen opaque element as the top layer can be |
|
977 fastpathed |
|
978 @SYMTestActions |
|
979 All compositions are autonomous: |
|
980 Compose an empty scene |
|
981 A) Create a scene containing a screen sized element with WFC_TRANSPARENCY_NONE enabled |
|
982 Compose the scene |
|
983 B) Create a small rectangle behind the first element |
|
984 Compose the scene |
|
985 */ |
|
986 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0004L() |
|
987 { |
|
988 iTestName = _L("FASTPATH_0004"); |
|
989 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
990 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
991 SetupEmptySceneL(); |
|
992 |
|
993 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
994 iFastpathablePixelFormat, |
|
995 iStride, iContiguous, iMaxBuffers); |
|
996 ASSERT_FALSE(surface.IsNull()); |
|
997 |
|
998 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
999 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
1000 ASSERT_EQUALS(err,KErrNone); |
|
1001 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
1002 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
1003 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
1004 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
1005 |
|
1006 TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2), |
|
1007 iFastpathablePixelFormat, |
|
1008 iStride, iContiguous, iMaxBuffers); |
|
1009 ASSERT_FALSE(surfaceB.IsNull()); |
|
1010 WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL); |
|
1011 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1012 ASSERT_EQUALS(err,KErrNone); |
|
1013 WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL); |
|
1014 wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB); |
|
1015 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect); |
|
1016 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect); |
|
1017 |
|
1018 #ifdef BREAKPOINT_FASTPATH |
|
1019 __BREAKPOINT(); |
|
1020 #endif |
|
1021 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
1022 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
1023 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1024 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1025 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1026 LOG(("OpenWFTest: Fastpath - now ON")); |
|
1027 |
|
1028 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
1029 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
1030 ASSERT_EQUALS(err,KErrNone); |
|
1031 WaitL(iCompositionPause); |
|
1032 |
|
1033 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1034 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1035 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
1036 ReleaseOnScreenStream(); |
|
1037 |
|
1038 LOG(("OpenWFTest: Fastpath - staying ON...")); |
|
1039 #ifdef BREAKPOINT_FASTPATH |
|
1040 __BREAKPOINT(); |
|
1041 #endif |
|
1042 wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE); |
|
1043 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
1044 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1045 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1046 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1047 |
|
1048 iUtility->FillSurfaceL(surfaceB, 0, KBlue); |
|
1049 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1050 ASSERT_EQUALS(err,KErrNone); |
|
1051 WaitL(iCompositionPause); |
|
1052 |
|
1053 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1054 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1055 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
1056 ReleaseOnScreenStream(); |
|
1057 |
|
1058 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
1059 wfcDestroySource(iDevice, fpSource); |
|
1060 wfcDestroySource(iDevice, sourceB); |
|
1061 } |
|
1062 |
|
1063 /* |
|
1064 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0005 |
|
1065 @SYMTestCaseDesc Positive testing - Fastpath two-element scene |
|
1066 @SYMREQ |
|
1067 @SYMPREQ PREQ417-54885 |
|
1068 @SYMTestType Unit Test |
|
1069 @SYMTestPriority Medium |
|
1070 @SYMTestPurpose Check a scene including a full screen element with global alpha as the top layer |
|
1071 can be fastpathed |
|
1072 @SYMTestActions |
|
1073 All compositions are autonomous: |
|
1074 Compose an empty scene |
|
1075 A) Create a scene containing a screen sized element |
|
1076 Enable WFC_TRANPARENCY_GLOBAL_ALPHA and set WFC_ELEMENT_GLOBAL_ALPHA to be 255 (opaque) |
|
1077 Compose the scene |
|
1078 B) Create a smaller element behind the first element |
|
1079 Compose the scene |
|
1080 @SYMTestExpectedResults |
|
1081 Both compositions should trigger fastpathing. |
|
1082 */ |
|
1083 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0005L() |
|
1084 { |
|
1085 iTestName = _L("FASTPATH_0005"); |
|
1086 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
1087 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
1088 SetupEmptySceneL(); |
|
1089 |
|
1090 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
1091 iFastpathablePixelFormat, |
|
1092 iStride, iContiguous, iMaxBuffers); |
|
1093 ASSERT_FALSE(surface.IsNull()); |
|
1094 |
|
1095 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
1096 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
1097 ASSERT_EQUALS(err,KErrNone); |
|
1098 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
1099 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
1100 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
1101 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
1102 //set element global alpha |
|
1103 wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 1.0f); |
|
1104 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA); |
|
1105 |
|
1106 TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2), |
|
1107 iFastpathablePixelFormat, |
|
1108 iStride, iContiguous, iMaxBuffers); |
|
1109 ASSERT_FALSE(surfaceB.IsNull()); |
|
1110 WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL); |
|
1111 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1112 ASSERT_EQUALS(err,KErrNone); |
|
1113 WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL); |
|
1114 wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB); |
|
1115 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect); |
|
1116 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect); |
|
1117 |
|
1118 #ifdef BREAKPOINT_FASTPATH |
|
1119 __BREAKPOINT(); |
|
1120 #endif |
|
1121 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
1122 LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element global alpha")); |
|
1123 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1124 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1125 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1126 LOG(("OpenWFTest: Fastpath - now ON... - using element global alpha")); |
|
1127 |
|
1128 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
1129 ASSERT_EQUALS(iUtility->SubmitUpdate(surface, 0, NULL),KErrNone); |
|
1130 WaitL(iCompositionPause); |
|
1131 |
|
1132 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1133 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1134 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
1135 ReleaseOnScreenStream(); |
|
1136 |
|
1137 |
|
1138 #ifdef BREAKPOINT_FASTPATH |
|
1139 __BREAKPOINT(); |
|
1140 #endif |
|
1141 wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE); |
|
1142 LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element global alpha")); |
|
1143 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1144 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1145 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1146 |
|
1147 iUtility->FillSurfaceL(surfaceB, 0, KBlue); |
|
1148 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1149 ASSERT_EQUALS(err,KErrNone); |
|
1150 WaitL(iCompositionPause); |
|
1151 |
|
1152 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1153 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1154 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
1155 ReleaseOnScreenStream(); |
|
1156 |
|
1157 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
1158 wfcDestroySource(iDevice, fpSource); |
|
1159 wfcDestroySource(iDevice, sourceB); |
|
1160 } |
|
1161 |
|
1162 /* |
|
1163 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0006 |
|
1164 @SYMTestCaseDesc Positive testing - Fastpath two-element scene |
|
1165 @SYMREQ |
|
1166 @SYMPREQ PREQ417-54885 |
|
1167 @SYMTestType Unit Test |
|
1168 @SYMTestPriority Low |
|
1169 @SYMTestPurpose Check a scene including a full screen opaque element behind a transparent element |
|
1170 can be fastpathed |
|
1171 @SYMTestActions |
|
1172 All compositions are autonomous: |
|
1173 Compose an empty scene |
|
1174 A) Create a scene containing an element of any size |
|
1175 Enable WFC_TRANPARENCY_GLOBAL_ALPHA and set WFC_ELEMENT_GLOBAL_ALPHA to 0 (transparent) |
|
1176 Compose the scene |
|
1177 B) Create another screen sized opaque element behind the frist |
|
1178 Compose the scene |
|
1179 @SYMTestExpectedResults |
|
1180 The final scene should fastpath for B), not for A) |
|
1181 (The current implementation does not support this fastpath behaviour. This test can be ignored at |
|
1182 the moment.) |
|
1183 */ |
|
1184 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0006L() |
|
1185 { |
|
1186 iTestName = _L("FASTPATH_0006"); |
|
1187 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
1188 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
1189 SetupEmptySceneL(); |
|
1190 |
|
1191 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2), |
|
1192 iFastpathablePixelFormat, |
|
1193 iStride, iContiguous, iMaxBuffers); |
|
1194 ASSERT_FALSE(surface.IsNull()); |
|
1195 |
|
1196 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
1197 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
1198 ASSERT_EQUALS(err,KErrNone); |
|
1199 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
1200 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
1201 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect); |
|
1202 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect); |
|
1203 //set element global alpha fully transparent |
|
1204 wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 0.0f); |
|
1205 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA); |
|
1206 |
|
1207 TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
1208 iFastpathablePixelFormat, |
|
1209 iStride, iContiguous, iMaxBuffers); |
|
1210 ASSERT_FALSE(surfaceB.IsNull()); |
|
1211 WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL); |
|
1212 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1213 ASSERT_EQUALS(err,KErrNone); |
|
1214 WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL); |
|
1215 wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB); |
|
1216 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
1217 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
1218 |
|
1219 #ifdef BREAKPOINT_FASTPATH |
|
1220 __BREAKPOINT(); |
|
1221 #endif |
|
1222 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
1223 LOG(("OpenWFTest: Expecting COMPOSITION after next commit -single fully transparent element using global alpha")); |
|
1224 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1225 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1226 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1227 LOG(("OpenWFTest: Fastpath - now ON - single fully transparent element using global alpha")); |
|
1228 |
|
1229 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
1230 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
1231 ASSERT_EQUALS(err,KErrNone); |
|
1232 WaitL(iCompositionPause); |
|
1233 |
|
1234 #ifdef BREAKPOINT_FASTPATH |
|
1235 __BREAKPOINT(); |
|
1236 #endif |
|
1237 wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE); |
|
1238 LOG(("OpenWFTest: Expecting FASTPATH after next commit -fullscreen opaque element behind fully transparent element")); |
|
1239 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1240 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1241 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1242 LOG(("OpenWFTest: Fastpath - now ON - fullscreen opaque element behind transparent element")); |
|
1243 |
|
1244 iUtility->FillSurfaceL(surfaceB, 0, KBlue); |
|
1245 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1246 ASSERT_EQUALS(err,KErrNone); |
|
1247 WaitL(iCompositionPause); |
|
1248 |
|
1249 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1250 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1251 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBlue,iTolerance)); |
|
1252 ReleaseOnScreenStream(); |
|
1253 |
|
1254 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
1255 wfcDestroySource(iDevice, fpSource); |
|
1256 wfcDestroySource(iDevice, sourceB); |
|
1257 } |
|
1258 |
|
1259 /* |
|
1260 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0007 |
|
1261 @SYMTestCaseDesc Positive testing - Fastpath one-element scene |
|
1262 @SYMREQ |
|
1263 @SYMPREQ PREQ417-54885 |
|
1264 @SYMTestType Unit Test |
|
1265 @SYMTestPriority High |
|
1266 @SYMTestPurpose Check a scene including destination rectangle changes can trigger fastpath on and off |
|
1267 @SYMTestActions |
|
1268 All compositions are autonomous: |
|
1269 Compose an empty scene |
|
1270 Create a scene containing a screen sized element |
|
1271 Compose scene |
|
1272 Set the destination rectangle smaller than screen size |
|
1273 Compose the scene |
|
1274 Set the destination rectangle back to screen size |
|
1275 Compose the scene |
|
1276 @SYMTestExpectedResults |
|
1277 The scenes with the element of full screen destination rectangle should be fastpathed |
|
1278 The scene with the element of smaller destination rectangle should not be fastpathed |
|
1279 */ |
|
1280 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0007L() |
|
1281 { |
|
1282 iTestName = _L("FASTPATH_0007"); |
|
1283 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
1284 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
1285 SetupEmptySceneL(); |
|
1286 |
|
1287 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
1288 iFastpathablePixelFormat, |
|
1289 iStride, iContiguous, iMaxBuffers); |
|
1290 ASSERT_FALSE(surface.IsNull()); |
|
1291 |
|
1292 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
1293 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
1294 ASSERT_EQUALS(err,KErrNone); |
|
1295 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
1296 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
1297 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
1298 //NOT full screen destination |
|
1299 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect); |
|
1300 |
|
1301 #ifdef BREAKPOINT_FASTPATH |
|
1302 __BREAKPOINT(); |
|
1303 #endif |
|
1304 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
1305 LOG(("OpenWFTest: Expecting COMPOSITION after next commit")); |
|
1306 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1307 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1308 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1309 LOG(("OpenWFTest: Fastpath - still OFF")); |
|
1310 |
|
1311 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
1312 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
1313 ASSERT_EQUALS(err,KErrNone); |
|
1314 WaitL(iCompositionPause); |
|
1315 |
|
1316 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1317 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1318 ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KGreen,iTolerance)); |
|
1319 ReleaseOnScreenStream(); |
|
1320 |
|
1321 //NOW set full screen |
|
1322 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
1323 |
|
1324 #ifdef BREAKPOINT_FASTPATH |
|
1325 __BREAKPOINT(); |
|
1326 #endif |
|
1327 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
1328 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1329 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1330 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1331 WaitL(iCompositionPause); |
|
1332 |
|
1333 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1334 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1335 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
1336 ReleaseOnScreenStream(); |
|
1337 |
|
1338 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
1339 wfcDestroySource(iDevice, fpSource); |
|
1340 } |
|
1341 |
|
1342 //NOTIFICATION TESTS |
|
1343 void COpenwfTest::FastpathNotificationsTestL(TBool aAutonomous) |
|
1344 { |
|
1345 SetupEmptySceneL(aAutonomous); |
|
1346 |
|
1347 //Create 3 elements A+C fastpathable, B centered |
|
1348 TSurfaceId surfaceA = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
1349 iFastpathablePixelFormat, |
|
1350 iStride, iContiguous, iMaxBuffers); |
|
1351 ASSERT_FALSE(surfaceA.IsNull()); |
|
1352 WFCSource sourceA = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceA), NULL); |
|
1353 TInt err = iUtility->SubmitUpdate(surfaceA, 0, NULL); |
|
1354 ASSERT_EQUALS(err,KErrNone); |
|
1355 WFCElement elementA = wfcCreateElement(iDevice, iContext, NULL); |
|
1356 wfcSetElementAttribi(iDevice, elementA, WFC_ELEMENT_SOURCE, sourceA); |
|
1357 wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
1358 wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
1359 |
|
1360 TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2), |
|
1361 iFastpathablePixelFormat, |
|
1362 iStride, iContiguous, iMaxBuffers); |
|
1363 ASSERT_FALSE(surfaceB.IsNull()); |
|
1364 WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL); |
|
1365 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1366 ASSERT_EQUALS(err,KErrNone); |
|
1367 WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL); |
|
1368 wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB); |
|
1369 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect); |
|
1370 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect); |
|
1371 |
|
1372 TSurfaceId surfaceC = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
1373 iFastpathablePixelFormat, |
|
1374 iStride, iContiguous, iMaxBuffers); |
|
1375 ASSERT_FALSE(surfaceC.IsNull()); |
|
1376 WFCSource sourceC = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceC), NULL); |
|
1377 err = iUtility->SubmitUpdate(surfaceC, 0, NULL); |
|
1378 ASSERT_EQUALS(err,KErrNone); |
|
1379 WFCElement elementC = wfcCreateElement(iDevice, iContext, NULL); |
|
1380 wfcSetElementAttribi(iDevice, elementC, WFC_ELEMENT_SOURCE, sourceC); |
|
1381 wfcSetElementAttribiv(iDevice, elementC, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
1382 wfcSetElementAttribiv(iDevice, elementC, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
1383 |
|
1384 //**********STARTING ACTUAL TEST!********** |
|
1385 //**********SURFACE A FASTPATHABLE********** |
|
1386 //Add A to scene |
|
1387 wfcInsertElement(iDevice, elementA, WFC_INVALID_HANDLE); |
|
1388 #ifdef BREAKPOINT_FASTPATH |
|
1389 __BREAKPOINT(); |
|
1390 #endif |
|
1391 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
1392 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1393 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1394 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1395 LOG(("OpenWFTest: Fastpath - now ON")); |
|
1396 //Set A buffer0 red |
|
1397 iUtility->FillSurfaceL(surfaceA, 0, KRed); |
|
1398 //Do content update Abuff0 idisp iavail |
|
1399 CActiveNotification* surfAbuff0disp = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1400 CleanupStack::PushL(surfAbuff0disp); |
|
1401 TTimeStamp surfAbuff0time; |
|
1402 CActiveNotification* surfAbuff0avail = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1403 CleanupStack::PushL(surfAbuff0avail); |
|
1404 //iUtility->NotifyWhenDisplayed(surfAbuff0disp,surfAbuff0time); |
|
1405 iUtility->NotifyWhenDisplayed(surfAbuff0disp->iStatus,surfAbuff0time); |
|
1406 iUtility->NotifyWhenAvailable(surfAbuff0avail->iStatus); |
|
1407 err = iUtility->SubmitUpdate(surfaceA, 0, NULL); |
|
1408 ASSERT_EQUALS(err,KErrNone); |
|
1409 |
|
1410 if(!aAutonomous) |
|
1411 { |
|
1412 WaitL(iCompositionPause); |
|
1413 //Check A buff0 iDisp doesnt complete |
|
1414 ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KRequestPending); |
|
1415 //Check A buff0 iAvail doesnt complete |
|
1416 ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending); |
|
1417 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1418 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1419 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1420 } |
|
1421 ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1)); |
|
1422 |
|
1423 //Check A buff0 iDisp completes |
|
1424 ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KErrNone); |
|
1425 //Check A buff0 iAvail doesnt complete |
|
1426 ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending); |
|
1427 |
|
1428 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1429 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1430 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KRed,iTolerance)); |
|
1431 ReleaseOnScreenStream(); |
|
1432 |
|
1433 //Set A buffer1 Yellow |
|
1434 iUtility->FillSurfaceL(surfaceA, 1, KYellow); |
|
1435 |
|
1436 //Check A buff0 iavail doesnt complete |
|
1437 ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending); |
|
1438 |
|
1439 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1440 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1441 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KRed,iTolerance)); |
|
1442 ReleaseOnScreenStream(); |
|
1443 |
|
1444 //Do content update Abuff1 idisp iavail |
|
1445 CActiveNotification* surfAbuff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1446 CleanupStack::PushL(surfAbuff1disp); |
|
1447 TTimeStamp surfAbuff1time; |
|
1448 CActiveNotification* surfAbuff1avail = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1449 CleanupStack::PushL(surfAbuff1avail); |
|
1450 iUtility->NotifyWhenDisplayed(surfAbuff1disp->iStatus,surfAbuff1time); |
|
1451 iUtility->NotifyWhenAvailable(surfAbuff1avail->iStatus); |
|
1452 err = iUtility->SubmitUpdate(surfaceA, 1, NULL); |
|
1453 ASSERT_EQUALS(err,KErrNone); |
|
1454 |
|
1455 if(!aAutonomous) |
|
1456 { |
|
1457 WaitL(iCompositionPause); |
|
1458 //Check A buff1 iDisp doesnt complete |
|
1459 ASSERT_EQUALS(surfAbuff1disp->iStatus.Int(),KRequestPending); |
|
1460 //Check A buff1 iAvail doesnt complete |
|
1461 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1462 //Check A buff0 iAvail doesnt complete |
|
1463 ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending); |
|
1464 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1465 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1466 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1467 } |
|
1468 ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2)); |
|
1469 |
|
1470 //Check A buff1 idisp completes |
|
1471 ASSERT_EQUALS(surfAbuff1disp->iStatus.Int(),KErrNone); |
|
1472 //Check A buff0 iAvail completes |
|
1473 ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KErrNone); |
|
1474 //Check A buff1 iAvail doesnt complete |
|
1475 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1476 |
|
1477 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1478 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1479 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KYellow,iTolerance)); |
|
1480 ReleaseOnScreenStream(); |
|
1481 |
|
1482 //**********SURFACE B NOT VISIBLE********** |
|
1483 //Add surfaceB to scene behind surfaceA |
|
1484 wfcInsertElement(iDevice, elementB, WFC_INVALID_HANDLE); |
|
1485 #ifdef BREAKPOINT_FASTPATH |
|
1486 __BREAKPOINT(); |
|
1487 #endif |
|
1488 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
1489 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1490 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1491 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1492 LOG(("OpenWFTest: Fastpath - still ON")); |
|
1493 //Set B buffer0 green |
|
1494 iUtility->FillSurfaceL(surfaceB, 0, KGreen); |
|
1495 //Do content update idisp iavail |
|
1496 CActiveNotification* surfBbuff0disp = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1497 CleanupStack::PushL(surfBbuff0disp); |
|
1498 TTimeStamp surfBbuff0time; |
|
1499 CActiveNotification* surfBbuff0avail = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1500 CleanupStack::PushL(surfBbuff0avail); |
|
1501 iUtility->NotifyWhenDisplayed(surfBbuff0disp->iStatus,surfBbuff0time); |
|
1502 iUtility->NotifyWhenAvailable(surfBbuff0avail->iStatus); |
|
1503 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1504 ASSERT_EQUALS(err,KErrNone); |
|
1505 |
|
1506 if(!aAutonomous) |
|
1507 { |
|
1508 WaitL(iCompositionPause); |
|
1509 //Check B buff0 iAvail doesnt complete |
|
1510 ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending); |
|
1511 //Check B buff0 iDisp doesnt complete |
|
1512 ASSERT_EQUALS(surfBbuff0disp->iStatus.Int(),KRequestPending); |
|
1513 //Check A buff1 iAvail doesnt complete |
|
1514 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1515 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1516 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1517 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1518 } |
|
1519 ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1)); |
|
1520 |
|
1521 //Check B buff0 idisp completes - could be no error or not visible |
|
1522 ASSERT_TRUE((surfBbuff0disp->iStatus.Int()==KErrNotVisible)||(surfBbuff0disp->iStatus.Int()==KErrNone)); |
|
1523 //Check B buff0 iavail doesnt complete |
|
1524 ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending); |
|
1525 //Check A buff1 iavail doesnt complete |
|
1526 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1527 |
|
1528 //Set B buffer1 blue |
|
1529 iUtility->FillSurfaceL(surfaceB, 1, KBlue); |
|
1530 //Do content update idisp iavail |
|
1531 CActiveNotification* surfBbuff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1532 CleanupStack::PushL(surfBbuff1disp); |
|
1533 TTimeStamp surfBbuff1time; |
|
1534 CActiveNotification* surfBbuff1avail = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1535 CleanupStack::PushL(surfBbuff1avail); |
|
1536 iUtility->NotifyWhenDisplayed(surfBbuff1disp->iStatus,surfBbuff1time); |
|
1537 iUtility->NotifyWhenAvailable(surfBbuff1avail->iStatus); |
|
1538 err = iUtility->SubmitUpdate(surfaceB, 1, NULL); |
|
1539 ASSERT_EQUALS(err,KErrNone); |
|
1540 |
|
1541 if(!aAutonomous) |
|
1542 { |
|
1543 WaitL(iCompositionPause); |
|
1544 //Check B buff1 iAvail doesnt complete |
|
1545 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending); |
|
1546 //Check B buff1 iDisp doesnt complete |
|
1547 ASSERT_EQUALS(surfBbuff1disp->iStatus.Int(),KRequestPending); |
|
1548 //Check B buff0 iAvail doesnt complete |
|
1549 ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending); |
|
1550 //Check A buff1 iAvail doesnt complete |
|
1551 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1552 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1553 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1554 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1555 } |
|
1556 ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2)); |
|
1557 |
|
1558 //Check B buff1 idisp completes - could be no error or not visible |
|
1559 ASSERT_TRUE((surfBbuff1disp->iStatus.Int()==KErrNotVisible)||(surfBbuff1disp->iStatus.Int()==KErrNone)); |
|
1560 //Check B buff1 iavail doesnt complete |
|
1561 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending); |
|
1562 //Check B buff0 iavail completes - could be no error or not visible |
|
1563 ASSERT_TRUE((surfBbuff0avail->iStatus.Int()==KErrNotVisible)||(surfBbuff0avail->iStatus.Int()==KErrNone)); |
|
1564 //Check A buff1 iavail doesnt complete |
|
1565 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1566 |
|
1567 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1568 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1569 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KYellow,iTolerance)); |
|
1570 ReleaseOnScreenStream(); |
|
1571 |
|
1572 //**********SURFACE C ALSO FASTPATHABLE********** |
|
1573 //Add C to scene in front of surfaceA |
|
1574 wfcInsertElement(iDevice, elementC, elementA); |
|
1575 #ifdef BREAKPOINT_FASTPATH |
|
1576 __BREAKPOINT(); |
|
1577 #endif |
|
1578 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
1579 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1580 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1581 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1582 LOG(("OpenWFTest: Fastpath - still ON")); |
|
1583 //Set C to brown |
|
1584 iUtility->FillSurfaceL(surfaceC, 0, KBrown); |
|
1585 //Do content update Cbuff0 idisp iavail |
|
1586 CActiveNotification* surfCbuff0disp = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1587 CleanupStack::PushL(surfCbuff0disp); |
|
1588 TTimeStamp surfCbuff0time; |
|
1589 CActiveNotification* surfCbuff0avail = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1590 CleanupStack::PushL(surfCbuff0avail); |
|
1591 iUtility->NotifyWhenDisplayed(surfCbuff0disp->iStatus,surfCbuff0time); |
|
1592 iUtility->NotifyWhenAvailable(surfCbuff0avail->iStatus); |
|
1593 err = iUtility->SubmitUpdate(surfaceC, 0, NULL); |
|
1594 ASSERT_EQUALS(err,KErrNone); |
|
1595 |
|
1596 if(!aAutonomous) |
|
1597 { |
|
1598 WaitL(iCompositionPause); |
|
1599 //Check C buff0 iAvail doesnt complete |
|
1600 ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KRequestPending); |
|
1601 //Check C buff0 iDisp doesnt complete |
|
1602 ASSERT_EQUALS(surfCbuff0disp->iStatus.Int(),KRequestPending); |
|
1603 //Check B buff1 iAvail doesnt complete |
|
1604 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending); |
|
1605 //Check A buff1 iAvail doesnt complete |
|
1606 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1607 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1608 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1609 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1610 } |
|
1611 ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,1)); |
|
1612 |
|
1613 //Check C buff0 idisp completes |
|
1614 ASSERT_EQUALS(surfCbuff0disp->iStatus.Int(),KErrNone); |
|
1615 //Check C buff0 iavail does not complete |
|
1616 ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KRequestPending); |
|
1617 //Check B buff1 iavail doesnt complete |
|
1618 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending); |
|
1619 //Check A buff1 iavail doesnt complete |
|
1620 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1621 |
|
1622 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1623 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1624 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBrown,iTolerance)); |
|
1625 ReleaseOnScreenStream(); |
|
1626 |
|
1627 //Set C buffer1 grey |
|
1628 iUtility->FillSurfaceL(surfaceC, 1, KGray); |
|
1629 //Do content update Cbuff1 idisp iavail |
|
1630 CActiveNotification* surfCbuff1disp = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1631 CleanupStack::PushL(surfCbuff1disp); |
|
1632 TTimeStamp surfCbuff1time; |
|
1633 CActiveNotification* surfCbuff1avail = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
1634 CleanupStack::PushL(surfCbuff1avail); |
|
1635 iUtility->NotifyWhenDisplayed(surfCbuff1disp->iStatus,surfCbuff1time); |
|
1636 iUtility->NotifyWhenAvailable(surfCbuff1avail->iStatus); |
|
1637 err = iUtility->SubmitUpdate(surfaceC, 1, NULL); |
|
1638 ASSERT_EQUALS(err,KErrNone); |
|
1639 |
|
1640 if(!aAutonomous) |
|
1641 { |
|
1642 WaitL(iCompositionPause); |
|
1643 //Check C buff1 iAvail doesnt complete |
|
1644 ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending); |
|
1645 //Check C buff1 iDisp doesnt complete |
|
1646 ASSERT_EQUALS(surfCbuff1disp->iStatus.Int(),KRequestPending); |
|
1647 //Check C buff0 iAvail doesnt complete |
|
1648 ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KRequestPending); |
|
1649 //Check B buff1 iAvail doesnt complete |
|
1650 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending); |
|
1651 //Check A buff1 iAvail doesnt complete |
|
1652 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1653 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1654 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1655 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1656 } |
|
1657 ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2)); |
|
1658 |
|
1659 //Check C buff1 idisp completes |
|
1660 ASSERT_EQUALS(surfCbuff1disp->iStatus.Int(),KErrNone); |
|
1661 //Check C buff1 iavail does not complete |
|
1662 ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending); |
|
1663 //Check C buff0 iavail completes |
|
1664 ASSERT_EQUALS(surfCbuff0avail->iStatus.Int(),KErrNone); |
|
1665 //Check B buff1 iavail doesnt complete |
|
1666 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending); |
|
1667 //Check A buff1 iavail doesnt complete |
|
1668 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1669 |
|
1670 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1671 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1672 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGray,iTolerance)); |
|
1673 ReleaseOnScreenStream(); |
|
1674 |
|
1675 //**********SURFACE A BACK TO FRONT********** |
|
1676 //Move A to the front |
|
1677 wfcInsertElement(iDevice, elementA, elementC); |
|
1678 #ifdef BREAKPOINT_FASTPATH |
|
1679 __BREAKPOINT(); |
|
1680 #endif |
|
1681 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
1682 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1683 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1684 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1685 LOG(("OpenWFTest: Fastpath - still ON")); |
|
1686 //Set A buffer0 magenta |
|
1687 iUtility->FillSurfaceL(surfaceA, 0, KMagenta); |
|
1688 //Do content update Abuff0 idisp iavail |
|
1689 surfAbuff0disp->Activate(); |
|
1690 surfAbuff0avail->Activate(); |
|
1691 iUtility->NotifyWhenDisplayed(surfAbuff0disp->iStatus,surfAbuff0time); |
|
1692 iUtility->NotifyWhenAvailable(surfAbuff0avail->iStatus); |
|
1693 err = iUtility->SubmitUpdate(surfaceA, 0, NULL); |
|
1694 ASSERT_EQUALS(err,KErrNone); |
|
1695 |
|
1696 if(!aAutonomous) |
|
1697 { |
|
1698 WaitL(iCompositionPause); |
|
1699 //Check A buff0 iAvail doesnt complete |
|
1700 ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending); |
|
1701 //Check A buff0 iDisp doesnt complete |
|
1702 ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KRequestPending); |
|
1703 //Check C buff1 iAvail doesnt complete |
|
1704 ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending); |
|
1705 //Check B buff1 iAvail doesnt complete |
|
1706 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending); |
|
1707 //Check A buff1 iAvail doesnt complete |
|
1708 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KRequestPending); |
|
1709 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1710 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1711 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1712 } |
|
1713 ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2)); |
|
1714 |
|
1715 //Check A buff0 idisp completes |
|
1716 ASSERT_EQUALS(surfAbuff0disp->iStatus.Int(),KErrNone); |
|
1717 //Check A buff0 iavail does not complete |
|
1718 ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending); |
|
1719 //Check A buff1 iavail does complete |
|
1720 ASSERT_EQUALS(surfAbuff1avail->iStatus.Int(),KErrNone); |
|
1721 //Check C buff1 iavail does not complete |
|
1722 ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending); |
|
1723 //Check B buff1 iavail doesnt complete |
|
1724 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending); |
|
1725 |
|
1726 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1727 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1728 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KMagenta,iTolerance)); |
|
1729 ReleaseOnScreenStream(); |
|
1730 |
|
1731 //**********SURFACE B TO FRONT - STOPS FASTPATH HAPPENING********** |
|
1732 //Move B to the front |
|
1733 wfcInsertElement(iDevice, elementB, elementA); |
|
1734 #ifdef BREAKPOINT_FASTPATH |
|
1735 __BREAKPOINT(); |
|
1736 #endif |
|
1737 LOG(("OpenWFTest: Expecting COMPOSITION after next commit")); |
|
1738 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1739 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1740 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1741 LOG(("OpenWFTest: Fastpath - now OFF...")); |
|
1742 //Set B buffer0 dark red |
|
1743 iUtility->FillSurfaceL(surfaceB, 0, KDarkRed); |
|
1744 //Do content update Abuff0 idisp iavail |
|
1745 surfBbuff0disp->Activate(); |
|
1746 surfBbuff0avail->Activate(); |
|
1747 iUtility->NotifyWhenDisplayed(surfBbuff0disp->iStatus,surfBbuff0time); |
|
1748 iUtility->NotifyWhenAvailable(surfBbuff0avail->iStatus); |
|
1749 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1750 ASSERT_EQUALS(err,KErrNone); |
|
1751 |
|
1752 if(!aAutonomous) |
|
1753 { |
|
1754 WaitL(iCompositionPause); |
|
1755 //Check B buff0 iAvail doesnt complete |
|
1756 ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending); |
|
1757 //Check B buff0 iDisp doesnt complete |
|
1758 ASSERT_EQUALS(surfBbuff0disp->iStatus.Int(),KRequestPending); |
|
1759 //Check A buff0 iAvail doesnt complete |
|
1760 ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending); |
|
1761 //Check C buff1 iAvail doesnt complete |
|
1762 ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending); |
|
1763 //Check B buff1 iAvail doesnt complete |
|
1764 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KRequestPending); |
|
1765 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1766 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1767 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1768 } |
|
1769 ASSERT_TRUE(WaitForNotifications(KMaxNotificationDelay,2)); |
|
1770 |
|
1771 //Check B buff0 iAvail doesnt complete |
|
1772 ASSERT_EQUALS(surfBbuff0avail->iStatus.Int(),KRequestPending); |
|
1773 //Check B buff0 iDisp completes |
|
1774 ASSERT_EQUALS(surfBbuff0disp->iStatus.Int(),KErrNone); |
|
1775 //Check A buff0 iAvail doesnt complete |
|
1776 ASSERT_EQUALS(surfAbuff0avail->iStatus.Int(),KRequestPending); |
|
1777 //Check C buff1 iAvail doesnt complete |
|
1778 ASSERT_EQUALS(surfCbuff1avail->iStatus.Int(),KRequestPending); |
|
1779 //Check B buff1 iAvail completes |
|
1780 ASSERT_EQUALS(surfBbuff1avail->iStatus.Int(),KErrNone); |
|
1781 |
|
1782 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1783 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1784 //Check dark red center of screen |
|
1785 ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KDarkRed,iTolerance)); |
|
1786 //Check magenta around the borders |
|
1787 ASSERT_TRUE(CheckOnScreenStreamRect(TRect(0,0,iCenterTRect.iTl.iX,iCenterTRect.iTl.iY),KMagenta,iTolerance)); |
|
1788 ASSERT_TRUE(CheckOnScreenStreamRect(TRect(iCenterTRect.iBr.iX+1,iCenterTRect.iBr.iY+1, |
|
1789 iFastpathableWidth,iFastpathableHeight),KMagenta,iTolerance)); |
|
1790 ReleaseOnScreenStream(); |
|
1791 |
|
1792 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
1793 |
|
1794 wfcDestroySource(iDevice, sourceA); |
|
1795 wfcDestroySource(iDevice, sourceB); |
|
1796 wfcDestroySource(iDevice, sourceC); |
|
1797 |
|
1798 CleanupStack::PopAndDestroy(12,surfAbuff0disp); |
|
1799 } |
|
1800 /* |
|
1801 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0010 |
|
1802 @SYMTestCaseDesc Positive testing - Fastpath with notification checking for autonomous composition |
|
1803 @SYMREQ |
|
1804 @SYMPREQ PREQ417-54885 |
|
1805 @SYMTestType Integration Test |
|
1806 @SYMTestPriority High |
|
1807 @SYMTestPurpose Check fastpath does not cause any problem to notifications |
|
1808 @SYMTestActions |
|
1809 Autonomous composition |
|
1810 All elements created are double buffered and opaque: |
|
1811 Compose an empty scene |
|
1812 |
|
1813 A) Create a scene containing a screen sized element A |
|
1814 Fill buffer 0 of element A with red colour |
|
1815 Submit the scene |
|
1816 Do content update of buffer 0 for available (iAvailable) and display time (iDisplayed) |
|
1817 Compose the scene, iDisplayed for buffer 0 should complete |
|
1818 |
|
1819 Fill buffer 1 of element A with yellow colour |
|
1820 Do content update of buffer 1 |
|
1821 Compose the scene, iDisplayed for buffer 1 should complete |
|
1822 Wait for iAvailable of buffer 0 to complete |
|
1823 (iAvailable of buffer 1 will not complete until further content update) |
|
1824 |
|
1825 B) Add a new element B of smaller non fastpathable size behind element A |
|
1826 Fill buffer 0 of element B with green colour |
|
1827 Submit the scene |
|
1828 Do content update of buffer 0 of element B |
|
1829 Compose the scene, iDisplayed for buffer 0 of element B should not complete |
|
1830 iAvailable for buffer 1 of element A should not complete |
|
1831 |
|
1832 Fill buffer 1 of element B with blue colour |
|
1833 Do content update of buffer 1 of element B |
|
1834 Wait for iDisplay to complete (possibly with KErrNotVisible) |
|
1835 Wait for iAvailable for buffer 0 of element B to complete (possibly with KErrNotVisible) |
|
1836 |
|
1837 C) Add a new screen size element C in front of A and B |
|
1838 Fill buffer 0 of element C to be brown |
|
1839 Do content update of buffer 0 of element C |
|
1840 Compose the scene, iDisplayed of buffer 0 of element C should complete |
|
1841 iAvailable of buffer 1 of element B should not complete |
|
1842 |
|
1843 Fill buffer 1 of element C with grey colour |
|
1844 Do content update of buffer 1 of element C |
|
1845 Compose the scene, iDisplayed of buffer 1 of element C should complete |
|
1846 Wait for iAvailable of buffer 0 of element C to complete |
|
1847 |
|
1848 D) Move element A to the front |
|
1849 Fill buffer 0 of element A with magenta colour |
|
1850 Do content update of buffer 0 of element A |
|
1851 Compose the scene, iDisplayed for buffer 0 of element A should complete |
|
1852 Wait for iAvailable of buffer 1 of element A to complete |
|
1853 iAvailable of buffer 1 of element C should not complete |
|
1854 |
|
1855 E) Move element B to the front *NOW NOT FASTPATHING* |
|
1856 Fill buffer 0 of element B with dark red colour |
|
1857 Do content update of buffer 0 of element B |
|
1858 Compose the scene, iDisplayed for buffer 0 of element B should complete |
|
1859 Wait for iAvailable of buffer 1 of element B to complete |
|
1860 iAvailable of buffer 1 of element C should not complete |
|
1861 iAvailable of buffer 0 of element A should not complete |
|
1862 |
|
1863 @SYMTestExpectedResults |
|
1864 All composition should trigger fastpath |
|
1865 Request status checks iAvailable and iDisplayed should be set to KErrNone every time. |
|
1866 Screen colour should change in the sequence of red, yellow, brown, grey, magenta |
|
1867 */ |
|
1868 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0010L() |
|
1869 { |
|
1870 iTestName = _L("FASTPATH_0010"); |
|
1871 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
1872 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
1873 FastpathNotificationsTestL(ETrue); |
|
1874 } |
|
1875 |
|
1876 /* |
|
1877 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0011 |
|
1878 @SYMTestCaseDesc Positive testing - Fastpath with notification checking for non-autonomous composition |
|
1879 @SYMREQ |
|
1880 @SYMPREQ PREQ417-54885 |
|
1881 @SYMTestType Integration Test |
|
1882 @SYMTestPriority High |
|
1883 @SYMTestPurpose Check fastpath does not cause any problem to notifications |
|
1884 @SYMTestActions |
|
1885 A repeat of GRAPHICS-OPENWFC-FASTPATH-0010 but with non autonomous composition |
|
1886 |
|
1887 Where possible TRequestStatuses are additionally checked after submit updates and before |
|
1888 explicit wfcCompose calls are made. |
|
1889 |
|
1890 @SYMTestExpectedResults |
|
1891 Just commit should not trigger any changes to the scene or notifications to complete |
|
1892 Just content updates should not trigger any changes to the scene or notifications to complete |
|
1893 Only after Commit, Content update and Force compose should things happen. |
|
1894 Request status checks iAvailable and iDisplayed should be completed. |
|
1895 Screen colour should change in the sequence of red, yellow, green, blue, brown and grey |
|
1896 */ |
|
1897 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0011L() |
|
1898 { |
|
1899 iTestName = _L("FASTPATH_0011"); |
|
1900 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
1901 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
1902 FastpathNotificationsTestL(EFalse); |
|
1903 } |
|
1904 |
|
1905 //NOTIFICATION TESTS |
|
1906 void COpenwfTest::FastpathDispXNotificationsTestL(TBool aAutonomous) |
|
1907 { |
|
1908 SetupEmptySceneL(aAutonomous); |
|
1909 if (aAutonomous) |
|
1910 { //if we have manual pauses the test will complete early |
|
1911 iAllowManualPause = EFalse; |
|
1912 } |
|
1913 |
|
1914 //Create 2 fastpathable elements |
|
1915 TSurfaceId surfaceA = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
1916 iFastpathablePixelFormat, |
|
1917 iStride, iContiguous, iMaxBuffers); |
|
1918 |
|
1919 ASSERT_FALSE(surfaceA.IsNull()); |
|
1920 WFCSource sourceA = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceA), NULL); |
|
1921 TInt err = iUtility->SubmitUpdate(surfaceA, 0, NULL); |
|
1922 ASSERT_EQUALS(err,KErrNone); |
|
1923 WFCElement elementA = wfcCreateElement(iDevice, iContext, NULL); |
|
1924 wfcSetElementAttribi(iDevice, elementA, WFC_ELEMENT_SOURCE, sourceA); |
|
1925 wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
1926 wfcSetElementAttribiv(iDevice, elementA, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
1927 |
|
1928 TSurfaceId surfaceB = iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2), |
|
1929 iFastpathablePixelFormat, |
|
1930 iStride, iContiguous, iMaxBuffers); |
|
1931 ASSERT_FALSE(surfaceB.IsNull()); |
|
1932 WFCSource sourceB = wfcCreateSourceFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceB), NULL); |
|
1933 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1934 ASSERT_EQUALS(err,KErrNone); |
|
1935 WFCElement elementB = wfcCreateElement(iDevice, iContext, NULL); |
|
1936 wfcSetElementAttribi(iDevice, elementB, WFC_ELEMENT_SOURCE, sourceB); |
|
1937 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect); |
|
1938 wfcSetElementAttribiv(iDevice, elementB, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iCenterRect); |
|
1939 |
|
1940 //**********STARTING ACTUAL TEST!********** |
|
1941 //Add A to scene |
|
1942 wfcInsertElement(iDevice, elementA, WFC_INVALID_HANDLE); |
|
1943 #ifdef BREAKPOINT_FASTPATH |
|
1944 __BREAKPOINT(); |
|
1945 #endif |
|
1946 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
1947 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1948 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1949 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1950 LOG(("OpenWFTest: Fastpath - now ON")); |
|
1951 //Set A buffer0 red |
|
1952 iUtility->FillSurfaceL(surfaceA, 0, KRed); |
|
1953 err = iUtility->SubmitUpdate(surfaceA, 0, NULL); |
|
1954 ASSERT_EQUALS(err,KErrNone); |
|
1955 if(!aAutonomous) |
|
1956 { |
|
1957 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1958 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1959 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1960 } |
|
1961 WaitL(iCompositionPause); |
|
1962 |
|
1963 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1964 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1965 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KRed,iTolerance)); |
|
1966 ReleaseOnScreenStream(); |
|
1967 |
|
1968 //Add surfaceB to scene infront of surfaceA |
|
1969 wfcInsertElement(iDevice, elementB, elementA); |
|
1970 #ifdef BREAKPOINT_FASTPATH |
|
1971 __BREAKPOINT(); |
|
1972 #endif |
|
1973 LOG(("OpenWFTest: Expecting COMPOSITION after next commit")); |
|
1974 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
1975 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1976 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1977 LOG(("OpenWFTest: Fastpath - now OFF")); |
|
1978 //Set B buffer0 green |
|
1979 iUtility->FillSurfaceL(surfaceB, 0, KBlue); |
|
1980 err = iUtility->SubmitUpdate(surfaceB, 0, NULL); |
|
1981 ASSERT_EQUALS(err,KErrNone); |
|
1982 if(!aAutonomous) |
|
1983 { |
|
1984 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
1985 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
1986 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
1987 } |
|
1988 WaitL(iCompositionPause); |
|
1989 |
|
1990 ASSERT_TRUE(AcquireOnScreenStream()); |
|
1991 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
1992 //Check blue center of screen |
|
1993 ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KBlue,iTolerance)); |
|
1994 //Check red around the borders |
|
1995 ASSERT_TRUE(CheckOnScreenStreamRect(TRect(0,0,iCenterTRect.iTl.iX,iCenterTRect.iTl.iY),KRed,iTolerance)); |
|
1996 ASSERT_TRUE(CheckOnScreenStreamRect(TRect(iCenterTRect.iBr.iX+1,iCenterTRect.iBr.iY+1, |
|
1997 iFastpathableWidth,iFastpathableHeight),KRed,iTolerance)); |
|
1998 ReleaseOnScreenStream(); |
|
1999 |
|
2000 //Set A buffer1 yellow |
|
2001 iUtility->FillSurfaceL(surfaceA, 1, KYellow); |
|
2002 //Set B buffer1 KGreen |
|
2003 iUtility->FillSurfaceL(surfaceB, 1, KGreen); |
|
2004 |
|
2005 //Do content updated surfaceA dispXtimes 10 |
|
2006 CActiveNotification* surfAbuff1dispX = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
2007 CleanupStack::PushL(surfAbuff1dispX); |
|
2008 iUtility->NotifyWhenDisplayedXTimes(10,surfAbuff1dispX->iStatus); |
|
2009 err = iUtility->SubmitUpdate(surfaceA, 1, NULL); |
|
2010 //Do content updated surfaceB dispXtimes 5 |
|
2011 CActiveNotification* surfBbuff1dispX = CActiveNotification::NewL(iUtility->Session(),ETrue); |
|
2012 CleanupStack::PushL(surfBbuff1dispX); |
|
2013 iUtility->NotifyWhenDisplayedXTimes(5,surfBbuff1dispX->iStatus); |
|
2014 err = iUtility->SubmitUpdate(surfaceB, 1, NULL); |
|
2015 |
|
2016 if(!aAutonomous) |
|
2017 { |
|
2018 for(TInt i=0;i<4;i++) |
|
2019 { |
|
2020 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
2021 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2022 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2023 WaitL(iCompositionPause); |
|
2024 //Check A has not completed yet |
|
2025 ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending); |
|
2026 //Check B has not completed yet |
|
2027 ASSERT_EQUALS(surfBbuff1dispX->iStatus.Int(),KRequestPending); |
|
2028 } |
|
2029 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
2030 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2031 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2032 } |
|
2033 //surfBbuff1dispX should complete, and its RunL will stop the scheduler |
|
2034 CActiveScheduler::Start(); |
|
2035 //Check B has completed |
|
2036 ASSERT_EQUALS(surfBbuff1dispX->iStatus.Int(),KErrNone); |
|
2037 //Check A has not completed yet |
|
2038 ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending); |
|
2039 |
|
2040 ASSERT_TRUE(AcquireOnScreenStream()); |
|
2041 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
2042 //Check green center of screen |
|
2043 ASSERT_TRUE(CheckOnScreenStreamRect(iCenterTRect,KGreen,iTolerance)); |
|
2044 //Check yellow around the borders |
|
2045 ASSERT_TRUE(CheckOnScreenStreamRect(TRect(0,0,iCenterTRect.iTl.iX,iCenterTRect.iTl.iY),KYellow,iTolerance)); |
|
2046 ASSERT_TRUE(CheckOnScreenStreamRect(TRect(iCenterTRect.iBr.iX+1,iCenterTRect.iBr.iY+1, |
|
2047 iFastpathableWidth,iFastpathableHeight),KYellow,iTolerance)); |
|
2048 ReleaseOnScreenStream(); |
|
2049 |
|
2050 //check it hasn't completed unexpectedly early while using on screen stream |
|
2051 ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending); |
|
2052 |
|
2053 //Remove surfaceB from the scene |
|
2054 wfcRemoveElement(iDevice, elementB); |
|
2055 #ifdef BREAKPOINT_FASTPATH |
|
2056 __BREAKPOINT(); |
|
2057 #endif |
|
2058 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
2059 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2060 if(!aAutonomous) |
|
2061 { |
|
2062 for(TInt i=0;i<4;i++) |
|
2063 { |
|
2064 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
2065 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2066 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2067 LOG(("OpenWFTest: Fastpath - now ON")); |
|
2068 WaitL(iCompositionPause); |
|
2069 //Check A has not completed yet |
|
2070 ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KRequestPending); |
|
2071 } |
|
2072 wfcCompose(iDevice, iContext, WFC_TRUE); |
|
2073 } |
|
2074 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2075 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2076 |
|
2077 //surfAbuff1dispX should complete, and its RunL will stop the scheduler |
|
2078 CActiveScheduler::Start(); |
|
2079 ASSERT_EQUALS(surfAbuff1dispX->iStatus.Int(),KErrNone); |
|
2080 |
|
2081 ASSERT_TRUE(AcquireOnScreenStream()); |
|
2082 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
2083 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KYellow,iTolerance)); |
|
2084 ReleaseOnScreenStream(); |
|
2085 |
|
2086 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
2087 //Shutdown |
|
2088 wfcDestroySource(iDevice, sourceA); |
|
2089 wfcDestroySource(iDevice, sourceB); |
|
2090 |
|
2091 CleanupStack::PopAndDestroy(2,surfAbuff1dispX); |
|
2092 } |
|
2093 |
|
2094 /* |
|
2095 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0012 |
|
2096 @SYMTestCaseDesc Positive testing - Fastpath with notification checking DisplayXTime |
|
2097 @SYMREQ |
|
2098 @SYMPREQ PREQ417-54885 |
|
2099 @SYMTestType Integration Test |
|
2100 @SYMTestPriority High |
|
2101 @SYMTestPurpose Check fastpath does not cause any problem to notifications |
|
2102 @SYMTestActions |
|
2103 All compositions are autonomous: |
|
2104 Compose an empty scene |
|
2105 A) Create a scene containing a screen sized opaque element A |
|
2106 Commit the scene |
|
2107 Make a content update for available (iAvailable) and display time (aDisplayed) |
|
2108 Wait for the request status objects to complete |
|
2109 |
|
2110 B) Add a small element B in front of A |
|
2111 Compose the scene |
|
2112 Content update for both A and B, set display 10 times to A, set display 5 times to B |
|
2113 Wait for the 5 times |
|
2114 |
|
2115 C) Remove element B |
|
2116 Commit the scene |
|
2117 Compose the scene |
|
2118 Wait for the 10 times |
|
2119 @SYMTestExpectedResults |
|
2120 Composition should fastpath in sections A and C |
|
2121 Elements A's 10 times should not complete before element B's 5 times |
|
2122 */ |
|
2123 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0012L() |
|
2124 { |
|
2125 iTestName = _L("FASTPATH_0012"); |
|
2126 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2127 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2128 FastpathDispXNotificationsTestL(ETrue); |
|
2129 } |
|
2130 |
|
2131 /* |
|
2132 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0013 |
|
2133 @SYMTestCaseDesc Positive testing - Fastpath with notification checking DisplayXTime |
|
2134 @SYMREQ |
|
2135 @SYMPREQ PREQ417-54885 |
|
2136 @SYMTestType Integration Test |
|
2137 @SYMTestPriority High |
|
2138 @SYMTestPurpose Check fastpath does not cause any problem to notifications |
|
2139 @SYMTestActions |
|
2140 Repeats GRAPHICS-OPENWFC-FASTPATH-0013 in non autonomous mode. |
|
2141 This allows gives the added benefit of accurate counting of wfcCompose calls, checking the displayXtimes |
|
2142 notifications only complete after the correct number of composes. |
|
2143 @SYMTestExpectedResults |
|
2144 Composition should fastpath in sections A and C |
|
2145 Both should complete after their expect amount of compose calls with no errors |
|
2146 */ |
|
2147 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0013L() |
|
2148 { |
|
2149 iTestName = _L("FASTPATH_0013"); |
|
2150 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2151 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2152 FastpathDispXNotificationsTestL(EFalse); |
|
2153 } |
|
2154 |
|
2155 /* |
|
2156 * NEGATIVE TESTING |
|
2157 * */ |
|
2158 /* |
|
2159 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0020 |
|
2160 @SYMTestCaseDesc Negative testing - Fastpath one-element scene |
|
2161 @SYMREQ |
|
2162 @SYMPREQ PREQ417-54885 |
|
2163 @SYMTestType Unit Test |
|
2164 @SYMTestPriority High |
|
2165 @SYMTestPurpose Check a scene including a full screen element with source alpha cannot be fastpathed |
|
2166 @SYMTestActions |
|
2167 All compositions are autonomous: |
|
2168 Create a scene containing a screen sized element |
|
2169 Enable WFC_TRANSPARENCY_SOURCE |
|
2170 Set the value of WFC_ELEMENT_SOURCE between 0 and 255 (non-inclusive). |
|
2171 Compose the scene |
|
2172 @SYMTestExpectedResults |
|
2173 The scene cannot be fastpathed. |
|
2174 */ |
|
2175 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0020L() |
|
2176 { |
|
2177 iTestName = _L("FASTPATH_0020"); |
|
2178 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2179 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2180 SetupEmptySceneL(); |
|
2181 |
|
2182 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
2183 EUidPixelFormatARGB_8888, |
|
2184 iStride, iContiguous, iMaxBuffers); |
|
2185 ASSERT_FALSE(surface.IsNull()); |
|
2186 |
|
2187 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
2188 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2189 ASSERT_EQUALS(err,KErrNone); |
|
2190 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
2191 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
2192 |
|
2193 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
2194 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
2195 //set per pixel alpha |
|
2196 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_SOURCE); |
|
2197 |
|
2198 #ifdef BREAKPOINT_FASTPATH |
|
2199 __BREAKPOINT(); |
|
2200 #endif |
|
2201 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
2202 LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using source alpha")); |
|
2203 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2204 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2205 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2206 |
|
2207 for (TInt i=0;i<=256;i+=64) |
|
2208 { |
|
2209 i=(i==256)?255:i; |
|
2210 iUtility->FillSurfaceL(surface, 0, TRgb(0,255,0,i)); |
|
2211 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2212 ASSERT_EQUALS(err,KErrNone); |
|
2213 WaitL(iCompositionPause); |
|
2214 } |
|
2215 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
2216 wfcDestroySource(iDevice, fpSource); |
|
2217 } |
|
2218 |
|
2219 /* |
|
2220 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0021 |
|
2221 @SYMTestCaseDesc Negative testing - Fastpath one-element scene |
|
2222 @SYMREQ |
|
2223 @SYMPREQ PREQ417-54885 |
|
2224 @SYMTestType Unit Test |
|
2225 @SYMTestPriority High |
|
2226 @SYMTestPurpose Check a scene including a full screen element with global alpha cannot be fastpathed |
|
2227 @SYMTestActions |
|
2228 All compositions are autonomous: |
|
2229 Create a scene containing a screen sized element |
|
2230 Enable WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA |
|
2231 Set the value of WFC_ELEMENT_GLOBAL_ALPHA between 0 and 255 (non-inclusive) |
|
2232 Compose the scene |
|
2233 @SYMTestExpectedResults |
|
2234 The scene cannot be fastpathed. |
|
2235 */ |
|
2236 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0021L() |
|
2237 { |
|
2238 iTestName = _L("FASTPATH_0021"); |
|
2239 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2240 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2241 SetupEmptySceneL(); |
|
2242 |
|
2243 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
2244 EUidPixelFormatXRGB_8888, |
|
2245 iStride, iContiguous, iMaxBuffers); |
|
2246 ASSERT_FALSE(surface.IsNull()); |
|
2247 |
|
2248 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
2249 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2250 ASSERT_EQUALS(err,KErrNone); |
|
2251 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
2252 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
2253 |
|
2254 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
2255 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
2256 //set element global alpha |
|
2257 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA); |
|
2258 wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 0.0f); |
|
2259 |
|
2260 #ifdef BREAKPOINT_FASTPATH |
|
2261 __BREAKPOINT(); |
|
2262 #endif |
|
2263 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
2264 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
2265 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2266 LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using element global alpha not fully opaque")); |
|
2267 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2268 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2269 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2270 |
|
2271 for (TInt i=0;i<=256;i+=64) |
|
2272 { |
|
2273 i=(i==256)?255:i; |
|
2274 wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, (TReal32)i/255); |
|
2275 if(i == 255) |
|
2276 { |
|
2277 #ifdef BREAKPOINT_FASTPATH |
|
2278 __BREAKPOINT(); |
|
2279 #endif |
|
2280 } |
|
2281 if(i == 255) |
|
2282 { |
|
2283 LOG(("OpenWFTest: Expecting FASTPATH after next commit - using element global alpha fully opaque")); |
|
2284 } |
|
2285 else |
|
2286 { |
|
2287 LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using element global alpha not fully opaque")); |
|
2288 } |
|
2289 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2290 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2291 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2292 WaitL(iCompositionPause); |
|
2293 } |
|
2294 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
2295 wfcDestroySource(iDevice, fpSource); |
|
2296 } |
|
2297 |
|
2298 /* |
|
2299 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0022 |
|
2300 @SYMTestCaseDesc Negative testing - Fastpath one-element scene |
|
2301 @SYMREQ |
|
2302 @SYMPREQ PREQ417-54885 |
|
2303 @SYMTestType Unit Test |
|
2304 @SYMTestPriority High |
|
2305 @SYMTestPurpose Check a scene with RGB 565 format cannot be fastpathed |
|
2306 @SYMTestActions |
|
2307 Create a scene containing a screen sized element with an unsupported source format, such as 565 |
|
2308 Compose the scene |
|
2309 @SYMTestExpectedResults |
|
2310 The scene cannot be fastpathed. |
|
2311 */ |
|
2312 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0022L() |
|
2313 { |
|
2314 iTestName = _L("FASTPATH_0022"); |
|
2315 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2316 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2317 SetupEmptySceneL(); |
|
2318 |
|
2319 //NON fastpathable pixel format |
|
2320 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
2321 iNonFastpathablePixelFormat, |
|
2322 iStride, iContiguous, iMaxBuffers); |
|
2323 ASSERT_FALSE(surface.IsNull()); |
|
2324 |
|
2325 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
2326 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2327 ASSERT_EQUALS(err,KErrNone); |
|
2328 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
2329 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
2330 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
2331 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
2332 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
2333 |
|
2334 #ifdef BREAKPOINT_FASTPATH |
|
2335 __BREAKPOINT(); |
|
2336 #endif |
|
2337 LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using non fastpathable pixel format")); |
|
2338 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2339 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2340 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2341 |
|
2342 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
2343 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2344 ASSERT_EQUALS(err,KErrNone); |
|
2345 WaitL(iCompositionPause); |
|
2346 |
|
2347 ASSERT_TRUE(AcquireOnScreenStream()); |
|
2348 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
2349 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
2350 ReleaseOnScreenStream(); |
|
2351 |
|
2352 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
2353 wfcDestroySource(iDevice, fpSource); |
|
2354 } |
|
2355 |
|
2356 /* |
|
2357 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0023 |
|
2358 @SYMTestCaseDesc Negative testing - Fastpath one-element scene |
|
2359 @SYMREQ |
|
2360 @SYMPREQ PREQ417-54885 |
|
2361 @SYMTestType Unit Test |
|
2362 @SYMTestPriority High |
|
2363 @SYMTestPurpose Check a scene with mask settings cannot be fastpathed |
|
2364 @SYMTestActions |
|
2365 All compositions are autonomous: |
|
2366 Create a scene containing a screen sized element A |
|
2367 Enable WFC_TRANSPARENCY_MASK |
|
2368 Set a value to WFC_ELEMENT_MASK |
|
2369 Create a mask element, set the size to be the same as element A's desitnation rectangle |
|
2370 Compose the scene |
|
2371 @SYMTestExpectedResults |
|
2372 The scene cannot be fastpathed. |
|
2373 */ |
|
2374 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0023L() |
|
2375 { |
|
2376 iTestName = _L("FASTPATH_0023"); |
|
2377 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2378 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2379 SetupEmptySceneL(); |
|
2380 |
|
2381 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
2382 iFastpathablePixelFormat, |
|
2383 iStride, iContiguous, iMaxBuffers); |
|
2384 ASSERT_FALSE(surface.IsNull()); |
|
2385 |
|
2386 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
2387 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2388 ASSERT_EQUALS(err,KErrNone); |
|
2389 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
2390 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
2391 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
2392 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
2393 |
|
2394 TSurfaceId surfaceMask = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
2395 iFastpathablePixelFormat, |
|
2396 iStride, iContiguous, iMaxBuffers); |
|
2397 ASSERT_FALSE(surfaceMask.IsNull()); |
|
2398 WFCMask mask = wfcCreateMaskFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceMask), NULL); |
|
2399 err = iUtility->SubmitUpdate(surfaceMask, 0, NULL); |
|
2400 ASSERT_EQUALS(err,KErrNone); |
|
2401 |
|
2402 //set the mask to fpElement |
|
2403 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, WFC_TRANSPARENCY_MASK); |
|
2404 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_MASK, mask); |
|
2405 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
2406 |
|
2407 #ifdef BREAKPOINT_FASTPATH |
|
2408 __BREAKPOINT(); |
|
2409 #endif |
|
2410 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
2411 LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using a mask")); |
|
2412 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2413 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2414 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2415 LOG(("OpenWFTest:Fastpath - still off - using a mask")); |
|
2416 |
|
2417 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
2418 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2419 ASSERT_EQUALS(err,KErrNone); |
|
2420 iUtility->FillSurfaceL(surfaceMask, 0, KBlack); |
|
2421 err = iUtility->SubmitUpdate(surfaceMask, 0, NULL); |
|
2422 ASSERT_EQUALS(err,KErrNone); |
|
2423 WaitL(iCompositionPause); |
|
2424 |
|
2425 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
2426 wfcDestroySource(iDevice, fpSource); |
|
2427 } |
|
2428 |
|
2429 /* |
|
2430 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0024 |
|
2431 @SYMTestCaseDesc Negative testing - Fastpath one-element scene |
|
2432 @SYMREQ |
|
2433 @SYMPREQ PREQ417-54885 |
|
2434 @SYMTestType Unit Test |
|
2435 @SYMTestPriority High |
|
2436 @SYMTestPurpose Check a scene with alpha and mask settings cannot be fastpathed |
|
2437 @SYMTestActions |
|
2438 All compositions are autonomous: |
|
2439 Create a scene containing a screen sized element A |
|
2440 Enable WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA |
|
2441 Set the value of WFC_ELEMENT_GLOBAL_ALPHA to be 255 |
|
2442 Enable WFC_TRANSPARENCY_MASK |
|
2443 Set a value to WFC_ELEMENT_MASK |
|
2444 Create a mask element, set it the same size of element A's destination rectangle |
|
2445 Compose the scene |
|
2446 @SYMTestExpectedResults |
|
2447 The scene cannot be fastpathed. |
|
2448 */ |
|
2449 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0024L() |
|
2450 { |
|
2451 iTestName = _L("FASTPATH_0024"); |
|
2452 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2453 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2454 SetupEmptySceneL(); |
|
2455 |
|
2456 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
2457 iFastpathablePixelFormat, |
|
2458 iStride, iContiguous, iMaxBuffers); |
|
2459 ASSERT_FALSE(surface.IsNull()); |
|
2460 |
|
2461 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
2462 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2463 ASSERT_EQUALS(err,KErrNone); |
|
2464 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
2465 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
2466 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
2467 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
2468 |
|
2469 TSurfaceId surfaceMask = iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
2470 iFastpathablePixelFormat, |
|
2471 iStride, iContiguous, iMaxBuffers); |
|
2472 ASSERT_FALSE(surfaceMask.IsNull()); |
|
2473 WFCMask mask = wfcCreateMaskFromStream(iDevice, iContext, reinterpret_cast<WFCNativeStreamType>(&surfaceMask), NULL); |
|
2474 err = iUtility->SubmitUpdate(surfaceMask, 0, NULL); |
|
2475 ASSERT_EQUALS(err,KErrNone); |
|
2476 |
|
2477 //set the mask and global alpha for use with fpElement |
|
2478 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_MASK, mask); |
|
2479 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_TRANSPARENCY_TYPES, |
|
2480 WFC_TRANSPARENCY_ELEMENT_GLOBAL_ALPHA|WFC_TRANSPARENCY_MASK); |
|
2481 //set global alpha to fully opaque |
|
2482 wfcSetElementAttribf(iDevice, fpElement, WFC_ELEMENT_GLOBAL_ALPHA, 1.0f); |
|
2483 |
|
2484 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
2485 #ifdef BREAKPOINT_FASTPATH |
|
2486 __BREAKPOINT(); |
|
2487 #endif |
|
2488 LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using a mask and global alpha")); |
|
2489 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2490 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2491 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2492 LOG(("OpenWFTest: Fastpath - still off - using a mask and global alpha")); |
|
2493 |
|
2494 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
2495 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2496 ASSERT_EQUALS(err,KErrNone); |
|
2497 iUtility->FillSurfaceL(surfaceMask, 0, KBlack); |
|
2498 err = iUtility->SubmitUpdate(surfaceMask, 0, NULL); |
|
2499 ASSERT_EQUALS(err,KErrNone); |
|
2500 WaitL(iCompositionPause); |
|
2501 |
|
2502 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
2503 wfcDestroySource(iDevice, fpSource); |
|
2504 } |
|
2505 |
|
2506 /* |
|
2507 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0025 |
|
2508 @SYMTestCaseDesc Negative testing - Fastpath a scene with scaling element |
|
2509 @SYMREQ |
|
2510 @SYMPREQ PREQ417-54885 |
|
2511 @SYMTestType Unit Test |
|
2512 @SYMTestPriority High |
|
2513 @SYMTestPurpose Check a scene with scaling cannot be fastpathed |
|
2514 @SYMTestActions |
|
2515 All compositions are autonomous: |
|
2516 Create an element containing source size smaller than full screen destination size |
|
2517 Add to scene and compose |
|
2518 @SYMTestExpectedResults |
|
2519 The scene cannot be fastpathed. |
|
2520 */ |
|
2521 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0025L() |
|
2522 { |
|
2523 iTestName = _L("FASTPATH_0025"); |
|
2524 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2525 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2526 SetupEmptySceneL(); |
|
2527 |
|
2528 //create half screen size surface |
|
2529 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth/2,iFastpathableHeight/2), |
|
2530 iFastpathablePixelFormat, |
|
2531 iStride, iContiguous, iMaxBuffers); |
|
2532 ASSERT_FALSE(surface.IsNull()); |
|
2533 |
|
2534 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
2535 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2536 ASSERT_EQUALS(err,KErrNone); |
|
2537 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
2538 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
2539 |
|
2540 //note the source is only half the size of the screen |
|
2541 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iHalfSizeRect); |
|
2542 //set destination to fullscreen, causing it to stretch |
|
2543 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
2544 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
2545 #ifdef BREAKPOINT_FASTPATH |
|
2546 __BREAKPOINT(); |
|
2547 #endif |
|
2548 LOG(("OpenWFTest: Expecting COMPOSITION after next commit - using a mask and global alpha")); |
|
2549 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2550 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2551 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2552 LOG(("OpenWFTest: Fastpath - still off... - source not equal to destination")); |
|
2553 |
|
2554 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
2555 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2556 ASSERT_EQUALS(err,KErrNone); |
|
2557 WaitL(iCompositionPause); |
|
2558 |
|
2559 ASSERT_TRUE(AcquireOnScreenStream()); |
|
2560 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
2561 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KGreen,iTolerance)); |
|
2562 ReleaseOnScreenStream(); |
|
2563 |
|
2564 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
2565 wfcDestroySource(iDevice, fpSource); |
|
2566 } |
|
2567 |
|
2568 /* |
|
2569 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0026 |
|
2570 @SYMTestCaseDesc Negative testing - Fastpath a scene with rotation |
|
2571 @SYMREQ |
|
2572 @SYMPREQ PREQ417-54885 |
|
2573 @SYMTestType Unit Test |
|
2574 @SYMTestPriority High |
|
2575 @SYMTestPurpose Check a scene with rotation cannot be fastpathed |
|
2576 @SYMTestActions |
|
2577 All compositions are autonomous: |
|
2578 Create a scene containing a screen size element |
|
2579 Compose the scene |
|
2580 Rotate the element with 90, 180 and 270 degrees |
|
2581 Compose the scene |
|
2582 @SYMTestExpectedResults |
|
2583 The scene can be fastpathed only for the first scene commited composition. |
|
2584 */ |
|
2585 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0026L() |
|
2586 { |
|
2587 iTestName = _L("FASTPATH_0026"); |
|
2588 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2589 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2590 SetupEmptySceneL(); |
|
2591 |
|
2592 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
2593 iFastpathablePixelFormat, |
|
2594 iStride, iContiguous, iMaxBuffers); |
|
2595 ASSERT_FALSE(surface.IsNull()); |
|
2596 |
|
2597 WFCSource fpSource = wfcCreateSourceFromStream(iDevice, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
2598 TInt err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2599 ASSERT_EQUALS(err,KErrNone); |
|
2600 WFCElement fpElement = wfcCreateElement(iDevice, iContext, NULL); |
|
2601 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
2602 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE_RECTANGLE, 4, iFullScreenRect); |
|
2603 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_DESTINATION_RECTANGLE, 4, iFullScreenRect); |
|
2604 |
|
2605 wfcInsertElement(iDevice, fpElement, WFC_INVALID_HANDLE); |
|
2606 #ifdef BREAKPOINT_FASTPATH |
|
2607 __BREAKPOINT(); |
|
2608 #endif |
|
2609 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
2610 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2611 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2612 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2613 LOG(("OpenWFTest: Fastpath - now ON")); |
|
2614 |
|
2615 iUtility->FillSurfaceL(surface, 0, KGreen); |
|
2616 err = iUtility->SubmitUpdate(surface, 0, NULL); |
|
2617 ASSERT_EQUALS(err,KErrNone); |
|
2618 WaitL(iCompositionPause); |
|
2619 |
|
2620 //Set 90 degree rotation |
|
2621 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE_ROTATION, WFC_ROTATION_90); |
|
2622 |
|
2623 #ifdef BREAKPOINT_FASTPATH |
|
2624 __BREAKPOINT(); |
|
2625 #endif |
|
2626 iUtility->FillSurfaceL(surface, 0, KBlue); |
|
2627 LOG(("OpenWFTest: Expecting COMPOSITION after next commit")); |
|
2628 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2629 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2630 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2631 LOG(("OpenWFTest: Fastpath - now OFF")); |
|
2632 WaitL(iCompositionPause); |
|
2633 |
|
2634 ASSERT_TRUE(AcquireOnScreenStream()); |
|
2635 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
2636 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBlue,iTolerance)); |
|
2637 ReleaseOnScreenStream(); |
|
2638 |
|
2639 |
|
2640 //Set 180 degree rotation |
|
2641 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE_ROTATION, WFC_ROTATION_180); |
|
2642 |
|
2643 #ifdef BREAKPOINT_FASTPATH |
|
2644 __BREAKPOINT(); |
|
2645 #endif |
|
2646 iUtility->FillSurfaceL(surface, 0, KMagenta); |
|
2647 LOG(("OpenWFTest: Expecting FASTPATH after next commit")); |
|
2648 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2649 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2650 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2651 LOG(("OpenWFTest: Fastpath - now OFF")); |
|
2652 WaitL(iCompositionPause); |
|
2653 |
|
2654 ASSERT_TRUE(AcquireOnScreenStream()); |
|
2655 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KMagenta,iTolerance)); |
|
2656 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
2657 ReleaseOnScreenStream(); |
|
2658 |
|
2659 //Set 270 degree rotation |
|
2660 wfcSetElementAttribi(iDevice, fpElement, WFC_ELEMENT_SOURCE_ROTATION, WFC_ROTATION_270); |
|
2661 |
|
2662 #ifdef BREAKPOINT_FASTPATH |
|
2663 __BREAKPOINT(); |
|
2664 #endif |
|
2665 iUtility->FillSurfaceL(surface, 0, KBrown); |
|
2666 LOG(("OpenWFTest: Expecting COMPOSITION after next commit")); |
|
2667 wfcCommit(iDevice, iContext, WFC_TRUE); |
|
2668 wfcFence(iDevice, iContext, iEGLDisplay, iSync); |
|
2669 ASSERT_EQUALS(eglClientWaitSyncKHR(iEGLDisplay,iSync,0,(EGLTimeKHR)EGL_FOREVER_KHR),EGL_CONDITION_SATISFIED_KHR); |
|
2670 LOG(("OpenWFTest: Fastpath - now OFF")); |
|
2671 WaitL(iCompositionPause); |
|
2672 |
|
2673 ASSERT_TRUE(AcquireOnScreenStream()); |
|
2674 ASSERT_TRUE(CheckOnScreenStreamRect(iFullScreenTRect,KBrown,iTolerance)); |
|
2675 ASSERT_TRUE(CheckOnScreenReferenceImage()); |
|
2676 ReleaseOnScreenStream(); |
|
2677 |
|
2678 ASSERT_EQUALS(wfcGetError(iDevice),WFC_ERROR_NONE); |
|
2679 wfcDestroySource(iDevice, fpSource); |
|
2680 } |
|
2681 |
|
2682 /* |
|
2683 @SYMTestCaseID GRAPHICS-OPENWFC-FASTPATH-0027 |
|
2684 @SYMTestCaseDesc Negative testing - Pass in bad parameter values |
|
2685 @SYMREQ |
|
2686 @SYMPREQ PREQ417-54885 |
|
2687 @SYMTestType Unit Test |
|
2688 @SYMTestPriority High |
|
2689 @SYMTestPurpose Check invalid parameter values passed in OWF APIs |
|
2690 @SYMTestActions |
|
2691 Use invalid values to call OWF APIs |
|
2692 @SYMTestExpectedResults |
|
2693 Test should pass without panic. |
|
2694 */ |
|
2695 void COpenwfTest::GRAPHICS_OPENWFC_FASTPATH_0027L() |
|
2696 { |
|
2697 iTestName = _L("FASTPATH_0027"); |
|
2698 INFO_PRINTF2(_L("GRAPHICS_OPENWFC_%SL()"),&iTestName); |
|
2699 LOGL((_L("OpenWFTest: GRAPHICS_OPENWFC_%SL()"),&iTestName)); |
|
2700 |
|
2701 WFCint deviceId; |
|
2702 WFCint filterList[] = { WFC_DEVICE_FILTER_SCREEN_NUMBER, WFC_DEFAULT_SCREEN_NUMBER, WFC_NONE}; |
|
2703 ASSERT_TRUE(wfcEnumerateDevices(&deviceId, 1, filterList) == 1); |
|
2704 |
|
2705 WFCint attribList = 1; |
|
2706 WFCDevice device = wfcCreateDevice(deviceId, &attribList); |
|
2707 WFCContext onScreenContext = wfcCreateOnScreenContext(NULL, WFC_DEFAULT_SCREEN_NUMBER, NULL); |
|
2708 WFCContext offScreenContext = wfcCreateOffScreenContext(NULL, WFC_DEFAULT_SCREEN_NUMBER, NULL); |
|
2709 |
|
2710 WFCfloat value = 1.0; |
|
2711 wfcGetContextAttribi(NULL, iContext, WFC_CONTEXT_TARGET_HEIGHT); |
|
2712 wfcSetContextAttribi(NULL, iContext, WFC_CONTEXT_ROTATION, WFC_ROTATION_0); |
|
2713 wfcGetContextAttribfv(NULL, iContext, WFC_CONTEXT_ROTATION, NULL, &value); |
|
2714 wfcSetContextAttribfv(NULL, iContext, WFC_CONTEXT_ROTATION, NULL, &value); |
|
2715 |
|
2716 TSurfaceId surface=iUtility->CreateSurfaceL(TSize(iFastpathableWidth,iFastpathableHeight), |
|
2717 iFastpathablePixelFormat, |
|
2718 iStride, iContiguous, iMaxBuffers); |
|
2719 ASSERT_FALSE(surface.IsNull()); |
|
2720 |
|
2721 WFCSource fpSource = wfcCreateSourceFromStream(NULL, iContext,reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
2722 wfcCreateMaskFromStream(NULL, iContext, reinterpret_cast<WFCNativeStreamType>(&surface), NULL); |
|
2723 WFCElement fpElement = wfcCreateElement(NULL, iContext, NULL); |
|
2724 wfcSetElementAttribi(NULL, fpElement, WFC_ELEMENT_SOURCE, fpSource); |
|
2725 wfcSetElementAttribf(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL); |
|
2726 wfcSetElementAttribiv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL); |
|
2727 wfcSetElementAttribfv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL); |
|
2728 wfcSetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL); |
|
2729 wfcSetElementAttribfv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL); |
|
2730 |
|
2731 wfcGetElementAttribi(NULL, fpElement, WFC_ELEMENT_SOURCE); |
|
2732 wfcGetElementAttribf(NULL, fpElement, WFC_ELEMENT_SOURCE); |
|
2733 wfcGetElementAttribiv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL); |
|
2734 wfcGetElementAttribiv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL); |
|
2735 wfcGetElementAttribfv(NULL, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL); |
|
2736 wfcGetElementAttribfv(iDevice, fpElement, WFC_ELEMENT_SOURCE, NULL, NULL); |
|
2737 |
|
2738 wfcInsertElement(NULL, fpElement, NULL); |
|
2739 wfcGetElementAbove(NULL, fpElement); |
|
2740 wfcGetElementBelow(NULL, fpElement); |
|
2741 |
|
2742 WFCDeviceAttrib devAttrib = WFC_DEVICE_ID; |
|
2743 wfcGetDeviceAttribi(NULL, devAttrib); |
|
2744 |
|
2745 wfcActivate(NULL, iContext); |
|
2746 wfcActivate(iDevice, NULL); |
|
2747 wfcDeactivate(NULL, iContext); |
|
2748 wfcDeactivate(iDevice, NULL); |
|
2749 wfcCompose(NULL, iContext, WFC_TRUE); |
|
2750 wfcCompose(iDevice, NULL, WFC_TRUE); |
|
2751 wfcCommit(NULL, iContext, WFC_TRUE); |
|
2752 wfcCommit(iDevice, NULL, WFC_TRUE); |
|
2753 wfcFence(NULL, iContext, iEGLDisplay, iSync); |
|
2754 wfcFence(iDevice, NULL, iEGLDisplay, iSync); |
|
2755 |
|
2756 WFCMask mask = WFC_INVALID_HANDLE; |
|
2757 wfcDestroyMask(NULL, mask); |
|
2758 wfcRemoveElement(NULL, fpElement); |
|
2759 wfcDestroyElement(NULL, fpElement); |
|
2760 wfcDestroySource(NULL, fpSource); |
|
2761 wfcDestroyContext(NULL, onScreenContext); |
|
2762 } |
|
2763 |