sl@0
|
1 |
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@test
|
sl@0
|
19 |
*/
|
sl@0
|
20 |
#include "egltest_syncobject.h"
|
sl@0
|
21 |
#include <test/tefunit.h>
|
sl@0
|
22 |
#include <hal.h>
|
sl@0
|
23 |
#include <test/egltestcommonsgimageinfo.h>
|
sl@0
|
24 |
|
sl@0
|
25 |
const TUint32 KThreshold = 0.5*1000*1000; // 0.5 sec
|
sl@0
|
26 |
const TUint32 KDelaySignalling = 2.5*1000*1000; // 2.5 sec
|
sl@0
|
27 |
const TUint32 KWaitSyncTimeout = 5*1000*1000; // 5 sec
|
sl@0
|
28 |
const TUint32 KLongDelaySignalling = 7.5*1000*1000; // 7.5 sec
|
sl@0
|
29 |
const TInt KNumStressIterations = 1000;
|
sl@0
|
30 |
|
sl@0
|
31 |
typedef void (*TEglDebugHeapMarkStartPtr) (void);
|
sl@0
|
32 |
typedef EGLint (*TEglDebugHeapMarkEndPtr) (EGLint count);
|
sl@0
|
33 |
typedef void (*TEglDebugSetBurstAllocFailPtr) (EGLenum type, EGLint rate, EGLint burst);
|
sl@0
|
34 |
|
sl@0
|
35 |
struct TSurfaceToDestroy
|
sl@0
|
36 |
{
|
sl@0
|
37 |
EGLSurface iSurface;
|
sl@0
|
38 |
EGLDisplay iDisplay;
|
sl@0
|
39 |
};
|
sl@0
|
40 |
|
sl@0
|
41 |
//the function clean up surface resource. Needs to be push into cleanup stack beforehand
|
sl@0
|
42 |
void DestroySurface(TAny* aAny)
|
sl@0
|
43 |
{
|
sl@0
|
44 |
TSurfaceToDestroy* surfaceToDestroy = (TSurfaceToDestroy*)aAny;
|
sl@0
|
45 |
eglDestroySurface(surfaceToDestroy->iDisplay, surfaceToDestroy->iSurface);
|
sl@0
|
46 |
}
|
sl@0
|
47 |
|
sl@0
|
48 |
CEglTest_SyncObject_Base::CEglTest_SyncObject_Base() :
|
sl@0
|
49 |
iSyncObject(EGL_NO_SYNC_KHR), iSyncObject1(EGL_NO_SYNC_KHR), iSyncObject2(EGL_NO_SYNC_KHR),
|
sl@0
|
50 |
iThreshold(KThreshold), iDelaySignalling(KDelaySignalling),
|
sl@0
|
51 |
iWaitSyncTimeout(KWaitSyncTimeout), iLongDelaySignalling(KLongDelaySignalling),
|
sl@0
|
52 |
iNumStressIterations(KNumStressIterations)
|
sl@0
|
53 |
{
|
sl@0
|
54 |
}
|
sl@0
|
55 |
|
sl@0
|
56 |
CEglTest_SyncObject_Base::~CEglTest_SyncObject_Base()
|
sl@0
|
57 |
{
|
sl@0
|
58 |
if(iPfnEglDestroySyncKHR)
|
sl@0
|
59 |
{
|
sl@0
|
60 |
iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
61 |
iPfnEglDestroySyncKHR(iDisplay, iSyncObject1);
|
sl@0
|
62 |
iPfnEglDestroySyncKHR(iDisplay, iSyncObject2);
|
sl@0
|
63 |
}
|
sl@0
|
64 |
CleanAll();
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
// from CTestStep
|
sl@0
|
68 |
TVerdict CEglTest_SyncObject_Base::doTestStepPreambleL()
|
sl@0
|
69 |
{
|
sl@0
|
70 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Base::doTestStepPreambleL()"));
|
sl@0
|
71 |
CEglTestStep::doTestStepPreambleL();
|
sl@0
|
72 |
TInt res = HAL::Get(HALData::ENanoTickPeriod, iTickPeriodMicroSeconds);
|
sl@0
|
73 |
if(res != KErrNone)
|
sl@0
|
74 |
{
|
sl@0
|
75 |
ERR_PRINTF2(_L("Can't retrieve tick period, err %d"), res);
|
sl@0
|
76 |
User::Leave(res);
|
sl@0
|
77 |
}
|
sl@0
|
78 |
INFO_PRINTF2(_L("Tick period in micro seconds %d"), iTickPeriodMicroSeconds);
|
sl@0
|
79 |
|
sl@0
|
80 |
_LIT(KKeyThreshold, "Threshold");
|
sl@0
|
81 |
_LIT(KKeyDelaySignalling, "DelaySignalling");
|
sl@0
|
82 |
_LIT(KKeyWaitSyncTimeout, "WaitSyncTimeout");
|
sl@0
|
83 |
_LIT(KKeyLongDelaySignalling, "LongDelaySignalling");
|
sl@0
|
84 |
_LIT(KKeyNumStressIterations, "NumIterations");
|
sl@0
|
85 |
|
sl@0
|
86 |
//retrive all setting from INI file
|
sl@0
|
87 |
GetIntFromConfig(ConfigSection(), KKeyThreshold, iThreshold);
|
sl@0
|
88 |
GetIntFromConfig(ConfigSection(), KKeyDelaySignalling, iDelaySignalling);
|
sl@0
|
89 |
GetIntFromConfig(ConfigSection(), KKeyWaitSyncTimeout, iWaitSyncTimeout);
|
sl@0
|
90 |
GetIntFromConfig(ConfigSection(), KKeyLongDelaySignalling, iLongDelaySignalling);
|
sl@0
|
91 |
GetIntFromConfig(ConfigSection(), KKeyNumStressIterations, iNumStressIterations);
|
sl@0
|
92 |
|
sl@0
|
93 |
INFO_PRINTF2(_L("Level of tolerance %d"), iThreshold);
|
sl@0
|
94 |
INFO_PRINTF2(_L("Delay before the signal occurs %d"), iDelaySignalling);
|
sl@0
|
95 |
INFO_PRINTF2(_L("Timeout client waits on sync object %d"), iWaitSyncTimeout);
|
sl@0
|
96 |
INFO_PRINTF2(_L("Long delay before signalling occurs %d"), iLongDelaySignalling);
|
sl@0
|
97 |
INFO_PRINTF2(_L("Number of iterations before stress test exits %d"), iNumStressIterations);
|
sl@0
|
98 |
|
sl@0
|
99 |
INFO_PRINTF1(_L("Check if the Sync object Khronos extension is supported"));
|
sl@0
|
100 |
iIsSyncObjectExtensionSupported = CheckForExtensionL(KEGL_KHR_reusable_sync);
|
sl@0
|
101 |
|
sl@0
|
102 |
INFO_PRINTF1(_L("Check if the Sync object private extension is supported"));
|
sl@0
|
103 |
iIsSyncObjectPrivateExtensionSupported = CheckForExtensionL(KEGL_NOK__private__signal_sync);
|
sl@0
|
104 |
|
sl@0
|
105 |
CleanAll();
|
sl@0
|
106 |
TEST(GetProcAddress());
|
sl@0
|
107 |
INFO_PRINTF1(_L("End of CEglTest_SyncObject_Base::doTestStepPreambleL()"));
|
sl@0
|
108 |
return TestStepResult();
|
sl@0
|
109 |
}
|
sl@0
|
110 |
|
sl@0
|
111 |
void CEglTest_SyncObject_Base::CreateEglSessionL()
|
sl@0
|
112 |
{
|
sl@0
|
113 |
delete iEglSess; //just in case it was called twice
|
sl@0
|
114 |
iEglSess = CTestEglSession::NewL(Logger(), iDisplay, 0);
|
sl@0
|
115 |
}
|
sl@0
|
116 |
|
sl@0
|
117 |
void CEglTest_SyncObject_Base::CheckSyncAttrib(EGLint aAttribute, EGLint aExpectedValue)
|
sl@0
|
118 |
{
|
sl@0
|
119 |
EGLint value;
|
sl@0
|
120 |
EGLBoolean res = iPfnEglGetSyncAttribKHR(iDisplay,iSyncObject,aAttribute,&value);
|
sl@0
|
121 |
TEST(res == EGL_TRUE);
|
sl@0
|
122 |
TEST(value == aExpectedValue);
|
sl@0
|
123 |
|
sl@0
|
124 |
switch(aAttribute)
|
sl@0
|
125 |
{
|
sl@0
|
126 |
case EGL_SYNC_TYPE_KHR:
|
sl@0
|
127 |
{
|
sl@0
|
128 |
if (value == EGL_SYNC_REUSABLE_KHR)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
INFO_PRINTF1(_L(" EGL_SYNC_TYPE_KHR: EGL_SYNC_REUSABLE_KHR"));
|
sl@0
|
131 |
}
|
sl@0
|
132 |
else
|
sl@0
|
133 |
{
|
sl@0
|
134 |
ERR_PRINTF1(_L(" EGL_SYNC_TYPE_KHR: Invalid attribute"));
|
sl@0
|
135 |
}
|
sl@0
|
136 |
break;
|
sl@0
|
137 |
}
|
sl@0
|
138 |
case EGL_SYNC_STATUS_KHR:
|
sl@0
|
139 |
{
|
sl@0
|
140 |
if (value == EGL_SIGNALED_KHR)
|
sl@0
|
141 |
{
|
sl@0
|
142 |
INFO_PRINTF1(_L(" EGL_SYNC_STATUS_KHR: EGL_SIGNALED_KHR"));
|
sl@0
|
143 |
}
|
sl@0
|
144 |
else if (value == EGL_UNSIGNALED_KHR)
|
sl@0
|
145 |
{
|
sl@0
|
146 |
INFO_PRINTF1(_L(" EGL_SYNC_STATUS_KHR: EGL_UNSIGNALED_KHR"));
|
sl@0
|
147 |
}
|
sl@0
|
148 |
else
|
sl@0
|
149 |
{
|
sl@0
|
150 |
ERR_PRINTF1(_L(" EGL_SYNC_STATUS_KHR: Invalid attribute"));
|
sl@0
|
151 |
}
|
sl@0
|
152 |
break;
|
sl@0
|
153 |
}
|
sl@0
|
154 |
default:
|
sl@0
|
155 |
{
|
sl@0
|
156 |
ERR_PRINTF1(_L(" Invalid attribute"));
|
sl@0
|
157 |
}
|
sl@0
|
158 |
}
|
sl@0
|
159 |
}
|
sl@0
|
160 |
|
sl@0
|
161 |
/**
|
sl@0
|
162 |
Obtain extension functions for the sync object
|
sl@0
|
163 |
*/
|
sl@0
|
164 |
TBool CEglTest_SyncObject_Base::GetProcAddress()
|
sl@0
|
165 |
{
|
sl@0
|
166 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
167 |
{
|
sl@0
|
168 |
INFO_PRINTF1(_L("Sync object extension is not defined in test INI file.\
|
sl@0
|
169 |
The retrieval of the pointers to the extension sync object function will be skipped"));
|
sl@0
|
170 |
return ETrue;
|
sl@0
|
171 |
}
|
sl@0
|
172 |
|
sl@0
|
173 |
//retrieve the pointers to the EGL sync object extension functions
|
sl@0
|
174 |
INFO_PRINTF1(_L("retrieve the pointers to the EGL sync object extension functions"));
|
sl@0
|
175 |
|
sl@0
|
176 |
iPfnEglCreateSyncKHR = reinterpret_cast <TFPtrEglCreateSyncKhr> (eglGetProcAddress("eglCreateSyncKHR"));
|
sl@0
|
177 |
iPfnEglDestroySyncKHR = reinterpret_cast <TFPtrEglDestroySyncKhr> (eglGetProcAddress("eglDestroySyncKHR"));
|
sl@0
|
178 |
iPfnEglClientWaitSyncKHR = reinterpret_cast <TFPtrEglClientWaitSyncKhr> (eglGetProcAddress("eglClientWaitSyncKHR"));
|
sl@0
|
179 |
iPfnEglSignalSyncKHR = reinterpret_cast <TFPtrEglSignalSyncKhr> (eglGetProcAddress("eglSignalSyncKHR"));
|
sl@0
|
180 |
iPfnEglGetSyncAttribKHR = reinterpret_cast <TFPtrEglGetSyncAttribKhr> (eglGetProcAddress("eglGetSyncAttribKHR"));
|
sl@0
|
181 |
if(iIsSyncObjectPrivateExtensionSupported)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
iPfnEglPrivateSignalSyncNOK = reinterpret_cast <TFPtrEglPrivateSignalSyncNok> (eglGetProcAddress("egl_Private_SignalSyncNOK"));
|
sl@0
|
184 |
if(!iPfnEglPrivateSignalSyncNOK)
|
sl@0
|
185 |
{
|
sl@0
|
186 |
ERR_PRINTF1(_L(" Pointer to function \"egl_Private_SignalSyncNOK\" is not valid"));
|
sl@0
|
187 |
}
|
sl@0
|
188 |
}
|
sl@0
|
189 |
if(!iPfnEglCreateSyncKHR)
|
sl@0
|
190 |
{
|
sl@0
|
191 |
ERR_PRINTF1(_L(" Pointer to function \"eglCreateSyncKHR\" is not valid"));
|
sl@0
|
192 |
}
|
sl@0
|
193 |
if(!iPfnEglDestroySyncKHR)
|
sl@0
|
194 |
{
|
sl@0
|
195 |
ERR_PRINTF1(_L(" Pointer to function \"eglDestroySyncKHR\" is not valid"));
|
sl@0
|
196 |
}
|
sl@0
|
197 |
if(!iPfnEglClientWaitSyncKHR)
|
sl@0
|
198 |
{
|
sl@0
|
199 |
ERR_PRINTF1(_L(" Pointer to function \"eglClientWaitSyncKHR\" is not valid"));
|
sl@0
|
200 |
}
|
sl@0
|
201 |
if(!iPfnEglSignalSyncKHR)
|
sl@0
|
202 |
{
|
sl@0
|
203 |
ERR_PRINTF1(_L(" Pointer to function \"eglSignalSyncKHR\" is not valid"));
|
sl@0
|
204 |
}
|
sl@0
|
205 |
|
sl@0
|
206 |
if(!iPfnEglGetSyncAttribKHR)
|
sl@0
|
207 |
{
|
sl@0
|
208 |
ERR_PRINTF1(_L(" Pointer to function \"eglGetSyncAttribKHR\" is not valid"));
|
sl@0
|
209 |
}
|
sl@0
|
210 |
|
sl@0
|
211 |
if(!(iPfnEglCreateSyncKHR && iPfnEglDestroySyncKHR && iPfnEglClientWaitSyncKHR
|
sl@0
|
212 |
&& iPfnEglSignalSyncKHR && iPfnEglGetSyncAttribKHR &&
|
sl@0
|
213 |
(!iIsSyncObjectPrivateExtensionSupported || (iPfnEglPrivateSignalSyncNOK))))
|
sl@0
|
214 |
{//if the private extension is not declared in the test ini file, we won't signal the failure
|
sl@0
|
215 |
return EFalse;
|
sl@0
|
216 |
}
|
sl@0
|
217 |
return ETrue;
|
sl@0
|
218 |
}
|
sl@0
|
219 |
|
sl@0
|
220 |
void CEglTest_SyncObject_Base::CleanAll()
|
sl@0
|
221 |
{
|
sl@0
|
222 |
if(iEglSess)
|
sl@0
|
223 |
{
|
sl@0
|
224 |
delete iEglSess;
|
sl@0
|
225 |
iEglSess = NULL;
|
sl@0
|
226 |
}
|
sl@0
|
227 |
TRAPD(res, TerminateDisplayL());
|
sl@0
|
228 |
TEST(res == KErrNone);
|
sl@0
|
229 |
INFO_PRINTF2(_L("Display termination completed with error %d"), res);
|
sl@0
|
230 |
|
sl@0
|
231 |
INFO_PRINTF1(_L("Main Thread: Calling eglReleaseThread()"));
|
sl@0
|
232 |
ASSERT_EGL_TRUE(eglReleaseThread())
|
sl@0
|
233 |
}
|
sl@0
|
234 |
|
sl@0
|
235 |
/**
|
sl@0
|
236 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-001
|
sl@0
|
237 |
|
sl@0
|
238 |
@SYMTestPriority 1
|
sl@0
|
239 |
|
sl@0
|
240 |
@SYMPREQ 2400
|
sl@0
|
241 |
|
sl@0
|
242 |
@SYMREQ 12326
|
sl@0
|
243 |
|
sl@0
|
244 |
@SYMTestCaseDesc
|
sl@0
|
245 |
To check that current implementation support EGL sync object extension
|
sl@0
|
246 |
|
sl@0
|
247 |
@SYMTestActions
|
sl@0
|
248 |
1. Request supporting extension for the existing display by calling eglQueryString(...) and passing EGL_EXTENSIONS as a second parameter.
|
sl@0
|
249 |
2. Obtain an EGL sync object extension functions by supplying the following procname to the function void (*eglGetProcAddress(const char *procname)):
|
sl@0
|
250 |
"eglCreateSyncKHR"
|
sl@0
|
251 |
"eglDestroySyncKHR"
|
sl@0
|
252 |
"eglClientWaitSyncKHR"
|
sl@0
|
253 |
"eglSignalSyncKHR"
|
sl@0
|
254 |
"eglGetSyncAttribKHR"
|
sl@0
|
255 |
|
sl@0
|
256 |
@SYMTestExpectedResults
|
sl@0
|
257 |
1. The function must return a string which includes space separated sub-string "EGL_KHR_reusable_sync".
|
sl@0
|
258 |
2. The pointer to the functions should be non zero.
|
sl@0
|
259 |
*/
|
sl@0
|
260 |
TVerdict CEglTest_SyncObject_Positive_GetProcAddress::doTestStepL()
|
sl@0
|
261 |
{
|
sl@0
|
262 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-001"));
|
sl@0
|
263 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_GetProcAddress::doTestStepL"));
|
sl@0
|
264 |
|
sl@0
|
265 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
266 |
{
|
sl@0
|
267 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
268 |
CleanAll();
|
sl@0
|
269 |
RecordTestResultL();
|
sl@0
|
270 |
CloseTMSGraphicsStep();
|
sl@0
|
271 |
return TestStepResult();
|
sl@0
|
272 |
}
|
sl@0
|
273 |
|
sl@0
|
274 |
// check that extension "EGL_KHR_reusable_sync" is supported
|
sl@0
|
275 |
INFO_PRINTF1(_L("Check that extension \"EGL_KHR_reusable_sync\" is supported"));
|
sl@0
|
276 |
TEST(CheckForExtensionL(KEGL_KHR_reusable_sync));
|
sl@0
|
277 |
|
sl@0
|
278 |
INFO_PRINTF1(_L("Obtain EGL sync object extension functions"));
|
sl@0
|
279 |
TEST(GetProcAddress());
|
sl@0
|
280 |
|
sl@0
|
281 |
RecordTestResultL();
|
sl@0
|
282 |
CloseTMSGraphicsStep();
|
sl@0
|
283 |
INFO_PRINTF1(_L("End of CEglTest_SyncObject_Positive_GetProcAddress::doTestStepL"));
|
sl@0
|
284 |
return TestStepResult();
|
sl@0
|
285 |
}
|
sl@0
|
286 |
|
sl@0
|
287 |
/**
|
sl@0
|
288 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-005
|
sl@0
|
289 |
|
sl@0
|
290 |
@SYMTestPriority 1
|
sl@0
|
291 |
|
sl@0
|
292 |
@SYMPREQ 2400
|
sl@0
|
293 |
|
sl@0
|
294 |
@SYMREQ 12326
|
sl@0
|
295 |
|
sl@0
|
296 |
@SYMTestCaseDesc
|
sl@0
|
297 |
To validate the creation and deletion of the sync object.
|
sl@0
|
298 |
|
sl@0
|
299 |
@SYMTestActions
|
sl@0
|
300 |
1. Create sync object for the default display. NULL are specified in attribute_list.
|
sl@0
|
301 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
302 |
2. Retrieve the following attributes of the sync object: EGL_SYNC_TYPE_KHR ,
|
sl@0
|
303 |
EGL_SYNC_STATUS_KHR
|
sl@0
|
304 |
3. Delete the sync object
|
sl@0
|
305 |
4. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
306 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
307 |
5. Retrieve the following attributes of the sync object: EGL_SYNC_TYPE_KHR ,
|
sl@0
|
308 |
EGL_SYNC_STATUS_KHR
|
sl@0
|
309 |
6. Delete the sync object
|
sl@0
|
310 |
|
sl@0
|
311 |
@SYMTestExpectedResults
|
sl@0
|
312 |
1. Sync object handle doesn't equal to EGL_NO_SYNC_KHR
|
sl@0
|
313 |
2. Sync object attribute EGL_SYNC_STATUS_KHR should be set to EGL_UNSIGNALED_KHR by default,
|
sl@0
|
314 |
attribute EGL_SYNC_TYPE_KHR should be set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
315 |
4. Sync object handle doesn't equal to EGL_NO_SYNC_KHR
|
sl@0
|
316 |
5. Sync object attribute EGL_SYNC_STATUS_KHR should be set to EGL_UNSIGNALED_KHR by default,
|
sl@0
|
317 |
attribute EGL_SYNC_TYPE_KHR should be set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
318 |
*/
|
sl@0
|
319 |
TVerdict CEglTest_SyncObject_Positive_CreateDestroy::doTestStepL()
|
sl@0
|
320 |
{
|
sl@0
|
321 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-005"));
|
sl@0
|
322 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_CreateDestroy::doTestStepL"));
|
sl@0
|
323 |
|
sl@0
|
324 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
325 |
{
|
sl@0
|
326 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
327 |
CleanAll();
|
sl@0
|
328 |
RecordTestResultL();
|
sl@0
|
329 |
CloseTMSGraphicsStep();
|
sl@0
|
330 |
return TestStepResult();
|
sl@0
|
331 |
}
|
sl@0
|
332 |
|
sl@0
|
333 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
334 |
GetDisplayL();
|
sl@0
|
335 |
CreateEglSessionL();
|
sl@0
|
336 |
iEglSess->InitializeL();
|
sl@0
|
337 |
|
sl@0
|
338 |
INFO_PRINTF1(_L("Create sync object - default display, NULL at attributes, type parameter set to EGL_SYNC_REUSABLE_KHR"));
|
sl@0
|
339 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, NULL);
|
sl@0
|
340 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
341 |
|
sl@0
|
342 |
//check attributes of the sync object.
|
sl@0
|
343 |
INFO_PRINTF1(_L("Check attributes of sync object"));
|
sl@0
|
344 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR, EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
345 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR, EGL_UNSIGNALED_KHR);
|
sl@0
|
346 |
|
sl@0
|
347 |
INFO_PRINTF1(_L("Delete sync object"));
|
sl@0
|
348 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
349 |
TEST(res == EGL_TRUE);
|
sl@0
|
350 |
|
sl@0
|
351 |
INFO_PRINTF1(_L("Create sync object - default display, no attribute specified, type parameter set to EGL_SYNC_REUSABLE_KHR "));
|
sl@0
|
352 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
353 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
354 |
|
sl@0
|
355 |
INFO_PRINTF1(_L("Check attributes"));
|
sl@0
|
356 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR, EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
357 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_UNSIGNALED_KHR);
|
sl@0
|
358 |
|
sl@0
|
359 |
INFO_PRINTF1(_L("Delete sync object"));
|
sl@0
|
360 |
res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
361 |
TEST(res == EGL_TRUE);
|
sl@0
|
362 |
|
sl@0
|
363 |
CleanAll();
|
sl@0
|
364 |
RecordTestResultL();
|
sl@0
|
365 |
CloseTMSGraphicsStep();
|
sl@0
|
366 |
return TestStepResult();
|
sl@0
|
367 |
}
|
sl@0
|
368 |
|
sl@0
|
369 |
/**
|
sl@0
|
370 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-010
|
sl@0
|
371 |
|
sl@0
|
372 |
@SYMTestPriority 1
|
sl@0
|
373 |
|
sl@0
|
374 |
@SYMPREQ 2400
|
sl@0
|
375 |
|
sl@0
|
376 |
@SYMREQ 12326
|
sl@0
|
377 |
|
sl@0
|
378 |
@SYMTestCaseDesc
|
sl@0
|
379 |
To check that transition from EGL_UNSIGNALED_KHR to EGL_SIGNALED_KHR state will trigger the signal and unblock the client thread
|
sl@0
|
380 |
|
sl@0
|
381 |
@SYMTestActions
|
sl@0
|
382 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
383 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
384 |
2. Launch thread A
|
sl@0
|
385 |
3. Wait on sync object by calling eglClientWaitSyncKHR
|
sl@0
|
386 |
4. Signal on the sync object from thread A with the flag EGL_SIGNALED_KHR
|
sl@0
|
387 |
5. Retrieve EGL_SYNC_STATUS_KHR attribute
|
sl@0
|
388 |
6. Delete the sync object
|
sl@0
|
389 |
|
sl@0
|
390 |
@SYMTestExpectedResults
|
sl@0
|
391 |
3. The main thread is blocked
|
sl@0
|
392 |
4. After the signal the main thread should be unblocked and the value returned by eglClientWaitSyncKHR() is set to EGL_CONDITION_SATISFIED_KHR
|
sl@0
|
393 |
5. Status attribute is set to EGL_SIGNALED_KHR
|
sl@0
|
394 |
*/
|
sl@0
|
395 |
TVerdict CEglTest_SyncObject_Positive_WaitSignal::doTestStepL()
|
sl@0
|
396 |
{
|
sl@0
|
397 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-010"));
|
sl@0
|
398 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_WaitSignal::doTestStepL"));
|
sl@0
|
399 |
|
sl@0
|
400 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
401 |
{
|
sl@0
|
402 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
403 |
CleanAll();
|
sl@0
|
404 |
RecordTestResultL();
|
sl@0
|
405 |
CloseTMSGraphicsStep();
|
sl@0
|
406 |
return TestStepResult();
|
sl@0
|
407 |
}
|
sl@0
|
408 |
|
sl@0
|
409 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
410 |
GetDisplayL();
|
sl@0
|
411 |
CreateEglSessionL();
|
sl@0
|
412 |
iEglSess->InitializeL();
|
sl@0
|
413 |
|
sl@0
|
414 |
//create sync object
|
sl@0
|
415 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
416 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
417 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
418 |
|
sl@0
|
419 |
//launch threadA
|
sl@0
|
420 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
421 |
|
sl@0
|
422 |
//Stall the main thread
|
sl@0
|
423 |
TUint32 timestampBefore = User::NTickCount(); //microsecond
|
sl@0
|
424 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
425 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
426 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
427 |
|
sl@0
|
428 |
INFO_PRINTF4(_L("Main thread waited on eglClientWaitSyncKHR for %d usec (threshold was [%d +- %d])"),timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
429 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
430 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
431 |
|
sl@0
|
432 |
INFO_PRINTF1(_L("Check attributes of sync object"));
|
sl@0
|
433 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_SIGNALED_KHR);
|
sl@0
|
434 |
|
sl@0
|
435 |
INFO_PRINTF1(_L("Delete sync object"));
|
sl@0
|
436 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
437 |
TEST(res == EGL_TRUE);
|
sl@0
|
438 |
|
sl@0
|
439 |
CleanAll();
|
sl@0
|
440 |
RecordTestResultL();
|
sl@0
|
441 |
CloseTMSGraphicsStep();
|
sl@0
|
442 |
return TestStepResult();
|
sl@0
|
443 |
}
|
sl@0
|
444 |
|
sl@0
|
445 |
void CEglTest_SyncObject_Positive_WaitSignal::doThreadFunctionL(TInt aIdx)
|
sl@0
|
446 |
{
|
sl@0
|
447 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_WaitSignal::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
448 |
ASSERT_TRUE(aIdx==0);
|
sl@0
|
449 |
|
sl@0
|
450 |
User::After(iDelaySignalling);
|
sl@0
|
451 |
|
sl@0
|
452 |
INFO_PRINTF1(_L("signal sync object from thread A"));
|
sl@0
|
453 |
EGLBoolean res = iPfnEglSignalSyncKHR(iDisplay,iSyncObject,EGL_SIGNALED_KHR);
|
sl@0
|
454 |
TEST(res == EGL_TRUE);
|
sl@0
|
455 |
}
|
sl@0
|
456 |
|
sl@0
|
457 |
/**
|
sl@0
|
458 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-015
|
sl@0
|
459 |
|
sl@0
|
460 |
@SYMTestPriority 1
|
sl@0
|
461 |
|
sl@0
|
462 |
@SYMPREQ 2400
|
sl@0
|
463 |
|
sl@0
|
464 |
@SYMREQ 12326
|
sl@0
|
465 |
|
sl@0
|
466 |
@SYMTestCaseDesc
|
sl@0
|
467 |
To check that the client will not be blocked by waiting on the sync object
|
sl@0
|
468 |
if the latter is in EGL_SIGNALED_KHR state and will stay blocked until
|
sl@0
|
469 |
transition from unsignal to signal state occurs.
|
sl@0
|
470 |
To check that eglSignalSyncKHR sets the state of the sync object correctly.
|
sl@0
|
471 |
|
sl@0
|
472 |
@SYMTestActions
|
sl@0
|
473 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
474 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
475 |
2. Call eglSignalSyncKHR with EGL_SIGNALED_KHR as a parameter.
|
sl@0
|
476 |
3. Retrieve an EGL_SYNC_STATUS_KHR attribute.
|
sl@0
|
477 |
4. Try to wait on the sync object by calling eglClientWaitSyncKHR.
|
sl@0
|
478 |
5. Call eglSignalSyncKHR with EGL_UNSIGNALED_KHR as a parameter.
|
sl@0
|
479 |
6. Retrieve an EGL_SYNC_STATUS_KHR attribute.
|
sl@0
|
480 |
7. Launch thread A.
|
sl@0
|
481 |
8. Waiting on the sync object by calling eglClientWaitSyncKHR.
|
sl@0
|
482 |
9. From thread A call eglSignalSyncKHR with EGL_UNSIGNALED_KHR as a parameter.
|
sl@0
|
483 |
10. From thread A retrieve EGL_SYNC_STATUS_KHR attribute.
|
sl@0
|
484 |
11. From thread A call eglSignalSyncKHR with EGL_SIGNALED_KHR as a parameter.
|
sl@0
|
485 |
12. From thread A retrieve EGL_SYNC_STATUS_KHR attribute.
|
sl@0
|
486 |
13 Delete the sync object.
|
sl@0
|
487 |
|
sl@0
|
488 |
@SYMTestExpectedResults
|
sl@0
|
489 |
3. EGL_SYNC_STATUS_KHR attribute is set to EGL_SIGNALED_KHR
|
sl@0
|
490 |
4. The thread is not blocked and an error code returned by eglClientWaitSyncKHR() is set to EGL_CONDITION_SATISFIED_KHR
|
sl@0
|
491 |
6. EGL_SYNC_STATUS_KHR attribute is set to EGL_UNSIGNALED_KHR
|
sl@0
|
492 |
8. Main thread is blocked
|
sl@0
|
493 |
9. Main thread stays blocked
|
sl@0
|
494 |
10. EGL_SYNC_STATUS_KHR attribute is set to EGL_UNSIGNALED_KHR
|
sl@0
|
495 |
11. Main thread is unblocked
|
sl@0
|
496 |
12. EGL_SYNC_STATUS_KHR attribute is set to EGL_SIGNALED_KHR
|
sl@0
|
497 |
*/
|
sl@0
|
498 |
TVerdict CEglTest_SyncObject_Positive_WaitSignal2::doTestStepL()
|
sl@0
|
499 |
{
|
sl@0
|
500 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-015"));
|
sl@0
|
501 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_WaitSignal2::doTestStepL"));
|
sl@0
|
502 |
|
sl@0
|
503 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
504 |
{
|
sl@0
|
505 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
506 |
CleanAll();
|
sl@0
|
507 |
RecordTestResultL();
|
sl@0
|
508 |
CloseTMSGraphicsStep();
|
sl@0
|
509 |
return TestStepResult();
|
sl@0
|
510 |
}
|
sl@0
|
511 |
|
sl@0
|
512 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
513 |
GetDisplayL();
|
sl@0
|
514 |
CreateEglSessionL();
|
sl@0
|
515 |
iEglSess->InitializeL();
|
sl@0
|
516 |
|
sl@0
|
517 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
518 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
519 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
520 |
|
sl@0
|
521 |
//set to signal state, basically we are not changing anything here
|
sl@0
|
522 |
EGLBoolean res = iPfnEglSignalSyncKHR(iDisplay,iSyncObject,EGL_SIGNALED_KHR);
|
sl@0
|
523 |
TEST(res = EGL_TRUE);
|
sl@0
|
524 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR, EGL_SIGNALED_KHR);
|
sl@0
|
525 |
|
sl@0
|
526 |
INFO_PRINTF1(_L("Try to wait on the sync object by calling eglClientWaitSyncKHR"));
|
sl@0
|
527 |
TUint32 timestampBefore = User::NTickCount(); //microsecond
|
sl@0
|
528 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
529 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
530 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
531 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
532 |
INFO_PRINTF1(_L(" Check that main thread was not stalled at eglClientWaitSyncKHR()"));
|
sl@0
|
533 |
TEST(timeElapsed < iThreshold);
|
sl@0
|
534 |
|
sl@0
|
535 |
//set to unsignal state
|
sl@0
|
536 |
res = iPfnEglSignalSyncKHR(iDisplay,iSyncObject,EGL_UNSIGNALED_KHR);
|
sl@0
|
537 |
TEST(res == EGL_TRUE);
|
sl@0
|
538 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR, EGL_UNSIGNALED_KHR);
|
sl@0
|
539 |
|
sl@0
|
540 |
//launch threadA
|
sl@0
|
541 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
542 |
|
sl@0
|
543 |
//Stall the main thread
|
sl@0
|
544 |
timestampBefore = User::NTickCount();
|
sl@0
|
545 |
resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
546 |
timestampAfter = User::NTickCount();
|
sl@0
|
547 |
timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
548 |
|
sl@0
|
549 |
INFO_PRINTF5(_L("Main thread waited on eglClientWaitSyncKHR for %d usec (threshold was [%d + %d +- %d])"),timeElapsed, iDelaySignalling*2, iTimeOverhead, iThreshold);
|
sl@0
|
550 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
551 |
TEST(Abs(timeElapsed - (iDelaySignalling*2 + iTimeOverhead)) < iThreshold);
|
sl@0
|
552 |
|
sl@0
|
553 |
INFO_PRINTF1(_L("Delete sync object"));
|
sl@0
|
554 |
res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
555 |
TEST(res == EGL_TRUE);
|
sl@0
|
556 |
|
sl@0
|
557 |
CleanAll();
|
sl@0
|
558 |
RecordTestResultL();
|
sl@0
|
559 |
CloseTMSGraphicsStep();
|
sl@0
|
560 |
return TestStepResult();
|
sl@0
|
561 |
}
|
sl@0
|
562 |
|
sl@0
|
563 |
void CEglTest_SyncObject_Positive_WaitSignal2::doThreadFunctionL(TInt aIdx)
|
sl@0
|
564 |
{
|
sl@0
|
565 |
TUint32 timeOverheadStart = User::NTickCount();
|
sl@0
|
566 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_WaitSignal2::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
567 |
ASSERT_TRUE(aIdx==0);
|
sl@0
|
568 |
|
sl@0
|
569 |
User::After(iDelaySignalling);
|
sl@0
|
570 |
INFO_PRINTF1(_L("unsignal sync object from thread A"));
|
sl@0
|
571 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_UNSIGNALED_KHR);
|
sl@0
|
572 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
573 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR, EGL_UNSIGNALED_KHR);
|
sl@0
|
574 |
|
sl@0
|
575 |
User::After(iDelaySignalling);
|
sl@0
|
576 |
INFO_PRINTF1(_L("signal sync object from thread A"));
|
sl@0
|
577 |
TUint32 timeOverheadEnd = User::NTickCount();
|
sl@0
|
578 |
iTimeOverhead = ElapsedTime(timeOverheadEnd, timeOverheadStart) - iDelaySignalling*2;
|
sl@0
|
579 |
resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_SIGNALED_KHR);
|
sl@0
|
580 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
581 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR, EGL_SIGNALED_KHR);
|
sl@0
|
582 |
}
|
sl@0
|
583 |
|
sl@0
|
584 |
/**
|
sl@0
|
585 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-020
|
sl@0
|
586 |
|
sl@0
|
587 |
@SYMTestPriority 1
|
sl@0
|
588 |
|
sl@0
|
589 |
@SYMPREQ 2400
|
sl@0
|
590 |
|
sl@0
|
591 |
@SYMREQ 12326
|
sl@0
|
592 |
|
sl@0
|
593 |
@SYMTestCaseDesc
|
sl@0
|
594 |
To check that the deletion of the sync object triggers the signalling
|
sl@0
|
595 |
|
sl@0
|
596 |
@SYMTestActions
|
sl@0
|
597 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
598 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
599 |
2. Launch a thread A
|
sl@0
|
600 |
3. Stall the main thread by calling eglClientWaitSyncKHR() on the sync object with timeout value EGL_FOREVER_KHR
|
sl@0
|
601 |
4. Delete the sync object from the thread A
|
sl@0
|
602 |
|
sl@0
|
603 |
@SYMTestExpectedResults
|
sl@0
|
604 |
3. The main thread which waits for the signal must be stalled
|
sl@0
|
605 |
4. After the sync object has been deleted the main client thread will be unblocked and an error code returned by eglClientWaitSyncKHR() is set to EGL_CONDITION_SATISFIED_KHR
|
sl@0
|
606 |
*/
|
sl@0
|
607 |
TVerdict CEglTest_SyncObject_Positive_WaitDelete::doTestStepL()
|
sl@0
|
608 |
{
|
sl@0
|
609 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-020"));
|
sl@0
|
610 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_WaitDelete::doTestStepL"));
|
sl@0
|
611 |
|
sl@0
|
612 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
613 |
{
|
sl@0
|
614 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
615 |
CleanAll();
|
sl@0
|
616 |
RecordTestResultL();
|
sl@0
|
617 |
CloseTMSGraphicsStep();
|
sl@0
|
618 |
return TestStepResult();
|
sl@0
|
619 |
}
|
sl@0
|
620 |
|
sl@0
|
621 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
622 |
GetDisplayL();
|
sl@0
|
623 |
CreateEglSessionL();
|
sl@0
|
624 |
iEglSess->InitializeL();
|
sl@0
|
625 |
|
sl@0
|
626 |
//create sync object
|
sl@0
|
627 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
628 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
629 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
630 |
|
sl@0
|
631 |
//launch threadA
|
sl@0
|
632 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
633 |
|
sl@0
|
634 |
//Stall the main thread
|
sl@0
|
635 |
TUint32 timestampBefore = User::NTickCount(); //microsecond
|
sl@0
|
636 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
637 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
638 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
639 |
|
sl@0
|
640 |
INFO_PRINTF4(_L("Main thread waited on eglClientWaitSyncKHR for %d usec (threshold was [%d +- %d])"),timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
641 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
642 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
643 |
|
sl@0
|
644 |
CleanAll();
|
sl@0
|
645 |
RecordTestResultL();
|
sl@0
|
646 |
CloseTMSGraphicsStep();
|
sl@0
|
647 |
return TestStepResult();
|
sl@0
|
648 |
}
|
sl@0
|
649 |
|
sl@0
|
650 |
void CEglTest_SyncObject_Positive_WaitDelete::doThreadFunctionL(TInt aIdx)
|
sl@0
|
651 |
{
|
sl@0
|
652 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_WaitDelete::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
653 |
ASSERT_TRUE(aIdx==0);
|
sl@0
|
654 |
|
sl@0
|
655 |
User::After(iDelaySignalling);
|
sl@0
|
656 |
INFO_PRINTF1(_L("Delete sync object from thread A"));
|
sl@0
|
657 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
658 |
TEST(res == EGL_TRUE);
|
sl@0
|
659 |
}
|
sl@0
|
660 |
|
sl@0
|
661 |
/**
|
sl@0
|
662 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-025
|
sl@0
|
663 |
|
sl@0
|
664 |
@SYMTestPriority 1
|
sl@0
|
665 |
|
sl@0
|
666 |
@SYMPREQ 2400
|
sl@0
|
667 |
|
sl@0
|
668 |
@SYMREQ 12326
|
sl@0
|
669 |
|
sl@0
|
670 |
@SYMTestCaseDesc
|
sl@0
|
671 |
To check that client will be unblocked once the timeout has expired even if there is no signalling occurred.
|
sl@0
|
672 |
|
sl@0
|
673 |
@SYMTestActions
|
sl@0
|
674 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
675 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
676 |
2. Take the start time stamp
|
sl@0
|
677 |
3. Call eglClientWaitSyncKHR() on the sync object with timeout value equals five seconds
|
sl@0
|
678 |
4. Take the end timestamp
|
sl@0
|
679 |
5. Retrieve EGL_SYNC_STATUS attribute of the sync object
|
sl@0
|
680 |
6. Destroy the sync object
|
sl@0
|
681 |
|
sl@0
|
682 |
@SYMTestExpectedResults
|
sl@0
|
683 |
3. The client thread should stay blocked until timeout is expired
|
sl@0
|
684 |
4. Check that (timestamp End - timestamp Before) equals (roughly) timeout and an error code returned by
|
sl@0
|
685 |
eglClientWaitSyncKHR is EGL_TIMEOUTE_EXPIRED_KHR
|
sl@0
|
686 |
5. The sync object attribute EGL_SYNC_STATUS is set to EGL_UNSIGNALED_KHR
|
sl@0
|
687 |
*/
|
sl@0
|
688 |
TVerdict CEglTest_SyncObject_Positive_WaitWithTimeoutExpired::doTestStepL()
|
sl@0
|
689 |
{
|
sl@0
|
690 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-025"));
|
sl@0
|
691 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_WaitWithTimeoutExpired::doTestStepL started...."));
|
sl@0
|
692 |
|
sl@0
|
693 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
694 |
{
|
sl@0
|
695 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
696 |
CleanAll();
|
sl@0
|
697 |
RecordTestResultL();
|
sl@0
|
698 |
CloseTMSGraphicsStep();
|
sl@0
|
699 |
return TestStepResult();
|
sl@0
|
700 |
}
|
sl@0
|
701 |
|
sl@0
|
702 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
703 |
GetDisplayL();
|
sl@0
|
704 |
CreateEglSessionL();
|
sl@0
|
705 |
iEglSess->InitializeL();
|
sl@0
|
706 |
|
sl@0
|
707 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
708 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
709 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
710 |
|
sl@0
|
711 |
// calling wait sync without signaling the object should hit the predefined timeout if set to anything different to EGL_FOREVER_KHR
|
sl@0
|
712 |
INFO_PRINTF2(_L("Calling eglClientWaitSyncKHR on the object with a defined timeout of %d usec"), iWaitSyncTimeout);
|
sl@0
|
713 |
EGLTimeKHR timeoutNano = (TUint64)iWaitSyncTimeout * 1000; // EGLTimeKHR is in nanoseconds!!
|
sl@0
|
714 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
715 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,timeoutNano);
|
sl@0
|
716 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
717 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
718 |
|
sl@0
|
719 |
INFO_PRINTF4(_L("Waited on eglClientWaitSyncKHR for %d usec (threshold was [%d +- %d])"),timeElapsed, iWaitSyncTimeout, iThreshold);
|
sl@0
|
720 |
TEST(resClientWait == EGL_TIMEOUT_EXPIRED_KHR);
|
sl@0
|
721 |
TEST (Abs(timeElapsed - timeoutNano/1000) < iThreshold);
|
sl@0
|
722 |
|
sl@0
|
723 |
INFO_PRINTF1(_L("Check attributes..."));
|
sl@0
|
724 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
725 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_UNSIGNALED_KHR);
|
sl@0
|
726 |
|
sl@0
|
727 |
INFO_PRINTF1(_L("Delete sync object"));
|
sl@0
|
728 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
729 |
TEST(res == EGL_TRUE);
|
sl@0
|
730 |
|
sl@0
|
731 |
CleanAll();
|
sl@0
|
732 |
RecordTestResultL();
|
sl@0
|
733 |
CloseTMSGraphicsStep();
|
sl@0
|
734 |
INFO_PRINTF1(_L("....CEglTest_SyncObject_Positive_WaitWithTimeoutExpired::doTestStepL completed!"));
|
sl@0
|
735 |
return TestStepResult();
|
sl@0
|
736 |
}
|
sl@0
|
737 |
|
sl@0
|
738 |
/**
|
sl@0
|
739 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-030
|
sl@0
|
740 |
|
sl@0
|
741 |
@SYMTestPriority 1
|
sl@0
|
742 |
|
sl@0
|
743 |
@SYMPREQ 2400
|
sl@0
|
744 |
|
sl@0
|
745 |
@SYMREQ 12326
|
sl@0
|
746 |
|
sl@0
|
747 |
@SYMTestCaseDesc
|
sl@0
|
748 |
To check that client will be unblocked once the signalling occurs even if the timeout is not expired
|
sl@0
|
749 |
|
sl@0
|
750 |
@SYMTestActions
|
sl@0
|
751 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
752 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR.
|
sl@0
|
753 |
2. Launch thread A
|
sl@0
|
754 |
3. Take the start time stamp
|
sl@0
|
755 |
4. Call eglClientWaitSyncKHR() on the sync object with timeout value equals five seconds
|
sl@0
|
756 |
5. Signal on the sync object from thread A before timeout is expired (after 2.5 seconds).
|
sl@0
|
757 |
6. Takes the end timestamp
|
sl@0
|
758 |
7. Retrieve EGL_SYNC_STATUS attribute of the sync object from thread A
|
sl@0
|
759 |
8. Destroy the sync object
|
sl@0
|
760 |
|
sl@0
|
761 |
@SYMTestExpectedResults
|
sl@0
|
762 |
4. The client thread should be blocked
|
sl@0
|
763 |
6. The main thread is unblocked. Check that (timestamp End - timestamp Before) equals (roughly)
|
sl@0
|
764 |
2.5 seconds and an error code returned by eglClientWaitSyncKHR is EGL_CONDITION_SATISFIED_KHR
|
sl@0
|
765 |
7. The sync object attribute EGL_SYNC_STATUS is set to EGL_SIGNALED_KHR
|
sl@0
|
766 |
*/
|
sl@0
|
767 |
TVerdict CEglTest_SyncObject_Positive_SignalBeforeTimeoutExpired::doTestStepL()
|
sl@0
|
768 |
{
|
sl@0
|
769 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-030"));
|
sl@0
|
770 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_SignalBeforeTimeoutExpired::doTestStepL started...."));
|
sl@0
|
771 |
|
sl@0
|
772 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
773 |
{
|
sl@0
|
774 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
775 |
CleanAll();
|
sl@0
|
776 |
RecordTestResultL();
|
sl@0
|
777 |
CloseTMSGraphicsStep();
|
sl@0
|
778 |
return TestStepResult();
|
sl@0
|
779 |
}
|
sl@0
|
780 |
|
sl@0
|
781 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
782 |
GetDisplayL();
|
sl@0
|
783 |
CreateEglSessionL();
|
sl@0
|
784 |
iEglSess->InitializeL();
|
sl@0
|
785 |
|
sl@0
|
786 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
787 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
788 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
789 |
|
sl@0
|
790 |
INFO_PRINTF1(_L("Launching thread A..."));
|
sl@0
|
791 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
792 |
|
sl@0
|
793 |
INFO_PRINTF2(_L("Main thread waiting for thread A to signal with a defined timeout of %d usec"), iWaitSyncTimeout);
|
sl@0
|
794 |
EGLTimeKHR timeoutNano = (TUint64)iWaitSyncTimeout * 1000; // EGLTimeKHR is in nanoseconds!!
|
sl@0
|
795 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
796 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,timeoutNano);
|
sl@0
|
797 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
798 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
799 |
|
sl@0
|
800 |
INFO_PRINTF4(_L("Main thread waited on eglClientWaitSyncKHR for %d usec (threshold was [%d +- %d])"),timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
801 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
802 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
803 |
|
sl@0
|
804 |
INFO_PRINTF1(_L("Check attributes..."));
|
sl@0
|
805 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
806 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_SIGNALED_KHR);
|
sl@0
|
807 |
|
sl@0
|
808 |
INFO_PRINTF1(_L("Delete sync object"));
|
sl@0
|
809 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
810 |
TEST(res == EGL_TRUE);
|
sl@0
|
811 |
|
sl@0
|
812 |
CleanAll();
|
sl@0
|
813 |
RecordTestResultL();
|
sl@0
|
814 |
CloseTMSGraphicsStep();
|
sl@0
|
815 |
INFO_PRINTF1(_L("....CEglTest_SyncObject_Positive_SignalBeforeTimeoutExpired::doTestStepL completed!"));
|
sl@0
|
816 |
return TestStepResult();
|
sl@0
|
817 |
}
|
sl@0
|
818 |
|
sl@0
|
819 |
void CEglTest_SyncObject_Positive_SignalBeforeTimeoutExpired::doThreadFunctionL(TInt aIdx)
|
sl@0
|
820 |
{
|
sl@0
|
821 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_SignalBeforeTimeoutExpired::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
822 |
ASSERT_TRUE(aIdx==0);
|
sl@0
|
823 |
|
sl@0
|
824 |
INFO_PRINTF2(_L("Wait for a bit before Signal sync object, Thread %d"),aIdx);
|
sl@0
|
825 |
User::After(iDelaySignalling);
|
sl@0
|
826 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_SIGNALED_KHR);
|
sl@0
|
827 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
828 |
INFO_PRINTF2(_L("Signal sync object done, Thread %d"),aIdx);
|
sl@0
|
829 |
}
|
sl@0
|
830 |
|
sl@0
|
831 |
/**
|
sl@0
|
832 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-035
|
sl@0
|
833 |
|
sl@0
|
834 |
@SYMTestPriority 1
|
sl@0
|
835 |
|
sl@0
|
836 |
@SYMPREQ 2400
|
sl@0
|
837 |
|
sl@0
|
838 |
@SYMREQ 12326
|
sl@0
|
839 |
|
sl@0
|
840 |
@SYMTestCaseDesc
|
sl@0
|
841 |
To check that client will be unblocked once the sync object has been deleted even if the timeout is not expired
|
sl@0
|
842 |
|
sl@0
|
843 |
@SYMTestActions
|
sl@0
|
844 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
845 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
846 |
2. Launch thread A
|
sl@0
|
847 |
3. Take the start time stamp
|
sl@0
|
848 |
4. Stall the client thread by calling eglClientWaitSyncKHR() on the sync object with timeout value equals five seconds
|
sl@0
|
849 |
5. Destroy the sync object from thread A before timeout is expired. (2.5 seconds)
|
sl@0
|
850 |
6. Takes the end timestamp
|
sl@0
|
851 |
7. Retrieve EGL_SYNC_STATUS attribute of the sync object
|
sl@0
|
852 |
8. Destroy the sync object
|
sl@0
|
853 |
|
sl@0
|
854 |
@SYMTestExpectedResults
|
sl@0
|
855 |
4. The main client thread should be blocked
|
sl@0
|
856 |
5. The main thread is unblocked. Check that (timestamp End - timestamp Before) equals (roughly)
|
sl@0
|
857 |
2.5 seconds and an error code returned by eglClientWaitSyncKHR is EGL_CONDITION_SATISFIED_KHR
|
sl@0
|
858 |
7. eglGetSyncAttribKHR() returns EGL_FALSE and EGL_BAD_PARAMETER is generated
|
sl@0
|
859 |
*/
|
sl@0
|
860 |
TVerdict CEglTest_SyncObject_Positive_DeleteBeforeTimeoutExpired::doTestStepL()
|
sl@0
|
861 |
{
|
sl@0
|
862 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-035"));
|
sl@0
|
863 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_DeleteBeforeTimeoutExpired::doTestStepL started...."));
|
sl@0
|
864 |
|
sl@0
|
865 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
866 |
{
|
sl@0
|
867 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
868 |
CleanAll();
|
sl@0
|
869 |
RecordTestResultL();
|
sl@0
|
870 |
CloseTMSGraphicsStep();
|
sl@0
|
871 |
return TestStepResult();
|
sl@0
|
872 |
}
|
sl@0
|
873 |
|
sl@0
|
874 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
875 |
GetDisplayL();
|
sl@0
|
876 |
CreateEglSessionL();
|
sl@0
|
877 |
iEglSess->InitializeL();
|
sl@0
|
878 |
|
sl@0
|
879 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
880 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
881 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
882 |
|
sl@0
|
883 |
INFO_PRINTF1(_L("Launching thread A..."));
|
sl@0
|
884 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
885 |
|
sl@0
|
886 |
INFO_PRINTF2(_L("Main thread waiting for thread A to signal with a defined timeout of %d usec"), iWaitSyncTimeout);
|
sl@0
|
887 |
EGLTimeKHR timeoutNano = (TUint64)iWaitSyncTimeout * 1000; // EGLTimeKHR is in nanoseconds!!
|
sl@0
|
888 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
889 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,timeoutNano);
|
sl@0
|
890 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
891 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
892 |
|
sl@0
|
893 |
INFO_PRINTF4(_L("Main thread waited on eglClientWaitSyncKHR for %d usec before sync object was deleted (threshold was [%d +- %d])"),timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
894 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
895 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
896 |
|
sl@0
|
897 |
INFO_PRINTF1(_L("Check attributes..."));
|
sl@0
|
898 |
EGLint syncTypeValue=-1;
|
sl@0
|
899 |
EGLBoolean ret = iPfnEglGetSyncAttribKHR(iDisplay,iSyncObject,EGL_SYNC_TYPE_KHR,&syncTypeValue);
|
sl@0
|
900 |
TEST(ret == EGL_FALSE);
|
sl@0
|
901 |
EGLint error = eglGetError();
|
sl@0
|
902 |
TEST(error == EGL_BAD_PARAMETER);
|
sl@0
|
903 |
TEST(syncTypeValue == -1); // due to the error, it wasn't properly retrieved
|
sl@0
|
904 |
|
sl@0
|
905 |
INFO_PRINTF1(_L("(attempt to) Delete sync object (was already deleted by a worker thread)"));
|
sl@0
|
906 |
ret = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
907 |
TEST(ret == EGL_FALSE);
|
sl@0
|
908 |
error = eglGetError();
|
sl@0
|
909 |
TEST(error == EGL_BAD_PARAMETER);
|
sl@0
|
910 |
|
sl@0
|
911 |
CleanAll();
|
sl@0
|
912 |
RecordTestResultL();
|
sl@0
|
913 |
CloseTMSGraphicsStep();
|
sl@0
|
914 |
INFO_PRINTF1(_L("....CEglTest_SyncObject_Positive_DeleteBeforeTimeoutExpired::doTestStepL completed!"));
|
sl@0
|
915 |
return TestStepResult();
|
sl@0
|
916 |
}
|
sl@0
|
917 |
|
sl@0
|
918 |
void CEglTest_SyncObject_Positive_DeleteBeforeTimeoutExpired::doThreadFunctionL(TInt aIdx)
|
sl@0
|
919 |
{
|
sl@0
|
920 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_DeleteBeforeTimeoutExpired::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
921 |
ASSERT_TRUE(aIdx==0);
|
sl@0
|
922 |
|
sl@0
|
923 |
INFO_PRINTF2(_L("Wait for a bit before destroying sync object, Thread %d"),aIdx);
|
sl@0
|
924 |
User::After(iDelaySignalling);
|
sl@0
|
925 |
TInt res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
926 |
TEST(res == EGL_TRUE);
|
sl@0
|
927 |
INFO_PRINTF2(_L("Delete sync object done, Thread %d"),aIdx);
|
sl@0
|
928 |
}
|
sl@0
|
929 |
|
sl@0
|
930 |
/**
|
sl@0
|
931 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-040
|
sl@0
|
932 |
|
sl@0
|
933 |
@SYMTestPriority 1
|
sl@0
|
934 |
|
sl@0
|
935 |
@SYMPREQ 2400
|
sl@0
|
936 |
|
sl@0
|
937 |
@SYMREQ 12326
|
sl@0
|
938 |
|
sl@0
|
939 |
@SYMTestCaseDesc
|
sl@0
|
940 |
To check that all threads waiting for the signal on the same sync object will be unblocked before the timeout has expired.
|
sl@0
|
941 |
|
sl@0
|
942 |
@SYMTestActions
|
sl@0
|
943 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
944 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
945 |
2. Launch two threads A and B.
|
sl@0
|
946 |
3. Call eglClientWaitSyncKHR() (from threads A and B) on the sync object with timeout value equals five seconds
|
sl@0
|
947 |
in thread A and EGL_FOREVER_KHR in thread B.
|
sl@0
|
948 |
4. Signal on the sync object with the flag EGL_SIGNALED_KHR from the main thread before timeout expired (after 2.5 seconds)
|
sl@0
|
949 |
5. Retrieve EGL_SYNC_STATUS attribute of the sync object from the main thread
|
sl@0
|
950 |
6. Destroy the sync object
|
sl@0
|
951 |
|
sl@0
|
952 |
@SYMTestExpectedResults
|
sl@0
|
953 |
3. Threads A and B will be stalled
|
sl@0
|
954 |
4. Both threads A and B will be unblocked and a value returned by eglClientWaitSyncKHR() is set to EGL_CONDITION_SATISFIED_KHR.
|
sl@0
|
955 |
5. The sync object attribute EGL_SYNC_STATUS is set to EGL_SIGNALED_KHR
|
sl@0
|
956 |
*/
|
sl@0
|
957 |
TVerdict CEglTest_SyncObject_Positive_Multithread_SignalBeforeTimeout::doTestStepL()
|
sl@0
|
958 |
{
|
sl@0
|
959 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-040"));
|
sl@0
|
960 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_Multithread_SignalBeforeTimeout::doTestStepL started...."));
|
sl@0
|
961 |
|
sl@0
|
962 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
963 |
{
|
sl@0
|
964 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
965 |
CleanAll();
|
sl@0
|
966 |
RecordTestResultL();
|
sl@0
|
967 |
CloseTMSGraphicsStep();
|
sl@0
|
968 |
return TestStepResult();
|
sl@0
|
969 |
}
|
sl@0
|
970 |
|
sl@0
|
971 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
972 |
GetDisplayL();
|
sl@0
|
973 |
CreateEglSessionL();
|
sl@0
|
974 |
iEglSess->InitializeL();
|
sl@0
|
975 |
|
sl@0
|
976 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
977 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
978 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
979 |
|
sl@0
|
980 |
INFO_PRINTF1(_L("Launching threads A and B..."));
|
sl@0
|
981 |
Test_MultiThreadL(2, EFalse);
|
sl@0
|
982 |
|
sl@0
|
983 |
INFO_PRINTF1(_L("Main thread, wait for a bit before Signal sync object"));
|
sl@0
|
984 |
User::After(iDelaySignalling);
|
sl@0
|
985 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_SIGNALED_KHR);
|
sl@0
|
986 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
987 |
INFO_PRINTF1(_L("Main thread Signal sync object done"));
|
sl@0
|
988 |
|
sl@0
|
989 |
INFO_PRINTF1(_L("Check attributes..."));
|
sl@0
|
990 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
991 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_SIGNALED_KHR);
|
sl@0
|
992 |
|
sl@0
|
993 |
INFO_PRINTF1(_L("Delete sync object"));
|
sl@0
|
994 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
995 |
TEST(res == EGL_TRUE);
|
sl@0
|
996 |
|
sl@0
|
997 |
CleanAll();
|
sl@0
|
998 |
RecordTestResultL();
|
sl@0
|
999 |
CloseTMSGraphicsStep();
|
sl@0
|
1000 |
INFO_PRINTF1(_L("....CEglTest_SyncObject_Positive_Multithread_SignalBeforeTimeout::doTestStepL completed!"));
|
sl@0
|
1001 |
return TestStepResult();
|
sl@0
|
1002 |
}
|
sl@0
|
1003 |
|
sl@0
|
1004 |
void CEglTest_SyncObject_Positive_Multithread_SignalBeforeTimeout::doThreadFunctionL(TInt aIdx)
|
sl@0
|
1005 |
{
|
sl@0
|
1006 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_Multithread_SignalBeforeTimeout::doThreadFunctionL, Thread %d"), aIdx);
|
sl@0
|
1007 |
ASSERT_TRUE(aIdx==0 || aIdx==1);
|
sl@0
|
1008 |
|
sl@0
|
1009 |
//Thread 0 waits for the main thread to signal the sync object, and exits
|
sl@0
|
1010 |
if(aIdx == 0)
|
sl@0
|
1011 |
{
|
sl@0
|
1012 |
INFO_PRINTF2(_L("Thread %d waiting for main thread to signal with a timeout EGL_FOREVER_KHR"), aIdx);
|
sl@0
|
1013 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1014 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
1015 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1016 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1017 |
|
sl@0
|
1018 |
INFO_PRINTF5(_L("Thread %d waited on eglClientWaitSyncKHR for %d usec before sync object was signaled (threshold was [%d +- %d])"), aIdx, timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
1019 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1020 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
1021 |
}
|
sl@0
|
1022 |
//Thread 1 waits for the main thread to signal the sync object, and exits
|
sl@0
|
1023 |
else if(aIdx == 1)
|
sl@0
|
1024 |
{
|
sl@0
|
1025 |
INFO_PRINTF3(_L("Thread %d waiting for main thread to signal with a defined timeout of %d"), aIdx, iWaitSyncTimeout);
|
sl@0
|
1026 |
EGLTimeKHR timeoutNano = (TUint64)iWaitSyncTimeout * 1000; // EGLTimeKHR is in nanoseconds!!
|
sl@0
|
1027 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1028 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,timeoutNano);
|
sl@0
|
1029 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1030 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1031 |
|
sl@0
|
1032 |
INFO_PRINTF5(_L("Thread %d waited on eglClientWaitSyncKHR for %d usec before sync object was signaled (threshold was [%d +- %d])"), aIdx, timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
1033 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1034 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
1035 |
}
|
sl@0
|
1036 |
}
|
sl@0
|
1037 |
|
sl@0
|
1038 |
/**
|
sl@0
|
1039 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-045
|
sl@0
|
1040 |
|
sl@0
|
1041 |
@SYMTestPriority 1
|
sl@0
|
1042 |
|
sl@0
|
1043 |
@SYMPREQ 2400
|
sl@0
|
1044 |
|
sl@0
|
1045 |
@SYMREQ 12326
|
sl@0
|
1046 |
|
sl@0
|
1047 |
@SYMTestCaseDesc
|
sl@0
|
1048 |
To check that a thread resumed due to timeout will not unblock another thread waiting for the signal.
|
sl@0
|
1049 |
|
sl@0
|
1050 |
@SYMTestActions
|
sl@0
|
1051 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
1052 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
1053 |
2. Launch two threads A and B.
|
sl@0
|
1054 |
3. Call eglClientWaitSyncKHR() (from threads A and B) on the sync object with timeout value equals five seconds in thread A and EGL_FOREVER_KHR in thread B.
|
sl@0
|
1055 |
4. Wait for approximately 7.5 seconds
|
sl@0
|
1056 |
5. Retrieve EGL_SYNC_STATUS attribute of the sync object from the main thread
|
sl@0
|
1057 |
6. Signal on the sync object with the flag EGL_SIGNALED_KHR from the main thread
|
sl@0
|
1058 |
7. Retrieve EGL_SYNC_STATUS attribute of the sync object from the main thread
|
sl@0
|
1059 |
8. Destroy the sync object
|
sl@0
|
1060 |
|
sl@0
|
1061 |
@SYMTestExpectedResults
|
sl@0
|
1062 |
3.Threads A and B will be stalled
|
sl@0
|
1063 |
4. Thread A will be unblocked after approximately 5 seconds and a value returned by eglClientWaitSyncKHR() is set to EGL_TIMEOUT_EXPIRED_KHR.
|
sl@0
|
1064 |
5. EGL_SYNC_STATUS attribute of the sync object is set to EGL_UNSIGNALED_KHR
|
sl@0
|
1065 |
6. Threads B will be unblocked and a value returned by eglClientWaitSyncKHR() is set to EGL_CONDITION_SATISFIED_KHR.
|
sl@0
|
1066 |
7. The sync object attribute EGL_SYNC_STATUS is set to EGL_SIGNALED_KHR
|
sl@0
|
1067 |
*/
|
sl@0
|
1068 |
TVerdict CEglTest_SyncObject_Positive_Multithread_SignalAfterTimeout::doTestStepL()
|
sl@0
|
1069 |
{
|
sl@0
|
1070 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-045"));
|
sl@0
|
1071 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_Multithread_SignalAfterTimeout::doTestStepL started...."));
|
sl@0
|
1072 |
|
sl@0
|
1073 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
1074 |
{
|
sl@0
|
1075 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
1076 |
CleanAll();
|
sl@0
|
1077 |
RecordTestResultL();
|
sl@0
|
1078 |
CloseTMSGraphicsStep();
|
sl@0
|
1079 |
return TestStepResult();
|
sl@0
|
1080 |
}
|
sl@0
|
1081 |
|
sl@0
|
1082 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
1083 |
GetDisplayL();
|
sl@0
|
1084 |
CreateEglSessionL();
|
sl@0
|
1085 |
iEglSess->InitializeL();
|
sl@0
|
1086 |
|
sl@0
|
1087 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
1088 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1089 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
1090 |
|
sl@0
|
1091 |
INFO_PRINTF1(_L("Launching threads A and B..."));
|
sl@0
|
1092 |
Test_MultiThreadL(2, EFalse);
|
sl@0
|
1093 |
TUint32 timeOverheadStart = User::NTickCount();
|
sl@0
|
1094 |
|
sl@0
|
1095 |
INFO_PRINTF1(_L("Main thread, wait for a long time, no Signal sync object yet"));
|
sl@0
|
1096 |
User::After(iLongDelaySignalling);
|
sl@0
|
1097 |
|
sl@0
|
1098 |
INFO_PRINTF1(_L("Check attributes..."));
|
sl@0
|
1099 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
1100 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_UNSIGNALED_KHR);
|
sl@0
|
1101 |
|
sl@0
|
1102 |
INFO_PRINTF1(_L("Main thread, Signal sync object now"));
|
sl@0
|
1103 |
TUint32 timeOverheadEnd = User::NTickCount();
|
sl@0
|
1104 |
iTimeOverhead = ElapsedTime(timeOverheadEnd, timeOverheadStart) - iLongDelaySignalling;
|
sl@0
|
1105 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_SIGNALED_KHR);
|
sl@0
|
1106 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1107 |
INFO_PRINTF1(_L("Main thread, Signal sync object done"));
|
sl@0
|
1108 |
|
sl@0
|
1109 |
INFO_PRINTF1(_L("Check attributes..."));
|
sl@0
|
1110 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
1111 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_SIGNALED_KHR);
|
sl@0
|
1112 |
|
sl@0
|
1113 |
INFO_PRINTF1(_L("Delete sync object"));
|
sl@0
|
1114 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
1115 |
TEST(res == EGL_TRUE);
|
sl@0
|
1116 |
|
sl@0
|
1117 |
CleanAll();
|
sl@0
|
1118 |
RecordTestResultL();
|
sl@0
|
1119 |
CloseTMSGraphicsStep();
|
sl@0
|
1120 |
INFO_PRINTF1(_L("....CEglTest_SyncObject_Positive_Multithread_SignalAfterTimeout::doTestStepL completed!"));
|
sl@0
|
1121 |
return TestStepResult();
|
sl@0
|
1122 |
}
|
sl@0
|
1123 |
|
sl@0
|
1124 |
void CEglTest_SyncObject_Positive_Multithread_SignalAfterTimeout::doThreadFunctionL(TInt aIdx)
|
sl@0
|
1125 |
{
|
sl@0
|
1126 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_Multithread_SignalAfterTimeout::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
1127 |
ASSERT_TRUE(aIdx==0 || aIdx==1);
|
sl@0
|
1128 |
|
sl@0
|
1129 |
//Thread 0 waits for the main thread to signal the sync object, and exits
|
sl@0
|
1130 |
if(aIdx == 0)
|
sl@0
|
1131 |
{
|
sl@0
|
1132 |
INFO_PRINTF2(_L("Thread %d waiting for main thread to signal with a timeout EGL_FOREVER_KHR"), aIdx);
|
sl@0
|
1133 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1134 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
1135 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1136 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1137 |
|
sl@0
|
1138 |
INFO_PRINTF6(_L("Thread %d waited on eglClientWaitSyncKHR for %d usec before sync object was signaled (threshold was [%d + %d +- %d])"), aIdx, timeElapsed, iLongDelaySignalling, iTimeOverhead, iThreshold);
|
sl@0
|
1139 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1140 |
TEST (Abs(timeElapsed - (iLongDelaySignalling + iTimeOverhead)) < iThreshold);
|
sl@0
|
1141 |
}
|
sl@0
|
1142 |
//Thread 1 waits for the main thread to signal the sync object, and exits
|
sl@0
|
1143 |
else if(aIdx == 1)
|
sl@0
|
1144 |
{
|
sl@0
|
1145 |
INFO_PRINTF3(_L("Thread %d waiting for main thread to signal with a defined timeout of %d"), aIdx, iWaitSyncTimeout);
|
sl@0
|
1146 |
EGLTimeKHR timeoutNano = (TUint64)iWaitSyncTimeout * 1000; // EGLTimeKHR is in nanoseconds!!
|
sl@0
|
1147 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1148 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,timeoutNano);
|
sl@0
|
1149 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1150 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1151 |
|
sl@0
|
1152 |
INFO_PRINTF5(_L("Thread %d waited on eglClientWaitSyncKHR for %d usec before sync object was timeout'ed (threshold was [%d +- %d])"), aIdx, timeElapsed, iWaitSyncTimeout, iThreshold);
|
sl@0
|
1153 |
TEST(resClientWait == EGL_TIMEOUT_EXPIRED_KHR);
|
sl@0
|
1154 |
TEST (Abs(timeElapsed - iWaitSyncTimeout) < iThreshold);
|
sl@0
|
1155 |
}
|
sl@0
|
1156 |
}
|
sl@0
|
1157 |
|
sl@0
|
1158 |
/**
|
sl@0
|
1159 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-050
|
sl@0
|
1160 |
|
sl@0
|
1161 |
@SYMTestPriority 1
|
sl@0
|
1162 |
|
sl@0
|
1163 |
@SYMPREQ 2400
|
sl@0
|
1164 |
|
sl@0
|
1165 |
@SYMREQ 12326
|
sl@0
|
1166 |
|
sl@0
|
1167 |
@SYMTestCaseDesc
|
sl@0
|
1168 |
To check that signalling on one sync object won't unblock the thread waiting on another sync object.
|
sl@0
|
1169 |
|
sl@0
|
1170 |
@SYMTestActions
|
sl@0
|
1171 |
1. Create two sync objects (S1 and S2) for the default display with no attributes are specified and the type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
1172 |
2. Launch two threads A and B.
|
sl@0
|
1173 |
3. Wait on the sync objects S1 and S2 from threads A and B respectively by calling eglClientWaitSyncKHR() with timeout set to EGL_FOREVER_KHR.
|
sl@0
|
1174 |
4. Signal on S1 with the flag EGL_SIGNALED_KHR from main thread
|
sl@0
|
1175 |
5. Retrieve EGL_SYNC_STATUS attribute of S1 and S2 from main thread
|
sl@0
|
1176 |
6. Signal on S2 with the flag EGL_SIGNALED_KHR from main thread
|
sl@0
|
1177 |
7. Retrieve EGL_SYNC_STATUS attribute of S1 and S2 from main thread
|
sl@0
|
1178 |
8. Destroy the sync objects
|
sl@0
|
1179 |
|
sl@0
|
1180 |
@SYMTestExpectedResults
|
sl@0
|
1181 |
3. Threads A and B will be stalled
|
sl@0
|
1182 |
4. Thread A will be unblocked and an error code returned by eglClientWaitSyncKHR() is set to EGL_CONDITION_SATISFIED_KHR.
|
sl@0
|
1183 |
Thread B stays blocked.
|
sl@0
|
1184 |
5. The S1 attribute EGL_SYNC_STATUS is set to EGL_SIGNALED_KHR, S2 attribute EGL_SYNC_STATUS is set to EGL_UNSIGNALED_KHR
|
sl@0
|
1185 |
6. Thread B will be unblocked and an error code returned by eglClientWaitSyncKHR() is set to EGL_CONDITION_SATISFIED_KHR.
|
sl@0
|
1186 |
7. The S1 & S2 attribute EGL_SYNC_STATUS is set to EGL_SIGNALED_KHR
|
sl@0
|
1187 |
*/
|
sl@0
|
1188 |
TVerdict CEglTest_SyncObject_Positive_Multithread_WaitOnTwoSyncObject::doTestStepL()
|
sl@0
|
1189 |
{
|
sl@0
|
1190 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-050"));
|
sl@0
|
1191 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_Multithread_WaitOnTwoSyncObject::doTestStepL started...."));
|
sl@0
|
1192 |
|
sl@0
|
1193 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
1194 |
{
|
sl@0
|
1195 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
1196 |
CleanAll();
|
sl@0
|
1197 |
RecordTestResultL();
|
sl@0
|
1198 |
CloseTMSGraphicsStep();
|
sl@0
|
1199 |
return TestStepResult();
|
sl@0
|
1200 |
}
|
sl@0
|
1201 |
|
sl@0
|
1202 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
1203 |
GetDisplayL();
|
sl@0
|
1204 |
CreateEglSessionL();
|
sl@0
|
1205 |
iEglSess->InitializeL();
|
sl@0
|
1206 |
|
sl@0
|
1207 |
INFO_PRINTF1(_L("Create two sync objects"));
|
sl@0
|
1208 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1209 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
1210 |
iSyncObject2 = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1211 |
TESTL(iSyncObject2 != EGL_NO_SYNC_KHR);
|
sl@0
|
1212 |
|
sl@0
|
1213 |
INFO_PRINTF1(_L("Launching threads A and B..."));
|
sl@0
|
1214 |
Test_MultiThreadL(2, EFalse);
|
sl@0
|
1215 |
TUint32 timeOverheadStart = User::NTickCount();
|
sl@0
|
1216 |
|
sl@0
|
1217 |
INFO_PRINTF1(_L("Main thread, wait for a bit before Signal sync object number 1"));
|
sl@0
|
1218 |
User::After(iDelaySignalling);
|
sl@0
|
1219 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_SIGNALED_KHR);
|
sl@0
|
1220 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1221 |
INFO_PRINTF1(_L("Main thread Signal sync object number 1 done"));
|
sl@0
|
1222 |
|
sl@0
|
1223 |
INFO_PRINTF1(_L("Check attributes for sync object number 1..."));
|
sl@0
|
1224 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
1225 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_SIGNALED_KHR);
|
sl@0
|
1226 |
|
sl@0
|
1227 |
INFO_PRINTF1(_L("Check attributes for sync object number 2..."));
|
sl@0
|
1228 |
// the CheckSyncAttrib uses iSyncObject, so we need to replace it, and restore it later
|
sl@0
|
1229 |
EGLSyncKHR oldSyncObject=iSyncObject;
|
sl@0
|
1230 |
iSyncObject=iSyncObject2;
|
sl@0
|
1231 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR, EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
1232 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_UNSIGNALED_KHR);
|
sl@0
|
1233 |
iSyncObject=oldSyncObject;
|
sl@0
|
1234 |
|
sl@0
|
1235 |
INFO_PRINTF1(_L("Main thread, wait for a bit before Signal sync object number 2"));
|
sl@0
|
1236 |
User::After(iDelaySignalling);
|
sl@0
|
1237 |
|
sl@0
|
1238 |
TUint32 timeOverheadEnd = User::NTickCount();
|
sl@0
|
1239 |
iTimeOverhead = ElapsedTime(timeOverheadEnd, timeOverheadStart) - iDelaySignalling*2;
|
sl@0
|
1240 |
resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject2, EGL_SIGNALED_KHR);
|
sl@0
|
1241 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1242 |
INFO_PRINTF1(_L("Main thread Signal sync object number 2 done"));
|
sl@0
|
1243 |
|
sl@0
|
1244 |
INFO_PRINTF1(_L("Check attributes for sync object number 1..."));
|
sl@0
|
1245 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
1246 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_SIGNALED_KHR);
|
sl@0
|
1247 |
|
sl@0
|
1248 |
INFO_PRINTF1(_L("Check attributes for sync object number 2..."));
|
sl@0
|
1249 |
oldSyncObject=iSyncObject;
|
sl@0
|
1250 |
iSyncObject=iSyncObject2;
|
sl@0
|
1251 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
1252 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_SIGNALED_KHR);
|
sl@0
|
1253 |
iSyncObject=oldSyncObject;
|
sl@0
|
1254 |
|
sl@0
|
1255 |
INFO_PRINTF1(_L("Delete both sync objects"));
|
sl@0
|
1256 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
1257 |
TEST(res == EGL_TRUE);
|
sl@0
|
1258 |
res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject2);
|
sl@0
|
1259 |
TEST(res == EGL_TRUE);
|
sl@0
|
1260 |
|
sl@0
|
1261 |
CleanAll();
|
sl@0
|
1262 |
RecordTestResultL();
|
sl@0
|
1263 |
CloseTMSGraphicsStep();
|
sl@0
|
1264 |
INFO_PRINTF1(_L("....CEglTest_SyncObject_Positive_Multithread_WaitOnTwoSyncObject::doTestStepL completed!"));
|
sl@0
|
1265 |
return TestStepResult();
|
sl@0
|
1266 |
}
|
sl@0
|
1267 |
|
sl@0
|
1268 |
void CEglTest_SyncObject_Positive_Multithread_WaitOnTwoSyncObject::doThreadFunctionL(TInt aIdx)
|
sl@0
|
1269 |
{
|
sl@0
|
1270 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_Multithread_WaitOnTwoSyncObject::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
1271 |
ASSERT_TRUE(aIdx==0 || aIdx==1);
|
sl@0
|
1272 |
|
sl@0
|
1273 |
//Thread 0 waits for the main thread to signal the sync object, and exits
|
sl@0
|
1274 |
if(aIdx == 0)
|
sl@0
|
1275 |
{
|
sl@0
|
1276 |
INFO_PRINTF2(_L("Thread %d waiting for main thread to signal object 1 with a timeout EGL_FOREVER_KHR"), aIdx);
|
sl@0
|
1277 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1278 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
1279 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1280 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1281 |
|
sl@0
|
1282 |
INFO_PRINTF5(_L("Thread %d waited on eglClientWaitSyncKHR for %d usec before sync object was signaled (threshold was [%d +- %d])"), aIdx, timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
1283 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1284 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
1285 |
}
|
sl@0
|
1286 |
//Thread 1 waits for the main thread to signal the sync object, and exits
|
sl@0
|
1287 |
else if(aIdx == 1)
|
sl@0
|
1288 |
{
|
sl@0
|
1289 |
INFO_PRINTF2(_L("Thread %d waiting for main thread to signal object 2 with a timeout EGL_FOREVER_KHR"), aIdx);
|
sl@0
|
1290 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1291 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject2,0,EGL_FOREVER_KHR);
|
sl@0
|
1292 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1293 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1294 |
|
sl@0
|
1295 |
INFO_PRINTF6(_L("Thread %d waited on eglClientWaitSyncKHR for %d usec before sync object was signaled (threshold was [%d + %d +- %d])"), aIdx, timeElapsed, 2*iDelaySignalling, iTimeOverhead, iThreshold);
|
sl@0
|
1296 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1297 |
TEST (Abs(timeElapsed - (2*iDelaySignalling + iTimeOverhead)) < iThreshold);
|
sl@0
|
1298 |
}
|
sl@0
|
1299 |
}
|
sl@0
|
1300 |
|
sl@0
|
1301 |
/**
|
sl@0
|
1302 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-055
|
sl@0
|
1303 |
|
sl@0
|
1304 |
@SYMTestPriority 1
|
sl@0
|
1305 |
|
sl@0
|
1306 |
@SYMPREQ 2400
|
sl@0
|
1307 |
|
sl@0
|
1308 |
@SYMREQ 12326
|
sl@0
|
1309 |
|
sl@0
|
1310 |
@SYMTestCaseDesc
|
sl@0
|
1311 |
To check that if zero timeout is passed to eglClientWaitSyncKHR(), the function just test the current status without attempt to stall the client thread.
|
sl@0
|
1312 |
|
sl@0
|
1313 |
@SYMTestActions
|
sl@0
|
1314 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
1315 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
1316 |
2. Take timestamp before
|
sl@0
|
1317 |
3. Call eglClientWaitSyncKHR() on the sync object with timeout value equals to zero
|
sl@0
|
1318 |
4. Take timestamp after
|
sl@0
|
1319 |
5. Call eglSignalSyncKHR on the sync object with the flag EGL_SIGNALED_KHR
|
sl@0
|
1320 |
6. Repeat steps 2 to 4
|
sl@0
|
1321 |
7. Destroy the sync object
|
sl@0
|
1322 |
|
sl@0
|
1323 |
@SYMTestExpectedResults
|
sl@0
|
1324 |
3. The client thread is not stalled. The function eglClientWaitSyncKHR() should return EGL_TIMEOUT_EXPIRED_KHR.
|
sl@0
|
1325 |
4. The difference timestamp (after - before) should be less than a half second
|
sl@0
|
1326 |
3.1 The client thread is not stalled. The function eglClientWaitSyncKHR() should return EGL_CONDITION_SATISFIED_KHR.
|
sl@0
|
1327 |
4.1 The difference timestamp (after - before) should be less than a half second
|
sl@0
|
1328 |
*/
|
sl@0
|
1329 |
TVerdict CEglTest_SyncObject_Positive_Wait_TestMode::doTestStepL()
|
sl@0
|
1330 |
{
|
sl@0
|
1331 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-055"));
|
sl@0
|
1332 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_Wait_TestMode::doTestStepL started...."));
|
sl@0
|
1333 |
|
sl@0
|
1334 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
1335 |
{
|
sl@0
|
1336 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
1337 |
CleanAll();
|
sl@0
|
1338 |
RecordTestResultL();
|
sl@0
|
1339 |
CloseTMSGraphicsStep();
|
sl@0
|
1340 |
return TestStepResult();
|
sl@0
|
1341 |
}
|
sl@0
|
1342 |
|
sl@0
|
1343 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
1344 |
GetDisplayL();
|
sl@0
|
1345 |
CreateEglSessionL();
|
sl@0
|
1346 |
iEglSess->InitializeL();
|
sl@0
|
1347 |
|
sl@0
|
1348 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
1349 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1350 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
1351 |
|
sl@0
|
1352 |
// calling wait sync without signaling the object, but with timeout set to 0 ==> no stalling
|
sl@0
|
1353 |
INFO_PRINTF1(_L("Calling eglClientWaitSyncKHR on the object, without signaling the object, but with timeout set to 0"));
|
sl@0
|
1354 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1355 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,0);
|
sl@0
|
1356 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1357 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1358 |
|
sl@0
|
1359 |
INFO_PRINTF3(_L("Check it didn't wait on eglClientWaitSyncKHR. Elapsed time was %d usec (threshold was [%d])"),timeElapsed, iThreshold);
|
sl@0
|
1360 |
TEST(resClientWait == EGL_TIMEOUT_EXPIRED_KHR);
|
sl@0
|
1361 |
TEST (timeElapsed < iThreshold);
|
sl@0
|
1362 |
|
sl@0
|
1363 |
INFO_PRINTF1(_L("Check attributes..."));
|
sl@0
|
1364 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
1365 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_UNSIGNALED_KHR);
|
sl@0
|
1366 |
|
sl@0
|
1367 |
INFO_PRINTF1(_L("Signal sync object"));
|
sl@0
|
1368 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_SIGNALED_KHR);
|
sl@0
|
1369 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1370 |
|
sl@0
|
1371 |
INFO_PRINTF1(_L("Repeat same step, calling eglClientWaitSyncKHR with timeout set to 0"));
|
sl@0
|
1372 |
timestampBefore = User::NTickCount();
|
sl@0
|
1373 |
resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,0);
|
sl@0
|
1374 |
timestampAfter = User::NTickCount();
|
sl@0
|
1375 |
timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1376 |
|
sl@0
|
1377 |
INFO_PRINTF3(_L("Check it didn't wait on eglClientWaitSyncKHR. Elapsed time was %d usec (threshold was [%d])"),timeElapsed, iThreshold);
|
sl@0
|
1378 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1379 |
TEST (timeElapsed < iThreshold);
|
sl@0
|
1380 |
|
sl@0
|
1381 |
INFO_PRINTF1(_L("Check attributes..."));
|
sl@0
|
1382 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR,EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
1383 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_SIGNALED_KHR);
|
sl@0
|
1384 |
|
sl@0
|
1385 |
INFO_PRINTF1(_L("Delete sync object"));
|
sl@0
|
1386 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
1387 |
TEST(res == EGL_TRUE);
|
sl@0
|
1388 |
|
sl@0
|
1389 |
CleanAll();
|
sl@0
|
1390 |
RecordTestResultL();
|
sl@0
|
1391 |
CloseTMSGraphicsStep();
|
sl@0
|
1392 |
INFO_PRINTF1(_L("....CEglTest_SyncObject_Positive_Wait_TestMode::doTestStepL completed!"));
|
sl@0
|
1393 |
return TestStepResult();
|
sl@0
|
1394 |
}
|
sl@0
|
1395 |
|
sl@0
|
1396 |
/**
|
sl@0
|
1397 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-060
|
sl@0
|
1398 |
|
sl@0
|
1399 |
@SYMTestPriority 1
|
sl@0
|
1400 |
|
sl@0
|
1401 |
@SYMPREQ 2400
|
sl@0
|
1402 |
|
sl@0
|
1403 |
@SYMREQ 12326
|
sl@0
|
1404 |
|
sl@0
|
1405 |
@SYMTestCaseDesc
|
sl@0
|
1406 |
To check that deletion of the sync object will unblock all threads waiting for the signal.
|
sl@0
|
1407 |
|
sl@0
|
1408 |
@SYMTestActions
|
sl@0
|
1409 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
1410 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
1411 |
2. Launch threads A and B
|
sl@0
|
1412 |
3. Call eglClientWaitSyncKHR() on the sync object in main thread and thread A.
|
sl@0
|
1413 |
4. Destroy the sync object from thread B
|
sl@0
|
1414 |
|
sl@0
|
1415 |
@SYMTestExpectedResults
|
sl@0
|
1416 |
3. Main thread and thread A will be stalled
|
sl@0
|
1417 |
4. All client threads which waited for the signal must be unblocked as if eglSignalSyncKHR() has been called.
|
sl@0
|
1418 |
The function eglClientWaitSyncKHR should return EGL_CONDITION_SATISFIED_KHR
|
sl@0
|
1419 |
*/
|
sl@0
|
1420 |
TVerdict CEglTest_SyncObject_Positive_Multithread_Deletion::doTestStepL()
|
sl@0
|
1421 |
{
|
sl@0
|
1422 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-060"));
|
sl@0
|
1423 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_Multithread_Deletion::doTestStepL started...."));
|
sl@0
|
1424 |
|
sl@0
|
1425 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
1426 |
{
|
sl@0
|
1427 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
1428 |
CleanAll();
|
sl@0
|
1429 |
RecordTestResultL();
|
sl@0
|
1430 |
CloseTMSGraphicsStep();
|
sl@0
|
1431 |
return TestStepResult();
|
sl@0
|
1432 |
}
|
sl@0
|
1433 |
|
sl@0
|
1434 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
1435 |
GetDisplayL();
|
sl@0
|
1436 |
CreateEglSessionL();
|
sl@0
|
1437 |
iEglSess->InitializeL();
|
sl@0
|
1438 |
|
sl@0
|
1439 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
1440 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1441 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
1442 |
|
sl@0
|
1443 |
INFO_PRINTF1(_L("Launching threads A and B..."));
|
sl@0
|
1444 |
Test_MultiThreadL(2, EFalse);
|
sl@0
|
1445 |
|
sl@0
|
1446 |
INFO_PRINTF1(_L("Main thread waiting for thread B to destroy the sync object, with timeout EGL_FOREVER_KHR"));
|
sl@0
|
1447 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1448 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
1449 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1450 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1451 |
|
sl@0
|
1452 |
INFO_PRINTF4(_L("Main thread waited on eglClientWaitSyncKHR for %d usec before sync object was deleted (threshold was [%d +- %d])"),timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
1453 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1454 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
1455 |
|
sl@0
|
1456 |
INFO_PRINTF1(_L("Check attributes..."));
|
sl@0
|
1457 |
EGLint syncTypeValue=-1;
|
sl@0
|
1458 |
EGLBoolean ret = iPfnEglGetSyncAttribKHR(iDisplay,iSyncObject,EGL_SYNC_TYPE_KHR,&syncTypeValue);
|
sl@0
|
1459 |
TEST(ret == EGL_FALSE);
|
sl@0
|
1460 |
EGLint error = eglGetError();
|
sl@0
|
1461 |
TEST(error == EGL_BAD_PARAMETER);
|
sl@0
|
1462 |
TEST(syncTypeValue == -1); // due to the error, it wasn't properly retrieved
|
sl@0
|
1463 |
|
sl@0
|
1464 |
INFO_PRINTF1(_L("(attempt to) Delete sync object (was already deleted by a worker thread)"));
|
sl@0
|
1465 |
ret = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
1466 |
TEST(ret == EGL_FALSE);
|
sl@0
|
1467 |
error = eglGetError();
|
sl@0
|
1468 |
TEST(error == EGL_BAD_PARAMETER);
|
sl@0
|
1469 |
|
sl@0
|
1470 |
CleanAll();
|
sl@0
|
1471 |
RecordTestResultL();
|
sl@0
|
1472 |
CloseTMSGraphicsStep();
|
sl@0
|
1473 |
INFO_PRINTF1(_L("....CEglTest_SyncObject_Positive_Multithread_Deletion::doTestStepL completed!"));
|
sl@0
|
1474 |
return TestStepResult();
|
sl@0
|
1475 |
}
|
sl@0
|
1476 |
|
sl@0
|
1477 |
void CEglTest_SyncObject_Positive_Multithread_Deletion::doThreadFunctionL(TInt aIdx)
|
sl@0
|
1478 |
{
|
sl@0
|
1479 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_Multithread_Deletion::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
1480 |
ASSERT_TRUE(aIdx==0 || aIdx==1);
|
sl@0
|
1481 |
|
sl@0
|
1482 |
//Thread 0 waits for a the thread B to delete the sync object, and exits
|
sl@0
|
1483 |
if(aIdx == 0)
|
sl@0
|
1484 |
{
|
sl@0
|
1485 |
INFO_PRINTF2(_L("Thread %d waiting for thread B to destroy the sync object, with timeout EGL_FOREVER_KHR"), aIdx);
|
sl@0
|
1486 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1487 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
1488 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1489 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1490 |
|
sl@0
|
1491 |
INFO_PRINTF5(_L("Thread %d waited on eglClientWaitSyncKHR for %d usec before sync object was deleted (threshold was [%d +- %d])"), aIdx, timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
1492 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1493 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
1494 |
}
|
sl@0
|
1495 |
//Thread 1 waits for a certain amount of time, deletes the sync object and exits
|
sl@0
|
1496 |
else if(aIdx == 1)
|
sl@0
|
1497 |
{
|
sl@0
|
1498 |
INFO_PRINTF2(_L("Wait for a bit before destroying sync object, Thread %d"),aIdx);
|
sl@0
|
1499 |
User::After(iDelaySignalling);
|
sl@0
|
1500 |
TInt res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
1501 |
TEST(res == EGL_TRUE);
|
sl@0
|
1502 |
INFO_PRINTF2(_L("Delete sync object done, Thread %d"),aIdx);
|
sl@0
|
1503 |
//This Thread now will just exit
|
sl@0
|
1504 |
}
|
sl@0
|
1505 |
}
|
sl@0
|
1506 |
|
sl@0
|
1507 |
/**
|
sl@0
|
1508 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-065
|
sl@0
|
1509 |
|
sl@0
|
1510 |
@SYMTestPriority 1
|
sl@0
|
1511 |
|
sl@0
|
1512 |
@SYMPREQ 2400
|
sl@0
|
1513 |
|
sl@0
|
1514 |
@SYMREQ 12326
|
sl@0
|
1515 |
|
sl@0
|
1516 |
@SYMTestCaseDesc
|
sl@0
|
1517 |
To exercise sync object functionality in stress conditions.
|
sl@0
|
1518 |
|
sl@0
|
1519 |
@SYMTestActions
|
sl@0
|
1520 |
1. Create three sync objects (S1, S2, S3) for the default display with no attributes are specified (containing only EGL_NONE).
|
sl@0
|
1521 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR.
|
sl@0
|
1522 |
2. Launch 2 threads (A and B)
|
sl@0
|
1523 |
3. Make the threads A and B waiting on sync objects S2 and S3 respectively.
|
sl@0
|
1524 |
4. Make consequential signalling in that order: Client-> A->B->Client->... for some period of time.
|
sl@0
|
1525 |
Each thread signals the next thread in the chain and then stalls itself on the corresponding sync object.
|
sl@0
|
1526 |
(Whenever each thread is unstalled, corresponding sync object should be reset by unsignalling it.)
|
sl@0
|
1527 |
Main thread is waiting on S1
|
sl@0
|
1528 |
5. When the number of iteration exceeds some predefined value (by default is 1000, but could be reconfigured in ini file) the sequence, defined in step 4 will stop executing
|
sl@0
|
1529 |
6. Delete the sync objects
|
sl@0
|
1530 |
|
sl@0
|
1531 |
@SYMTestExpectedResults
|
sl@0
|
1532 |
4. The functionality is robust, transition from "unsignaled" to "signaled"
|
sl@0
|
1533 |
state always unblocks the threads
|
sl@0
|
1534 |
*/
|
sl@0
|
1535 |
TVerdict CEglTest_SyncObject_Positive_Stress::doTestStepL()
|
sl@0
|
1536 |
{
|
sl@0
|
1537 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-065"));
|
sl@0
|
1538 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_Stress::doTestStepL"));
|
sl@0
|
1539 |
|
sl@0
|
1540 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
1541 |
{
|
sl@0
|
1542 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
1543 |
CleanAll();
|
sl@0
|
1544 |
RecordTestResultL();
|
sl@0
|
1545 |
CloseTMSGraphicsStep();
|
sl@0
|
1546 |
return TestStepResult();
|
sl@0
|
1547 |
}
|
sl@0
|
1548 |
|
sl@0
|
1549 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
1550 |
GetDisplayL();
|
sl@0
|
1551 |
CreateEglSessionL();
|
sl@0
|
1552 |
iEglSess->InitializeL();
|
sl@0
|
1553 |
|
sl@0
|
1554 |
INFO_PRINTF1(_L("Create sync objects"));
|
sl@0
|
1555 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1556 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
1557 |
iSyncObject1 = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1558 |
TESTL(iSyncObject1 != EGL_NO_SYNC_KHR);
|
sl@0
|
1559 |
iSyncObject2 = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1560 |
TESTL(iSyncObject2 != EGL_NO_SYNC_KHR);
|
sl@0
|
1561 |
|
sl@0
|
1562 |
iLastThreadToSignal = 2;
|
sl@0
|
1563 |
|
sl@0
|
1564 |
//launch threadA & threadB
|
sl@0
|
1565 |
Test_MultiThreadL(2, EFalse);
|
sl@0
|
1566 |
User::After(iDelaySignalling); //to allow threads start up before we signal
|
sl@0
|
1567 |
|
sl@0
|
1568 |
for(TInt index = 0; index < iNumStressIterations; index++)
|
sl@0
|
1569 |
{
|
sl@0
|
1570 |
iLastThreadToSignal = 2;
|
sl@0
|
1571 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay,iSyncObject1,EGL_SIGNALED_KHR );
|
sl@0
|
1572 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1573 |
|
sl@0
|
1574 |
EGLint res = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
1575 |
TEST(iLastThreadToSignal == 1);
|
sl@0
|
1576 |
TEST(res == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1577 |
resSignal = iPfnEglSignalSyncKHR(iDisplay,iSyncObject,EGL_UNSIGNALED_KHR );//to set the status of iSyncObject EGL_UNSIGNALED_KHR
|
sl@0
|
1578 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1579 |
User::After(0);//to yield the processor
|
sl@0
|
1580 |
}
|
sl@0
|
1581 |
iStopTest = ETrue;
|
sl@0
|
1582 |
INFO_PRINTF2(_L("Threads have been signalling for %d times"), iNumStressIterations);
|
sl@0
|
1583 |
INFO_PRINTF1(_L("Delete sync objects"));
|
sl@0
|
1584 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
1585 |
TEST(res == EGL_TRUE);
|
sl@0
|
1586 |
res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject1);
|
sl@0
|
1587 |
TEST(res == EGL_TRUE);
|
sl@0
|
1588 |
res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject2);
|
sl@0
|
1589 |
TEST(res == EGL_TRUE);
|
sl@0
|
1590 |
|
sl@0
|
1591 |
CleanAll();
|
sl@0
|
1592 |
RecordTestResultL();
|
sl@0
|
1593 |
CloseTMSGraphicsStep();
|
sl@0
|
1594 |
INFO_PRINTF1(_L("End of CEglTest_SyncObject_Positive_Stress::doTestStepL"));
|
sl@0
|
1595 |
return TestStepResult();
|
sl@0
|
1596 |
}
|
sl@0
|
1597 |
|
sl@0
|
1598 |
void CEglTest_SyncObject_Positive_Stress::doThreadFunctionL(TInt aIdx)
|
sl@0
|
1599 |
{
|
sl@0
|
1600 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_Stress::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
1601 |
ASSERT_TRUE(aIdx==0 || aIdx==1);
|
sl@0
|
1602 |
|
sl@0
|
1603 |
EGLint res;
|
sl@0
|
1604 |
if(aIdx == 0)
|
sl@0
|
1605 |
{
|
sl@0
|
1606 |
while(!iStopTest)
|
sl@0
|
1607 |
{
|
sl@0
|
1608 |
res = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject1,0,EGL_FOREVER_KHR);
|
sl@0
|
1609 |
TEST(res == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1610 |
User::After(0); //to yield the processor
|
sl@0
|
1611 |
if(!iStopTest)
|
sl@0
|
1612 |
{
|
sl@0
|
1613 |
TEST(iLastThreadToSignal == 2);
|
sl@0
|
1614 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay,iSyncObject1,EGL_UNSIGNALED_KHR );//to reset the status of iSyncObject1 EGL_UNSIGNALED_KHR
|
sl@0
|
1615 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1616 |
|
sl@0
|
1617 |
iLastThreadToSignal = 0;
|
sl@0
|
1618 |
resSignal = iPfnEglSignalSyncKHR(iDisplay,iSyncObject2,EGL_SIGNALED_KHR );
|
sl@0
|
1619 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1620 |
}
|
sl@0
|
1621 |
}
|
sl@0
|
1622 |
}
|
sl@0
|
1623 |
else if(aIdx == 1)
|
sl@0
|
1624 |
{
|
sl@0
|
1625 |
while(!iStopTest)
|
sl@0
|
1626 |
{
|
sl@0
|
1627 |
res = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject2,0,EGL_FOREVER_KHR);
|
sl@0
|
1628 |
TEST(res == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1629 |
User::After(0); //to yield the processor
|
sl@0
|
1630 |
if(!iStopTest)
|
sl@0
|
1631 |
{
|
sl@0
|
1632 |
TEST(iLastThreadToSignal == 0);
|
sl@0
|
1633 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay,iSyncObject2,EGL_UNSIGNALED_KHR );//to reset the status of iSyncObject2 EGL_UNSIGNALED_KHR
|
sl@0
|
1634 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1635 |
|
sl@0
|
1636 |
iLastThreadToSignal = 1;
|
sl@0
|
1637 |
resSignal = iPfnEglSignalSyncKHR(iDisplay,iSyncObject,EGL_SIGNALED_KHR );
|
sl@0
|
1638 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1639 |
}
|
sl@0
|
1640 |
}
|
sl@0
|
1641 |
}
|
sl@0
|
1642 |
}
|
sl@0
|
1643 |
|
sl@0
|
1644 |
/**
|
sl@0
|
1645 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-070
|
sl@0
|
1646 |
|
sl@0
|
1647 |
@SYMTestPriority 1
|
sl@0
|
1648 |
|
sl@0
|
1649 |
@SYMPREQ 2400
|
sl@0
|
1650 |
|
sl@0
|
1651 |
@SYMREQ 12326
|
sl@0
|
1652 |
|
sl@0
|
1653 |
@SYMTestCaseDesc
|
sl@0
|
1654 |
To check that flushing of the client API (bit EGL_SYNC_FLUSH_COMMANDS_BIT_KHR is set
|
sl@0
|
1655 |
for eglClientWaitSyncKHR()) doesn't cause any problems.
|
sl@0
|
1656 |
|
sl@0
|
1657 |
@SYMTestActions
|
sl@0
|
1658 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
1659 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
1660 |
2. Bind Open VG API.
|
sl@0
|
1661 |
3. Create and make the context current for the bound API.
|
sl@0
|
1662 |
4. Launch the thread A.
|
sl@0
|
1663 |
5. Wait on sync object by calling eglClientWaitSyncKHR(), pass on EGL_SYNC_FLUSH_COMMANDS_BIT_KHR as a flag.
|
sl@0
|
1664 |
6. Signal "EGL_UNSIGNALED_KHR" to the sync object.
|
sl@0
|
1665 |
7. Bind Open GLES API.
|
sl@0
|
1666 |
8. Repeat steps 3-6.
|
sl@0
|
1667 |
9. Repeat step 5, but client waits in test mode (timeout is set to zero)
|
sl@0
|
1668 |
10. Make no context current
|
sl@0
|
1669 |
11. Repeat steps 3-5.
|
sl@0
|
1670 |
12. Delete the sync object.
|
sl@0
|
1671 |
|
sl@0
|
1672 |
@SYMTestExpectedResults
|
sl@0
|
1673 |
All functions succeed. Setting the flag on step 5 doesn't cause any problem.
|
sl@0
|
1674 |
9. The function eglClientWaitSyncKHR()returns EGL_TIMEOUT_EXPIRED_KHR
|
sl@0
|
1675 |
*/
|
sl@0
|
1676 |
TVerdict CEglTest_SyncObject_Positive_WaitFlush::doTestStepL()
|
sl@0
|
1677 |
{
|
sl@0
|
1678 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-070"));
|
sl@0
|
1679 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_WaitFlush::doTestStepL"));
|
sl@0
|
1680 |
|
sl@0
|
1681 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
1682 |
{
|
sl@0
|
1683 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
1684 |
CleanAll();
|
sl@0
|
1685 |
RecordTestResultL();
|
sl@0
|
1686 |
CloseTMSGraphicsStep();
|
sl@0
|
1687 |
return TestStepResult();
|
sl@0
|
1688 |
}
|
sl@0
|
1689 |
|
sl@0
|
1690 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
1691 |
GetDisplayL();
|
sl@0
|
1692 |
CreateEglSessionL();
|
sl@0
|
1693 |
iEglSess->InitializeL();
|
sl@0
|
1694 |
|
sl@0
|
1695 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
1696 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1697 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
1698 |
|
sl@0
|
1699 |
INFO_PRINTF1(_L("bind OpenVG API"));
|
sl@0
|
1700 |
ASSERT_EGL_TRUE(eglBindAPI(EGL_OPENVG_API));
|
sl@0
|
1701 |
EGLConfig currentConfig = iEglSess->GetConfigExactMatchL(EPixmapAttribsColor64K);
|
sl@0
|
1702 |
INFO_PRINTF1(_L("Create and make the context current for the bound API"));
|
sl@0
|
1703 |
EGLContext context = eglCreateContext(iDisplay, currentConfig, EGL_NO_CONTEXT, NULL);
|
sl@0
|
1704 |
ASSERT_EGL_TRUE(context != EGL_NO_CONTEXT);
|
sl@0
|
1705 |
|
sl@0
|
1706 |
//Create an OffScreen Pixmap to be used as an OpenVg target
|
sl@0
|
1707 |
TSgImageInfoTest imageInfo = TSgImageInfoTest();
|
sl@0
|
1708 |
imageInfo.iSizeInPixels = TSize(200, 200);
|
sl@0
|
1709 |
imageInfo.iPixelFormat = EUidPixelFormatRGB_565;
|
sl@0
|
1710 |
#ifdef SYMBIAN_GRAPHICS_EGL_SGIMAGELITE
|
sl@0
|
1711 |
imageInfo.iUsage = ESgUsageBitOpenVgSurface;
|
sl@0
|
1712 |
#else
|
sl@0
|
1713 |
imageInfo.iUsage = ESgUsageOpenVgTarget;
|
sl@0
|
1714 |
#endif
|
sl@0
|
1715 |
RSgImage sgImageTarget;
|
sl@0
|
1716 |
CleanupClosePushL(sgImageTarget);
|
sl@0
|
1717 |
TInt ret2 = sgImageTarget.Create(imageInfo, NULL, NULL);
|
sl@0
|
1718 |
ASSERT_EQUALS(ret2, KErrNone);
|
sl@0
|
1719 |
EGLSurface surface = eglCreatePixmapSurface(iDisplay, currentConfig,&sgImageTarget, KPixmapAttribsNone );
|
sl@0
|
1720 |
ASSERT_EGL_TRUE(surface != EGL_NO_SURFACE);
|
sl@0
|
1721 |
|
sl@0
|
1722 |
TSurfaceToDestroy surfaceToDestroy;
|
sl@0
|
1723 |
surfaceToDestroy.iSurface = surface;
|
sl@0
|
1724 |
surfaceToDestroy.iDisplay = iDisplay;
|
sl@0
|
1725 |
CleanupStack::PushL(TCleanupItem(DestroySurface, &surfaceToDestroy));
|
sl@0
|
1726 |
|
sl@0
|
1727 |
INFO_PRINTF1(_L("Calling eglMakeCurrent"));
|
sl@0
|
1728 |
ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, surface, surface, context));
|
sl@0
|
1729 |
|
sl@0
|
1730 |
//launch threadA
|
sl@0
|
1731 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
1732 |
INFO_PRINTF1(_L("Wait on sync object by calling eglClientWaitSyncKHR(), pass on EGL_SYNC_FLUSH_COMMANDS_BIT_KHR as a flag"));
|
sl@0
|
1733 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1734 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,EGL_FOREVER_KHR);
|
sl@0
|
1735 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1736 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1737 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1738 |
TEST(Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
1739 |
EGLBoolean resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_UNSIGNALED_KHR);
|
sl@0
|
1740 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1741 |
|
sl@0
|
1742 |
//make no context current
|
sl@0
|
1743 |
ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
|
sl@0
|
1744 |
|
sl@0
|
1745 |
//Wait for the thread to finish before starting the next part of the test.
|
sl@0
|
1746 |
Test_MultiThread_WaitL(ETrue, TThreadStatus::ELogin);
|
sl@0
|
1747 |
|
sl@0
|
1748 |
//---- the same test but for OpenGLES
|
sl@0
|
1749 |
INFO_PRINTF1(_L("bind OpenGLES API"));
|
sl@0
|
1750 |
ASSERT_EGL_TRUE(eglBindAPI(EGL_OPENGL_ES_API));
|
sl@0
|
1751 |
EGLContext context1 = eglCreateContext(iDisplay, currentConfig, EGL_NO_CONTEXT, NULL);
|
sl@0
|
1752 |
ASSERT_EGL_TRUE(context1 != EGL_NO_CONTEXT);
|
sl@0
|
1753 |
|
sl@0
|
1754 |
INFO_PRINTF1(_L("Calling eglMakeCurrent"));
|
sl@0
|
1755 |
ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, surface, surface, context1));
|
sl@0
|
1756 |
|
sl@0
|
1757 |
//launch threadA
|
sl@0
|
1758 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
1759 |
INFO_PRINTF1(_L("Wait on sync object by calling eglClientWaitSyncKHR(), pass on EGL_SYNC_FLUSH_COMMANDS_BIT_KHR as a flag"));
|
sl@0
|
1760 |
timestampBefore = User::NTickCount();
|
sl@0
|
1761 |
resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,EGL_FOREVER_KHR);
|
sl@0
|
1762 |
timestampAfter = User::NTickCount();
|
sl@0
|
1763 |
timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1764 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1765 |
TEST(Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
1766 |
resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_UNSIGNALED_KHR);
|
sl@0
|
1767 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1768 |
|
sl@0
|
1769 |
//repeat the same, but in test mode (timeout is set to zero)
|
sl@0
|
1770 |
INFO_PRINTF1(_L("Wait on sync object by calling eglClientWaitSyncKHR(), pass on EGL_SYNC_FLUSH_COMMANDS_BIT_KHR as a flag"));
|
sl@0
|
1771 |
timestampBefore = User::NTickCount();
|
sl@0
|
1772 |
resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,0);
|
sl@0
|
1773 |
timestampAfter = User::NTickCount();
|
sl@0
|
1774 |
timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1775 |
TEST(resClientWait == EGL_TIMEOUT_EXPIRED_KHR);//the sync object is in "unsignaled" state
|
sl@0
|
1776 |
TEST(timeElapsed < iThreshold);
|
sl@0
|
1777 |
resSignal = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_UNSIGNALED_KHR);
|
sl@0
|
1778 |
TEST(resSignal == EGL_TRUE);
|
sl@0
|
1779 |
|
sl@0
|
1780 |
INFO_PRINTF1(_L("Make no context current"));
|
sl@0
|
1781 |
ASSERT_EGL_TRUE(eglMakeCurrent(iDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
|
sl@0
|
1782 |
|
sl@0
|
1783 |
//Wait for the thread to finish before starting the next part of the test.
|
sl@0
|
1784 |
Test_MultiThread_WaitL(ETrue, TThreadStatus::ELogin);
|
sl@0
|
1785 |
|
sl@0
|
1786 |
//now try to wait with flushing bit on (EGL_SYNC_FLUSH_COMMANDS_BIT_KHR). The flag will be ignored
|
sl@0
|
1787 |
//launch threadA
|
sl@0
|
1788 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
1789 |
|
sl@0
|
1790 |
INFO_PRINTF1(_L("Wait on sync object by calling eglClientWaitSyncKHR(), pass on EGL_SYNC_FLUSH_COMMANDS_BIT_KHR as a flag, when no context is current"));
|
sl@0
|
1791 |
timestampBefore = User::NTickCount();
|
sl@0
|
1792 |
resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,EGL_SYNC_FLUSH_COMMANDS_BIT_KHR,EGL_FOREVER_KHR);
|
sl@0
|
1793 |
timestampAfter = User::NTickCount();
|
sl@0
|
1794 |
timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1795 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1796 |
TEST(Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
1797 |
|
sl@0
|
1798 |
eglDestroyContext(iDisplay, context1); //Closing eglContext
|
sl@0
|
1799 |
eglDestroyContext(iDisplay, context); //Closing eglContext
|
sl@0
|
1800 |
CleanupStack::PopAndDestroy(2, &sgImageTarget);
|
sl@0
|
1801 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
1802 |
TEST(res == EGL_TRUE);
|
sl@0
|
1803 |
|
sl@0
|
1804 |
CleanAll();
|
sl@0
|
1805 |
RecordTestResultL();
|
sl@0
|
1806 |
CloseTMSGraphicsStep();
|
sl@0
|
1807 |
INFO_PRINTF1(_L("End of CEglTest_SyncObject_Positive_WaitFlush::doTestStepL"));
|
sl@0
|
1808 |
return TestStepResult();
|
sl@0
|
1809 |
}
|
sl@0
|
1810 |
|
sl@0
|
1811 |
void CEglTest_SyncObject_Positive_WaitFlush::doThreadFunctionL(TInt aIdx)
|
sl@0
|
1812 |
{
|
sl@0
|
1813 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_WaitFlush::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
1814 |
ASSERT_TRUE(aIdx==0);
|
sl@0
|
1815 |
|
sl@0
|
1816 |
User::After(TTimeIntervalMicroSeconds32(iDelaySignalling));
|
sl@0
|
1817 |
EGLBoolean res = iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_SIGNALED_KHR);
|
sl@0
|
1818 |
TEST(res == EGL_TRUE);
|
sl@0
|
1819 |
}
|
sl@0
|
1820 |
|
sl@0
|
1821 |
/**
|
sl@0
|
1822 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-075
|
sl@0
|
1823 |
|
sl@0
|
1824 |
@SYMTestPriority 1
|
sl@0
|
1825 |
|
sl@0
|
1826 |
@SYMPREQ 2400
|
sl@0
|
1827 |
|
sl@0
|
1828 |
@SYMREQ 12326
|
sl@0
|
1829 |
|
sl@0
|
1830 |
@SYMTestCaseDesc
|
sl@0
|
1831 |
To check that eglTerminate() destroys sync object associated with display.
|
sl@0
|
1832 |
|
sl@0
|
1833 |
@SYMTestActions
|
sl@0
|
1834 |
1. Create sync object for the default display. NULL are specified in attribute_list.
|
sl@0
|
1835 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR.
|
sl@0
|
1836 |
2. Call eglTerminate() without deleting the sync objects.
|
sl@0
|
1837 |
|
sl@0
|
1838 |
@SYMTestExpectedResults
|
sl@0
|
1839 |
1. Sync object handle doesn't equal to EGL_NO_SYNC_KHR.
|
sl@0
|
1840 |
2. Test completes without any error and panic. No memory leak.
|
sl@0
|
1841 |
*/
|
sl@0
|
1842 |
|
sl@0
|
1843 |
TVerdict CEglTest_SyncObject_Positive_Terminate::doTestStepL()
|
sl@0
|
1844 |
{
|
sl@0
|
1845 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-075"));
|
sl@0
|
1846 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_Terminate::doTestStepL"));
|
sl@0
|
1847 |
|
sl@0
|
1848 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
1849 |
{
|
sl@0
|
1850 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
1851 |
CleanAll();
|
sl@0
|
1852 |
RecordTestResultL();
|
sl@0
|
1853 |
CloseTMSGraphicsStep();
|
sl@0
|
1854 |
return TestStepResult();
|
sl@0
|
1855 |
}
|
sl@0
|
1856 |
|
sl@0
|
1857 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
1858 |
GetDisplayL();
|
sl@0
|
1859 |
CreateEglSessionL();
|
sl@0
|
1860 |
iEglSess->InitializeL();
|
sl@0
|
1861 |
|
sl@0
|
1862 |
INFO_PRINTF1(_L("Create sync object - default display, NULL at attributes, type parameter set to EGL_SYNC_REUSABLE_KHR"));
|
sl@0
|
1863 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, NULL);
|
sl@0
|
1864 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
1865 |
|
sl@0
|
1866 |
//check attributes of the sync object.
|
sl@0
|
1867 |
INFO_PRINTF1(_L("Check attributes of sync object"));
|
sl@0
|
1868 |
CheckSyncAttrib(EGL_SYNC_TYPE_KHR, EGL_SYNC_REUSABLE_KHR);
|
sl@0
|
1869 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR, EGL_UNSIGNALED_KHR);
|
sl@0
|
1870 |
|
sl@0
|
1871 |
TRAPD(result, TerminateDisplayL());
|
sl@0
|
1872 |
TEST(result == KErrNone);
|
sl@0
|
1873 |
|
sl@0
|
1874 |
CleanAll();
|
sl@0
|
1875 |
RecordTestResultL();
|
sl@0
|
1876 |
CloseTMSGraphicsStep();
|
sl@0
|
1877 |
return TestStepResult();
|
sl@0
|
1878 |
}
|
sl@0
|
1879 |
|
sl@0
|
1880 |
/**
|
sl@0
|
1881 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-080
|
sl@0
|
1882 |
|
sl@0
|
1883 |
@SYMTestPriority 1
|
sl@0
|
1884 |
|
sl@0
|
1885 |
@SYMPREQ 2400
|
sl@0
|
1886 |
|
sl@0
|
1887 |
@SYMREQ 12326
|
sl@0
|
1888 |
|
sl@0
|
1889 |
@SYMTestCaseDesc
|
sl@0
|
1890 |
To check that eglTerminate() destroys sync object and will unblock thread waiting for the signal.
|
sl@0
|
1891 |
|
sl@0
|
1892 |
@SYMTestActions
|
sl@0
|
1893 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
1894 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
1895 |
2. Launch thread A
|
sl@0
|
1896 |
3. Call eglClientWaitSyncKHR() on the sync object in thread A.
|
sl@0
|
1897 |
4. Call eglTerminate() from main thread without deleting the sync object.
|
sl@0
|
1898 |
|
sl@0
|
1899 |
@SYMTestExpectedResults
|
sl@0
|
1900 |
1. Sync object handle doesn't equal to EGL_NO_SYNC_KHR.
|
sl@0
|
1901 |
3. Thread A will be stalled
|
sl@0
|
1902 |
4. Thread A which waited for the signal must be unblocked as if eglSignalSyncKHR() has been called.
|
sl@0
|
1903 |
The function eglClientWaitSyncKHR should return EGL_CONDITION_SATISFIED_KHR.
|
sl@0
|
1904 |
Test completes without any error and panic. No memory leak.
|
sl@0
|
1905 |
*/
|
sl@0
|
1906 |
|
sl@0
|
1907 |
TVerdict CEglTest_SyncObject_Positive_TerminateBeforeTimeoutExpired::doTestStepL()
|
sl@0
|
1908 |
{
|
sl@0
|
1909 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-080"));
|
sl@0
|
1910 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Positive_TerminateBeforeTimeoutExpired::doTestStepL started...."));
|
sl@0
|
1911 |
|
sl@0
|
1912 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
1913 |
{
|
sl@0
|
1914 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
1915 |
CleanAll();
|
sl@0
|
1916 |
RecordTestResultL();
|
sl@0
|
1917 |
CloseTMSGraphicsStep();
|
sl@0
|
1918 |
return TestStepResult();
|
sl@0
|
1919 |
}
|
sl@0
|
1920 |
|
sl@0
|
1921 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
1922 |
GetDisplayL();
|
sl@0
|
1923 |
CreateEglSessionL();
|
sl@0
|
1924 |
iEglSess->InitializeL();
|
sl@0
|
1925 |
|
sl@0
|
1926 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
1927 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
1928 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
1929 |
|
sl@0
|
1930 |
INFO_PRINTF1(_L("Launching threads A"));
|
sl@0
|
1931 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
1932 |
|
sl@0
|
1933 |
INFO_PRINTF1(_L("Wait for a bit before eglTerminate"));
|
sl@0
|
1934 |
User::After(iDelaySignalling);
|
sl@0
|
1935 |
|
sl@0
|
1936 |
TRAPD(result, TerminateDisplayL());
|
sl@0
|
1937 |
TEST(result == KErrNone);
|
sl@0
|
1938 |
|
sl@0
|
1939 |
CleanAll();
|
sl@0
|
1940 |
RecordTestResultL();
|
sl@0
|
1941 |
CloseTMSGraphicsStep();
|
sl@0
|
1942 |
INFO_PRINTF1(_L("....CEglTest_SyncObject_Positive_TerminateBeforeTimeoutExpired::doTestStepL completed!"));
|
sl@0
|
1943 |
return TestStepResult();
|
sl@0
|
1944 |
}
|
sl@0
|
1945 |
|
sl@0
|
1946 |
void CEglTest_SyncObject_Positive_TerminateBeforeTimeoutExpired::doThreadFunctionL(TInt aIdx)
|
sl@0
|
1947 |
{
|
sl@0
|
1948 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Positive_TerminateBeforeTimeoutExpired::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
1949 |
ASSERT_TRUE(aIdx==0);
|
sl@0
|
1950 |
|
sl@0
|
1951 |
INFO_PRINTF2(_L("Thread %d waiting for main thread to call eglTerminate(), with timeout EGL_FOREVER_KHR"), aIdx);
|
sl@0
|
1952 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
1953 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
1954 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
1955 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
1956 |
|
sl@0
|
1957 |
INFO_PRINTF5(_L("Thread %d waited on eglClientWaitSyncKHR for %d usec before sync object was destroyed by eglTerminate() (threshold was [%d +- %d])"), aIdx, timeElapsed, iDelaySignalling, iThreshold);
|
sl@0
|
1958 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);
|
sl@0
|
1959 |
TEST (Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
1960 |
}
|
sl@0
|
1961 |
|
sl@0
|
1962 |
/**
|
sl@0
|
1963 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-100
|
sl@0
|
1964 |
|
sl@0
|
1965 |
@SYMTestPriority 1
|
sl@0
|
1966 |
|
sl@0
|
1967 |
@SYMPREQ 2400
|
sl@0
|
1968 |
|
sl@0
|
1969 |
@SYMREQ 12326
|
sl@0
|
1970 |
|
sl@0
|
1971 |
@SYMTestCaseDesc
|
sl@0
|
1972 |
To ensure that sync object API generates correct errors and returns correct
|
sl@0
|
1973 |
value if wrong parameters supplied.
|
sl@0
|
1974 |
|
sl@0
|
1975 |
@SYMTestActions
|
sl@0
|
1976 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
1977 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
1978 |
2. Call all sync API for the display which doesn't exist in the system.
|
sl@0
|
1979 |
3. Call eglCreateSyncKHR() with unsupported type parameter.
|
sl@0
|
1980 |
4. Call eglCreateSyncKHR() with specified attributes, type parameter set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
1981 |
5. Call eglCreateSyncKHR() with unspecified attributes, type parameter set to EGL_SYNC_REUSABLE_KHR
|
sl@0
|
1982 |
6. Call all sync API (with the exception to eglCreateSyncKHR(...), providing invalid EGLSyncKHR as a parameter
|
sl@0
|
1983 |
7. Call eglClientWaitSyncKHR(), providing unspecified flags.
|
sl@0
|
1984 |
8. Call eglSignalSyncKHR(), providing unspecified status.
|
sl@0
|
1985 |
9. Call eglGetSyncAttribSyncKHR(), providing unspecified attributes.
|
sl@0
|
1986 |
10. Destroy the sync object
|
sl@0
|
1987 |
|
sl@0
|
1988 |
@SYMTestExpectedResults
|
sl@0
|
1989 |
2. eglCreateSyncKHR(...) should return EGL_NO_SYNC_KHR and EGL_BAD_DISPLAY error is generated.
|
sl@0
|
1990 |
eglClientWaitSyncKHR(...), eglSignalSyncKHR(...), eglGetSyncAttribKHR(...) and eglDestroySyncKHR(...)
|
sl@0
|
1991 |
should return EGL_FALSE and EGL_BAD_DISPLAY error is generated.
|
sl@0
|
1992 |
3. Should return EGL_NO_SYNC_KHR and EGL_BAD_ATTRIBUTE error is generated.
|
sl@0
|
1993 |
4.5 Should return EGL_NO_SYNC_KHR and EGL_BAD_ATTRIBUTE error is generated.
|
sl@0
|
1994 |
6, 7, 8. Should return EGL_FALSE and EGL_BAD_PARAMETER error is generated
|
sl@0
|
1995 |
9. Should return EGL_FALSE and EGL_BAD_ATTRIBUTE error is generated
|
sl@0
|
1996 |
*/
|
sl@0
|
1997 |
TVerdict CEglTest_SyncObject_Negative_WrongParameters::doTestStepL()
|
sl@0
|
1998 |
{
|
sl@0
|
1999 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-100"));
|
sl@0
|
2000 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Negative_WrongParameters::doTestStepL"));
|
sl@0
|
2001 |
|
sl@0
|
2002 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
2003 |
{
|
sl@0
|
2004 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
2005 |
CleanAll();
|
sl@0
|
2006 |
RecordTestResultL();
|
sl@0
|
2007 |
CloseTMSGraphicsStep();
|
sl@0
|
2008 |
return TestStepResult();
|
sl@0
|
2009 |
}
|
sl@0
|
2010 |
|
sl@0
|
2011 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
2012 |
GetDisplayL();
|
sl@0
|
2013 |
CreateEglSessionL();
|
sl@0
|
2014 |
iEglSess->InitializeL();
|
sl@0
|
2015 |
|
sl@0
|
2016 |
//create a sync object
|
sl@0
|
2017 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
2018 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
2019 |
TEST(eglGetError() == EGL_SUCCESS);
|
sl@0
|
2020 |
|
sl@0
|
2021 |
INFO_PRINTF1(_L("Call all sync API for the display which doesn't exist in the system"));
|
sl@0
|
2022 |
EGLDisplay invalidDisplay = iDisplay + 1;
|
sl@0
|
2023 |
iSyncObject1 = iPfnEglCreateSyncKHR(invalidDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
2024 |
TEST(iSyncObject1 == EGL_NO_SYNC_KHR);
|
sl@0
|
2025 |
TEST(eglGetError() == EGL_BAD_DISPLAY);
|
sl@0
|
2026 |
EGLBoolean res = iPfnEglSignalSyncKHR(invalidDisplay,iSyncObject,EGL_UNSIGNALED_KHR );
|
sl@0
|
2027 |
TEST(res == EGL_FALSE);
|
sl@0
|
2028 |
TEST(eglGetError() == EGL_BAD_DISPLAY);
|
sl@0
|
2029 |
EGLint res1 = iPfnEglClientWaitSyncKHR(invalidDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
2030 |
TEST(res1 == EGL_FALSE);
|
sl@0
|
2031 |
TEST(eglGetError() == EGL_BAD_DISPLAY);
|
sl@0
|
2032 |
EGLint value;
|
sl@0
|
2033 |
res = iPfnEglGetSyncAttribKHR(invalidDisplay,iSyncObject,EGL_SYNC_STATUS_KHR, &value);
|
sl@0
|
2034 |
TEST(res == EGL_FALSE);
|
sl@0
|
2035 |
TEST(eglGetError() == EGL_BAD_DISPLAY);
|
sl@0
|
2036 |
res = iPfnEglDestroySyncKHR(invalidDisplay, iSyncObject);
|
sl@0
|
2037 |
TEST(res == EGL_FALSE);
|
sl@0
|
2038 |
TEST(eglGetError() == EGL_BAD_DISPLAY);
|
sl@0
|
2039 |
|
sl@0
|
2040 |
INFO_PRINTF1(_L("Call eglCreateSyncKHR() with unsupported type parameter."));
|
sl@0
|
2041 |
const EGLint unsupportedType = 0x3fff;
|
sl@0
|
2042 |
iSyncObject1 = iPfnEglCreateSyncKHR(iDisplay, unsupportedType, KEglSyncAttribsNone);
|
sl@0
|
2043 |
TEST(iSyncObject1 == EGL_NO_SYNC_KHR);
|
sl@0
|
2044 |
TEST(eglGetError() == EGL_BAD_ATTRIBUTE);
|
sl@0
|
2045 |
|
sl@0
|
2046 |
const EGLint KSpecifiedAttrib[] = {
|
sl@0
|
2047 |
EGL_SYNC_STATUS_KHR, EGL_UNSIGNALED_KHR,
|
sl@0
|
2048 |
EGL_NONE
|
sl@0
|
2049 |
};
|
sl@0
|
2050 |
INFO_PRINTF1(_L("Call eglCreateSyncKHR() with specified condition, type parameter set to EGL_SYNC_REUSABLE_KHR"));
|
sl@0
|
2051 |
iSyncObject1 = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KSpecifiedAttrib);
|
sl@0
|
2052 |
TEST(iSyncObject1 == EGL_NO_SYNC_KHR);
|
sl@0
|
2053 |
TEST(eglGetError() == EGL_BAD_ATTRIBUTE);
|
sl@0
|
2054 |
|
sl@0
|
2055 |
INFO_PRINTF1(_L("Call eglCreateSyncKHR() with unspecified attributes, type parameter set to EGL_SYNC_REUSABLE_KHR"));
|
sl@0
|
2056 |
const TInt KUndefinedAttrib = 0x4000;
|
sl@0
|
2057 |
const EGLint KUnspecifiedAttrib1[] = {
|
sl@0
|
2058 |
KUndefinedAttrib, EGL_UNSIGNALED_KHR,
|
sl@0
|
2059 |
EGL_NONE
|
sl@0
|
2060 |
};
|
sl@0
|
2061 |
iSyncObject1 = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KUnspecifiedAttrib1);
|
sl@0
|
2062 |
TEST(iSyncObject1 == EGL_NO_SYNC_KHR);
|
sl@0
|
2063 |
TEST(eglGetError() == EGL_BAD_ATTRIBUTE);
|
sl@0
|
2064 |
const EGLint KUnspecifiedAttrib2[] = {
|
sl@0
|
2065 |
EGL_SYNC_STATUS_KHR, KUndefinedAttrib,
|
sl@0
|
2066 |
EGL_NONE
|
sl@0
|
2067 |
};
|
sl@0
|
2068 |
iSyncObject1 = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KUnspecifiedAttrib2);
|
sl@0
|
2069 |
TEST(iSyncObject1 == EGL_NO_SYNC_KHR);
|
sl@0
|
2070 |
TEST(eglGetError() == EGL_BAD_ATTRIBUTE);
|
sl@0
|
2071 |
|
sl@0
|
2072 |
INFO_PRINTF1(_L("Call all sync API (with the exception to eglCreateSyncKHR(...), providing invalid EGLSyncKHR as a parameter"));
|
sl@0
|
2073 |
res = iPfnEglSignalSyncKHR(iDisplay,iSyncObject1,EGL_UNSIGNALED_KHR );
|
sl@0
|
2074 |
TEST(res == EGL_FALSE);
|
sl@0
|
2075 |
TEST(eglGetError() == EGL_BAD_PARAMETER);
|
sl@0
|
2076 |
res1 = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject1,0,EGL_FOREVER_KHR);
|
sl@0
|
2077 |
TEST(res1 == EGL_FALSE);
|
sl@0
|
2078 |
TEST(eglGetError() == EGL_BAD_PARAMETER);
|
sl@0
|
2079 |
res = iPfnEglGetSyncAttribKHR(iDisplay,iSyncObject1,EGL_SYNC_STATUS_KHR, &value);
|
sl@0
|
2080 |
TEST(res == EGL_FALSE);
|
sl@0
|
2081 |
TEST(eglGetError() == EGL_BAD_PARAMETER);
|
sl@0
|
2082 |
res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject1);
|
sl@0
|
2083 |
TEST(res == EGL_FALSE);
|
sl@0
|
2084 |
TEST(eglGetError() == EGL_BAD_PARAMETER);
|
sl@0
|
2085 |
|
sl@0
|
2086 |
INFO_PRINTF1(_L("Call eglClientWaitSyncKHR(), providing unspecified flags"));
|
sl@0
|
2087 |
const TInt KUnspecifiedFlags = 0x002;
|
sl@0
|
2088 |
res1 = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,KUnspecifiedFlags,EGL_FOREVER_KHR);
|
sl@0
|
2089 |
TEST(res1 == EGL_FALSE);
|
sl@0
|
2090 |
TEST(eglGetError() == EGL_BAD_PARAMETER);
|
sl@0
|
2091 |
|
sl@0
|
2092 |
INFO_PRINTF1(_L("Call eglSignalSyncKHR(), providing unspecified status"));
|
sl@0
|
2093 |
const EGLint unspecifiedStatus = 0x3fff;
|
sl@0
|
2094 |
res = iPfnEglSignalSyncKHR(iDisplay,iSyncObject,unspecifiedStatus);
|
sl@0
|
2095 |
TEST(res == EGL_FALSE);
|
sl@0
|
2096 |
TEST(eglGetError() == EGL_BAD_PARAMETER);
|
sl@0
|
2097 |
|
sl@0
|
2098 |
INFO_PRINTF1(_L("Call eglGetSyncAttribSyncKHR(), providing unspecified attributes"));
|
sl@0
|
2099 |
const EGLint unspecifiedAttribute = 0x3fff;
|
sl@0
|
2100 |
res = iPfnEglGetSyncAttribKHR(iDisplay,iSyncObject,unspecifiedAttribute, &value);
|
sl@0
|
2101 |
TEST(res == EGL_FALSE);
|
sl@0
|
2102 |
TEST(eglGetError() == EGL_BAD_ATTRIBUTE);
|
sl@0
|
2103 |
//close sync object
|
sl@0
|
2104 |
res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
2105 |
TEST(res == EGL_TRUE);
|
sl@0
|
2106 |
|
sl@0
|
2107 |
CleanAll();
|
sl@0
|
2108 |
RecordTestResultL();
|
sl@0
|
2109 |
CloseTMSGraphicsStep();
|
sl@0
|
2110 |
INFO_PRINTF1(_L("End of CEglTest_SyncObject_Negative_WrongParameters::doTestStepL"));
|
sl@0
|
2111 |
return TestStepResult();
|
sl@0
|
2112 |
}
|
sl@0
|
2113 |
|
sl@0
|
2114 |
/**
|
sl@0
|
2115 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-105
|
sl@0
|
2116 |
|
sl@0
|
2117 |
@SYMTestPriority 1
|
sl@0
|
2118 |
|
sl@0
|
2119 |
@SYMPREQ 2400
|
sl@0
|
2120 |
|
sl@0
|
2121 |
@SYMREQ 12326
|
sl@0
|
2122 |
|
sl@0
|
2123 |
@SYMTestCaseDesc
|
sl@0
|
2124 |
To check that internal version of the signal function, which is accessible
|
sl@0
|
2125 |
via extension mechanism, doesn't generate an error.
|
sl@0
|
2126 |
|
sl@0
|
2127 |
@SYMTestActions
|
sl@0
|
2128 |
1. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
2129 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR.
|
sl@0
|
2130 |
2. Call egl_Private_SignalSyncNOK() on sync object supplying invalid status
|
sl@0
|
2131 |
3. Call eglGetError()
|
sl@0
|
2132 |
4. Call egl_Private_SignalSyncNOK() on sync object with EGL_SIGNALED_KHR flag supplying invalid display
|
sl@0
|
2133 |
5. Call eglGetError()
|
sl@0
|
2134 |
6. Retrieve status attribute
|
sl@0
|
2135 |
7. Call eglQueryString(..) supplying invalid name parameter (for instance, "OpenGL_Wrong" ).
|
sl@0
|
2136 |
8. Call egl_Private_SignalSyncNOK() on sync object with EGL_SIGNALED_KHR flag supplying invalid display
|
sl@0
|
2137 |
9. Call eglGetError()
|
sl@0
|
2138 |
10. Destroy the sync object
|
sl@0
|
2139 |
|
sl@0
|
2140 |
@SYMTestExpectedResults
|
sl@0
|
2141 |
2. The function returns EGL_BAD_ PARAMETERS
|
sl@0
|
2142 |
3. An error is set to EGL_SUCCESS
|
sl@0
|
2143 |
4. The function returns EGL_BAD_DISPLAY.
|
sl@0
|
2144 |
5. An error is set to EGL_SUCCESS
|
sl@0
|
2145 |
6. The status attributes indicates that object is still in a signaled state (EGL_UNSIGNALED_KHR)
|
sl@0
|
2146 |
8. The function returns EGL_BAD_DISPLAY.
|
sl@0
|
2147 |
9. An error is set to EGL_BAD_PARAMETER
|
sl@0
|
2148 |
*/
|
sl@0
|
2149 |
TVerdict CEglTest_SyncObject_Negative_SignalImpl::doTestStepL()
|
sl@0
|
2150 |
{
|
sl@0
|
2151 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-105"));
|
sl@0
|
2152 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Negative_SignalImpl::doTestStepL"));
|
sl@0
|
2153 |
|
sl@0
|
2154 |
if(!iIsSyncObjectExtensionSupported || !iIsSyncObjectPrivateExtensionSupported)
|
sl@0
|
2155 |
{
|
sl@0
|
2156 |
INFO_PRINTF1(_L("Sync object extensions (whether EGL_KHR_reusable_sync or EGL_NOK__private__signal_sync or both) \
|
sl@0
|
2157 |
are not supported, the test will not be executed"));
|
sl@0
|
2158 |
CleanAll();
|
sl@0
|
2159 |
RecordTestResultL();
|
sl@0
|
2160 |
CloseTMSGraphicsStep();
|
sl@0
|
2161 |
return TestStepResult();
|
sl@0
|
2162 |
}
|
sl@0
|
2163 |
|
sl@0
|
2164 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
2165 |
GetDisplayL();
|
sl@0
|
2166 |
CreateEglSessionL();
|
sl@0
|
2167 |
iEglSess->InitializeL();
|
sl@0
|
2168 |
|
sl@0
|
2169 |
INFO_PRINTF1(_L("Create the sync object"));
|
sl@0
|
2170 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
2171 |
TESTL(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
2172 |
|
sl@0
|
2173 |
INFO_PRINTF1(_L("Call egl_Private_SignalSyncNOK() on sync object supplying invalid status"));
|
sl@0
|
2174 |
const EGLint unspecifiedMode = 0x3fff;
|
sl@0
|
2175 |
EGLint res1 = iPfnEglPrivateSignalSyncNOK(iDisplay, iSyncObject, unspecifiedMode);
|
sl@0
|
2176 |
TEST(res1 == EGL_BAD_PARAMETER);
|
sl@0
|
2177 |
TEST(eglGetError() == EGL_SUCCESS);
|
sl@0
|
2178 |
|
sl@0
|
2179 |
INFO_PRINTF1(_L("Call egl_Private_SignalSyncNOK() on sync object with EGL_SIGNALED_KHR flag supplying invalid display"));
|
sl@0
|
2180 |
const EGLDisplay invalidDisplay = iDisplay + 1;
|
sl@0
|
2181 |
res1 = iPfnEglPrivateSignalSyncNOK(invalidDisplay, iSyncObject, EGL_SIGNALED_KHR);
|
sl@0
|
2182 |
TEST(res1 == EGL_BAD_DISPLAY);
|
sl@0
|
2183 |
TEST(eglGetError() == EGL_SUCCESS);
|
sl@0
|
2184 |
CheckSyncAttrib(EGL_SYNC_STATUS_KHR,EGL_UNSIGNALED_KHR); //the status is still "unsignaled"
|
sl@0
|
2185 |
|
sl@0
|
2186 |
INFO_PRINTF1(_L("Call eglQueryString(..) supplying invalid name parameter ")); //the actual API doesn't matter, we need to generate an error
|
sl@0
|
2187 |
const TInt invalidExtension = 0xffff;
|
sl@0
|
2188 |
const char* extensionsString = eglQueryString(iDisplay, invalidExtension); //this should generate EGL_BAD_PARAMETER
|
sl@0
|
2189 |
TEST(!extensionsString);
|
sl@0
|
2190 |
|
sl@0
|
2191 |
res1 = iPfnEglPrivateSignalSyncNOK(invalidDisplay, iSyncObject, EGL_SIGNALED_KHR);
|
sl@0
|
2192 |
TEST(res1 == EGL_BAD_DISPLAY);
|
sl@0
|
2193 |
TEST(eglGetError() == EGL_BAD_PARAMETER); //check that error code was not overidden
|
sl@0
|
2194 |
|
sl@0
|
2195 |
EGLBoolean res = iPfnEglDestroySyncKHR(iDisplay, iSyncObject);
|
sl@0
|
2196 |
TEST(res == EGL_TRUE);
|
sl@0
|
2197 |
CleanAll();
|
sl@0
|
2198 |
RecordTestResultL();
|
sl@0
|
2199 |
CloseTMSGraphicsStep();
|
sl@0
|
2200 |
INFO_PRINTF1(_L("End of CEglTest_SyncObject_Negative_SignalImpl::doTestStepL"));
|
sl@0
|
2201 |
return TestStepResult();
|
sl@0
|
2202 |
}
|
sl@0
|
2203 |
|
sl@0
|
2204 |
/**
|
sl@0
|
2205 |
@SYMTestCaseID GRAPHICS-EGL-SYNC-OBJECT-110
|
sl@0
|
2206 |
|
sl@0
|
2207 |
@SYMTestPriority 1
|
sl@0
|
2208 |
|
sl@0
|
2209 |
@SYMPREQ 2400
|
sl@0
|
2210 |
|
sl@0
|
2211 |
@SYMREQ 12326
|
sl@0
|
2212 |
|
sl@0
|
2213 |
@SYMTestCaseDesc
|
sl@0
|
2214 |
To check that system correctly processing errors in the environment with shortage of memory.
|
sl@0
|
2215 |
|
sl@0
|
2216 |
@SYMTestActions
|
sl@0
|
2217 |
1. Run a loop (step 2 to 7) with fail rate counting from 1 upward until
|
sl@0
|
2218 |
the following operations succeed
|
sl@0
|
2219 |
2. Set heap failure with the fail rate specifying in step 1
|
sl@0
|
2220 |
3. Create sync object for the default display. No attributes are specified (containing only EGL_NONE).
|
sl@0
|
2221 |
The type parameter is set to EGL_SYNC_REUSABLE_KHR. Skip the following test steps if operation doesn't succeed
|
sl@0
|
2222 |
4. Launch thread A
|
sl@0
|
2223 |
5. Wait on the sync object
|
sl@0
|
2224 |
6. Signal from thread A on the sync object the flag EGL_SIGNALED_KHR
|
sl@0
|
2225 |
7. Destroy the sync object
|
sl@0
|
2226 |
8. Reset heap
|
sl@0
|
2227 |
|
sl@0
|
2228 |
@SYMTestExpectedResults
|
sl@0
|
2229 |
3. If memory is not enough to fulfil an operation EGL_NO_SYNC_KHR is returned. Otherwise it should return a handle to a valid sync object
|
sl@0
|
2230 |
5. The main thread should be stalled
|
sl@0
|
2231 |
6. The main thread should be unblocked
|
sl@0
|
2232 |
*/
|
sl@0
|
2233 |
TVerdict CEglTest_SyncObject_Negative_OOM::doTestStepL()
|
sl@0
|
2234 |
{
|
sl@0
|
2235 |
SetTestStepID(_L("GRAPHICS-EGL-SYNC-OBJECT-110"));
|
sl@0
|
2236 |
INFO_PRINTF1(_L("CEglTest_SyncObject_Negative_OOM::doTestStepL"));
|
sl@0
|
2237 |
#ifndef _DEBUG
|
sl@0
|
2238 |
WARN_PRINTF1(_L("CEglTest_SyncObject_Negative_OOM can only be run in debug mode"));
|
sl@0
|
2239 |
RecordTestResultL();
|
sl@0
|
2240 |
CloseTMSGraphicsStep();
|
sl@0
|
2241 |
return TestStepResult();
|
sl@0
|
2242 |
#else
|
sl@0
|
2243 |
|
sl@0
|
2244 |
if(!iIsSyncObjectExtensionSupported)
|
sl@0
|
2245 |
{
|
sl@0
|
2246 |
INFO_PRINTF1(_L("Sync object extension is not supported, the test will not be executed"));
|
sl@0
|
2247 |
CleanAll();
|
sl@0
|
2248 |
RecordTestResultL();
|
sl@0
|
2249 |
CloseTMSGraphicsStep();
|
sl@0
|
2250 |
return TestStepResult();
|
sl@0
|
2251 |
}
|
sl@0
|
2252 |
|
sl@0
|
2253 |
ASSERT_TRUE(iDisplay == EGL_NO_DISPLAY);
|
sl@0
|
2254 |
GetDisplayL();
|
sl@0
|
2255 |
CreateEglSessionL();
|
sl@0
|
2256 |
iEglSess->InitializeL();
|
sl@0
|
2257 |
|
sl@0
|
2258 |
INFO_PRINTF1(_L("Retrieving the heapMark functions for memory testing..."));
|
sl@0
|
2259 |
TEglDebugHeapMarkStartPtr heapMarkStart = reinterpret_cast<TEglDebugHeapMarkStartPtr>(eglGetProcAddress("egliDebugHeapMarkStart"));
|
sl@0
|
2260 |
TEglDebugHeapMarkEndPtr heapMarkEnd = reinterpret_cast<TEglDebugHeapMarkEndPtr>(eglGetProcAddress("egliDebugHeapMarkEnd"));
|
sl@0
|
2261 |
TEglDebugSetBurstAllocFailPtr setSyncObjectAllocFail = reinterpret_cast<TEglDebugSetBurstAllocFailPtr>(eglGetProcAddress("egliDebugSetBurstAllocFail"));
|
sl@0
|
2262 |
TESTL(heapMarkStart && heapMarkEnd && setSyncObjectAllocFail);
|
sl@0
|
2263 |
|
sl@0
|
2264 |
EGLint err = EGL_BAD_ALLOC;
|
sl@0
|
2265 |
for(TUint failAfter=1; (err == EGL_BAD_ALLOC); ++failAfter)
|
sl@0
|
2266 |
{
|
sl@0
|
2267 |
__UHEAP_MARK;
|
sl@0
|
2268 |
heapMarkStart();
|
sl@0
|
2269 |
|
sl@0
|
2270 |
// Set heap failure
|
sl@0
|
2271 |
INFO_PRINTF2(_L("Set EGL heap to fail after %u allocations"), failAfter);
|
sl@0
|
2272 |
setSyncObjectAllocFail(static_cast<EGLenum>(RHeap::EBurstFailNext), failAfter, 742);
|
sl@0
|
2273 |
|
sl@0
|
2274 |
INFO_PRINTF1(_L("Create sync object"));
|
sl@0
|
2275 |
iSyncObject = iPfnEglCreateSyncKHR(iDisplay, EGL_SYNC_REUSABLE_KHR, KEglSyncAttribsNone);
|
sl@0
|
2276 |
err = eglGetError();
|
sl@0
|
2277 |
if(err == EGL_SUCCESS)
|
sl@0
|
2278 |
{
|
sl@0
|
2279 |
TEST(iSyncObject != EGL_NO_SYNC_KHR);
|
sl@0
|
2280 |
//launch threadA
|
sl@0
|
2281 |
Test_MultiThreadL(1, EFalse);
|
sl@0
|
2282 |
TUint32 timestampBefore = User::NTickCount();
|
sl@0
|
2283 |
EGLint resClientWait = iPfnEglClientWaitSyncKHR(iDisplay,iSyncObject,0,EGL_FOREVER_KHR);
|
sl@0
|
2284 |
TUint32 timestampAfter = User::NTickCount();
|
sl@0
|
2285 |
TInt timeElapsed = ElapsedTime(timestampAfter, timestampBefore);
|
sl@0
|
2286 |
TEST(resClientWait == EGL_CONDITION_SATISFIED_KHR);//we do not expect failure here, as eglClientWaitSyncKHR function doesn't allocate any memory
|
sl@0
|
2287 |
TEST(Abs(timeElapsed - iDelaySignalling) < iThreshold);
|
sl@0
|
2288 |
//close sync object
|
sl@0
|
2289 |
TEST(iPfnEglDestroySyncKHR(iDisplay, iSyncObject)== EGL_TRUE);
|
sl@0
|
2290 |
|
sl@0
|
2291 |
//Wait for the thread to finish before launching the thread with the same index again.
|
sl@0
|
2292 |
Test_MultiThread_WaitL(ETrue, TThreadStatus::ELogin);
|
sl@0
|
2293 |
}
|
sl@0
|
2294 |
else
|
sl@0
|
2295 |
{
|
sl@0
|
2296 |
TEST(iSyncObject == EGL_NO_SYNC_KHR);
|
sl@0
|
2297 |
}
|
sl@0
|
2298 |
// Unset heap failure
|
sl@0
|
2299 |
setSyncObjectAllocFail(static_cast<EGLenum>(RHeap::ENone), 0, 0);
|
sl@0
|
2300 |
(void)heapMarkEnd(0);
|
sl@0
|
2301 |
__UHEAP_MARKEND;
|
sl@0
|
2302 |
}
|
sl@0
|
2303 |
TEST(err == EGL_SUCCESS);
|
sl@0
|
2304 |
|
sl@0
|
2305 |
CleanAll();
|
sl@0
|
2306 |
RecordTestResultL();
|
sl@0
|
2307 |
CloseTMSGraphicsStep();
|
sl@0
|
2308 |
INFO_PRINTF1(_L("End of CEglTest_SyncObject_Negative_OOM::doTestStepL"));
|
sl@0
|
2309 |
return TestStepResult();
|
sl@0
|
2310 |
#endif
|
sl@0
|
2311 |
}
|
sl@0
|
2312 |
|
sl@0
|
2313 |
void CEglTest_SyncObject_Negative_OOM::doThreadFunctionL(TInt aIdx)
|
sl@0
|
2314 |
{
|
sl@0
|
2315 |
INFO_PRINTF2(_L("CEglTest_SyncObject_Negative_OOM::doThreadFunctionL, Thread %d"),aIdx);
|
sl@0
|
2316 |
ASSERT_TRUE(aIdx==0);
|
sl@0
|
2317 |
|
sl@0
|
2318 |
User::After(TTimeIntervalMicroSeconds32(iDelaySignalling));
|
sl@0
|
2319 |
TEST(iPfnEglSignalSyncKHR(iDisplay, iSyncObject, EGL_SIGNALED_KHR) == EGL_TRUE); //we do not expect failure here, as eglSignalSyncKHR function doesn't allocate a memory
|
sl@0
|
2320 |
}
|