1 /*-------------------------------------------------------------------------
2 * drawElements Quality Program EGL Module
3 * ---------------------------------------
5 * Copyright 2014 The Android Open Source Project
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 * \brief EGL EGL_KHR_fence_sync and EGL_KHR_reusable_sync tests
22 *//*--------------------------------------------------------------------*/
24 #include "teglSyncTests.hpp"
26 #include "deStringUtil.hpp"
28 #include "egluNativeWindow.hpp"
29 #include "egluStrUtil.hpp"
30 #include "egluUtil.hpp"
32 #include "eglwLibrary.hpp"
33 #include "eglwEnums.hpp"
35 #include "tcuTestLog.hpp"
36 #include "tcuCommandLine.hpp"
38 #include "gluDefs.hpp"
40 #include "glwFunctions.hpp"
41 #include "glwEnums.hpp"
62 const char* getSyncTypeName (EGLenum syncType)
66 case EGL_SYNC_FENCE_KHR: return "EGL_SYNC_FENCE_KHR";
67 case EGL_SYNC_REUSABLE_KHR: return "EGL_SYNC_REUSABLE_KHR";
74 class SyncTest : public TestCase
77 typedef EGLSync (Library::*createSync)(EGLDisplay, EGLenum, const EGLAttrib *) const ;
78 typedef EGLSyncKHR (Library::*createSyncKHR)(EGLDisplay, EGLenum, const EGLint *) const ;
79 typedef EGLint (Library::*clientWaitSync)(EGLDisplay, EGLSync, EGLint, EGLTime) const ;
80 typedef EGLint (Library::*clientWaitSyncKHR)(EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR) const ;
81 typedef EGLBoolean (Library::*getSyncAttrib)(EGLDisplay, EGLSync, EGLint, EGLAttrib *) const ;
82 typedef EGLBoolean (Library::*getSyncAttribKHR)(EGLDisplay, EGLSyncKHR, EGLint, EGLint *) const ;
83 typedef EGLBoolean (Library::*destroySync)(EGLDisplay, EGLSync) const ;
84 typedef EGLBoolean (Library::*destroySyncKHR)(EGLDisplay, EGLSyncKHR) const ;
85 typedef EGLBoolean (Library::*waitSync)(EGLDisplay, EGLSync, EGLint) const ;
86 typedef EGLint (Library::*waitSyncKHR)(EGLDisplay, EGLSyncKHR, EGLint) const ;
90 FUNC_NAME_CREATE_SYNC,
91 FUNC_NAME_CLIENT_WAIT_SYNC,
92 FUNC_NAME_GET_SYNC_ATTRIB,
93 FUNC_NAME_DESTROY_SYNC,
101 EXTENSION_WAIT_SYNC = (0x1 << 0),
102 EXTENSION_FENCE_SYNC = (0x1 << 1),
103 EXTENSION_REUSABLE_SYNC = (0x1 << 2)
105 SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, bool useCurrentContext, const char* name, const char* description);
106 virtual ~SyncTest (void);
110 bool hasRequiredEGLVersion(int requiredMajor, int requiredMinor);
111 bool hasRequiredEGLExtensions(void);
112 EGLDisplay getEglDisplay() {return m_eglDisplay;}
115 const EGLenum m_syncType;
116 const bool m_useCurrentContext;
120 Extension m_extensions;
121 EGLDisplay m_eglDisplay;
122 EGLConfig m_eglConfig;
123 EGLSurface m_eglSurface;
124 eglu::NativeWindow* m_nativeWindow;
125 EGLContext m_eglContext;
127 string m_funcNames[FUNC_NAME_NUM_NAMES];
128 string m_funcNamesKHR[FUNC_NAME_NUM_NAMES];
131 SyncTest::SyncTest (EglTestContext& eglTestCtx, EGLenum syncType, Extension extensions, bool useCurrentContext, const char* name, const char* description)
132 : TestCase (eglTestCtx, name, description)
133 , m_syncType (syncType)
134 , m_useCurrentContext (useCurrentContext)
135 , m_extensions (extensions)
136 , m_eglDisplay (EGL_NO_DISPLAY)
137 , m_eglConfig (((eglw::EGLConfig)0)) // EGL_NO_CONFIG
138 , m_eglSurface (EGL_NO_SURFACE)
139 , m_nativeWindow (DE_NULL)
140 , m_eglContext (EGL_NO_CONTEXT)
141 , m_sync (EGL_NO_SYNC_KHR)
143 m_funcNames[FUNC_NAME_CREATE_SYNC] = "eglCreateSync";
144 m_funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] = "eglClientWaitSync";
145 m_funcNames[FUNC_NAME_GET_SYNC_ATTRIB] = "eglGetSyncAttrib";
146 m_funcNames[FUNC_NAME_DESTROY_SYNC] = "eglDestroySync";
147 m_funcNames[FUNC_NAME_WAIT_SYNC] = "eglWaitSync";
149 m_funcNamesKHR[FUNC_NAME_CREATE_SYNC] = "eglCreateSyncKHR";
150 m_funcNamesKHR[FUNC_NAME_CLIENT_WAIT_SYNC] = "eglClientWaitSyncKHR";
151 m_funcNamesKHR[FUNC_NAME_GET_SYNC_ATTRIB] = "eglGetSyncAttribKHR";
152 m_funcNamesKHR[FUNC_NAME_DESTROY_SYNC] = "eglDestroySyncKHR";
153 m_funcNamesKHR[FUNC_NAME_WAIT_SYNC] = "eglWaitSyncKHR";
156 SyncTest::~SyncTest (void)
161 bool SyncTest::hasRequiredEGLVersion (int requiredMajor, int requiredMinor)
163 const Library& egl = m_eglTestCtx.getLibrary();
164 TestLog& log = m_testCtx.getLog();
165 eglu::Version version = eglu::getVersion(egl, m_eglDisplay);
167 if (version < eglu::Version(requiredMajor, requiredMinor))
169 log << TestLog::Message << "Required EGL version is not supported. "
170 "Has: " << version.getMajor() << "." << version.getMinor()
171 << ", Required: " << requiredMajor << "." << requiredMinor << TestLog::EndMessage;
178 bool SyncTest::hasRequiredEGLExtensions (void)
180 TestLog& log = m_testCtx.getLog();
182 if (!eglu::hasExtension(m_eglTestCtx.getLibrary(), m_eglDisplay, "EGL_KHR_fence_sync"))
184 log << TestLog::Message << "EGL_KHR_fence_sync not supported" << TestLog::EndMessage;
188 if (!eglu::hasExtension(m_eglTestCtx.getLibrary(), m_eglDisplay, "EGL_KHR_reusable_sync"))
190 log << TestLog::Message << "EGL_KHR_reusable_sync not supported" << TestLog::EndMessage;
194 if (!eglu::hasExtension(m_eglTestCtx.getLibrary(), m_eglDisplay, "EGL_KHR_wait_sync"))
196 log << TestLog::Message << "EGL_KHR_wait_sync not supported" << TestLog::EndMessage;
203 void requiredGLESExtensions (const glw::Functions& gl)
206 std::istringstream extensionStream((const char*)gl.getString(GL_EXTENSIONS));
209 GLU_CHECK_GLW_MSG(gl, "glGetString(GL_EXTENSIONS)");
211 while (std::getline(extensionStream, extension, ' '))
213 if (extension == "GL_OES_EGL_sync")
218 TCU_THROW(NotSupportedError, "GL_OES_EGL_sync not supported");
221 SyncTest::Extension getSyncTypeExtension (EGLenum syncType)
225 case EGL_SYNC_FENCE_KHR: return SyncTest::EXTENSION_FENCE_SYNC;
226 case EGL_SYNC_REUSABLE_KHR: return SyncTest::EXTENSION_REUSABLE_SYNC;
229 return SyncTest::EXTENSION_NONE;
233 void SyncTest::init (void)
235 const Library& egl = m_eglTestCtx.getLibrary();
236 const eglu::NativeWindowFactory& windowFactory = eglu::selectNativeWindowFactory(m_eglTestCtx.getNativeDisplayFactory(), m_testCtx.getCommandLine());
238 const EGLint displayAttribList[] =
240 EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
241 EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
246 const EGLint contextAttribList[] =
248 EGL_CONTEXT_CLIENT_VERSION, 2,
252 m_eglDisplay = eglu::getAndInitDisplay(m_eglTestCtx.getNativeDisplay());
253 m_eglConfig = eglu::chooseSingleConfig(egl, m_eglDisplay, displayAttribList);
255 m_eglTestCtx.initGLFunctions(&m_gl, glu::ApiType::es(2,0));
257 m_extensions = (Extension)(m_extensions | getSyncTypeExtension(m_syncType));
259 if (m_useCurrentContext)
262 EGLU_CHECK_CALL(egl, bindAPI(EGL_OPENGL_ES_API));
263 m_eglContext = egl.createContext(m_eglDisplay, m_eglConfig, EGL_NO_CONTEXT, contextAttribList);
264 EGLU_CHECK_MSG(egl, "Failed to create GLES2 context");
267 m_nativeWindow = windowFactory.createWindow(&m_eglTestCtx.getNativeDisplay(), m_eglDisplay, m_eglConfig, DE_NULL, eglu::WindowParams(480, 480, eglu::parseWindowVisibility(m_testCtx.getCommandLine())));
268 m_eglSurface = eglu::createWindowSurface(m_eglTestCtx.getNativeDisplay(), *m_nativeWindow, m_eglDisplay, m_eglConfig, DE_NULL);
270 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, m_eglSurface, m_eglSurface, m_eglContext));
272 requiredGLESExtensions(m_gl);
275 // Verify EXTENSION_REUSABLE_SYNC is supported before running the tests
276 if (m_syncType == EGL_SYNC_REUSABLE_KHR) {
277 if (!eglu::hasExtension(m_eglTestCtx.getLibrary(), m_eglDisplay, "EGL_KHR_reusable_sync"))
279 TCU_THROW(NotSupportedError, "EGL_KHR_reusable_sync not supported");
284 void SyncTest::deinit (void)
286 const Library& egl = m_eglTestCtx.getLibrary();
288 if (m_eglDisplay != EGL_NO_DISPLAY)
290 if (m_sync != EGL_NO_SYNC_KHR)
292 EGLU_CHECK_CALL(egl, destroySyncKHR(m_eglDisplay, m_sync));
293 m_sync = EGL_NO_SYNC_KHR;
296 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT));
298 if (m_eglContext != EGL_NO_CONTEXT)
300 EGLU_CHECK_CALL(egl, destroyContext(m_eglDisplay, m_eglContext));
301 m_eglContext = EGL_NO_CONTEXT;
304 if (m_eglSurface != EGL_NO_SURFACE)
306 EGLU_CHECK_CALL(egl, destroySurface(m_eglDisplay, m_eglSurface));
307 m_eglSurface = EGL_NO_SURFACE;
310 delete m_nativeWindow;
311 m_nativeWindow = DE_NULL;
313 egl.terminate(m_eglDisplay);
314 m_eglDisplay = EGL_NO_DISPLAY;
318 class CreateNullAttribsTest : public SyncTest
321 CreateNullAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
322 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_null_attribs", "create_null_attribs")
326 template <typename createSyncFuncType>
327 void test(string funcNames[FUNC_NAME_NUM_NAMES],
328 createSyncFuncType createSyncFunc)
330 // Reset before each test
334 const Library& egl = m_eglTestCtx.getLibrary();
335 TestLog& log = m_testCtx.getLog();
336 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
338 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
339 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
340 m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
342 EGLU_CHECK_MSG(egl, msgChk.c_str());
345 IterateResult iterate(void)
347 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
349 if (hasRequiredEGLVersion(1, 5))
351 test<createSync>(m_funcNames, &Library::createSync);
353 if (hasRequiredEGLExtensions())
355 test<createSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR);
357 else if (!hasRequiredEGLVersion(1, 5))
359 TCU_THROW(NotSupportedError, "Required extensions not supported");
366 class CreateEmptyAttribsTest : public SyncTest
369 CreateEmptyAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
370 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_empty_attribs", "create_empty_attribs")
374 template <typename createSyncFuncType, typename attribType>
375 void test(string funcNames[FUNC_NAME_NUM_NAMES],
376 createSyncFuncType createSyncFunc)
378 // Reset before each test
382 const Library& egl = m_eglTestCtx.getLibrary();
383 TestLog& log = m_testCtx.getLog();
384 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
385 const attribType attribList[] =
390 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, attribList);
391 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
392 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) <<
393 ", { EGL_NONE })" << TestLog::EndMessage;
394 EGLU_CHECK_MSG(egl, msgChk.c_str());
397 IterateResult iterate (void)
399 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
401 if (hasRequiredEGLVersion(1, 5))
403 test<createSync, EGLAttrib>(m_funcNames, &Library::createSync);
405 if (hasRequiredEGLExtensions())
407 test<createSyncKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR);
409 else if (!hasRequiredEGLVersion(1, 5))
411 TCU_THROW(NotSupportedError, "Required extensions not supported");
418 class CreateInvalidDisplayTest : public SyncTest
421 CreateInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
422 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_display", "create_invalid_display")
426 template <typename createSyncFuncType, typename syncType>
427 void test(string funcNames[FUNC_NAME_NUM_NAMES],
428 createSyncFuncType createSyncFunc, syncType eglNoSync)
430 // Reset before each test
434 const Library& egl = m_eglTestCtx.getLibrary();
435 TestLog& log = m_testCtx.getLog();
437 m_sync = (egl.*createSyncFunc)(EGL_NO_DISPLAY, m_syncType, NULL);
438 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
439 "(EGL_NO_DISPLAY, " << getSyncTypeName(m_syncType) << ", NULL)" <<
442 EGLint error = egl.getError();
443 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
445 if (error != EGL_BAD_DISPLAY)
447 log << TestLog::Message << "Unexpected error '" <<
448 eglu::getErrorStr(error) << "' expected EGL_BAD_DISPLAY" <<
450 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
454 TCU_CHECK(m_sync == eglNoSync);
457 IterateResult iterate (void)
459 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
461 if (hasRequiredEGLVersion(1, 5))
463 test<createSync, EGLSync>(m_funcNames, &Library::createSync, EGL_NO_SYNC);
465 if (hasRequiredEGLExtensions())
467 test<createSyncKHR, EGLSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR, EGL_NO_SYNC_KHR);
469 else if (!hasRequiredEGLVersion(1, 5))
471 TCU_THROW(NotSupportedError, "Required extensions not supported");
478 class CreateInvalidTypeTest : public SyncTest
481 CreateInvalidTypeTest (EglTestContext& eglTestCtx, EGLenum syncType)
482 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_type", "create_invalid_type")
486 template <typename createSyncFuncType>
487 void test(string funcNames[FUNC_NAME_NUM_NAMES],
488 createSyncFuncType createSyncFunc, EGLSyncKHR eglNoSync,
489 EGLint syncError, string syncErrorName)
491 // Reset before each test
495 const Library& egl = m_eglTestCtx.getLibrary();
496 TestLog& log = m_testCtx.getLog();
498 m_sync = (egl.*createSyncFunc)(m_eglDisplay, EGL_NONE, NULL);
499 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
500 m_eglDisplay << ", EGL_NONE, NULL)" << TestLog::EndMessage;
502 EGLint error = egl.getError();
503 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
505 if (error != syncError)
507 log << TestLog::Message << "Unexpected error '" <<
508 eglu::getErrorStr(error) << "' expected " << syncErrorName << " " <<
510 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
514 TCU_CHECK(m_sync == eglNoSync);
517 IterateResult iterate (void)
519 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
521 if (hasRequiredEGLVersion(1, 5))
523 test<createSync>(m_funcNames, &Library::createSync, EGL_NO_SYNC,
524 EGL_BAD_PARAMETER, "EGL_BAD_PARAMETER");
526 if (hasRequiredEGLExtensions())
528 test<createSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR, EGL_NO_SYNC_KHR,
529 EGL_BAD_ATTRIBUTE, "EGL_BAD_ATTRIBUTE");
531 else if (!hasRequiredEGLVersion(1, 5))
533 TCU_THROW(NotSupportedError, "Required extensions not supported");
540 class CreateInvalidAttribsTest : public SyncTest
543 CreateInvalidAttribsTest (EglTestContext& eglTestCtx, EGLenum syncType)
544 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_attribs", "create_invalid_attribs")
548 template <typename createSyncFuncType, typename attribType>
549 void test(string funcNames[FUNC_NAME_NUM_NAMES],
550 createSyncFuncType createSyncFunc, EGLSyncKHR eglNoSync)
552 // Reset before each test
556 const Library& egl = m_eglTestCtx.getLibrary();
557 TestLog& log = m_testCtx.getLog();
559 attribType attribs[] = {
564 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, attribs);
565 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
566 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) <<
567 ", { 2, 3, 4, 5, EGL_NONE })" << TestLog::EndMessage;
569 EGLint error = egl.getError();
570 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
572 if (error != EGL_BAD_ATTRIBUTE)
574 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
575 "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
576 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
580 TCU_CHECK(m_sync == eglNoSync);
583 IterateResult iterate (void)
585 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
587 if (hasRequiredEGLVersion(1, 5))
589 test<createSync, EGLAttrib>(m_funcNames, &Library::createSync, EGL_NO_SYNC);
591 if (hasRequiredEGLExtensions())
593 test<createSyncKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR, EGL_NO_SYNC_KHR);
595 else if (!hasRequiredEGLVersion(1, 5))
597 TCU_THROW(NotSupportedError, "Required extensions not supported");
604 class CreateInvalidContextTest : public SyncTest
607 CreateInvalidContextTest (EglTestContext& eglTestCtx, EGLenum syncType)
608 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "create_invalid_context", "create_invalid_context")
612 template <typename createSyncFuncType>
613 void test(string funcNames[FUNC_NAME_NUM_NAMES],
614 createSyncFuncType createSyncFunc, EGLSyncKHR eglNoSync)
616 // Reset before each test
620 const Library& egl = m_eglTestCtx.getLibrary();
621 TestLog& log = m_testCtx.getLog();
623 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay <<
624 ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
625 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE,
626 EGL_NO_SURFACE, EGL_NO_CONTEXT));
628 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
629 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
630 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
633 EGLint error = egl.getError();
634 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
636 if (error != EGL_BAD_MATCH)
638 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
639 "' expected EGL_BAD_MATCH" << TestLog::EndMessage;
640 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
644 TCU_CHECK(m_sync == eglNoSync);
647 IterateResult iterate (void)
649 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
651 if (hasRequiredEGLVersion(1, 5))
653 test<createSync>(m_funcNames, &Library::createSync, EGL_NO_SYNC);
655 if (hasRequiredEGLExtensions())
657 test<createSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR, EGL_NO_SYNC_KHR);
659 else if (!hasRequiredEGLVersion(1, 5))
661 TCU_THROW(NotSupportedError, "Required extensions not supported");
668 class ClientWaitNoTimeoutTest : public SyncTest
671 ClientWaitNoTimeoutTest (EglTestContext& eglTestCtx, EGLenum syncType)
672 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_no_timeout", "wait_no_timeout")
676 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
677 void test(string funcNames[FUNC_NAME_NUM_NAMES],
678 createSyncFuncType createSyncFunc,
679 clientWaitSyncFuncType clientWaitSyncFunc)
681 // Reset before each test
685 const Library& egl = m_eglTestCtx.getLibrary();
686 TestLog& log = m_testCtx.getLog();
687 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
689 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
690 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
691 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
693 EGLU_CHECK_MSG(egl, msgChk.c_str());
695 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, 0, 0);
696 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
697 "(" << m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
699 if (m_syncType == EGL_SYNC_FENCE_KHR)
700 TCU_CHECK(status == EGL_CONDITION_SATISFIED_KHR || status == EGL_TIMEOUT_EXPIRED_KHR);
701 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
702 TCU_CHECK(status == EGL_TIMEOUT_EXPIRED_KHR);
707 IterateResult iterate (void)
709 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
711 if (hasRequiredEGLVersion(1, 5))
713 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
714 &Library::clientWaitSync);
716 if (hasRequiredEGLExtensions())
718 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
719 &Library::clientWaitSyncKHR);
721 else if (!hasRequiredEGLVersion(1, 5))
723 TCU_THROW(NotSupportedError, "Required extensions not supported");
731 class ClientWaitForeverTest : public SyncTest
734 ClientWaitForeverTest (EglTestContext& eglTestCtx, EGLenum syncType)
735 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_forever", "wait_forever")
739 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
740 void test(string funcNames[FUNC_NAME_NUM_NAMES],
741 createSyncFuncType createSyncFunc,
742 clientWaitSyncFuncType clientWaitSyncFunc,
743 EGLTime eglTime, const string &eglTimeName,
744 EGLint condSatisfied)
746 // Reset before each test
750 const Library& egl = m_eglTestCtx.getLibrary();
751 TestLog& log = m_testCtx.getLog();
752 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
753 string clientWaitSyncMsgChk = funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] + "()";
755 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
756 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
757 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
759 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
761 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
763 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
764 log << TestLog::Message << ret << " = eglSignalSyncKHR(" <<
765 m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" <<
767 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
769 else if (m_syncType == EGL_SYNC_FENCE_KHR)
771 GLU_CHECK_GLW_CALL(m_gl, flush());
772 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
777 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, 0, eglTime);
778 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
779 "(" << m_eglDisplay << ", " << m_sync << ", 0, " << eglTimeName << ")" <<
782 TCU_CHECK(status == condSatisfied);
783 EGLU_CHECK_MSG(egl, clientWaitSyncMsgChk.c_str());
786 IterateResult iterate (void)
788 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
790 if (hasRequiredEGLVersion(1, 5))
792 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
793 &Library::clientWaitSync,
794 EGL_FOREVER, "EGL_FOREVER",
795 EGL_CONDITION_SATISFIED);
797 if (hasRequiredEGLExtensions())
799 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
800 &Library::clientWaitSyncKHR,
801 EGL_FOREVER_KHR, "EGL_FOREVER_KHR",
802 EGL_CONDITION_SATISFIED_KHR);
804 else if (!hasRequiredEGLVersion(1, 5))
806 TCU_THROW(NotSupportedError, "Required extensions not supported");
813 class ClientWaitNoContextTest : public SyncTest
816 ClientWaitNoContextTest (EglTestContext& eglTestCtx, EGLenum syncType)
817 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_no_context", "wait_no_Context")
821 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
822 void test(string funcNames[FUNC_NAME_NUM_NAMES],
823 createSyncFuncType createSyncFunc,
824 clientWaitSyncFuncType clientWaitSyncFunc,
825 EGLint condSatisfied, EGLTime eglTime, const string &eglTimeName)
827 // Reset before each test
831 const Library& egl = m_eglTestCtx.getLibrary();
832 TestLog& log = m_testCtx.getLog();
833 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
835 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
836 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
837 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
839 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
842 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
844 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
845 log << TestLog::Message << ret << " = eglSignalSyncKHR(" <<
846 m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" <<
848 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
850 else if (m_syncType == EGL_SYNC_FENCE_KHR)
852 GLU_CHECK_GLW_CALL(m_gl, flush());
853 log << TestLog::Message << "glFlush()" << TestLog::EndMessage;
858 log << TestLog::Message << "eglMakeCurrent(" << m_eglDisplay <<
859 ", EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT)" << TestLog::EndMessage;
860 EGLU_CHECK_CALL(egl, makeCurrent(m_eglDisplay, EGL_NO_SURFACE,
861 EGL_NO_SURFACE, EGL_NO_CONTEXT));
863 EGLint result = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, 0, eglTime);
864 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
865 "(" << m_eglDisplay << ", " << m_sync << ", 0, " << eglTimeName << ")" <<
868 TCU_CHECK(result == condSatisfied);
871 IterateResult iterate (void)
873 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
875 if (hasRequiredEGLVersion(1, 5))
877 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
878 &Library::clientWaitSync,
879 EGL_CONDITION_SATISFIED, EGL_FOREVER, "EGL_FOREVER");
881 if (hasRequiredEGLExtensions())
883 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
884 &Library::clientWaitSyncKHR,
885 EGL_CONDITION_SATISFIED_KHR, EGL_FOREVER_KHR, "EGL_FOREVER_KHR");
887 else if (!hasRequiredEGLVersion(1, 5))
889 TCU_THROW(NotSupportedError, "Required extensions not supported");
896 class ClientWaitForeverFlushTest : public SyncTest
899 ClientWaitForeverFlushTest (EglTestContext& eglTestCtx, EGLenum syncType)
900 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_forever_flush", "wait_forever_flush")
904 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
905 void test(string funcNames[FUNC_NAME_NUM_NAMES],
906 createSyncFuncType createSyncFunc,
907 clientWaitSyncFuncType clientWaitSyncFunc,
908 EGLint flags, const string &flagsName,
909 EGLTime eglTime, const string &eglTimeName,
910 EGLint condSatisfied)
912 // Reset before each test
916 const Library& egl = m_eglTestCtx.getLibrary();
917 TestLog& log = m_testCtx.getLog();
918 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
920 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
921 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
922 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
924 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
926 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
928 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
929 log << TestLog::Message << ret << " = eglSignalSyncKHR(" <<
930 m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" <<
932 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
935 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, flags, eglTime);
936 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
937 "(" << m_eglDisplay << ", " << m_sync << ", " << flagsName << ", " <<
938 eglTimeName << ")" << TestLog::EndMessage;
940 TCU_CHECK(status == condSatisfied);
944 IterateResult iterate (void)
946 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
948 if (hasRequiredEGLVersion(1, 5))
950 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
951 &Library::clientWaitSync,
952 EGL_SYNC_FLUSH_COMMANDS_BIT, "EGL_SYNC_FLUSH_COMMANDS_BIT",
953 EGL_FOREVER, "EGL_FOREVER",
954 EGL_CONDITION_SATISFIED);
956 if (hasRequiredEGLExtensions())
958 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
959 &Library::clientWaitSyncKHR,
960 EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, "EGL_SYNC_FLUSH_COMMANDS_BIT_KHR",
961 EGL_FOREVER_KHR, "EGL_FOREVER_KHR",
962 EGL_CONDITION_SATISFIED_KHR);
964 else if (!hasRequiredEGLVersion(1, 5))
966 TCU_THROW(NotSupportedError, "Required extensions not supported");
973 class ClientWaitInvalidDisplayTest : public SyncTest
976 ClientWaitInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
977 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_invalid_display", "wait_invalid_display")
981 template <typename createSyncFuncType, typename clientWaitSyncFuncType>
982 void test(string funcNames[FUNC_NAME_NUM_NAMES],
983 createSyncFuncType createSyncFunc,
984 clientWaitSyncFuncType clientWaitSyncFunc,
985 EGLint flags, const string &flagsName,
986 EGLTime eglTime, const string &eglTimeName)
988 // Reset before each test
992 const Library& egl = m_eglTestCtx.getLibrary();
993 TestLog& log = m_testCtx.getLog();
994 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
996 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
997 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
998 m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1000 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1002 EGLint status = (egl.*clientWaitSyncFunc)(EGL_NO_DISPLAY, m_sync, flags, eglTime);
1003 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
1004 "(EGL_NO_DISPLAY, " << m_sync << ", " << flagsName << ", " <<
1005 eglTimeName << ")" << TestLog::EndMessage;
1007 EGLint error = egl.getError();
1008 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1010 if (error != EGL_BAD_DISPLAY)
1012 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1013 "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1014 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1018 TCU_CHECK(status == EGL_FALSE);
1021 IterateResult iterate (void)
1023 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1025 if (hasRequiredEGLVersion(1, 5))
1027 test<createSync, clientWaitSync>(m_funcNames, &Library::createSync,
1028 &Library::clientWaitSync,
1029 EGL_SYNC_FLUSH_COMMANDS_BIT, "EGL_SYNC_FLUSH_COMMANDS_BIT",
1030 EGL_FOREVER, "EGL_FOREVER");
1032 if (hasRequiredEGLExtensions())
1034 test<createSyncKHR, clientWaitSyncKHR>(m_funcNamesKHR, &Library::createSyncKHR,
1035 &Library::clientWaitSyncKHR,
1036 EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, "EGL_SYNC_FLUSH_COMMANDS_BIT_KHR",
1037 EGL_FOREVER_KHR, "EGL_FOREVER_KHR");
1039 else if (!hasRequiredEGLVersion(1, 5))
1041 TCU_THROW(NotSupportedError, "Required extensions not supported");
1048 class ClientWaitInvalidSyncTest : public SyncTest
1051 ClientWaitInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1052 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "wait_invalid_sync", "wait_invalid_sync")
1056 template <typename clientWaitSyncFuncType>
1057 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1058 clientWaitSyncFuncType clientWaitSyncFunc,
1059 EGLSync sync, const string &syncName,
1060 EGLTime eglTime, const string &eglTimeName)
1062 // Reset before each test
1066 const Library& egl = m_eglTestCtx.getLibrary();
1067 TestLog& log = m_testCtx.getLog();
1069 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, sync, 0, eglTime);
1070 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] <<
1071 "(" << m_eglDisplay << ", " << syncName << ", 0, " << eglTimeName << ")" <<
1072 TestLog::EndMessage;
1074 EGLint error = egl.getError();
1075 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1077 if (error != EGL_BAD_PARAMETER)
1079 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1080 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1081 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1085 TCU_CHECK(status == EGL_FALSE);
1088 IterateResult iterate (void)
1090 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1092 if (hasRequiredEGLVersion(1, 5))
1094 test<clientWaitSync>(m_funcNames, &Library::clientWaitSync,
1095 EGL_NO_SYNC, "EGL_NO_SYNC",
1096 EGL_FOREVER, "EGL_FOREVER");
1098 if (hasRequiredEGLExtensions())
1100 test<clientWaitSyncKHR>(m_funcNamesKHR, &Library::clientWaitSyncKHR,
1101 EGL_NO_SYNC_KHR, "EGL_NO_SYNC_KHR",
1102 EGL_FOREVER_KHR, "EGL_FOREVER_KHR");
1104 else if (!hasRequiredEGLVersion(1, 5))
1106 TCU_THROW(NotSupportedError, "Required extensions not supported");
1113 class GetSyncTypeTest : public SyncTest
1116 GetSyncTypeTest (EglTestContext& eglTestCtx, EGLenum syncType)
1117 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_type", "get_type")
1121 template <typename createSyncFuncType, typename getSyncAttribFuncType, typename getSyncAttribValueType>
1122 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1123 createSyncFuncType createSyncFunc,
1124 getSyncAttribFuncType getSyncAttribFunc,
1125 EGLint attribute, const string &attributeName)
1127 // Reset before each test
1131 const Library& egl = m_eglTestCtx.getLibrary();
1132 TestLog& log = m_testCtx.getLog();
1133 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1135 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1136 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1137 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1138 TestLog::EndMessage;
1139 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1141 getSyncAttribValueType type = 0;
1142 EGLU_CHECK_CALL_FPTR(egl, (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync,
1144 log << TestLog::Message << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] << "(" << m_eglDisplay <<
1145 ", " << m_sync << ", " << attributeName << ", {" << type << "})" <<
1146 TestLog::EndMessage;
1148 TCU_CHECK(type == ((getSyncAttribValueType)m_syncType));
1151 IterateResult iterate (void)
1153 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1155 if (hasRequiredEGLVersion(1, 5))
1157 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames, &Library::createSync,
1158 &Library::getSyncAttrib,
1159 EGL_SYNC_TYPE, "EGL_SYNC_TYPE");
1161 if (hasRequiredEGLExtensions())
1163 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR,
1164 &Library::getSyncAttribKHR,
1165 EGL_SYNC_TYPE_KHR, "EGL_SYNC_TYPE_KHR");
1167 else if (!hasRequiredEGLVersion(1, 5))
1169 TCU_THROW(NotSupportedError, "Required extensions not supported");
1176 class GetSyncStatusTest : public SyncTest
1179 GetSyncStatusTest (EglTestContext& eglTestCtx, EGLenum syncType)
1180 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_status", "get_status")
1184 template <typename createSyncFuncType, typename getSyncAttribFuncType, typename getSyncAttribValueType>
1185 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1186 createSyncFuncType createSyncFunc,
1187 getSyncAttribFuncType getSyncAttribFunc,
1188 EGLint attribute, const string &attributeName)
1190 // Reset before each test
1194 const Library& egl = m_eglTestCtx.getLibrary();
1195 TestLog& log = m_testCtx.getLog();
1196 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1198 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1199 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1200 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1201 TestLog::EndMessage;
1202 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1204 getSyncAttribValueType status = 0;
1205 EGLU_CHECK_CALL_FPTR(egl, (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync, attribute, &status));
1206 log << TestLog::Message << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] << "(" <<
1207 m_eglDisplay << ", " << m_sync << ", " << attributeName << ", {" <<
1208 status << "})" << TestLog::EndMessage;
1210 if (m_syncType == EGL_SYNC_FENCE_KHR)
1211 TCU_CHECK(status == EGL_SIGNALED_KHR || status == EGL_UNSIGNALED_KHR);
1212 else if (m_syncType == EGL_SYNC_REUSABLE_KHR)
1213 TCU_CHECK(status == EGL_UNSIGNALED_KHR);
1216 IterateResult iterate (void)
1218 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1220 if (hasRequiredEGLVersion(1, 5))
1222 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames, &Library::createSync,
1223 &Library::getSyncAttrib,
1224 EGL_SYNC_STATUS, "EGL_SYNC_STATUS");
1226 if (hasRequiredEGLExtensions())
1228 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR,
1229 &Library::getSyncAttribKHR,
1230 EGL_SYNC_STATUS_KHR, "EGL_SYNC_STATUS_KHR");
1232 else if (!hasRequiredEGLVersion(1, 5))
1234 TCU_THROW(NotSupportedError, "Required extensions not supported");
1241 class GetSyncStatusSignaledTest : public SyncTest
1244 GetSyncStatusSignaledTest (EglTestContext& eglTestCtx, EGLenum syncType)
1245 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_status_signaled", "get_status_signaled")
1249 template <typename createSyncFuncType,
1250 typename clientWaitSyncFuncType,
1251 typename getSyncAttribFuncType,
1252 typename getSyncAttribValueType>
1253 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1254 createSyncFuncType createSyncFunc,
1255 clientWaitSyncFuncType clientWaitSyncFunc,
1256 EGLint flags, const string &flagsName,
1257 EGLTime eglTime, const string &eglTimeName,
1258 EGLint condSatisfied,
1259 getSyncAttribFuncType getSyncAttribFunc,
1260 EGLint attribute, const string &attributeName,
1261 getSyncAttribValueType statusVal)
1263 // Reset before each test
1267 const Library& egl = m_eglTestCtx.getLibrary();
1268 TestLog& log = m_testCtx.getLog();
1269 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1271 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1272 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1273 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1274 TestLog::EndMessage;
1275 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1277 if (m_syncType == EGL_SYNC_REUSABLE_KHR)
1279 EGLBoolean ret = egl.signalSyncKHR(m_eglDisplay, m_sync, EGL_SIGNALED_KHR);
1280 log << TestLog::Message << ret << " = eglSignalSyncKHR(" <<
1281 m_eglDisplay << ", " << m_sync << ", EGL_SIGNALED_KHR)" <<
1282 TestLog::EndMessage;
1283 EGLU_CHECK_MSG(egl, "eglSignalSyncKHR()");
1285 else if (m_syncType == EGL_SYNC_FENCE_KHR)
1287 GLU_CHECK_GLW_CALL(m_gl, finish());
1288 log << TestLog::Message << "glFinish()" << TestLog::EndMessage;
1291 DE_ASSERT(DE_FALSE);
1294 EGLint status = (egl.*clientWaitSyncFunc)(m_eglDisplay, m_sync, flags, eglTime);
1295 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_CLIENT_WAIT_SYNC] << "(" <<
1296 m_eglDisplay << ", " << m_sync << ", " << flagsName << ", " <<
1297 eglTimeName << ")" << TestLog::EndMessage;
1298 TCU_CHECK(status == condSatisfied);
1301 getSyncAttribValueType status = 0;
1302 EGLU_CHECK_CALL_FPTR(egl, (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync, attribute, &status));
1303 log << TestLog::Message << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] << "(" <<
1304 m_eglDisplay << ", " << m_sync << ", " << attributeName << ", {" <<
1305 status << "})" << TestLog::EndMessage;
1307 TCU_CHECK(status == statusVal);
1310 IterateResult iterate (void)
1312 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1314 if (hasRequiredEGLVersion(1, 5))
1316 test<createSync, clientWaitSync, getSyncAttrib, EGLAttrib>(m_funcNames,
1317 &Library::createSync,
1318 &Library::clientWaitSync,
1319 EGL_SYNC_FLUSH_COMMANDS_BIT, "EGL_SYNC_FLUSH_COMMANDS_BIT",
1320 EGL_FOREVER, "EGL_FOREVER",
1321 EGL_CONDITION_SATISFIED,
1322 &Library::getSyncAttrib,
1323 EGL_SYNC_STATUS, "EGL_SYNC_STATUS",
1326 if (hasRequiredEGLExtensions())
1328 test<createSyncKHR, clientWaitSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR,
1329 &Library::createSyncKHR,
1330 &Library::clientWaitSyncKHR,
1331 EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, "EGL_SYNC_FLUSH_COMMANDS_BIT_KHR",
1332 EGL_FOREVER_KHR, "EGL_FOREVER_KHR",
1333 EGL_CONDITION_SATISFIED_KHR,
1334 &Library::getSyncAttribKHR,
1335 EGL_SYNC_STATUS_KHR, "EGL_SYNC_STATUS_KHR",
1338 else if (!hasRequiredEGLVersion(1, 5))
1340 TCU_THROW(NotSupportedError, "Required extensions not supported");
1347 class GetSyncConditionTest : public SyncTest
1350 GetSyncConditionTest (EglTestContext& eglTestCtx, EGLenum syncType)
1351 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_condition", "get_condition")
1355 template <typename createSyncFuncType,
1356 typename getSyncAttribFuncType,
1357 typename getSyncAttribValueType>
1358 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1359 createSyncFuncType createSyncFunc,
1360 getSyncAttribFuncType getSyncAttribFunc,
1361 EGLint attribute, const string &attributeName,
1362 getSyncAttribValueType statusVal)
1364 // Reset before each test
1368 const Library& egl = m_eglTestCtx.getLibrary();
1369 TestLog& log = m_testCtx.getLog();
1370 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1372 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1373 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1374 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1375 TestLog::EndMessage;
1376 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1378 getSyncAttribValueType condition = 0;
1379 EGLU_CHECK_CALL_FPTR(egl, (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync,
1380 attribute, &condition));
1381 log << TestLog::Message << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] << "(" <<
1382 m_eglDisplay << ", " << m_sync << ", " << attributeName << ", {" <<
1383 condition << "})" << TestLog::EndMessage;
1385 TCU_CHECK(condition == statusVal);
1388 IterateResult iterate (void)
1390 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1392 if (hasRequiredEGLVersion(1, 5))
1394 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames, &Library::createSync,
1395 &Library::getSyncAttrib,
1396 EGL_SYNC_CONDITION, "EGL_SYNC_CONDITION",
1397 EGL_SYNC_PRIOR_COMMANDS_COMPLETE);
1399 if (hasRequiredEGLExtensions())
1401 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR,
1402 &Library::getSyncAttribKHR,
1403 EGL_SYNC_CONDITION_KHR, "EGL_SYNC_CONDITION_KHR",
1404 EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR);
1406 else if (!hasRequiredEGLVersion(1, 5))
1408 TCU_THROW(NotSupportedError, "Required extensions not supported");
1415 class GetSyncInvalidDisplayTest : public SyncTest
1418 GetSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
1419 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_display", "get_invalid_display")
1423 template <typename createSyncFuncType,
1424 typename getSyncAttribFuncType,
1425 typename getSyncAttribValueType>
1426 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1427 createSyncFuncType createSyncFunc,
1428 getSyncAttribFuncType getSyncAttribFunc,
1429 EGLint attribute, const string &attributeName)
1431 // Reset before each test
1435 const Library& egl = m_eglTestCtx.getLibrary();
1436 TestLog& log = m_testCtx.getLog();
1437 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1439 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1440 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1441 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1442 TestLog::EndMessage;
1443 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1445 getSyncAttribValueType condition = 0xF0F0F;
1446 EGLBoolean result = (egl.*getSyncAttribFunc)(EGL_NO_DISPLAY, m_sync, attribute, &condition);
1447 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] <<
1448 "(EGL_NO_DISPLAY, " << m_sync << ", " << attributeName << ", {" <<
1449 condition << "})" << TestLog::EndMessage;
1451 EGLint error = egl.getError();
1452 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1454 if (error != EGL_BAD_DISPLAY)
1456 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1457 "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1458 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1462 TCU_CHECK(result == EGL_FALSE);
1463 TCU_CHECK(condition == 0xF0F0F);
1466 IterateResult iterate (void)
1468 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1470 if (hasRequiredEGLVersion(1, 5))
1472 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames, &Library::createSync,
1473 &Library::getSyncAttrib,
1474 EGL_SYNC_CONDITION, "EGL_SYNC_CONDITION");
1476 if (hasRequiredEGLExtensions())
1478 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR, &Library::createSyncKHR,
1479 &Library::getSyncAttribKHR,
1480 EGL_SYNC_CONDITION_KHR, "EGL_SYNC_CONDITION_KHR");
1482 else if (!hasRequiredEGLVersion(1, 5))
1484 TCU_THROW(NotSupportedError, "Required extensions not supported");
1491 class GetSyncInvalidSyncTest : public SyncTest
1494 GetSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)\
1495 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR, "get_invalid_sync", "get_invalid_sync")
1499 template <typename getSyncAttribFuncType,
1500 typename getSyncSyncValueType,
1501 typename getSyncAttribValueType>
1502 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1503 getSyncAttribFuncType getSyncAttribFunc,
1504 getSyncSyncValueType syncValue, const string &syncName,
1505 EGLint attribute, const string &attributeName)
1507 // Reset before each test
1511 const Library& egl = m_eglTestCtx.getLibrary();
1512 TestLog& log = m_testCtx.getLog();
1514 getSyncAttribValueType condition = 0xF0F0F;
1515 EGLBoolean result = (egl.*getSyncAttribFunc)(m_eglDisplay, syncValue,
1516 attribute, &condition);
1517 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] <<
1518 "(" << m_eglDisplay << ", " << syncName << ", " << attributeName << ", {" <<
1519 condition << "})" << TestLog::EndMessage;
1521 EGLint error = egl.getError();
1522 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1524 if (error != EGL_BAD_PARAMETER)
1526 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1527 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1528 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1532 TCU_CHECK(result == EGL_FALSE);
1533 TCU_CHECK(condition == 0xF0F0F);
1536 IterateResult iterate (void)
1538 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1540 if (hasRequiredEGLVersion(1, 5))
1542 test<getSyncAttrib, EGLSync, EGLAttrib>(m_funcNames, &Library::getSyncAttrib,
1543 EGL_NO_SYNC, "EGL_NO_SYNC",
1544 EGL_SYNC_CONDITION, "EGL_SYNC_CONDITION");
1546 if (hasRequiredEGLExtensions())
1548 test<getSyncAttribKHR, EGLSyncKHR, EGLint>(m_funcNamesKHR, &Library::getSyncAttribKHR,
1549 EGL_NO_SYNC_KHR, "EGL_NO_SYNC_KHR",
1550 EGL_SYNC_CONDITION_KHR, "EGL_SYNC_CONDITION_KHR");
1552 else if (!hasRequiredEGLVersion(1, 5))
1554 TCU_THROW(NotSupportedError, "Required extensions not supported");
1561 class GetSyncInvalidAttributeTest : public SyncTest
1564 GetSyncInvalidAttributeTest (EglTestContext& eglTestCtx, EGLenum syncType)
1565 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_attribute", "get_invalid_attribute")
1569 template <typename createSyncFuncType,
1570 typename getSyncAttribFuncType,
1571 typename getSyncAttribValueType>
1572 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1573 createSyncFuncType createSyncFunc,
1574 getSyncAttribFuncType getSyncAttribFunc)
1576 // Reset before each test
1580 const Library& egl = m_eglTestCtx.getLibrary();
1581 TestLog& log = m_testCtx.getLog();
1582 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1584 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1585 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1586 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1587 TestLog::EndMessage;
1588 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1590 getSyncAttribValueType condition = 0xF0F0F;
1591 EGLBoolean result = (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync, EGL_NONE, &condition);
1592 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] <<
1593 "(" << m_eglDisplay << ", " << m_sync << ", EGL_NONE, {" << condition << "})" <<
1594 TestLog::EndMessage;
1596 EGLint error = egl.getError();
1597 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1599 if (error != EGL_BAD_ATTRIBUTE)
1601 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1602 "' expected EGL_BAD_ATTRIBUTE" << TestLog::EndMessage;
1603 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1607 TCU_CHECK(result == EGL_FALSE);
1608 TCU_CHECK(condition == 0xF0F0F);
1611 IterateResult iterate (void)
1613 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1615 if (hasRequiredEGLVersion(1, 5))
1617 test<createSync, getSyncAttrib, EGLAttrib>(m_funcNames,
1618 &Library::createSync,
1619 &Library::getSyncAttrib);
1621 if (hasRequiredEGLExtensions())
1623 test<createSyncKHR, getSyncAttribKHR, EGLint>(m_funcNamesKHR,
1624 &Library::createSyncKHR,
1625 &Library::getSyncAttribKHR);
1627 else if (!hasRequiredEGLVersion(1, 5))
1629 TCU_THROW(NotSupportedError, "Required extensions not supported");
1636 class GetSyncInvalidValueTest : public SyncTest
1639 GetSyncInvalidValueTest (EglTestContext& eglTestCtx, EGLenum syncType)
1640 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"get_invalid_value", "get_invalid_value")
1644 template <typename createSyncFuncType,
1645 typename getSyncAttribFuncType>
1646 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1647 createSyncFuncType createSyncFunc,
1648 getSyncAttribFuncType getSyncAttribFunc,
1649 EGLint attribute, const string &attributeName)
1651 // Reset before each test
1655 const Library& egl = m_eglTestCtx.getLibrary();
1656 TestLog& log = m_testCtx.getLog();
1657 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1659 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1660 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1661 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1662 TestLog::EndMessage;
1663 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1665 EGLBoolean result = (egl.*getSyncAttribFunc)(m_eglDisplay, m_sync, attribute, NULL);
1666 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_GET_SYNC_ATTRIB] <<
1667 "(" << m_eglDisplay << ", " << m_sync << ", " << attributeName << ", NULL)" <<
1668 TestLog::EndMessage;
1670 EGLint error = egl.getError();
1671 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1673 if (error != EGL_BAD_PARAMETER)
1675 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1676 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1677 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1681 TCU_CHECK(result == EGL_FALSE);
1684 IterateResult iterate (void)
1686 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1688 if (hasRequiredEGLVersion(1, 5))
1690 test<createSync, getSyncAttrib>(m_funcNames, &Library::createSync,
1691 &Library::getSyncAttrib,
1692 EGL_SYNC_TYPE, "EGL_SYNC_TYPE");
1694 if (hasRequiredEGLExtensions())
1696 test<createSyncKHR, getSyncAttribKHR>(m_funcNamesKHR, &Library::createSyncKHR,
1697 &Library::getSyncAttribKHR,
1698 EGL_SYNC_TYPE_KHR, "EGL_SYNC_TYPE_KHR");
1700 else if (!hasRequiredEGLVersion(1, 5))
1702 TCU_THROW(NotSupportedError, "Required extensions not supported");
1709 class DestroySyncTest : public SyncTest
1712 DestroySyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1713 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy", "destroy")
1717 template <typename createSyncFuncType,
1718 typename destroySyncFuncType,
1719 typename getSyncSyncValueType>
1720 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1721 createSyncFuncType createSyncFunc,
1722 destroySyncFuncType destroySyncFunc,
1723 getSyncSyncValueType syncValue)
1725 // Reset before each test
1729 const Library& egl = m_eglTestCtx.getLibrary();
1730 TestLog& log = m_testCtx.getLog();
1731 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1733 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1734 log << TestLog::Message << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
1735 m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1736 TestLog::EndMessage;
1737 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1739 log << TestLog::Message << funcNames[FUNC_NAME_DESTROY_SYNC] << "(" <<
1740 m_eglDisplay << ", " << m_sync << ")" << TestLog::EndMessage;
1741 EGLU_CHECK_CALL_FPTR(egl, (egl.*destroySyncFunc)(m_eglDisplay, m_sync));
1745 IterateResult iterate (void)
1747 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1749 if (hasRequiredEGLVersion(1, 5))
1751 test<createSync, destroySync, EGLSync>(m_funcNames,
1752 &Library::createSync,
1753 &Library::destroySync,
1756 if (hasRequiredEGLExtensions())
1758 test<createSyncKHR, destroySyncKHR, EGLSyncKHR>(m_funcNamesKHR,
1759 &Library::createSyncKHR,
1760 &Library::destroySyncKHR,
1763 else if (!hasRequiredEGLVersion(1, 5))
1765 TCU_THROW(NotSupportedError, "Required extensions not supported");
1772 class DestroySyncInvalidDislayTest : public SyncTest
1775 DestroySyncInvalidDislayTest (EglTestContext& eglTestCtx, EGLenum syncType)
1776 : SyncTest(eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy_invalid_display", "destroy_invalid_display")
1780 template <typename createSyncFuncType, typename destroySyncFuncType>
1781 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1782 createSyncFuncType createSyncFunc,
1783 destroySyncFuncType destroySyncFunc)
1785 // Reset before each test
1789 const Library& egl = m_eglTestCtx.getLibrary();
1790 TestLog& log = m_testCtx.getLog();
1791 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1793 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1794 log << TestLog::Message << funcNames[FUNC_NAME_CREATE_SYNC] << "(" <<
1795 m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1796 TestLog::EndMessage;
1797 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
1799 EGLBoolean result = (egl.*destroySyncFunc)(EGL_NO_DISPLAY, m_sync);
1800 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_DESTROY_SYNC] <<
1801 "(EGL_NO_DISPLAY, " << m_sync << ")" << TestLog::EndMessage;
1803 EGLint error = egl.getError();
1804 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1806 if (error != EGL_BAD_DISPLAY)
1808 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1809 "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
1810 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1814 TCU_CHECK(result == EGL_FALSE);
1817 IterateResult iterate (void)
1819 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1821 if (hasRequiredEGLVersion(1, 5))
1823 test<createSync, destroySync>(m_funcNames,
1824 &Library::createSync,
1825 &Library::destroySync);
1827 if (hasRequiredEGLExtensions())
1829 test<createSyncKHR, destroySyncKHR>(m_funcNamesKHR,
1830 &Library::createSyncKHR,
1831 &Library::destroySyncKHR);
1833 else if (!hasRequiredEGLVersion(1, 5))
1835 TCU_THROW(NotSupportedError, "Required extensions not supported");
1842 class DestroySyncInvalidSyncTest : public SyncTest
1845 DestroySyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1846 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_NONE, syncType != EGL_SYNC_REUSABLE_KHR,"destroy_invalid_sync", "destroy_invalid_sync")
1850 template <typename destroySyncFuncType, typename getSyncSyncValueType>
1851 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1852 destroySyncFuncType destroySyncFunc,
1853 getSyncSyncValueType syncValue)
1855 // Reset before each test
1859 const Library& egl = m_eglTestCtx.getLibrary();
1860 TestLog& log = m_testCtx.getLog();
1862 EGLBoolean result = (egl.*destroySyncFunc)(m_eglDisplay, syncValue);
1863 log << TestLog::Message << result << " = " << funcNames[FUNC_NAME_DESTROY_SYNC] <<
1864 "(" << m_eglDisplay << ", " << syncValue << ")" << TestLog::EndMessage;
1866 EGLint error = egl.getError();
1867 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
1869 if (error != EGL_BAD_PARAMETER)
1871 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
1872 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
1873 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
1877 TCU_CHECK(result == EGL_FALSE);
1880 IterateResult iterate (void)
1882 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1884 if (hasRequiredEGLVersion(1, 5))
1886 test<destroySync, EGLSync>(m_funcNames,
1887 &Library::destroySync,
1890 if (hasRequiredEGLExtensions())
1892 test<destroySyncKHR, EGLSyncKHR>(m_funcNamesKHR,
1893 &Library::destroySyncKHR,
1896 else if (!hasRequiredEGLVersion(1, 5))
1898 TCU_THROW(NotSupportedError, "Required extensions not supported");
1905 class WaitSyncTest : public SyncTest
1908 WaitSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
1909 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server", "wait_server")
1913 template <typename createSyncFuncType,
1914 typename waitSyncFuncType,
1915 typename waitSyncStatusType>
1916 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1917 createSyncFuncType createSyncFunc,
1918 waitSyncFuncType waitSyncFunc)
1920 // Reset before each test
1924 const Library& egl = m_eglTestCtx.getLibrary();
1925 TestLog& log = m_testCtx.getLog();
1926 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1928 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1929 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1930 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1931 TestLog::EndMessage;
1932 EGLU_CHECK_MSG(egl, msgChk.c_str());
1934 waitSyncStatusType status = (egl.*waitSyncFunc)(m_eglDisplay, m_sync, 0);
1935 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_WAIT_SYNC] << "(" <<
1936 m_eglDisplay << ", " << m_sync << ", 0, 0)" << TestLog::EndMessage;
1938 TCU_CHECK(status == EGL_TRUE);
1940 GLU_CHECK_GLW_CALL(m_gl, finish());
1944 IterateResult iterate (void)
1946 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
1948 if (hasRequiredEGLVersion(1, 5))
1950 test<createSync, waitSync, EGLBoolean>(m_funcNames,
1951 &Library::createSync,
1952 &Library::waitSync);
1954 if (hasRequiredEGLExtensions())
1956 test<createSyncKHR, waitSyncKHR, EGLint>(m_funcNamesKHR,
1957 &Library::createSyncKHR,
1958 &Library::waitSyncKHR);
1960 else if (!hasRequiredEGLVersion(1, 5))
1962 TCU_THROW(NotSupportedError, "Required extensions not supported");
1970 class WaitSyncInvalidDisplayTest : public SyncTest
1973 WaitSyncInvalidDisplayTest (EglTestContext& eglTestCtx, EGLenum syncType)
1974 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_display", "wait_server_invalid_display")
1978 template <typename createSyncFuncType,
1979 typename waitSyncFuncType,
1980 typename waitSyncStatusType>
1981 void test(string funcNames[FUNC_NAME_NUM_NAMES],
1982 createSyncFuncType createSyncFunc,
1983 waitSyncFuncType waitSyncFunc)
1985 // Reset before each test
1989 const Library& egl = m_eglTestCtx.getLibrary();
1990 TestLog& log = m_testCtx.getLog();
1991 string msgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
1993 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
1994 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
1995 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
1996 TestLog::EndMessage;
1997 EGLU_CHECK_MSG(egl, msgChk.c_str());
1999 waitSyncStatusType status = (egl.*waitSyncFunc)(EGL_NO_DISPLAY, m_sync, 0);
2000 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_WAIT_SYNC] <<
2001 "(EGL_NO_DISPLAY, " << m_sync << ", 0)" << TestLog::EndMessage;
2003 EGLint error = egl.getError();
2004 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
2006 if (error != EGL_BAD_DISPLAY)
2008 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
2009 "' expected EGL_BAD_DISPLAY" << TestLog::EndMessage;
2010 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
2014 TCU_CHECK(status == EGL_FALSE);
2017 IterateResult iterate (void)
2019 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
2021 if (hasRequiredEGLVersion(1, 5))
2023 test<createSync, waitSync, EGLBoolean>(m_funcNames,
2024 &Library::createSync,
2025 &Library::waitSync);
2027 if (hasRequiredEGLExtensions())
2029 test<createSyncKHR, waitSyncKHR, EGLint>(m_funcNamesKHR,
2030 &Library::createSyncKHR,
2031 &Library::waitSyncKHR);
2033 else if (!hasRequiredEGLVersion(1, 5))
2035 TCU_THROW(NotSupportedError, "Required extensions not supported");
2042 class WaitSyncInvalidSyncTest : public SyncTest
2045 WaitSyncInvalidSyncTest (EglTestContext& eglTestCtx, EGLenum syncType)
2046 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_sync", "wait_server_invalid_sync")
2050 template <typename waitSyncFuncType, typename waitSyncSyncType>
2051 void test(string funcNames[FUNC_NAME_NUM_NAMES],
2052 waitSyncFuncType waitSyncFunc,
2053 waitSyncSyncType syncValue)
2055 // Reset before each test
2059 const Library& egl = m_eglTestCtx.getLibrary();
2060 TestLog& log = m_testCtx.getLog();
2062 EGLint status = (egl.*waitSyncFunc)(m_eglDisplay, syncValue, 0);
2063 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_WAIT_SYNC] <<
2064 "(" << m_eglDisplay << ", " << syncValue << ", 0)" << TestLog::EndMessage;
2066 EGLint error = egl.getError();
2067 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
2069 if (error != EGL_BAD_PARAMETER)
2071 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
2072 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
2073 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
2077 TCU_CHECK(status == EGL_FALSE);
2080 IterateResult iterate (void)
2082 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
2084 if (hasRequiredEGLVersion(1, 5))
2086 test<waitSync, EGLSync>(m_funcNames,
2090 if (hasRequiredEGLExtensions())
2092 test<waitSyncKHR, EGLSyncKHR>(m_funcNamesKHR,
2093 &Library::waitSyncKHR,
2096 else if (!hasRequiredEGLVersion(1, 5))
2098 TCU_THROW(NotSupportedError, "Required extensions not supported");
2105 class WaitSyncInvalidFlagTest : public SyncTest
2108 WaitSyncInvalidFlagTest (EglTestContext& eglTestCtx, EGLenum syncType)
2109 : SyncTest (eglTestCtx, syncType, SyncTest::EXTENSION_WAIT_SYNC, true, "wait_server_invalid_flag", "wait_server_invalid_flag")
2113 template <typename createSyncFuncType, typename waitSyncFuncType>
2114 void test(string funcNames[FUNC_NAME_NUM_NAMES],
2115 createSyncFuncType createSyncFunc,
2116 waitSyncFuncType waitSyncFunc)
2118 // Reset before each test
2122 const Library& egl = m_eglTestCtx.getLibrary();
2123 TestLog& log = m_testCtx.getLog();
2124 string createSyncMsgChk = funcNames[FUNC_NAME_CREATE_SYNC] + "()";
2126 m_sync = (egl.*createSyncFunc)(m_eglDisplay, m_syncType, NULL);
2127 log << TestLog::Message << m_sync << " = " << funcNames[FUNC_NAME_CREATE_SYNC] <<
2128 "(" << m_eglDisplay << ", " << getSyncTypeName(m_syncType) << ", NULL)" <<
2129 TestLog::EndMessage;
2130 EGLU_CHECK_MSG(egl, createSyncMsgChk.c_str());
2132 EGLint status = (egl.*waitSyncFunc)(m_eglDisplay, m_sync, 0xFFFFFFFF);
2133 log << TestLog::Message << status << " = " << funcNames[FUNC_NAME_WAIT_SYNC] <<
2134 "(" << m_eglDisplay << ", " << m_sync << ", 0xFFFFFFFF)" << TestLog::EndMessage;
2136 EGLint error = egl.getError();
2137 log << TestLog::Message << error << " = eglGetError()" << TestLog::EndMessage;
2139 if (error != EGL_BAD_PARAMETER)
2141 log << TestLog::Message << "Unexpected error '" << eglu::getErrorStr(error) <<
2142 "' expected EGL_BAD_PARAMETER" << TestLog::EndMessage;
2143 m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
2147 TCU_CHECK(status == EGL_FALSE);
2150 IterateResult iterate (void)
2152 m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
2154 if (hasRequiredEGLVersion(1, 5))
2156 test<createSync, waitSync>(m_funcNames,
2157 &Library::createSync,
2158 &Library::waitSync);
2160 if (hasRequiredEGLExtensions())
2162 test<createSyncKHR, waitSyncKHR>(m_funcNamesKHR,
2163 &Library::createSyncKHR,
2164 &Library::waitSyncKHR);
2166 else if (!hasRequiredEGLVersion(1, 5))
2168 TCU_THROW(NotSupportedError, "Required extensions not supported");
2175 FenceSyncTests::FenceSyncTests (EglTestContext& eglTestCtx)
2176 : TestCaseGroup (eglTestCtx, "fence_sync", "EGL_KHR_fence_sync extension tests")
2180 void FenceSyncTests::init (void)
2182 // Add valid API test
2184 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
2186 // eglCreateSyncKHR tests
2187 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2188 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2190 // eglClientWaitSyncKHR tests
2191 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2192 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2193 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2194 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2196 // eglGetSyncAttribKHR tests
2197 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2198 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2199 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2200 valid->addChild(new GetSyncConditionTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2202 // eglDestroySyncKHR tests
2203 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2205 // eglWaitSyncKHR tests
2206 valid->addChild(new WaitSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2211 // Add negative API tests
2213 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
2215 // eglCreateSyncKHR tests
2216 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2217 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2218 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2219 invalid->addChild(new CreateInvalidContextTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2221 // eglClientWaitSyncKHR tests
2222 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2223 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2225 // eglGetSyncAttribKHR tests
2226 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2227 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2228 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2229 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2231 // eglDestroySyncKHR tests
2232 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2233 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2235 // eglWaitSyncKHR tests
2236 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2237 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2238 invalid->addChild(new WaitSyncInvalidFlagTest(m_eglTestCtx, EGL_SYNC_FENCE_KHR));
2244 ReusableSyncTests::ReusableSyncTests (EglTestContext& eglTestCtx)
2245 : TestCaseGroup (eglTestCtx, "reusable_sync", "EGL_KHR_reusable_sync extension tests")
2249 void ReusableSyncTests::init (void)
2251 // Add valid API test
2253 TestCaseGroup* const valid = new TestCaseGroup(m_eglTestCtx, "valid", "Valid function calls");
2255 // eglCreateSyncKHR tests
2256 valid->addChild(new CreateNullAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2257 valid->addChild(new CreateEmptyAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2259 // eglClientWaitSyncKHR tests
2260 valid->addChild(new ClientWaitNoTimeoutTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2261 valid->addChild(new ClientWaitForeverTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2262 valid->addChild(new ClientWaitNoContextTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2263 valid->addChild(new ClientWaitForeverFlushTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2265 // eglGetSyncAttribKHR tests
2266 valid->addChild(new GetSyncTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2267 valid->addChild(new GetSyncStatusTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2268 valid->addChild(new GetSyncStatusSignaledTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2270 // eglDestroySyncKHR tests
2271 valid->addChild(new DestroySyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2276 // Add negative API tests
2278 TestCaseGroup* const invalid = new TestCaseGroup(m_eglTestCtx, "invalid", "Invalid function calls");
2280 // eglCreateSyncKHR tests
2281 invalid->addChild(new CreateInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2282 invalid->addChild(new CreateInvalidTypeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2283 invalid->addChild(new CreateInvalidAttribsTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2285 // eglClientWaitSyncKHR tests
2286 invalid->addChild(new ClientWaitInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2287 invalid->addChild(new ClientWaitInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2289 // eglGetSyncAttribKHR tests
2290 invalid->addChild(new GetSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2291 invalid->addChild(new GetSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2292 invalid->addChild(new GetSyncInvalidAttributeTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2293 invalid->addChild(new GetSyncInvalidValueTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2295 // eglDestroySyncKHR tests
2296 invalid->addChild(new DestroySyncInvalidDislayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2297 invalid->addChild(new DestroySyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2299 // eglWaitSyncKHR tests
2300 invalid->addChild(new WaitSyncInvalidDisplayTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));
2301 invalid->addChild(new WaitSyncInvalidSyncTest(m_eglTestCtx, EGL_SYNC_REUSABLE_KHR));